diff --git a/makefile.gaz b/makefile.gaz index 5b3906d6f..ca1ab7be6 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -72,6 +72,8 @@ mem_src := memory pad_src := pads +paul_src := paul + # sound_src := sndbank \ # music \ # cdxa @@ -79,7 +81,8 @@ pad_src := pads system_src := main \ gstate \ vid \ - debug + dbg \ + vsprintf utils_src := utils \ sincos diff --git a/source/fileio/fileio.cpp b/source/fileio/fileio.cpp index 3dfe754b5..f95f5f10c 100644 --- a/source/fileio/fileio.cpp +++ b/source/fileio/fileio.cpp @@ -61,7 +61,7 @@ int FATSize=FileEquate_MAX*sizeof(sFAT); // Read Main FAT (special case load) MainFAT=(sFAT *)MemAlloc( FATSize,"MainFAT"); - DBG_MSG1("IoInit:FATSIZE=%i",FATSize); + SYSTEM_DBGMSG("IoInit:FATSIZE=%i",FATSize); FileIO->Open(); BigLump.Status = BLStatusOpen; @@ -372,7 +372,7 @@ u8 *CFileIO::isFileInDataBank(FileEquate File) if (Pos!=-1) return(MakePtr(ThisBank.Data,Pos)); } } - DBG_MSG1("File Not in Cache [%i]",File); + SYSTEM_DBGMSG("File Not in Cache [%i]",File); return(0); } diff --git a/source/game/game.cpp b/source/game/game.cpp index 678a1e9e7..fe11be233 100644 --- a/source/game/game.cpp +++ b/source/game/game.cpp @@ -24,7 +24,7 @@ CGameScene GameScene; /*****************************************************************************/ // Note, do not load any data in this function -void CGameScene::Init() +void CGameScene::init() { s_genericFont=new ("CGameScene::Init") FontBank(); s_genericFont->initialise( &standardFont ); @@ -34,7 +34,7 @@ void CGameScene::Init() /*****************************************************************************/ -void CGameScene::Shutdown() +void CGameScene::shutdown() { } @@ -44,7 +44,7 @@ int Y=256/2; int Dx=+7; int Dy=-3; -void CGameScene::Render() +void CGameScene::render() { char *Str="Sponge\nBob\nSquare\nPants"; @@ -55,13 +55,12 @@ char *Str="Sponge\nBob\nSquare\nPants"; if (Y>256-64) {Y=256-64; Dy=-Dy;} - s_genericFont->print(X,Y,(u8*)Str); + s_genericFont->print(X,Y,Str); } /*****************************************************************************/ -bool CGameScene::Control() +void CGameScene::think() { - return 1; } /*****************************************************************************/ diff --git a/source/game/game.h b/source/game/game.h index 34bf5c40f..8ecc980cf 100644 --- a/source/game/game.h +++ b/source/game/game.h @@ -14,15 +14,15 @@ class FontBank; class CGameScene : public CScene { public: - CGameScene() {}; - virtual ~CGameScene() {}; + CGameScene() {;} + virtual ~CGameScene() {;} - void Init(); - void Shutdown(); - void Render(); - bool Control(); - char *GetSceneName() {return "Game";} + void init(); + void shutdown(); + void render(); + void think(); + char *getSceneName() {return "Game";} private: diff --git a/source/gfx/font.cpp b/source/gfx/font.cpp index 5b5306418..be30a2ace 100644 --- a/source/gfx/font.cpp +++ b/source/gfx/font.cpp @@ -112,7 +112,7 @@ void FontBank::dump() ---------------------------------------------------------------------- */ void FontBank::print( int _x, int _y, s32 _textId ) { - print(_x,_y,(u8*)TranslationDatabase::getString(_textId)); + print(_x,_y,(char*)TranslationDatabase::getString(_textId)); } @@ -122,7 +122,7 @@ void FontBank::print( int _x, int _y, s32 _textId ) Params: Returns: ---------------------------------------------------------------------- */ -void FontBank::print( int _x, int _y, u8 *_text ) +void FontBank::print( int _x, int _y, char *_text ) { ASSERT( m_initialised ); @@ -249,7 +249,7 @@ void FontBank::setSMode( int _sMode ) Params: Returns: ---------------------------------------------------------------------- */ -int FontBank::getCharWidth( u8 _char ) +int FontBank::getCharWidth( char _char ) { int size; @@ -283,7 +283,7 @@ int FontBank::getCharHeight() Params: Returns: ---------------------------------------------------------------------- */ -int FontBank::getStringHeight( u8 *_text ) +int FontBank::getStringHeight( char *_text ) { int length=0; int height=0; @@ -310,7 +310,7 @@ int FontBank::getStringHeight( u8 *_text ) Params: Returns: ---------------------------------------------------------------------- */ -int FontBank::printChar( u8 _char,int _x,int _y ) +int FontBank::printChar( char _char,int _x,int _y ) { if (_char!=' ') { @@ -335,7 +335,7 @@ int FontBank::printChar( u8 _char,int _x,int _y ) ---------------------------------------------------------------------- */ int FontBank::getStringWidth( char * text ) { - return getStrWrapLen( (u8 *)text, VidGetScrW() ); + return getStrWrapLen( text, VidGetScrW() ); } /*---------------------------------------------------------------------- @@ -344,10 +344,10 @@ int FontBank::getStringWidth( char * text ) Params: Returns: ---------------------------------------------------------------------- */ -int FontBank::getStrWrapLen( u8 *_text,int _maxWidth ) +int FontBank::getStrWrapLen( char *_text,int _maxWidth ) { - int length=0,spaceW; - u8 C; + int length=0,spaceW; + char C; spaceW=length+1; // +1 to prevent infinite loop while (*_text && length<=_maxWidth) diff --git a/source/gfx/font.h b/source/gfx/font.h index ae0808610..3002c082a 100644 --- a/source/gfx/font.h +++ b/source/gfx/font.h @@ -51,7 +51,7 @@ public: virtual void initialise( FontData *_fontData ); void dump(); int isInitialised() { return m_initialised; } - virtual void print( int _x, int _y, u8 *_text ); + virtual void print( int _x, int _y, char *_text ); void print( int _x, int _y, s32 _textId ); void setColour( u8 _r, u8 _g, u8 _b ); void setJustification( Justification _justification ); @@ -60,15 +60,15 @@ public: void setTrans( int _trans ); void setSMode( int _sMode ); - int getCharWidth( u8 _char ); + int getCharWidth( char _char ); int getCharHeight(); int getStringWidth( char * text ); - int getStringHeight( u8 *_text ); + int getStringHeight( char *_text ); - int getStrWrapLen( u8 *_text,int _maxWidth ); + int getStrWrapLen( char *_text,int _maxWidth ); private: - virtual int printChar( u8 _char,int _x,int _y ); + virtual int printChar( char _char,int _x,int _y ); enum { diff --git a/source/locale/textdbase.cpp b/source/locale/textdbase.cpp index d7db73f33..0c530373f 100644 --- a/source/locale/textdbase.cpp +++ b/source/locale/textdbase.cpp @@ -68,7 +68,7 @@ struct TransHeader #if defined(__VERSION_debug__) if (stringNum > m_numOfStrings) { - DBG_MSG2("stringNum %d > m_numOfStrings %d", stringNum, m_numOfStrings); + SYSTEM_DBGMSG("stringNum %d > m_numOfStrings %d", stringNum, m_numOfStrings); ASSERT(0); } #endif @@ -126,7 +126,7 @@ void TranslationDatabase::initialise(bool includeIds) /* now Allocate some mem for it */ - DBG_MSG1("Translation Database allocating %d bytes string space",largestSize); + SYSTEM_DBGMSG("Translation Database allocating %d bytes string space",largestSize); s_database=(TransHeader*)MemAlloc(largestSize,"TextDB"); s_loaded=false; diff --git a/source/sound/cdxa.cpp b/source/sound/cdxa.cpp index b3e2bed8d..86162227e 100644 --- a/source/sound/cdxa.cpp +++ b/source/sound/cdxa.cpp @@ -111,13 +111,13 @@ sXAStream &ThisStream=CXAStream::Stream[CXAStream::CurrentStream]; void CXAStream::Init() { #ifdef FORCE_XA - DbgMsg0("FORCE XA\n"); + SYSTEM_DBGMSG("FORCE XA\n"); while (!CdInit()); CFileIO::FindAllFilePos(); CXAStream::SetSector(CFileIO::GetFilePos(FILEPOS_TRACK1)); #endif - DBG_MSG0("XA INITIALISED"); + SYSTEM_DBGMSG("XA INITIALISED"); // Set defaults CurrentStream=XA_STREAM_MUSIC; diff --git a/source/system/global.h b/source/system/global.h index 240107d52..a1830ea64 100644 --- a/source/system/global.h +++ b/source/system/global.h @@ -67,7 +67,7 @@ enum DRAW_TYPE #include "utils\cmxmacro.h" #include "utils\fixed.h" -#include "system\debug.h" +#include "system\dbg.h" #include "system\info.h" #include "system\lnkopt.h" diff --git a/source/system/gstate.cpp b/source/system/gstate.cpp index 3fc26175e..b4d257129 100644 --- a/source/system/gstate.cpp +++ b/source/system/gstate.cpp @@ -46,17 +46,17 @@ void GameState::think() { if( s_currentScene ) { - s_currentScene->Shutdown(); + s_currentScene->shutdown(); } s_currentScene=s_pendingScene; s_pendingScene=NULL; - s_currentScene->Init(); + s_currentScene->init(); } } ASSERT(s_currentScene); - s_currentScene->Control(); + s_currentScene->think(); } @@ -66,7 +66,7 @@ void GameState::think() void GameState::render() { ASSERT(s_currentScene); - s_currentScene->Render(); + s_currentScene->render(); } diff --git a/source/system/gstate.h b/source/system/gstate.h index 9b14486e3..1deb5abc5 100644 --- a/source/system/gstate.h +++ b/source/system/gstate.h @@ -14,17 +14,24 @@ #ifndef __SYSTEM_GSTATE_H__ #define __SYSTEM_GSTATE_H__ + + + + + + +/*****************************************************************************/ class CScene { public: - CScene() {} - virtual ~CScene() {} + CScene() {;} + virtual ~CScene() {;} - virtual void Init()=0; - virtual void Shutdown()=0; - virtual void Render()=0; - virtual bool Control()=0; - virtual char *GetSceneName()=0; + virtual void init()=0; + virtual void shutdown()=0; + virtual void render()=0; + virtual void think()=0; + virtual char *getSceneName()=0; protected: }; @@ -40,8 +47,8 @@ public: static void setNextScene( CScene *_nextScene ); - inline static u32 getTimeSinceLast() {return s_timeSinceLast;} - inline static u32 getFramesSinceLast() {return (s_timeSinceLast>>12)+1;} + inline static long int getTimeSinceLast() {return s_timeSinceLast;} + inline static long int getFramesSinceLast() {return (s_timeSinceLast>>12)+1;} static void setTimeSpeed( int speed ); diff --git a/source/system/vsprintf.cpp b/source/system/vsprintf.cpp index 9b6fe1097..660bf24f7 100644 --- a/source/system/vsprintf.cpp +++ b/source/system/vsprintf.cpp @@ -1,4 +1,7 @@ -#include +//#include + +#include "system\vsprintf.h" + // Linux Kernel Source Tour // http://www.tamacom.com/tour/linux/index.html @@ -6,17 +9,6 @@ -// stdarg defs from MSVC - -#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) ) - -#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) ) -#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) -#define va_end(ap) ( ap = (va_list)0 ) - -typedef char *va_list; - - // linux/lib/string.c static int strnlen(const char * s, int count) @@ -134,7 +126,7 @@ static char * number(char * str, long num, int base, int size, int precision return str; } -extern int vsprintf(char *buf, const char *fmt, va_list args) +extern int __vsprintf(char *buf, const char *fmt, __va_list args) { int len; unsigned long num; @@ -174,7 +166,7 @@ extern int vsprintf(char *buf, const char *fmt, va_list args) else if (*fmt == '*') { ++fmt; /* it's the next argument */ - field_width = va_arg(args, int); + field_width = __va_arg(args, int); if (field_width < 0) { field_width = -field_width; flags |= LEFT; @@ -190,7 +182,7 @@ extern int vsprintf(char *buf, const char *fmt, va_list args) else if (*fmt == '*') { ++fmt; /* it's the next argument */ - precision = va_arg(args, int); + precision = __va_arg(args, int); } if (precision < 0) precision = 0; @@ -211,13 +203,13 @@ extern int vsprintf(char *buf, const char *fmt, va_list args) if (!(flags & LEFT)) while (--field_width > 0) *str++ = ' '; - *str++ = (unsigned char) va_arg(args, int); + *str++ = (unsigned char) __va_arg(args, int); while (--field_width > 0) *str++ = ' '; continue; case 's': - s = va_arg(args, char *); + s = __va_arg(args, char *); if (!s) s = ""; @@ -238,17 +230,17 @@ extern int vsprintf(char *buf, const char *fmt, va_list args) flags |= ZEROPAD; } str = number(str, - (unsigned long) va_arg(args, void *), 16, + (unsigned long) __va_arg(args, void *), 16, field_width, precision, flags); continue; case 'n': if (qualifier == 'l') { - long * ip = va_arg(args, long *); + long * ip = __va_arg(args, long *); *ip = (str - buf); } else { - int * ip = va_arg(args, int *); + int * ip = __va_arg(args, int *); *ip = (str - buf); } continue; @@ -280,16 +272,16 @@ extern int vsprintf(char *buf, const char *fmt, va_list args) continue; } if (qualifier == 'l') - num = va_arg(args, unsigned long); + num = __va_arg(args, unsigned long); else if (qualifier == 'h') if (flags & SIGN) - num = va_arg(args, short); + num = __va_arg(args, short); else - num = va_arg(args, unsigned short); + num = __va_arg(args, unsigned short); else if (flags & SIGN) - num = va_arg(args, int); + num = __va_arg(args, int); else - num = va_arg(args, unsigned int); + num = __va_arg(args, unsigned int); str = number(str, num, base, field_width, precision, flags); } *str = '\0'; diff --git a/source/system/vsprintf.h b/source/system/vsprintf.h index 0df25b6a3..6077e2325 100644 --- a/source/system/vsprintf.h +++ b/source/system/vsprintf.h @@ -1,6 +1,15 @@ #ifndef __SYSTEM_VSPRINTF_H__ #define __SYSTEM_VSPRINTF_H__ -extern int vsprintf(char *buf, const char *fmt, va_list args) + +// stdarg defs from MSVC +#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) ) +#define __va_start(ap,v) ( ap = (__va_list)&v + _INTSIZEOF(v) ) +#define __va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) +#define __va_end(ap) ( ap = (__va_list)0 ) +typedef char *__va_list; + + +extern int __vsprintf(char *buf, const char *fmt, __va_list args); #endif /* __SYSTEM_VSPRINTF_H__ */ \ No newline at end of file