X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameInitDispose.cpp;h=e8e16827b762168ca06d531ba8f13a0975072ac8;hb=9248d1455aa434112b5ddd771fd69b8df02d44ee;hp=9fb279bc52fb248185e73c9ff75ba664f9960c7b;hpb=decb00e82a2e65e25dbcdd8f16fff5a6a07d31d6;p=lugaru.git diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index 9fb279b..e8e1682 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Game.h" #include "openal_wrapper.h" +#include "Animation.h" extern float screenwidth,screenheight; extern float viewdistance; @@ -31,13 +32,12 @@ extern float fadestart; extern float texscale; extern float gravity; extern Light light; -extern Animation animation[animation_count]; extern Skeleton testskeleton; extern int numsounds; extern OPENAL_SAMPLE *samp[100]; extern int channels[100]; extern Terrain terrain; -extern Sprites sprites; +//extern Sprites sprites; extern int kTextureSize; extern float texdetail; extern float realtexdetail; @@ -78,16 +78,6 @@ extern float slomospeed; extern char mapname[256]; extern bool gamestarted; -extern int numaccounts; -extern int accountactive; -extern int accountdifficulty[10]; -extern int accountprogress[10]; -extern float accountpoints[10]; -extern float accounthighscore[10][50]; -extern float accountfasttime[10][50]; -extern bool accountunlocked[10][60]; -extern char accountname[10][256]; - extern int numdialogues; extern int numdialogueboxes[20]; extern int dialoguetype[20]; @@ -131,59 +121,11 @@ void Game::Dispose() LOGFUNC; if(endgame==2){ - accountcampaignchoicesmade[accountactive]=0; - accountcampaignscore[accountactive]=0; - accountcampaigntime[accountactive]=0; + accountactive->endGame(); endgame=0; } - - sprintf (mapname, ":Data:Users"); - - FILE *tfile; - tfile=fopen( ConvertFileName(mapname), "wb" ); - if (tfile) - { - fpackf(tfile, "Bi", numaccounts); - fpackf(tfile, "Bi", accountactive); - if(numaccounts>0) - { - for(i=0;i0) - { - for(j=0;j<(int)strlen(accountname[i]);j++) - { - fpackf(tfile, "Bb", accountname[i][j]); - } - } - } - } - - fclose(tfile); - } + Account::saveFile(":Data:Users", accountactive); TexIter it = textures.begin(); for (; it != textures.end(); ++it) @@ -451,7 +393,8 @@ void Game::LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); - if(!*textureid)glGenTextures( 1, textureid ); + if(!*textureid) + glGenTextures( 1, textureid ); glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); glBindTexture( GL_TEXTURE_2D, *textureid); @@ -459,20 +402,9 @@ void Game::LoadTexture(const char *fileName, GLuint *textureid,int mipmap, bool if(trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR ); if(!trilinear)if(mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST ); if(!mipmap)glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - - //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture.sizeX, texture.sizeY, 0, - // GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, texture.data); - - //gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, GL_BGRA_EXT, GL_UNSIGNED_INT_8_8_8_8_REV, texture.data ); - + gluBuild2DMipmaps( GL_TEXTURE_2D, type, texture.sizeX, texture.sizeY, type, GL_UNSIGNED_BYTE, texture.data ); - -// textures.insert(std::make_pair(fname, *textureid)); } -// else -// { -// *textureid = it->second; -// } } void Game::LoadTextureSave(const char *fileName, GLuint *textureid,int mipmap,GLubyte *array, int *skinsize) @@ -996,60 +928,7 @@ void Game::InitGame() numchallengelevels=14; - - FILE *tfile; - - accountactive=-1; - - sprintf (mapname, ":Data:Users"); - tfile=fopen( ConvertFileName(mapname), "rb" ); - if(tfile) - { - funpackf(tfile, "Bi", &numaccounts); - funpackf(tfile, "Bi", &accountactive); - if(numaccounts>0) - { - for(i=0;i= 10) - { - accountcampaignchoices[i][j] = 0; - } - } - funpackf(tfile, "Bf", &accountpoints[i]); - for(j=0;j<50;j++) - { - funpackf(tfile, "Bf", &accounthighscore[i][j]); - funpackf(tfile, "Bf", &accountfasttime[i][j]); - } - for(j=0;j<60;j++) - { - funpackf(tfile, "Bb", &accountunlocked[i][j]); - } - int temp; - funpackf(tfile, "Bi", &temp); - if(temp>0) - { - for(j=0;j