X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameInitDispose.cpp;h=e936228c4ab54993ea905400284c8cc60c52511b;hb=38615999d550e75a973ce4d5520c9ef117d65cea;hp=47ceb900ff29b8add71b672243465a4a60723e62;hpb=8dd1be7b95d8684e02b7fd9aa576d0a4ef267623;p=lugaru.git diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index 47ceb90..e936228 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; @@ -37,7 +38,7 @@ 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 +79,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 +122,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 +394,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 +403,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,73 +929,7 @@ void Game::InitGame() numchallengelevels=14; - /*char tempstring[256]; - sprintf (tempstring, "%s", registrationname); - long num1; - long num2; - long num3; - long num4; - long long longnum; - longnum = MD5_string ( tempstring); - //longnum = 1111111111111111; - num1 = longnum/100000000; - num2 = longnum%100000000; - sprintf (tempstring, "%d-%d-%d-%d", num1/10000, num1%10000, num2/10000, num2%10000); - */ - - 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