X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameInitDispose.cpp;h=3cbed4a5040d083116aeebfc32fdd003e9b30d29;hb=e7b76642d8998c250272a8313ad8aa7c7efff319;hp=0ce61eeb704cbb2a8a4faa017e86e406dc96d2b0;hpb=2d54e57ffa32e0a02013d79be57b8a2f3bc8db05;p=lugaru.git diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index 0ce61ee..3cbed4a 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -26,13 +26,10 @@ along with Lugaru. If not, see . extern float screenwidth, screenheight; extern float viewdistance; extern XYZ viewer; -extern XYZ lightlocation; extern float fadestart; extern float texscale; extern float gravity; extern Light light; -extern Skeleton testskeleton; -extern int numsounds; extern Terrain terrain; extern int kTextureSize; extern float texdetail; @@ -52,9 +49,6 @@ extern float multiplier; extern int netdatanew; extern float mapinfo; extern bool stillloading; -extern ImageRec texture; -extern short vRefNum; -extern long dirID; extern int mainmenu; extern bool visibleloading; extern float flashamount, flashr, flashg, flashb; @@ -62,25 +56,9 @@ extern int flashdelay; extern int whichjointstartarray[26]; extern int whichjointendarray[26]; extern int difficulty; -extern float tintr, tintg, tintb; extern float slomospeed; extern bool gamestarted; -extern int numdialogues; -extern int numdialogueboxes[20]; -extern int dialoguetype[20]; -extern int dialogueboxlocation[20][20]; -extern float dialogueboxcolor[20][20][3]; -extern int dialogueboxsound[20][20]; -extern char dialoguetext[20][20][128]; -extern char dialoguename[20][20][64]; -extern XYZ dialoguecamera[20][20]; -extern float dialoguecamerayaw[20][20]; -extern float dialoguecamerapitch[20][20]; -extern int indialogue; -extern int whichdialogue; -extern float dialoguetime; - extern float accountcampaignhighscore[10]; extern float accountcampaignfasttime[10]; extern float accountcampaignscore[10]; @@ -120,10 +98,6 @@ void Dispose() } OPENAL_Close(); - if (texture.data) { - free(texture.data); - } - texture.data = 0; #endif } @@ -170,7 +144,8 @@ void LoadSave(const char *fileName, GLuint *textureid, bool mipmap, GLubyte *arr texdetail = 1; //Load Image - upload_image(ConvertFileName(fileName)); + ImageRec texture; + load_image(ConvertFileName(fileName), texture); texdetail = temptexdetail; int bytesPerPixel = texture.bpp / 8; @@ -472,9 +447,6 @@ void FadeLoadingScreen(float howmuch) swap_gl_buffers(); } - -extern bool cmdline(const char *cmd); - void Game::InitGame() { LOGFUNC; @@ -483,10 +455,6 @@ void Game::InitGame() accountactive = Account::loadFile(":Data:Users"); - tintr = 1; - tintg = 1; - tintb = 1; - whichjointstartarray[0] = righthip; whichjointendarray[0] = rightfoot; @@ -569,8 +537,6 @@ void Game::InitGame() stillloading = 1; - texture.data = ( GLubyte* )malloc( 1024 * 1024 * 4 ); - int temptexdetail = texdetail; texdetail = 1; text->LoadFontTexture(":Data:Textures:Font.png"); @@ -594,15 +560,14 @@ void Game::InitGame() #if PLATFORM_LINUX unsigned char rc = 0; int output = OPENAL_OUTPUT_ALSA; // Try alsa first... - if (cmdline("forceoss")) // ...but let user override that. - output = OPENAL_OUTPUT_OSS; - else if (cmdline("nosound")) - output = OPENAL_OUTPUT_NOSOUND; + if (commandLineOptions[SOUND]) { + output = commandLineOptions[SOUND].last()->type(); // ...but let user override that. + } OPENAL_SetOutput(output); if ((rc = OPENAL_Init(44100, 32, 0)) == false) { // if we tried ALSA and failed, fall back to OSS. - if ( (output == OPENAL_OUTPUT_ALSA) && (!cmdline("forcealsa")) ) { + if ( (output == OPENAL_OUTPUT_ALSA) && (commandLineOptions[SOUND].last()->type() != OPENAL_OUTPUT_ALSA) ) { OPENAL_Close(); output = OPENAL_OUTPUT_OSS; OPENAL_SetOutput(output); @@ -626,25 +591,23 @@ void Game::InitGame() if (musictoggle) emit_stream_np(stream_menutheme); - cursortexture.load(":Data:Textures:Cursor.png", 0, 1); + cursortexture.load(":Data:Textures:Cursor.png", 0); - Mapcircletexture.load(":Data:Textures:MapCircle.png", 0, 1); - Mapboxtexture.load(":Data:Textures:MapBox.png", 0, 1); - Maparrowtexture.load(":Data:Textures:MapArrow.png", 0, 1); + Mapcircletexture.load(":Data:Textures:MapCircle.png", 0); + Mapboxtexture.load(":Data:Textures:MapBox.png", 0); + Maparrowtexture.load(":Data:Textures:MapArrow.png", 0); temptexdetail = texdetail; if (texdetail > 2) texdetail = 2; - Mainmenuitems[0].load(":Data:Textures:Lugaru.png", 0, 0); - Mainmenuitems[1].load(":Data:Textures:Newgame.png", 0, 0); - Mainmenuitems[2].load(":Data:Textures:Options.png", 0, 0); - Mainmenuitems[3].load(":Data:Textures:Quit.png", 0, 0); - Mainmenuitems[4].load(":Data:Textures:Eyelid.png", 0, 1); - Mainmenuitems[5].load(":Data:Textures:Resume.png", 0, 0); - Mainmenuitems[6].load(":Data:Textures:Endgame.png", 0, 0); - - //LoadTexture(":Data:Textures:Eye.jpg",&Mainmenuitems[5],0,1); - //~ LoadTexture(":Data:Textures:World.png",&Mainmenuitems[7],0,0); // LoadCampaign will take care of that + Mainmenuitems[0].load(":Data:Textures:Lugaru.png", 0); + Mainmenuitems[1].load(":Data:Textures:Newgame.png", 0); + Mainmenuitems[2].load(":Data:Textures:Options.png", 0); + Mainmenuitems[3].load(":Data:Textures:Quit.png", 0); + Mainmenuitems[4].load(":Data:Textures:Eyelid.png", 0); + Mainmenuitems[5].load(":Data:Textures:Resume.png", 0); + Mainmenuitems[6].load(":Data:Textures:Endgame.png", 0); + texdetail = temptexdetail; FadeLoadingScreen(95); @@ -701,7 +664,7 @@ void Game::LoadStuff() i = abs(Random() % 4); visibleloading = 0; //don't use loadscreentexture yet - loadscreentexture.load(":Data:Textures:fire.jpg", 1, 0); + loadscreentexture.load(":Data:Textures:fire.jpg", 1); visibleloading = 1; temptexdetail = texdetail; @@ -710,8 +673,6 @@ void Game::LoadStuff() text->BuildFont(); texdetail = temptexdetail; - numsounds = 71; - viewdistdetail = 2; viewdistance = 50 * megascale * viewdistdetail; @@ -729,13 +690,13 @@ void Game::LoadStuff() LOG("Loading weapon data..."); - Weapon::knifetextureptr.load(":Data:Textures:knife.png", 0, 1); - Weapon::bloodknifetextureptr.load(":Data:Textures:bloodknife.png", 0, 1); - Weapon::lightbloodknifetextureptr.load(":Data:Textures:lightbloodknife.png", 0, 1); - Weapon::swordtextureptr.load(":Data:Textures:sword.jpg", 1, 0); - Weapon::bloodswordtextureptr.load(":Data:Textures:Swordblood.jpg", 1, 0); - Weapon::lightbloodswordtextureptr.load(":Data:Textures:Swordbloodlight.jpg", 1, 0); - Weapon::stafftextureptr.load(":Data:Textures:Staff.jpg", 1, 0); + Weapon::knifetextureptr.load(":Data:Textures:knife.png", 0); + Weapon::bloodknifetextureptr.load(":Data:Textures:bloodknife.png", 0); + Weapon::lightbloodknifetextureptr.load(":Data:Textures:lightbloodknife.png", 0); + Weapon::swordtextureptr.load(":Data:Textures:sword.jpg", 1); + Weapon::bloodswordtextureptr.load(":Data:Textures:Swordblood.jpg", 1); + Weapon::lightbloodswordtextureptr.load(":Data:Textures:Swordbloodlight.jpg", 1); + Weapon::stafftextureptr.load(":Data:Textures:Staff.jpg", 1); Weapon::throwingknifemodel.load((char *)":Data:Models:throwingknife.solid", 1); Weapon::throwingknifemodel.Scale(.001, .001, .001); @@ -760,28 +721,28 @@ void Game::LoadStuff() Weapon::staffmodel.flat = 1; Weapon::staffmodel.CalculateNormals(1); - terrain.shadowtexture.load(":Data:Textures:shadow.png", 0, 1); - terrain.bloodtexture.load(":Data:Textures:blood.png", 0, 1); - terrain.breaktexture.load(":Data:Textures:break.png", 0, 1); - terrain.bloodtexture2.load(":Data:Textures:blood.png", 0, 1); + terrain.shadowtexture.load(":Data:Textures:shadow.png", 0); + terrain.bloodtexture.load(":Data:Textures:blood.png", 0); + terrain.breaktexture.load(":Data:Textures:break.png", 0); + terrain.bloodtexture2.load(":Data:Textures:blood.png", 0); - terrain.footprinttexture.load(":Data:Textures:footprint.png", 0, 1); - terrain.bodyprinttexture.load(":Data:Textures:bodyprint.png", 0, 1); - hawktexture.load(":Data:Textures:hawk.png", 0, 1); + terrain.footprinttexture.load(":Data:Textures:footprint.png", 0); + terrain.bodyprinttexture.load(":Data:Textures:bodyprint.png", 0); + hawktexture.load(":Data:Textures:hawk.png", 0); - Sprite::cloudtexture.load(":Data:Textures:cloud.png", 1, 1); - Sprite::cloudimpacttexture.load(":Data:Textures:cloudimpact.png", 1, 1); - Sprite::bloodtexture.load(":Data:Textures:bloodparticle.png", 1, 1); - Sprite::snowflaketexture.load(":Data:Textures:snowflake.png", 1, 1); - Sprite::flametexture.load(":Data:Textures:flame.png", 1, 1); - Sprite::bloodflametexture.load(":Data:Textures:bloodflame.png", 1, 1); - Sprite::smoketexture.load(":Data:Textures:smoke.png", 1, 1); - Sprite::shinetexture.load(":Data:Textures:shine.png", 1, 0); - Sprite::splintertexture.load(":Data:Textures:splinter.png", 1, 1); - Sprite::leaftexture.load(":Data:Textures:leaf.png", 1, 1); - Sprite::toothtexture.load(":Data:Textures:tooth.png", 1, 1); + Sprite::cloudtexture.load(":Data:Textures:cloud.png", 1); + Sprite::cloudimpacttexture.load(":Data:Textures:cloudimpact.png", 1); + Sprite::bloodtexture.load(":Data:Textures:bloodparticle.png", 1); + Sprite::snowflaketexture.load(":Data:Textures:snowflake.png", 1); + Sprite::flametexture.load(":Data:Textures:flame.png", 1); + Sprite::bloodflametexture.load(":Data:Textures:bloodflame.png", 1); + Sprite::smoketexture.load(":Data:Textures:smoke.png", 1); + Sprite::shinetexture.load(":Data:Textures:shine.png", 1); + Sprite::splintertexture.load(":Data:Textures:splinter.png", 1); + Sprite::leaftexture.load(":Data:Textures:leaf.png", 1); + Sprite::toothtexture.load(":Data:Textures:tooth.png", 1); yaw = 0; pitch = 0;