float dialoguetime;
int dialoguegonethrough[20];
-Game::Game()
+namespace Game{
+ GLuint terraintexture;
+ GLuint terraintexture2;
+ GLuint terraintexture3;
+ GLuint screentexture;
+ GLuint screentexture2;
+ GLuint logotexture;
+ GLuint loadscreentexture;
+ GLuint Maparrowtexture;
+ GLuint Mapboxtexture;
+ GLuint Mapcircletexture;
+ GLuint cursortexture;
+ GLuint Mainmenuitems[10];
+
+ int selected;
+ int keyselect;
+ int indemo;
+
+ bool won;
+
+ bool entername;
+
+ char menustring[100][256];
+ char registrationname[256];
+ float registrationnumber;
+
+ int newdetail;
+ int newscreenwidth;
+ int newscreenheight;
+
+ bool gameon;
+ float deltah,deltav;
+ int mousecoordh,mousecoordv;
+ int oldmousecoordh,oldmousecoordv;
+ float rotation,rotation2;
+ SkyBox skybox;
+ bool cameramode;
+ int olddrawmode;
+ int drawmode;
+ bool firstload;
+ bool oldbutton;
+
+ float leveltime;
+ float loadtime;
+
+ Model hawk;
+ XYZ hawkcoords;
+ XYZ realhawkcoords;
+ GLuint hawktexture;
+ float hawkrotation;
+ float hawkcalldelay;
+
+ Model eye;
+ Model iris;
+ Model cornea;
+
+ bool stealthloading;
+
+ std::vector<CampaignLevel> campaignlevels;
+ int whichchoice;
+ int actuallevel;
+ bool winhotspot;
+ bool windialogue;
+
+ bool minimap;
+
+ int musictype,oldmusictype,oldoldmusictype;
+ bool realthreat;
+
+ Model rabbit;
+ XYZ rabbitcoords;
+
+ XYZ mapcenter;
+ float mapradius;
+
+ Text* text;
+ float fps;
+
+ XYZ cameraloc;
+ float cameradist;
+
+ int drawtoggle;
+
+ bool editorenabled;
+ int editortype;
+ float editorsize;
+ float editorrotation;
+ float editorrotation2;
+
+ float brightness;
+
+ int quit;
+ int tryquit;
+
+ XYZ pathpoint[30];
+ int numpathpoints;
+ int numpathpointconnect[30];
+ int pathpointconnect[30][30];
+ int pathpointselected;
+
+ int endgame;
+ bool scoreadded;
+ int numchallengelevels;
+
+ bool console;
+ int archiveselected;
+ char consoletext[15][256];
+ int consolechars[15];
+ bool chatting;
+ char displaytext[15][256];
+ int displaychars[15];
+ float displaytime[15];
+ float displayblinkdelay;
+ bool displayblink;
+ int displayselected;
+ bool consolekeydown;
+ float consoleblinkdelay;
+ bool consoleblink;
+ int consoleselected;
+ bool autocam;
+
+ unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
+ unsigned short consolekey;
+ bool oldattackkey;
+
+ int loading;
+ float talkdelay;
+
+ int numboundaries;
+ XYZ boundary[360];
+
+ int whichlevel;
+ int oldenvironment;
+ int targetlevel;
+ float changedelay;
+
+ float musicvolume[4];
+ float oldmusicvolume[4];
+ int musicselected;
+ int change;
+
+ bool waiting;
+ Account* accountactive;
+}
+
+void Game::newGame()
{
+ text=NULL;
+ text=new Text();
+
terraintexture = 0;
terraintexture2 = 0;
terraintexture3 = 0;
accountactive = NULL;
}
-typedef struct {
- Game* game;
- void (Game::*method)();
-} params_thread;
+void Game::deleteGame(){
+ if(text)
+ delete text;
+ for(int i=0;i<10;i++){
+ if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] );
+ }
+ glDeleteTextures( 1, &cursortexture );
+ glDeleteTextures( 1, &Maparrowtexture );
+ glDeleteTextures( 1, &Mapboxtexture );
+ glDeleteTextures( 1, &Mapcircletexture );
+ glDeleteTextures( 1, &terraintexture );
+ glDeleteTextures( 1, &terraintexture2 );
+ if(screentexture>0)glDeleteTextures( 1, &screentexture );
+ if(screentexture2>0)glDeleteTextures( 1, &screentexture2 );
+ glDeleteTextures( 1, &hawktexture );
+ glDeleteTextures( 1, &logotexture );
+ glDeleteTextures( 1, &loadscreentexture );
+
+ Dispose();
+}
void Game::fireSound(int sound) {
emit_sound_at(sound);
void Game::setKeySelected() {
waiting=true;
- params_thread* data = new params_thread;
- data->game = this;
- data->method = &Game::setKeySelected_thread;
printf("launch thread\n");
- SDL_Thread* thread = SDL_CreateThread(Game::thread, data);
+ SDL_Thread* thread = SDL_CreateThread(Game::setKeySelected_thread,NULL);
if ( thread == NULL ) {
fprintf(stderr, "Unable to create thread: %s\n", SDL_GetError());
waiting=false;
}
}
-void Game::setKeySelected_thread() {
+int Game::setKeySelected_thread(void* data) {
int keycode=-1;
SDL_Event evenement;
while(keycode==-1) {
}
keyselect=-1;
waiting=false;
-}
-
-int Game::thread(void *data) {
- params_thread* pt = (params_thread*)data;
- if(pt) {
- (pt->game->*(pt->method))();
- }
+ return 0;
}
void Game::DrawGL() {
}
};
-class Game
+namespace Game
{
- public:
- GLuint terraintexture;
- GLuint terraintexture2;
- GLuint terraintexture3;
- GLuint screentexture;
- GLuint screentexture2;
- GLuint logotexture;
- GLuint loadscreentexture;
- GLuint Maparrowtexture;
- GLuint Mapboxtexture;
- GLuint Mapcircletexture;
- GLuint cursortexture;
- GLuint Mainmenuitems[10];
-
- int selected;
- int keyselect;
- int indemo;
-
- bool won;
-
- bool entername;
-
- char menustring[100][256];
- char registrationname[256];
- float registrationnumber;
-
- int newdetail;
- int newscreenwidth;
- int newscreenheight;
-
- bool gameon;
- float deltah,deltav;
- int mousecoordh,mousecoordv;
- int oldmousecoordh,oldmousecoordv;
- float rotation,rotation2;
- SkyBox skybox;
- bool cameramode;
- int olddrawmode;
- int drawmode;
- bool firstload;
- bool oldbutton;
-
- float leveltime;
- float loadtime;
-
- Model hawk;
- XYZ hawkcoords;
- XYZ realhawkcoords;
- GLuint hawktexture;
- float hawkrotation;
- float hawkcalldelay;
-
- Model eye;
- Model iris;
- Model cornea;
-
- bool stealthloading;
-
- std::vector<CampaignLevel> campaignlevels;
- int whichchoice;
- int actuallevel;
- bool winhotspot;
- bool windialogue;
-
- bool minimap;
-
- int musictype,oldmusictype,oldoldmusictype;
- bool realthreat;
-
- Model rabbit;
- XYZ rabbitcoords;
-
- XYZ mapcenter;
- float mapradius;
-
- Text text;
- float fps;
-
- XYZ cameraloc;
- float cameradist;
-
- int drawtoggle;
-
- bool editorenabled;
- int editortype;
- float editorsize;
- float editorrotation;
- float editorrotation2;
-
- float brightness;
-
- int quit;
- int tryquit;
-
- XYZ pathpoint[30];
- int numpathpoints;
- int numpathpointconnect[30];
- int pathpointconnect[30][30];
- int pathpointselected;
-
- int endgame;
- bool scoreadded;
- int numchallengelevels;
-
- bool console;
- int archiveselected;
- char consoletext[15][256];
- int consolechars[15];
- bool chatting;
- char displaytext[15][256];
- int displaychars[15];
- float displaytime[15];
- float displayblinkdelay;
- bool displayblink;
- int displayselected;
- bool consolekeydown;
- float consoleblinkdelay;
- bool consoleblink;
- int consoleselected;
- bool autocam;
-
- unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
- unsigned short consolekey;
- bool oldattackkey;
-
- static void LoadTexture(const string fileName, GLuint *textureid,int mipmap, bool hasalpha);
- static void LoadTextureSave(const string fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize);
- void LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
- bool AddClothes(const char *fileName, GLubyte *array);
- void InitGame();
- void LoadScreenTexture();
- void LoadStuff();
- void LoadingScreen();
- void LoadCampaign();
- static std::vector<std::string> ListCampaigns();
- void FadeLoadingScreen(float howmuch);
- void Dispose();
- int DrawGLScene(StereoSide side);
- void DrawMenu();
- void DrawGL();
- //factored from Tick() -sf17k
- void MenuTick();
- void doTutorial();
- void doDebugKeys();
- void doJumpReversals();
- void doAerialAcrobatics();
- void doAttacks();
- void doPlayerCollisions();
- void doAI(int i);
- //end factored
- void Tick();
- void TickOnce();
- void TickOnceAfter();
- void SetUpLighting();
- void Loadlevel(int which);
- void Loadlevel(const char *name);
- void Setenvironment(int which);
- GLvoid ReSizeGLScene(float fov, float near);
- int findPathDist(int start,int end);
- int checkcollide(XYZ startpoint, XYZ endpoint);
- int checkcollide(XYZ startpoint, XYZ endpoint, int what);
- int loading;
- float talkdelay;
-
- void fireSound(int sound=fireendsound);
- void setKeySelected();
-
- int numboundaries;
- XYZ boundary[360];
-
- int whichlevel;
- int oldenvironment;
- int targetlevel;
- float changedelay;
-
- float musicvolume[4];
- float oldmusicvolume[4];
- int musicselected;
- int change;
- Game();
- ~Game() {
- for(int i=0;i<10;i++){
- if(Mainmenuitems[i])glDeleteTextures( 1, &Mainmenuitems[i] );
- }
- glDeleteTextures( 1, &cursortexture );
- glDeleteTextures( 1, &Maparrowtexture );
- glDeleteTextures( 1, &Mapboxtexture );
- glDeleteTextures( 1, &Mapcircletexture );
- glDeleteTextures( 1, &terraintexture );
- glDeleteTextures( 1, &terraintexture2 );
- if(screentexture>0)glDeleteTextures( 1, &screentexture );
- if(screentexture2>0)glDeleteTextures( 1, &screentexture2 );
- glDeleteTextures( 1, &hawktexture );
- glDeleteTextures( 1, &logotexture );
- glDeleteTextures( 1, &loadscreentexture );
-
- Dispose();
- }
- bool isWaiting() { return waiting; };
- private:
- void setKeySelected_thread();
- static int thread(void *data);
- void inputText(char* str, int* charselected, int* nb_chars);
- void flash();
- bool waiting;
- //int mainmenu;
- Account* accountactive;
-};
+ //public:
+ extern GLuint terraintexture;
+ extern GLuint terraintexture2;
+ extern GLuint terraintexture3;
+ extern GLuint screentexture;
+ extern GLuint screentexture2;
+ extern GLuint logotexture;
+ extern GLuint loadscreentexture;
+ extern GLuint Maparrowtexture;
+ extern GLuint Mapboxtexture;
+ extern GLuint Mapcircletexture;
+ extern GLuint cursortexture;
+ extern GLuint Mainmenuitems[10];
+
+ extern int selected;
+ extern int keyselect;
+ extern int indemo;
+
+ extern bool won;
+
+ extern bool entername;
+
+ extern char menustring[100][256];
+ extern char registrationname[256];
+ extern float registrationnumber;
+
+ extern int newdetail;
+ extern int newscreenwidth;
+ extern int newscreenheight;
+
+ extern bool gameon;
+ extern float deltah,deltav;
+ extern int mousecoordh,mousecoordv;
+ extern int oldmousecoordh,oldmousecoordv;
+ extern float rotation,rotation2;
+ extern SkyBox skybox;
+ extern bool cameramode;
+ extern int olddrawmode;
+ extern int drawmode;
+ extern bool firstload;
+ extern bool oldbutton;
+
+ extern float leveltime;
+ extern float loadtime;
+
+ extern Model hawk;
+ extern XYZ hawkcoords;
+ extern XYZ realhawkcoords;
+ extern GLuint hawktexture;
+ extern float hawkrotation;
+ extern float hawkcalldelay;
+
+ extern Model eye;
+ extern Model iris;
+ extern Model cornea;
+
+ extern bool stealthloading;
+
+ extern std::vector<CampaignLevel> campaignlevels;
+ extern int whichchoice;
+ extern int actuallevel;
+ extern bool winhotspot;
+ extern bool windialogue;
+
+ extern bool minimap;
+
+ extern int musictype,oldmusictype,oldoldmusictype;
+ extern bool realthreat;
+
+ extern Model rabbit;
+ extern XYZ rabbitcoords;
+
+ extern XYZ mapcenter;
+ extern float mapradius;
+
+ extern Text* text;
+ extern float fps;
+
+ extern XYZ cameraloc;
+ extern float cameradist;
+
+ extern int drawtoggle;
+
+ extern bool editorenabled;
+ extern int editortype;
+ extern float editorsize;
+ extern float editorrotation;
+ extern float editorrotation2;
+
+ extern float brightness;
+
+ extern int quit;
+ extern int tryquit;
+
+ extern XYZ pathpoint[30];
+ extern int numpathpoints;
+ extern int numpathpointconnect[30];
+ extern int pathpointconnect[30][30];
+ extern int pathpointselected;
+
+ extern int endgame;
+ extern bool scoreadded;
+ extern int numchallengelevels;
+
+ extern bool console;
+ extern int archiveselected;
+ extern char consoletext[15][256];
+ extern int consolechars[15];
+ extern bool chatting;
+ extern char displaytext[15][256];
+ extern int displaychars[15];
+ extern float displaytime[15];
+ extern float displayblinkdelay;
+ extern bool displayblink;
+ extern int displayselected;
+ extern bool consolekeydown;
+ extern float consoleblinkdelay;
+ extern bool consoleblink;
+ extern int consoleselected;
+ extern bool autocam;
+
+ extern unsigned short crouchkey,jumpkey,forwardkey,chatkey,backkey,leftkey,rightkey,drawkey,throwkey,attackkey;
+ extern unsigned short consolekey;
+ extern bool oldattackkey;
+
+ void LoadTexture(const string fileName, GLuint *textureid,int mipmap, bool hasalpha);
+ void LoadTextureSave(const string fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize);
+ void LoadSave(const char *fileName, GLuint *textureid,bool mipmap,GLubyte *array, int *skinsize);
+ bool AddClothes(const char *fileName, GLubyte *array);
+ void InitGame();
+ void LoadScreenTexture();
+ void LoadStuff();
+ void LoadingScreen();
+ void LoadCampaign();
+ std::vector<std::string> ListCampaigns();
+ void FadeLoadingScreen(float howmuch);
+ void Dispose();
+ int DrawGLScene(StereoSide side);
+ void DrawMenu();
+ void DrawGL();
+ //factored from Tick() -sf17k
+ void MenuTick();
+ void doTutorial();
+ void doDebugKeys();
+ void doJumpReversals();
+ void doAerialAcrobatics();
+ void doAttacks();
+ void doPlayerCollisions();
+ void doAI(int i);
+ //end factored
+ void Tick();
+ void TickOnce();
+ void TickOnceAfter();
+ void SetUpLighting();
+ void Loadlevel(int which);
+ void Loadlevel(const char *name);
+ void Setenvironment(int which);
+ GLvoid ReSizeGLScene(float fov, float near);
+ int findPathDist(int start,int end);
+ int checkcollide(XYZ startpoint, XYZ endpoint);
+ int checkcollide(XYZ startpoint, XYZ endpoint, int what);
+ extern int loading;
+ extern float talkdelay;
+
+ void fireSound(int sound=fireendsound);
+ void setKeySelected();
+
+ extern int numboundaries;
+ extern XYZ boundary[360];
+
+ extern int whichlevel;
+ extern int oldenvironment;
+ extern int targetlevel;
+ extern float changedelay;
+
+ extern float musicvolume[4];
+ extern float oldmusicvolume[4];
+ extern int musicselected;
+ extern int change;
+ void newGame();
+ void deleteGame();
+ extern bool waiting;
+ //private:
+ int setKeySelected_thread(void*);
+ int thread(void *data);
+ void inputText(char* str, int* charselected, int* nb_chars);
+ void flash();
+ //bool waiting;
+ extern Account* accountactive;
+}
#ifndef __forceinline
# ifdef __GNUC__
glColor4f(.5,.5,.5,1);
if(!console) {
sprintf (string, " ",(int)(fps));
- text.glPrint(10,30,string,0,.8,screenwidth,screenheight);
+ text->glPrint(10,30,string,0,.8,screenwidth,screenheight);
if(!tutoriallevel)
if(bonus>0&&bonustime<1&&!winfreeze&&indialogue==-1/*bonustime<4*/){
bonus_name = "Excellent!"; // When does this happen?
glColor4f(0,0,0,1-bonustime);
- text.glPrintOutline(1024/2-10*strlen(bonus_name)-4,768/16-4+768*4/5,bonus_name,1,2.5,1024,768);
+ text->glPrintOutline(1024/2-10*strlen(bonus_name)-4,768/16-4+768*4/5,bonus_name,1,2.5,1024,768);
glColor4f(1,0,0,1-bonustime);
- text.glPrint(1024/2-10*strlen(bonus_name),768/16+768*4/5,bonus_name,1,2,1024,768);
+ text->glPrint(1024/2-10*strlen(bonus_name),768/16+768*4/5,bonus_name,1,2,1024,768);
sprintf (string, "%d",(int)bonusvalue);
glColor4f(0,0,0,1-bonustime);
- text.glPrintOutline(1024/2-10*strlen(string)-4,768/16-4-20+768*4/5,string,1,2.5*.8,1024,768);
+ text->glPrintOutline(1024/2-10*strlen(string)-4,768/16-4-20+768*4/5,string,1,2.5*.8,1024,768);
glColor4f(1,0,0,1-bonustime);
- text.glPrint(1024/2-10*strlen(string),768/16-20+768*4/5,string,1,2*.8,1024,768);
+ text->glPrint(1024/2-10*strlen(string),768/16-20+768*4/5,string,1,2*.8,1024,768);
glColor4f(.5,.5,.5,1);
}
}
glColor4f(0,0,0,tutorialopac);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string2)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-20*screenwidth/1024,string2,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string3)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-40*screenwidth/1024,string3,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
+ text->glPrintOutline(screenwidth/2-7.6*strlen(string)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
+ text->glPrintOutline(screenwidth/2-7.6*strlen(string2)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-20*screenwidth/1024,string2,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
+ text->glPrintOutline(screenwidth/2-7.6*strlen(string3)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-40*screenwidth/1024,string3,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
glColor4f(1,1,1,tutorialopac);
- text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024,screenheight/16+screenheight*4/5,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
- text.glPrint(screenwidth/2-7.6*strlen(string2)*screenwidth/1024,screenheight/16+screenheight*4/5-20*screenwidth/1024,string2,1,1.5*screenwidth/1024,screenwidth,screenheight);
- text.glPrint(screenwidth/2-7.6*strlen(string3)*screenwidth/1024,screenheight/16+screenheight*4/5-40*screenwidth/1024,string3,1,1.5*screenwidth/1024,screenwidth,screenheight);
+ text->glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024,screenheight/16+screenheight*4/5,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
+ text->glPrint(screenwidth/2-7.6*strlen(string2)*screenwidth/1024,screenheight/16+screenheight*4/5-20*screenwidth/1024,string2,1,1.5*screenwidth/1024,screenwidth,screenheight);
+ text->glPrint(screenwidth/2-7.6*strlen(string3)*screenwidth/1024,screenheight/16+screenheight*4/5-40*screenwidth/1024,string3,1,1.5*screenwidth/1024,screenwidth,screenheight);
sprintf (string, "Press 'tab' to skip to the next item.",Input::keyToChar(jumpkey));
sprintf (string2, "Press escape at any time to");
sprintf (string3, "pause or exit the tutorial.");
glColor4f(0,0,0,1);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8-4,0-4+screenheight*1/10,string,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string2)*screenwidth/1024*.8-4,0-4+screenheight*1/10-20*.8*screenwidth/1024,string2,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string3)*screenwidth/1024*.8-4,0-4+screenheight*1/10-40*.8*screenwidth/1024,string3,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
+ text->glPrintOutline(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8-4,0-4+screenheight*1/10,string,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
+ text->glPrintOutline(screenwidth/2-7.6*strlen(string2)*screenwidth/1024*.8-4,0-4+screenheight*1/10-20*.8*screenwidth/1024,string2,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
+ text->glPrintOutline(screenwidth/2-7.6*strlen(string3)*screenwidth/1024*.8-4,0-4+screenheight*1/10-40*.8*screenwidth/1024,string3,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
glColor4f(0.5,0.5,0.5,1);
- text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8,0+screenheight*1/10,string,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
- text.glPrint(screenwidth/2-7.6*strlen(string2)*screenwidth/1024*.8,0+screenheight*1/10-20*.8*screenwidth/1024,string2,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
- text.glPrint(screenwidth/2-7.6*strlen(string3)*screenwidth/1024*.8,0+screenheight*1/10-40*.8*screenwidth/1024,string3,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
+ text->glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8,0+screenheight*1/10,string,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
+ text->glPrint(screenwidth/2-7.6*strlen(string2)*screenwidth/1024*.8,0+screenheight*1/10-20*.8*screenwidth/1024,string2,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
+ text->glPrint(screenwidth/2-7.6*strlen(string3)*screenwidth/1024*.8,0+screenheight*1/10-40*.8*screenwidth/1024,string3,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
}
//Hot spots
while(!done){
if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
glColor4f(0,0,0,tutorialopac);
- text.glPrintOutline(screenwidth/2-7.6*(i-lastline)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-20*screenwidth/1024*line,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight,lastline,i);
+ text->glPrintOutline(screenwidth/2-7.6*(i-lastline)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-20*screenwidth/1024*line,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight,lastline,i);
glColor4f(1,1,1,tutorialopac);
- text.glPrint(screenwidth/2-7.6*(i-lastline)*screenwidth/1024,screenheight/16+screenheight*4/5-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
+ text->glPrint(screenwidth/2-7.6*(i-lastline)*screenwidth/1024,screenheight/16+screenheight*4/5-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
lastline=i+1;
line++;
if(string[i]=='\0')done=1;
if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
glColor4f(0,0,0,tutorialopac);
- text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
+ text->glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
glColor4f(0.7,0.7,0.7,tutorialopac);
- text.glPrint(startx-2*7.6*strlen(string)*screenwidth/1024,starty,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
+ text->glPrint(startx-2*7.6*strlen(string)*screenwidth/1024,starty,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
}
else
{
glColor4f(0,0,0,tutorialopac);
- text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
+ text->glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
}
tempnum=0;
if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
glColor4f(0,0,0,tutorialopac);
- text.glPrintOutline(startx/*-7.6*(i-lastline)*screenwidth/1024*/-4,starty-4-20*screenwidth/1024*line,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight,lastline,i);
+ text->glPrintOutline(startx/*-7.6*(i-lastline)*screenwidth/1024*/-4,starty-4-20*screenwidth/1024*line,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight,lastline,i);
glColor4f(1,1,1,tutorialopac);
- text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
+ text->glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
}
else
{
glColor4f(0,0,0,tutorialopac);
- text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
+ text->glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
}
lastline=i+1;
line++;
}
if(!campaign)sprintf (string, "Score: %d", (int)bonustotal);
glColor4f(0,0,0,1);
- text.glPrintOutline(1024/40-4,768/16-4+768*14/16,string,1,1.5*1.25,1024,768);
+ text->glPrintOutline(1024/40-4,768/16-4+768*14/16,string,1,1.5*1.25,1024,768);
glColor4f(1,0,0,1);
- text.glPrint(1024/40,768/16+768*14/16,string,1,1.5,1024,768);
+ text->glPrint(1024/40,768/16+768*14/16,string,1,1.5,1024,768);
if(showdamagebar) {
glDisable(GL_DEPTH_TEST); // Disables Depth Testing
glDisable(GL_CULL_FACE);
// writing the numbers :
sprintf (string, "Damages : %d/%d (%d)",(int)(player[0].damage),(int)(player[0].damagetolerance),(int)(player[0].bloodloss));
glColor4f(0,0,0,1);
- text.glPrintOutline(1024/40-4,768/16-4+768*14/16-40,string,1,1.5*1.25,1024,768);
+ text->glPrintOutline(1024/40-4,768/16-4+768*14/16-40,string,1,1.5*1.25,1024,768);
glColor4f(1,0,0,1);
- text.glPrint(1024/40,768/16+768*14/16-40,string,1,1.5,1024,768);
+ text->glPrint(1024/40,768/16+768*14/16-40,string,1,1.5,1024,768);
}
}
if((texttoggle||editorenabled)&&debugmode&&!mainmenu){
sprintf (string, "The framespersecond is %d.",(int)(fps));
- text.glPrint(10,30,string,0,.8,1024,768);
+ text->glPrint(10,30,string,0,.8,1024,768);
sprintf (string, "Name: %s", registrationname);
- text.glPrint(10,260,string,0,.8,1024,768);
+ text->glPrint(10,260,string,0,.8,1024,768);
if(editorenabled)
sprintf (string, "Map editor enabled.");
else
sprintf (string, "Map editor disabled.");
- text.glPrint(10,60,string,0,.8,1024,768);
+ text->glPrint(10,60,string,0,.8,1024,768);
if(editorenabled){
sprintf (string, "Object size: %f",editorsize);
- text.glPrint(10,75,string,0,.8,1024,768);
+ text->glPrint(10,75,string,0,.8,1024,768);
if(editorrotation>=0)sprintf (string, "Object rotation: %f",editorrotation);
else sprintf (string, "Object rotation: Random");
- text.glPrint(10,90,string,0,.8,1024,768);
+ text->glPrint(10,90,string,0,.8,1024,768);
if(editorrotation2>=0)sprintf (string, "Object rotation2: %f",editorrotation2);
else sprintf (string, "Object rotation2: Random");
- text.glPrint(10,105,string,0,.8,1024,768);
+ text->glPrint(10,105,string,0,.8,1024,768);
sprintf (string, "Object type: %d",editortype);
- text.glPrint(10,120,string,0,.8,1024,768);
+ text->glPrint(10,120,string,0,.8,1024,768);
switch(editortype) {
case boxtype:
sprintf (string, "(box)");
sprintf (string, "(fire)");
break;
}
- text.glPrint(130,120,string,0,.8,1024,768);
+ text->glPrint(130,120,string,0,.8,1024,768);
sprintf (string, "Numplayers: %d",numplayers);
- text.glPrint(10,155,string,0,.8,1024,768);
+ text->glPrint(10,155,string,0,.8,1024,768);
sprintf (string, "Player %d: numwaypoints: %d",numplayers,player[numplayers-1].numwaypoints);
- text.glPrint(10,140,string,0,.8,1024,768);
+ text->glPrint(10,140,string,0,.8,1024,768);
}
sprintf (string, "Difficulty: %d",difficulty);
- text.glPrint(10,240,string,0,.8,1024,768);
+ text->glPrint(10,240,string,0,.8,1024,768);
}
}
glColor4f(1,1,1,1);
if(chatting){
sprintf (string, " ]");
- text.glPrint(10,30+screenheight-330,string,0,1,screenwidth,screenheight);
+ text->glPrint(10,30+screenheight-330,string,0,1,screenwidth,screenheight);
if(displayblink){
sprintf (string, "_");
- text.glPrint(30+(float)(displayselected)*10,30+(screenheight-330),string,0,1,screenwidth,screenheight);
+ text->glPrint(30+(float)(displayselected)*10,30+(screenheight-330),string,0,1,screenwidth,screenheight);
}
}
for(i=0;i<15;i++)
glColor4f(1,1,1,4-displaytime[i]);
if(j<displaychars[i]) {
sprintf (string, "%c",displaytext[i][j]);
- text.glPrint(30+j*10,30+i*20+(screenheight-330),string,0,1,screenwidth,screenheight);
+ text->glPrint(30+j*10,30+i*20+(screenheight-330),string,0,1,screenwidth,screenheight);
}
}
}
glEnable(GL_TEXTURE_2D);
glColor4f(1,1,1,1);
sprintf (string, "Loading...");
- text.glPrint(1024/2-90,768/2,string,1,2,1024,768);
+ text->glPrint(1024/2-90,768/2,string,1,2,1024,768);
}
loading=2;
//if(ismotionblur)drawmode=motionblurmode;
glEnable(GL_TEXTURE_2D);
glColor4f(1,1,1,1);
sprintf (string, "Level Cleared!");
- text.glPrintOutlined(1024/2-strlen(string)*10,768*7/8,string,1,2,1024,768);
+ text->glPrintOutlined(1024/2-strlen(string)*10,768*7/8,string,1,2,1024,768);
sprintf (string, "Score: %d",(int)(bonustotal-startbonustotal));
- text.glPrintOutlined(1024/30,768*6/8,string,1,2,1024,768);
+ text->glPrintOutlined(1024/30,768*6/8,string,1,2,1024,768);
if(campaign)
sprintf (string, "Press Escape or Space to continue");
else
sprintf (string, "Press Escape to return to menu or Space to continue");
- text.glPrintOutlined(640/2-strlen(string)*5,480*1/16,string,1,1,640,480);
+ text->glPrintOutlined(640/2-strlen(string)*5,480*1/16,string,1,1,640,480);
char temp[255];
if((int)(leveltime)%60<10)strcat(string,"0");
sprintf (temp, "%d",(int)(leveltime)%60);
strcat(string,temp);
- text.glPrintOutlined(1024/30,768*6/8-40,string,1,2,1024,768);
+ text->glPrintOutlined(1024/30,768*6/8-40,string,1,2,1024,768);
//Awards
int awards[award_count];
int numawards = award_awards(awards);
for (i = 0; i < numawards && i < 6; i++)
- text.glPrintOutlined(1024/30,768*6/8-90-40*i,award_names[awards[i]],1,2,1024,768);
+ text->glPrintOutlined(1024/30,768*6/8-90-40*i,award_names[awards[i]],1,2,1024,768);
}
if(drawmode!=normalmode){
if(consoleselected>=60)
offset=consoleselected-60;
sprintf (string, " ]");
- text.glPrint(10,30,string,0,1,1024,768);
+ text->glPrint(10,30,string,0,1,1024,768);
if(consoleblink){
sprintf (string, "_");
- text.glPrint(30+(float)(consoleselected)*10-offset*10,30,string,0,1,1024,768);
+ text->glPrint(30+(float)(consoleselected)*10-offset*10,30,string,0,1,1024,768);
}
for(i=0;i<15;i++)
for(j=0;j<consolechars[i];j++){
glColor4f(1,1,1,1-(float)(i)/16);
if(j<consolechars[i]){
sprintf (string, "%c",consoletext[i][j]);
- text.glPrint(30+j*10-offset*10,30+i*20,string,0,1,1024,768);
+ text->glPrint(30+j*10-offset*10,30+i*20,string,0,1,1024,768);
}
}
}
oldmainmenu=mainmenu;
selected=Menu::getSelected(mousecoordh*640/screenwidth,480-mousecoordv*480/screenheight);
- Menu::GUITick(this);
+ Menu::GUITick();
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glPushMatrix(); // Store The Projection Matrix
glLoadIdentity(); // Reset The Modelview Matrix
glEnable(GL_TEXTURE_2D);
- Menu::drawItems(this);
+ Menu::drawItems();
//draw mouse cursor
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
int temptexdetail=texdetail;
texdetail=1;
- text.LoadFontTexture(":Data:Textures:Font.png");
- text.BuildFont();
+ text->LoadFontTexture(":Data:Textures:Font.png");
+ text->BuildFont();
texdetail=temptexdetail;
FadeLoadingScreen(10);
temptexdetail=texdetail;
texdetail=1;
- text.LoadFontTexture(":Data:Textures:Font.png");
- text.BuildFont();
+ text->LoadFontTexture(":Data:Textures:Font.png");
+ text->BuildFont();
texdetail=temptexdetail;
numsounds=71;
#include <algorithm>
using namespace std;
+using namespace Game;
// Added more evilness needed for MSVC
#ifdef _MSC_VER
#undef DECLARE_COMMAND
};
-typedef void (*console_handler)(Game *game, const char *args);
+typedef void (*console_handler)(const char *args);
-#define DECLARE_COMMAND(cmd) static void ch_##cmd(Game *game, const char *args);
+#define DECLARE_COMMAND(cmd) static void ch_##cmd(const char *args);
#include "ConsoleCmds.h"
#undef DECLARE_COMMAND
-static void ch_quit(Game *game, const char *args)
+static void ch_quit(const char *args)
{
- game->tryquit = 1;
+ tryquit = 1;
}
-static void ch_map(Game *game, const char *args)
+static void ch_map(const char *args)
{
- game->Loadlevel(args);
- game->whichlevel = -2;
+ Loadlevel(args);
+ whichlevel = -2;
campaign = 0;
}
-static void ch_save(Game *game, const char *args){
+static void ch_save(const char *args){
char buf[64];
snprintf(buf, 63, ":Data:Maps:%s", args);
}
}
- fpackf(tfile, "Bi", game->numpathpoints);
- for(int j=0;j<game->numpathpoints;j++){
- fpackf(tfile, "Bf Bf Bf Bi", game->pathpoint[j].x, game->pathpoint[j].y, game->pathpoint[j].z, game->numpathpointconnect[j]);
- for(int k=0;k<game->numpathpointconnect[j];k++)
- fpackf(tfile, "Bi", game->pathpointconnect[j][k]);
+ fpackf(tfile, "Bi", numpathpoints);
+ for(int j=0;j<numpathpoints;j++){
+ fpackf(tfile, "Bf Bf Bf Bi", pathpoint[j].x, pathpoint[j].y, pathpoint[j].z, numpathpointconnect[j]);
+ for(int k=0;k<numpathpointconnect[j];k++)
+ fpackf(tfile, "Bi", pathpointconnect[j][k]);
}
- fpackf(tfile, "Bf Bf Bf Bf", game->mapcenter.x, game->mapcenter.y, game->mapcenter.z, game->mapradius);
+ fpackf(tfile, "Bf Bf Bf Bf", mapcenter.x, mapcenter.y, mapcenter.z, mapradius);
fclose(tfile);
}
-static void ch_cellar(Game *game, const char *args)
+static void ch_cellar(const char *args)
{
- game->LoadTextureSave(":Data:Textures:Furdarko.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
+ LoadTextureSave(":Data:Textures:Furdarko.jpg",&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
}
-static void ch_tint(Game *game, const char *args)
+static void ch_tint(const char *args)
{
sscanf(args, "%f%f%f", &tintr, &tintg, &tintb);
}
-static void ch_tintr(Game *game, const char *args)
+static void ch_tintr(const char *args)
{
tintr = atof(args);
}
-static void ch_tintg(Game *game, const char *args)
+static void ch_tintg(const char *args)
{
tintg = atof(args);
}
-static void ch_tintb(Game *game, const char *args)
+static void ch_tintb(const char *args)
{
tintb = atof(args);
}
-static void ch_speed(Game *game, const char *args)
+static void ch_speed(const char *args)
{
player[0].speedmult = atof(args);
}
-static void ch_strength(Game *game, const char *args)
+static void ch_strength(const char *args)
{
player[0].power = atof(args);
}
-static void ch_power(Game *game, const char *args)
+static void ch_power(const char *args)
{
player[0].power = atof(args);
}
-static void ch_size(Game *game, const char *args)
+static void ch_size(const char *args)
{
player[0].scale = atof(args) * .2;
}
return closest;
}
-static void ch_sizenear(Game *game, const char *args)
+static void ch_sizenear(const char *args)
{
int closest = find_closest();
}
}
-static void ch_proportion(Game *game, const char *args)
+static void ch_proportion(const char *args)
{
set_proportion(0, args);
}
-static void ch_proportionnear(Game *game, const char *args)
+static void ch_proportionnear(const char *args)
{
int closest = find_closest();
if (closest)
player[pnum].protectionlow = low;
}
-static void ch_protection(Game *game, const char *args)
+static void ch_protection(const char *args)
{
set_protection(0, args);
}
-static void ch_protectionnear(Game *game, const char *args)
+static void ch_protectionnear(const char *args)
{
int closest = find_closest();
if (closest)
player[pnum].armorlow = low;
}
-static void ch_armor(Game *game, const char *args)
+static void ch_armor(const char *args)
{
set_armor(0, args);
}
-static void ch_armornear(Game *game, const char *args)
+static void ch_armornear(const char *args)
{
int closest = find_closest();
if (closest)
set_armor(closest, args);
}
-static void ch_protectionreset(Game *game, const char *args)
+static void ch_protectionreset(const char *args)
{
set_protection(0, "1 1 1");
set_armor(0, "1 1 1");
player[pnum].metallow = low;
}
-static void ch_metal(Game *game, const char *args)
+static void ch_metal(const char *args)
{
set_metal(0, args);
}
-static void set_noclothes(int pnum, Game *game, const char *args)
+static void set_noclothes(int pnum, const char *args)
{
player[pnum].numclothes = 0;
- game->LoadTextureSave(creatureskin[player[pnum].creature][player[pnum].whichskin],
+ LoadTextureSave(creatureskin[player[pnum].creature][player[pnum].whichskin],
&player[pnum].skeleton.drawmodel.textureptr,1,
&player[pnum].skeleton.skinText[0],&player[pnum].skeleton.skinsize);
}
-static void ch_noclothes(Game *game, const char *args)
+static void ch_noclothes(const char *args)
{
- set_noclothes(0, game, args);
+ set_noclothes(0, args);
}
-static void ch_noclothesnear(Game *game, const char *args)
+static void ch_noclothesnear(const char *args)
{
int closest = find_closest();
if (closest)
- set_noclothes(closest, game, args);
+ set_noclothes(closest, args);
}
-static void set_clothes(int pnum, Game *game, const char *args)
+static void set_clothes(int pnum, const char *args)
{
char buf[64];
snprintf(buf, 63, ":Data:Textures:%s.png", args);
- if (!game->AddClothes(buf,&player[pnum].skeleton.skinText[pnum]))
+ if (!AddClothes(buf,&player[pnum].skeleton.skinText[pnum]))
return;
player[pnum].DoMipmaps();
player[pnum].numclothes++;
}
-static void ch_clothes(Game *game, const char *args)
+static void ch_clothes(const char *args)
{
- set_clothes(0, game, args);
+ set_clothes(0, args);
}
-static void ch_clothesnear(Game *game, const char *args)
+static void ch_clothesnear(const char *args)
{
int closest = find_closest();
if (closest)
- set_clothes(closest, game, args);
+ set_clothes(closest, args);
}
-static void ch_belt(Game *game, const char *args)
+static void ch_belt(const char *args)
{
player[0].skeleton.clothes = !player[0].skeleton.clothes;
}
-static void ch_cellophane(Game *game, const char *args)
+static void ch_cellophane(const char *args)
{
cellophane = !cellophane;
float mul = cellophane ? 0 : 1;
}
}
-static void ch_funnybunny(Game *game, const char *args)
+static void ch_funnybunny(const char *args)
{
player[0].skeleton.id=0;
player[0].skeleton.Load(":Data:Skeleton:Basic Figure",":Data:Skeleton:Basic Figurelow",
":Data:Models:Body4.solid",":Data:Models:Body5.solid",
":Data:Models:Body6.solid",":Data:Models:Body7.solid",
":Data:Models:Bodylow.solid",":Data:Models:Belt.solid",1);
- game->LoadTextureSave(":Data:Textures:fur3.jpg",&player[0].skeleton.drawmodel.textureptr,1,
+ LoadTextureSave(":Data:Textures:fur3.jpg",&player[0].skeleton.drawmodel.textureptr,1,
&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
player[0].creature=rabbittype;
player[0].scale=.2;
set_proportion(0, "1 1 1 1");
}
-static void ch_wolfie(Game *game, const char *args)
+static void ch_wolfie(const char *args)
{
player[0].skeleton.id=0;
player[0].skeleton.Load(":Data:Skeleton:Basic Figure Wolf",":Data:Skeleton:Basic Figure Wolf Low",
":Data:Models:Wolf4.solid",":Data:Models:Wolf5.solid",
":Data:Models:Wolf6.solid",":Data:Models:Wolf7.solid",
":Data:Models:Wolflow.solid",":Data:Models:Belt.solid",0);
- game->LoadTextureSave(":Data:Textures:Wolf.jpg",&player[0].skeleton.drawmodel.textureptr,1,
+ LoadTextureSave(":Data:Textures:Wolf.jpg",&player[0].skeleton.drawmodel.textureptr,1,
&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
player[0].creature=wolftype;
player[0].damagetolerance=300;
set_proportion(0, "1 1 1 1");
}
-static void ch_wolfieisgod(Game *game, const char *args)
+static void ch_wolfieisgod(const char *args)
{
- ch_wolfie(game, args);
+ ch_wolfie(args);
}
-static void ch_wolf(Game *game, const char *args)
+static void ch_wolf(const char *args)
{
- game->LoadTextureSave(":Data:Textures:Wolf.jpg",&player[0].skeleton.drawmodel.textureptr,1,
+ LoadTextureSave(":Data:Textures:Wolf.jpg",&player[0].skeleton.drawmodel.textureptr,1,
&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
}
-static void ch_snowwolf(Game *game, const char *args)
+static void ch_snowwolf(const char *args)
{
- game->LoadTextureSave(":Data:Textures:SnowWolf.jpg",&player[0].skeleton.drawmodel.textureptr,1,
+ LoadTextureSave(":Data:Textures:SnowWolf.jpg",&player[0].skeleton.drawmodel.textureptr,1,
&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
}
-static void ch_darkwolf(Game *game, const char *args)
+static void ch_darkwolf(const char *args)
{
- game->LoadTextureSave(":Data:Textures:DarkWolf.jpg",&player[0].skeleton.drawmodel.textureptr,1,
+ LoadTextureSave(":Data:Textures:DarkWolf.jpg",&player[0].skeleton.drawmodel.textureptr,1,
&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
}
-static void ch_lizardwolf(Game *game, const char *args)
+static void ch_lizardwolf(const char *args)
{
- game->LoadTextureSave(":Data:Textures:Lizardwolf.jpg",&player[0].skeleton.drawmodel.textureptr,1,
+ LoadTextureSave(":Data:Textures:Lizardwolf.jpg",&player[0].skeleton.drawmodel.textureptr,1,
&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
}
-static void ch_white(Game *game, const char *args)
+static void ch_white(const char *args)
{
- game->LoadTextureSave(":Data:Textures:fur.jpg",&player[0].skeleton.drawmodel.textureptr,1,
+ LoadTextureSave(":Data:Textures:fur.jpg",&player[0].skeleton.drawmodel.textureptr,1,
&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
}
-static void ch_brown(Game *game, const char *args)
+static void ch_brown(const char *args)
{
- game->LoadTextureSave(":Data:Textures:fur3.jpg",&player[0].skeleton.drawmodel.textureptr,1,
+ LoadTextureSave(":Data:Textures:fur3.jpg",&player[0].skeleton.drawmodel.textureptr,1,
&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
}
-static void ch_black(Game *game, const char *args)
+static void ch_black(const char *args)
{
- game->LoadTextureSave(":Data:Textures:fur2.jpg",&player[0].skeleton.drawmodel.textureptr,1,
+ LoadTextureSave(":Data:Textures:fur2.jpg",&player[0].skeleton.drawmodel.textureptr,1,
&player[0].skeleton.skinText[0],&player[0].skeleton.skinsize);
}
-static void ch_sizemin(Game *game, const char *args)
+static void ch_sizemin(const char *args)
{
for (int i = 1; i < numplayers; i++)
if (player[i].scale < 0.8 * 0.2)
player[i].scale = 0.8 * 0.2;
}
-static void ch_tutorial(Game *game, const char *args)
+static void ch_tutorial(const char *args)
{
tutoriallevel = atoi(args);
}
-static void ch_hostile(Game *game, const char *args)
+static void ch_hostile(const char *args)
{
hostile = atoi(args);
}
-static void ch_indemo(Game *game, const char *args)
+static void ch_indemo(const char *args)
{
- game->indemo=1;
+ indemo=1;
hotspot[numhotspots]=player[0].coords;
hotspotsize[numhotspots]=0;
hotspottype[numhotspots]=-111;
numhotspots++;
}
-static void ch_notindemo(Game *game, const char *args)
+static void ch_notindemo(const char *args)
{
- game->indemo=0;
+ indemo=0;
numhotspots--;
}
-static void ch_type(Game *game, const char *args)
+static void ch_type(const char *args)
{
int n = sizeof(editortypenames) / sizeof(editortypenames[0]);
for (int i = 0; i < n; i++)
}
}
-static void ch_path(Game *game, const char *args)
+static void ch_path(const char *args)
{
int n = sizeof(pathtypenames) / sizeof(pathtypenames[0]);
for (int i = 0; i < n; i++)
}
}
-static void ch_hs(Game *game, const char *args)
+static void ch_hs(const char *args)
{
hotspot[numhotspots]=player[0].coords;
numhotspots++;
}
-static void ch_dialogue(Game *game, const char *args)
+static void ch_dialogue(const char *args)
{
int dlg;
char buf1[32], buf2[64];
numdialogues++;
}
-static void ch_fixdialogue(Game *game, const char *args)
+static void ch_fixdialogue(const char *args)
{
char buf1[32], buf2[64];
int whichdi;
ipstream.close();
}
-static void ch_fixtype(Game *game, const char *args)
+static void ch_fixtype(const char *args)
{
int dlg;
sscanf(args, "%d", &dlg);
dialoguetype[0] = dlg;
}
-static void ch_fixrotation(Game *game, const char *args)
+static void ch_fixrotation(const char *args)
{
participantrotation[whichdialogue][participantfocus[whichdialogue][indialogue]]=player[participantfocus[whichdialogue][indialogue]].rotation;
}
-static void ch_ddialogue(Game *game, const char *args)
+static void ch_ddialogue(const char *args)
{
if (numdialogues)
numdialogues--;
}
-static void ch_dhs(Game *game, const char *args)
+static void ch_dhs(const char *args)
{
if (numhotspots)
numhotspots--;
}
-static void ch_immobile(Game *game, const char *args)
+static void ch_immobile(const char *args)
{
player[0].immobile = 1;
}
-static void ch_allimmobile(Game *game, const char *args)
+static void ch_allimmobile(const char *args)
{
for (int i = 1; i < numplayers; i++)
player[i].immobile = 1;
}
-static void ch_mobile(Game *game, const char *args)
+static void ch_mobile(const char *args)
{
player[0].immobile = 0;
}
-static void ch_default(Game *game, const char *args)
+static void ch_default(const char *args)
{
player[0].armorhead=1;
player[0].armorhigh=1;
}
player[0].numclothes=0;
- game->LoadTextureSave(creatureskin[player[0].creature][player[0].whichskin],
+ LoadTextureSave(creatureskin[player[0].creature][player[0].whichskin],
&player[0].skeleton.drawmodel.textureptr,1,&player[0].skeleton.skinText[0],
&player[0].skeleton.skinsize);
player[0].immobile=0;
}
-static void ch_play(Game *game, const char *args)
+static void ch_play(const char *args)
{
int dlg;
sscanf(args, "%d", &dlg);
playdialogueboxsound();
}
-static void ch_mapkilleveryone(Game *game, const char *args)
+static void ch_mapkilleveryone(const char *args)
{
maptype = mapkilleveryone;
}
-static void ch_mapkillmost(Game *game, const char *args)
+static void ch_mapkillmost(const char *args)
{
maptype = mapkillmost;
}
-static void ch_mapkillsomeone(Game *game, const char *args)
+static void ch_mapkillsomeone(const char *args)
{
maptype = mapkillsomeone;
}
-static void ch_mapgosomewhere(Game *game, const char *args)
+static void ch_mapgosomewhere(const char *args)
{
maptype = mapgosomewhere;
}
-static void ch_viewdistance(Game *game, const char *args)
+static void ch_viewdistance(const char *args)
{
viewdistance = atof(args)*100;
}
-static void ch_fadestart(Game *game, const char *args)
+static void ch_fadestart(const char *args)
{
fadestart = atof(args);
}
-static void ch_slomo(Game *game, const char *args)
+static void ch_slomo(const char *args)
{
slomospeed = atof(args);
slomo = !slomo;
slomodelay = 1000;
}
-static void ch_slofreq(Game *game, const char *args)
+static void ch_slofreq(const char *args)
{
slomofreq = atof(args);
}
-static void ch_skytint(Game *game, const char *args)
+static void ch_skytint(const char *args)
{
sscanf(args, "%f%f%f", &skyboxr, &skyboxg, &skyboxb);
skyboxlightg=skyboxg;
skyboxlightb=skyboxb;
- game->SetUpLighting();
+ SetUpLighting();
terrain.DoShadows();
objects.DoShadows();
}
-static void ch_skylight(Game *game, const char *args)
+static void ch_skylight(const char *args)
{
sscanf(args, "%f%f%f", &skyboxlightr, &skyboxlightg, &skyboxlightb);
- game->SetUpLighting();
+ SetUpLighting();
terrain.DoShadows();
objects.DoShadows();
}
-static void ch_skybox(Game *game, const char *args)
+static void ch_skybox(const char *args)
{
skyboxtexture = !skyboxtexture;
- game->SetUpLighting();
+ SetUpLighting();
terrain.DoShadows();
objects.DoShadows();
}
-static void cmd_dispatch(Game *game, const string cmd)
+static void cmd_dispatch(const string cmd)
{
int i, n_cmds = sizeof(cmd_names) / sizeof(cmd_names[0]);
if (cmd.substr(0,cmd.find(' '))==string(cmd_names[i]))
{
cout << "|" << cmd.substr(cmd.find(' ')+1) << "|" << endl;
- cmd_handlers[i](game, cmd.substr(cmd.find(' ')+1).c_str());
+ cmd_handlers[i](cmd.substr(cmd.find(' ')+1).c_str());
break;
}
emit_sound_np(i < n_cmds ? consolesuccesssound : consolefailsound);
case 8:
flash();
- SaveSettings(*this);
+ SaveSettings();
mainmenu=gameon?2:1;
break;
case 9:
if(Input::isKeyDown(SDLK_q) && Input::isKeyDown(SDLK_LMETA)){
tryquit=1;
if(mainmenu==3) {
- SaveSettings(*this);
+ SaveSettings();
}
}
}
//finished with settings menu
if(mainmenu==3){
- SaveSettings(*this);
+ SaveSettings();
}
//effects
if(mainmenu>=3&&mainmenu!=8){
archiveselected=0;
if(consolechars[0]>0) {
consoletext[0][consolechars[0]]='\0';
- cmd_dispatch(this, consoletext[0]);
+ cmd_dispatch(consoletext[0]);
for(int k=14;k>=1;k--) {
for(int j=0;j<255;j++)
consoletext[k][j]=consoletext[k-1][j];
if(Input::isKeyDown(SDLK_q)&&Input::isKeyDown(SDLK_LMETA)){
tryquit=1;
if(mainmenu==3) {
- SaveSettings(*this);
+ SaveSettings();
}
}
static bool isKeyDown(int k);
static bool isKeyPressed(int k);
static const char* keyToChar(unsigned short which);
- static void setKeyFor(Game* g);
static unsigned short CharToKey(const char* which);
static Boolean MouseClicked();
};
-void Menu::GUITick(Game* game){
+void Menu::GUITick(){
for(vector<MenuItem>::iterator it=items.begin();it!=items.end();it++){
- if(it->id==game->selected){
+ if(it->id==Game::selected){
it->effectfade+=multiplier*5;
if(it->effectfade>1)
it->effectfade=1;
return -1;
}
-void Menu::drawItems(Game* game){
+void Menu::drawItems(){
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
case MenuItem::BUTTON:
glColor4f(it->r,it->g,it->b,1);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- game->text.glPrint(it->x,it->y,it->label.c_str(),0,1,640,480);
+ Game::text->glPrint(it->x,it->y,it->label.c_str(),0,1,640,480);
if(it->type!=MenuItem::LABEL){
//mouseover highlight
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
for(int i=0;i<15;i++){
if(1-((float)i)/15-(1-it->effectfade)>0){
glColor4f(it->r,it->g,it->b,(1-((float)i)/10-(1-it->effectfade))*.25);
- game->text.glPrint(it->x-((float)i),it->y,it->label.c_str(),0,1+((float)i)/70,640,480);
+ Game::text->glPrint(it->x-((float)i),it->y,it->label.c_str(),0,1+((float)i)/70,640,480);
}
}
}
break;
case MenuItem::MAPLABEL:
- game->text.glPrintOutlined(0.9,0,0,it->x,it->y,it->label.c_str(),0,0.6,640,480);
+ Game::text->glPrintOutlined(0.9,0,0,it->x,it->y,it->label.c_str(),0,0.6,640,480);
break;
case MenuItem::MAPLINE: {
XYZ linestart;
namespace Menu {
typedef void(*MBCallback)(int id);
- void GUITick(Game* game);
+ void GUITick();
void clearMenu();
void addLabel(int id,const string& label,int x,int y);
void addButton(int id,const string& label,MBCallback cb,int x,int y,int w,int h,float r=1,float g=0,float b=0);
void setButtonText(int id,const string& label);
void setButtonText(int id,const string& label,int x,int y,int w,int h);
int getSelected(int mousex, int mousey);
- void drawItems(Game* game);
+ void drawItems();
}
#endif
extern float texdetail;
extern bool decals;
-extern Game * pgame;
extern bool visibleloading;
int Model::LineCheck(XYZ *p1,XYZ *p2, XYZ *p, XYZ *move, float *rotate)
LOG(std::string("Loading model...") + filename);
if(visibleloading)
- pgame->LoadingScreen();
+ Game::LoadingScreen();
int oldvertexNum,oldTriangleNum;
oldvertexNum=vertexNum;
void Model::CalculateNormals(bool facenormalise)
{
if(visibleloading)
- pgame->LoadingScreen();
+ Game::LoadingScreen();
static int i;
if(type!=normaltype&&type!=decalstype)return;
#endif
}
+using namespace Game;
+
static bool load_image(const char * fname, TGAImageRec & tex);
static bool load_png(const char * fname, TGAImageRec & tex);
static bool load_jpg(const char * fname, TGAImageRec & tex);
NULL
};
-void DrawGL(Game & game);
-
-Boolean SetUp (Game & game);
-void DoUpdate (Game & game);
+Boolean SetUp ();
+void DoUpdate ();
void CleanUp (void);
Boolean gDone = false;
-Game * pgame = 0;
-
#ifndef __MINGW32__
static int _argc = 0;
static char **_argv = NULL;
//~ pgame->LoadScreenTexture();
}
-static void sdlEventProc(const SDL_Event &e, Game &game)
+static void sdlEventProc(const SDL_Event &e)
{
switch(e.type) {
case SDL_MOUSEMOTION:
- game.deltah += e.motion.xrel;
- game.deltav += e.motion.yrel;
+ deltah += e.motion.xrel;
+ deltav += e.motion.yrel;
break;
case SDL_KEYDOWN:
static Point gMidPoint;
-Boolean SetUp (Game & game)
+Boolean SetUp ()
{
char string[10];
slomofreq=8012;
numplayers=1;
- DefaultSettings(game);
+ DefaultSettings();
if (!SDL_WasInit(SDL_INIT_VIDEO))
if (SDL_Init(SDL_INIT_VIDEO) == -1)
fprintf(stderr, "SDL_Init() failed: %s\n", SDL_GetError());
return false;
}
- if(!LoadSettings(game)) {
+ if(!LoadSettings()) {
fprintf(stderr, "Failed to load config, creating default\n");
- SaveSettings(game);
+ SaveSettings();
}
if(kBitsPerPixel!=32&&kBitsPerPixel!=16){
kBitsPerPixel=16;
screenwidth=width;
screenheight=height;
- game.newdetail=detail;
- game.newscreenwidth=screenwidth;
- game.newscreenheight=screenheight;
+ newdetail=detail;
+ newscreenwidth=screenwidth;
+ newscreenheight=screenheight;
- game.InitGame();
+ InitGame();
return true;
}
-static void DoMouse(Game & game)
+static void DoMouse()
{
- if(mainmenu|| ( (abs(game.deltah)<10*realmultiplier*1000) && (abs(game.deltav)<10*realmultiplier*1000) ))
+ if(mainmenu|| ( (abs(deltah)<10*realmultiplier*1000) && (abs(deltav)<10*realmultiplier*1000) ))
{
- game.deltah *= usermousesensitivity;
- game.deltav *= usermousesensitivity;
- game.mousecoordh += game.deltah;
- game.mousecoordv += game.deltav;
- if (game.mousecoordh < 0)
- game.mousecoordh = 0;
- else if (game.mousecoordh >= kContextWidth)
- game.mousecoordh = kContextWidth - 1;
- if (game.mousecoordv < 0)
- game.mousecoordv = 0;
- else if (game.mousecoordv >= kContextHeight)
- game.mousecoordv = kContextHeight - 1;
+ deltah *= usermousesensitivity;
+ deltav *= usermousesensitivity;
+ mousecoordh += deltah;
+ mousecoordv += deltav;
+ if (mousecoordh < 0)
+ mousecoordh = 0;
+ else if (mousecoordh >= kContextWidth)
+ mousecoordh = kContextWidth - 1;
+ if (mousecoordv < 0)
+ mousecoordv = 0;
+ else if (mousecoordv >= kContextHeight)
+ mousecoordv = kContextHeight - 1;
}
}
}
-void DoUpdate (Game & game)
+void DoUpdate ()
{
static float sps=200;
static int count;
DoFrameRate(1);
if(multiplier>.6)multiplier=.6;
- game.fps=1/multiplier;
+ fps=1/multiplier;
count = multiplier*sps;
if(count<2)count=2;
if(difficulty==1)multiplier*=.9;
if(difficulty==0)multiplier*=.8;
- if(game.loading==4)multiplier*=.00001;
+ if(loading==4)multiplier*=.00001;
if(slomo&&!mainmenu)multiplier*=slomospeed;
oldmult=multiplier;
multiplier/=(float)count;
- DoMouse(game);
+ DoMouse();
- game.TickOnce();
+ TickOnce();
for(int i=0;i<count;i++)
{
- game.Tick();
+ Tick();
}
multiplier=oldmult;
- game.TickOnceAfter();
+ TickOnceAfter();
/* - Debug code to test how many channels were active on average per frame
static long frames = 0;
num_channels = 0;
}
*/
- game.DrawGL();
+ DrawGL();
}
// --------------------------------------------------------------------------
try
{
{
- Game game;
- pgame = &game;
+ newGame();
//ofstream os("error.txt");
//os.close();
//ofstream os("log.txt");
//os.close();
- if (!SetUp (game))
+ if (!SetUp ())
return 42;
- while (!gDone&&!game.quit&&(!game.tryquit))
+ while (!gDone&&!quit&&(!tryquit))
{
if (IsFocused())
{
// check windows messages
- game.deltah = 0;
- game.deltav = 0;
+ deltah = 0;
+ deltav = 0;
SDL_Event e;
- if(!game.isWaiting()) {
+ if(!waiting) {
// message pump
while( SDL_PollEvent( &e ) )
{
gDone=true;
break;
}
- sdlEventProc(e, game);
+ sdlEventProc(e);
}
}
// game
- DoUpdate(game);
+ DoUpdate();
}
else
{
{
// allow game chance to pause
gameFocused = false;
- DoUpdate(game);
+ DoUpdate();
}
// game is not in focus, give CPU time to other apps by waiting for messages instead of 'peeking'
}
}
-
+ deleteGame();
}
- pgame = 0;
CleanUp ();
#include "Game.h"
#include "Input.h"
-void DefaultSettings(Game &game) {
+using namespace Game;
+
+void DefaultSettings() {
detail=1;
ismotionblur=0;
usermousesensitivity=1;
vblsync=1;
debugmode=0;
- game.crouchkey=SDLK_LSHIFT;
- game.jumpkey=SDLK_SPACE;
- game.leftkey=SDLK_a;
- game.forwardkey=SDLK_w;
- game.backkey=SDLK_s;
- game.rightkey=SDLK_d;
- game.drawkey=SDLK_e;
- game.throwkey=SDLK_q;
- game.attackkey=MOUSEBUTTON1;
- game.consolekey=SDLK_BACKQUOTE;
- game.chatkey=SDLK_t;
+ crouchkey=SDLK_LSHIFT;
+ jumpkey=SDLK_SPACE;
+ leftkey=SDLK_a;
+ forwardkey=SDLK_w;
+ backkey=SDLK_s;
+ rightkey=SDLK_d;
+ drawkey=SDLK_e;
+ throwkey=SDLK_q;
+ attackkey=MOUSEBUTTON1;
+ consolekey=SDLK_BACKQUOTE;
+ chatkey=SDLK_t;
}
-void SaveSettings(Game &game) {
- if(game.newdetail<0) game.newdetail=0;
- if(game.newdetail>2) game.newdetail=2;
- if(game.newscreenwidth>3000) game.newscreenwidth=screenwidth;
- if(game.newscreenwidth<0) game.newscreenwidth=screenwidth;
- if(game.newscreenheight>3000) game.newscreenheight=screenheight;
- if(game.newscreenheight<0) game.newscreenheight=screenheight;
+void SaveSettings() {
+ if(newdetail<0) newdetail=0;
+ if(newdetail>2) newdetail=2;
+ if(newscreenwidth>3000) newscreenwidth=screenwidth;
+ if(newscreenwidth<0) newscreenwidth=screenwidth;
+ if(newscreenheight>3000) newscreenheight=screenheight;
+ if(newscreenheight<0) newscreenheight=screenheight;
ofstream opstream(ConvertFileName(":Data:config.txt", "w"));
opstream << "Screenwidth:\n";
- opstream << game.newscreenwidth;
+ opstream << newscreenwidth;
opstream << "\nScreenheight:\n";
- opstream << game.newscreenheight;
+ opstream << newscreenheight;
opstream << "\nMouse sensitivity:\n";
opstream << usermousesensitivity;
opstream << "\nBlur(0,1):\n";
opstream << ismotionblur;
opstream << "\nOverall Detail(0,1,2) higher=better:\n";
- opstream << game.newdetail;
+ opstream << newdetail;
opstream << "\nFloating jump:\n";
opstream << floatjump;
opstream << "\nMouse jump:\n";
opstream << "\nVolume:\n";
opstream << volume;
opstream << "\nForward key:\n";
- opstream << Input::keyToChar(game.forwardkey);
+ opstream << Input::keyToChar(forwardkey);
opstream << "\nBack key:\n";
- opstream << Input::keyToChar(game.backkey);
+ opstream << Input::keyToChar(backkey);
opstream << "\nLeft key:\n";
- opstream << Input::keyToChar(game.leftkey);
+ opstream << Input::keyToChar(leftkey);
opstream << "\nRight key:\n";
- opstream << Input::keyToChar(game.rightkey);
+ opstream << Input::keyToChar(rightkey);
opstream << "\nJump key:\n";
- opstream << Input::keyToChar(game.jumpkey);
+ opstream << Input::keyToChar(jumpkey);
opstream << "\nCrouch key:\n";
- opstream << Input::keyToChar(game.crouchkey);
+ opstream << Input::keyToChar(crouchkey);
opstream << "\nDraw key:\n";
- opstream << Input::keyToChar(game.drawkey);
+ opstream << Input::keyToChar(drawkey);
opstream << "\nThrow key:\n";
- opstream << Input::keyToChar(game.throwkey);
+ opstream << Input::keyToChar(throwkey);
opstream << "\nAttack key:\n";
- opstream << Input::keyToChar(game.attackkey);
+ opstream << Input::keyToChar(attackkey);
opstream << "\nConsole key:\n";
- opstream << Input::keyToChar(game.consolekey);
+ opstream << Input::keyToChar(consolekey);
opstream << "\nChat key:\n";
- opstream << Input::keyToChar(game.chatkey);
+ opstream << Input::keyToChar(chatkey);
opstream << "\nDamage bar:\n";
opstream << showdamagebar;
opstream << "\nStereoMode:\n";
opstream.close();
}
-bool LoadSettings(Game &game) {
+bool LoadSettings() {
ifstream ipstream(ConvertFileName(":Data:config.txt"), std::ios::in);
if ( !ipstream || ipstream.fail() ) {
printf("Config file not found\n");
ipstream >> volume;
} else if ( !strncmp(setting, "Forward key", 11) ) {
ipstream.getline( string, sizeof(string) );
- game.forwardkey = Input::CharToKey(string);
+ forwardkey = Input::CharToKey(string);
} else if ( !strncmp(setting, "Back key", 8) ) {
ipstream.getline( string, sizeof(string) );
- game.backkey = Input::CharToKey(string);
+ backkey = Input::CharToKey(string);
} else if ( !strncmp(setting, "Left key", 8) ) {
ipstream.getline( string, sizeof(string) );
- game.leftkey = Input::CharToKey(string);
+ leftkey = Input::CharToKey(string);
} else if ( !strncmp(setting, "Right key", 9) ) {
ipstream.getline( string, sizeof(string) );
- game.rightkey = Input::CharToKey(string);
+ rightkey = Input::CharToKey(string);
} else if ( !strncmp(setting, "Jump key", 8) ) {
ipstream.getline( string, sizeof(string) );
- game.jumpkey = Input::CharToKey(string);
+ jumpkey = Input::CharToKey(string);
} else if ( !strncmp(setting, "Crouch key", 10) ) {
ipstream.getline( string, sizeof(string) );
- game.crouchkey = Input::CharToKey(string);
+ crouchkey = Input::CharToKey(string);
} else if ( !strncmp(setting, "Draw key", 8) ) {
ipstream.getline( string, sizeof(string) );
- game.drawkey = Input::CharToKey(string);
+ drawkey = Input::CharToKey(string);
} else if ( !strncmp(setting, "Throw key", 9) ) {
ipstream.getline( string, sizeof(string) );
- game.throwkey = Input::CharToKey(string);
+ throwkey = Input::CharToKey(string);
} else if ( !strncmp(setting, "Attack key", 10) ) {
ipstream.getline( string, sizeof(string) );
- game.attackkey = Input::CharToKey(string);
+ attackkey = Input::CharToKey(string);
} else if ( !strncmp(setting, "Console key", 11) ) {
ipstream.getline( string, sizeof(string) );
- game.consolekey = Input::CharToKey(string);
+ consolekey = Input::CharToKey(string);
} else if ( !strncmp(setting, "Chat key", 8) ) {
ipstream.getline( string, sizeof(string) );
- game.chatkey = Input::CharToKey(string);
+ chatkey = Input::CharToKey(string);
} else if ( !strncmp(setting, "Damage bar", 10) ) {
ipstream >> showdamagebar;
} else if ( !strncmp(setting, "StereoMode", 10) ) {
extern int kContextHeight;
extern float screenwidth,screenheight;
-void DefaultSettings(Game &game);
-void SaveSettings(Game &game);
-bool LoadSettings(Game &game);
+void DefaultSettings();
+void SaveSettings();
+bool LoadSettings();
#endif
extern int whichjointstartarray[26];
extern int whichjointendarray[26];
-extern Game * pgame;
extern bool visibleloading;
void dealloc2(void* param){
height=aheight;
attack=aattack;
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
tfile=fopen( fixedFN, "rb" );
if(tfile){
extern short vRefNum;
extern long dirID;
extern bool visibleloading;
-extern Game * pgame;
extern bool LoadImage(const char * fname, TGAImageRec & tex);
/********************> LoadTGA() <*****/
bool upload_image(const unsigned char* filePath, bool hasalpha)
{
if(visibleloading)
- pgame->LoadingScreen();
+ Game::LoadingScreen();
#if !PLATFORM_MACOSX
extern float targetblurness;
extern Objects objects;
extern TGAImageRec texture;
-extern Game * pgame;
extern bool visibleloading;
extern bool skyboxtexture;
extern int tutoriallevel;
}
}
texture.bpp=24;
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
texdetail=temptexdetail;
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
float slopeness;
textureness[i][j]=-1;
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
for(i=0;i<size;i++){
}
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
for(i=0;i<size;i++){
for(j=0;j<size;j++){
}
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
/*float total;
int todivide;
}
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
patch_size=size/subdivision;
patch_elements=(patch_size)*(patch_size)*54;
}
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
}
brightness=dotproduct(&lightloc,&normals[i][j]);
if(shadowed)brightness*=1-shadowed;
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
//Smooth shadows
for(i=0;i<size;i++){