/******************************************************************************************
	CRTest PS   (c) 1999-2001 ISL

	global.h:		Global defintions / system includes
******************************************************************************************/

// ==== JS : I've had to comment this out because of the PC conversion.  Sorry Chris, but 
// ====      sometimes we have a sane reason for compiling under win32. :o)
/*#ifdef _WIN32
	#error This is a PSX program, you dolt!
#endif*/
#include "main.h"

#ifndef _GLOBAL_H_
#define _GLOBAL_H_

//#ifdef _WINDOWS
//#define PALMODE 1
//#endif

// Take the attrib off, and define this for ECTS, etc
//#define GAME_SHOW_DEMO

//#define POLY_COUNTERS

#define VERSIONSTR		__DATE__


#define PALPRODUCTCODE	"SLES-03188"
#define NTSCPRODUCTCODE	"SLUS-00000"

//#if PALMODE==0
	#define PRODUCTCODE			NTSCPRODUCTCODE
	#define OTHERPRODUCTCODE	PALPRODUCTCODE
	#define PRODUCTPREFIX		"BA"
	#define OTHERPRODUCTPREFIX	"BE"
//#else
//	#define PRODUCTCODE			PALPRODUCTCODE
//	#define OTHERPRODUCTCODE	NTSCPRODUCTCODE
//	#define PRODUCTPREFIX		"BE"
//	#define OTHERPRODUCTPREFIX	"BA"
//#endif


#define MEMORYCARDNAME	PRODUCTPREFIX PRODUCTCODE "CHRUN"
#define OTHERMEMORYCARDNAME	OTHERPRODUCTPREFIX OTHERPRODUCTCODE "CHRUN"



#define PREVIEW_VERSION				0
#define EIDOS_DEBUG_STUFF			1	// Even in burns
#define FRAME_RATE_COMPENTSATION	1

#ifndef _WINDOWS

#define BYTE	char
#define UBYTE	unsigned char
#define uchar	unsigned char
#define SHORT	short
#define USHORT	unsigned short
#define LONG	long
#define ULONG	unsigned long
#define VOID	void

#endif

#define ANG2FIX(a)		(((a)*4096)/360)
#define SAMESIGN(a,b)	(((long)((unsigned long)a^(unsigned long)b))>=0)
#define PER2FIX(a)		(((a)*4096)/100)
#define INT_SMALLEST	(-2147483647)
#define INT_LARGEST		(2147483647)

#define FRAMESEC		((PALMODE)?(25):(30))

#include "actor.h"
#include "ranges.h"	// I don't know if this should be in here or not
#include "overlay.h"
//#include "gametext.h"

#ifndef _WINDOWS
#include "shell.h"
#endif

//#ifndef _WINDOWS
//#define DCACHE  0x1f800000
//#define DCACHETOP  0x1f8003fc
//#else
extern char pcDCacheData[1024*4];
#define DCACHE  pcDCacheData
#define DCACHETOP (pcDCacheData+4096)
//#endif

extern int debugPrintf(char* fmt, ...);
extern int DB(char* fmt, ...);

#ifndef ADD2POINTER
	#define ADD2POINTER(a,b) ( (void *) ( (int)(a) + (b))  )
#endif
#ifndef SUBPOINTERS
	#define SUBPOINTERS(a,b) (((int)((int)(a) - (int)(b))))
#endif
#ifndef CRASH
//	#define CRASH while(0==0)POLLHOST();
	#define CRASH while(0==0);
#endif

#ifdef DEBUG
	#ifdef SCREENDEBUG
//		#define debugPrintf screenPrintf
		#define DB debugPrintf
	#else
//		#define debugPrintf utilPrintf
		#define DB debugPrintf
	#endif

	#define ASSERT(V) if(!(V)) {DB("\nASSERT FAILED! in "__FILE__", %d, "#V"\n", __LINE__); CRASH}
	#define VERIFY(V)
// verifyPointer(V, sizeof(*V), __FILE__, __LINE__)

#else
 //	#define debugPrintf
	#define DB
	#define ASSERT
	#define VERIFY
#endif



#define ENEMIES_FORCEFRONT_SORTDEPTH	1
#define DEATH_FADEPOLY_SORTDEPTH		2
#define PANEL_OVERLAYS_SORTDEPTH		3

#ifdef POLY_COUNTERS
	enum
	{
		SKY_POLYS,
		MAP_POLYS,
		MODEL_POLYS,
		SPRITE_POLYS,
		N_POLY_COUNTERS
	};
	extern int polycounts[N_POLY_COUNTERS];

	#define INCPOLYCOUNT(a) {polycounts[a]++;}
#else
	#define INCPOLYCOUNT(a)
#endif

#endif
