This commit is contained in:
parent
af942304af
commit
ae882b7dfb
13 changed files with 84 additions and 74 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#include <stdio.h>
|
||||
//#include <stdio.h>
|
||||
|
||||
#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 = "<NULL>";
|
||||
|
||||
|
@ -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';
|
||||
|
|
|
@ -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__ */
|
Loading…
Add table
Add a link
Reference in a new issue