X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameTick.cpp;h=ef7598485386444b5a3476c33efc27419acb6818;hb=d5ff767196019eeb0001f921365bb1e4060eee5b;hp=cf67c1a75f498872ac8c38cb4f7ab51f105cc0ea;hpb=71128f2976d474e055fdc68887d9403e9b5e3fc6;p=lugaru.git diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index cf67c1a..ef75984 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -70,9 +70,6 @@ extern float blackout; extern bool cellophane; extern bool musictoggle; extern int difficulty; -extern Weapons weapons; -extern Person player[maxplayers]; -extern int numplayers; extern int bloodtoggle; extern bool invertmouse; extern float windvar; @@ -241,7 +238,6 @@ static bool stripfx(const char *str, const char *pfx) return !strncasecmp(str, pfx, strlen(pfx)); } -extern OPENAL_STREAM * strm[20]; extern "C" void PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused); extern "C" void PlayStreamEx(int chan, OPENAL_STREAM *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused); @@ -1388,7 +1384,7 @@ void Game::Setenvironment(int which) windvector.z=3; if(ambientsound){ //PlaySoundEx( wind, samp[wind], NULL, true); - PlayStreamEx(stream_wind, strm[stream_wind], 0, true); + PlayStreamEx(stream_wind, samp[stream_wind], 0, true); OPENAL_SetPaused(channels[stream_wind], false); OPENAL_SetVolume(channels[stream_wind], 256); } @@ -1398,14 +1394,10 @@ void Game::Setenvironment(int which) LoadTexture(":Data:Textures:bouldersnow.jpg",&objects.rocktextureptr,1,0); LoadTexture(":Data:Textures:snowbox.jpg",&objects.boxtextureptr,1,0); - OPENAL_Sample_Free(samp[footstepsound]); - OPENAL_Sample_Free(samp[footstepsound2]); - OPENAL_Sample_Free(samp[footstepsound3]); - OPENAL_Sample_Free(samp[footstepsound4]); - samp[footstepsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0); - samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0); - samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone1.ogg"), OPENAL_HW3D, 0, 0); - samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone2.ogg"), OPENAL_HW3D, 0, 0); + footstepsound = footstepsn1; + footstepsound2 = footstepsn2; + footstepsound3 = footstepst1; + footstepsound4 = footstepst2; LoadTexture(":Data:Textures:snow.jpg",&terraintexture,1,0); @@ -1443,19 +1435,15 @@ void Game::Setenvironment(int which) if(ambientsound){ //PlaySoundEx( desertambient, samp[desertambient], NULL, true); - PlayStreamEx( stream_desertambient, strm[stream_desertambient], NULL, true); + PlayStreamEx( stream_desertambient, samp[stream_desertambient], NULL, true); OPENAL_SetPaused(channels[stream_desertambient], false); OPENAL_SetVolume(channels[stream_desertambient], 256); } - OPENAL_Sample_Free(samp[footstepsound]); - OPENAL_Sample_Free(samp[footstepsound2]); - OPENAL_Sample_Free(samp[footstepsound3]); - OPENAL_Sample_Free(samp[footstepsound4]); - samp[footstepsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0); - samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0); - samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow1.ogg"), OPENAL_HW3D, 0, 0); - samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepsnow2.ogg"), OPENAL_HW3D, 0, 0); + footstepsound = footstepsn1; + footstepsound2 = footstepsn2; + footstepsound3 = footstepsn1; + footstepsound4 = footstepsn2; LoadTexture(":Data:Textures:sand.jpg",&terraintexture,1,0); @@ -1490,19 +1478,15 @@ void Game::Setenvironment(int which) LoadTexture(":Data:Textures:grassbox.jpg",&objects.boxtextureptr,1,0); if(ambientsound){ - PlayStreamEx( stream_wind, strm[stream_wind], NULL, true); + PlayStreamEx( stream_wind, samp[stream_wind], NULL, true); OPENAL_SetPaused(channels[stream_wind], false); OPENAL_SetVolume(channels[stream_wind], 100); } - OPENAL_Sample_Free(samp[footstepsound]); - OPENAL_Sample_Free(samp[footstepsound2]); - OPENAL_Sample_Free(samp[footstepsound3]); - OPENAL_Sample_Free(samp[footstepsound4]); - samp[footstepsound] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepgrass1.ogg"), OPENAL_HW3D, 0, 0); - samp[footstepsound2] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepgrass2.ogg"), OPENAL_HW3D, 0, 0); - samp[footstepsound3] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone1.ogg"), OPENAL_HW3D, 0, 0); - samp[footstepsound4] = OPENAL_Sample_Load(OPENAL_FREE, ConvertFileName(":Data:Sounds:footstepstone2.ogg"), OPENAL_HW3D, 0, 0); + footstepsound = footstepgr1; + footstepsound2 = footstepgr2; + footstepsound3 = footstepst1; + footstepsound4 = footstepst2; LoadTexture(":Data:Textures:grassdirt.jpg",&terraintexture,1,0); @@ -2283,7 +2267,7 @@ void Game::Loadlevel(char *name){ { if(ambientsound) { - PlayStreamEx(stream_wind, strm[stream_wind], NULL, true); + PlayStreamEx(stream_wind, samp[stream_wind], NULL, true); OPENAL_SetPaused(channels[stream_wind], false); OPENAL_SetVolume(channels[stream_wind], 256); } @@ -2295,7 +2279,7 @@ void Game::Loadlevel(char *name){ //PlaySoundEx(desertambient, // samp[desertambient], NULL, true); PlayStreamEx(stream_desertambient, - strm[stream_desertambient], NULL, true); + samp[stream_desertambient], NULL, true); OPENAL_SetPaused(channels[stream_desertambient], false); OPENAL_SetVolume(channels[stream_desertambient], 256); } @@ -2305,7 +2289,7 @@ void Game::Loadlevel(char *name){ if(ambientsound) { //PlaySoundEx(wind, samp[wind], NULL, true); - PlayStreamEx(stream_wind, strm[stream_wind], NULL, true); + PlayStreamEx(stream_wind, samp[stream_wind], NULL, true); OPENAL_SetPaused(channels[stream_wind], false); OPENAL_SetVolume(channels[stream_wind], 100); } @@ -2403,7 +2387,7 @@ void Game::Tick() if(mainmenu&&musictoggle){ if(mainmenu==1||mainmenu==2||mainmenu==100){ OPENAL_SetFrequency(OPENAL_ALL, 0.001); - PlayStreamEx( stream_music3, strm[stream_music3], NULL, true); + PlayStreamEx( stream_music3, samp[stream_music3], NULL, true); OPENAL_SetPaused(channels[stream_music3], false); OPENAL_SetVolume(channels[stream_music3], 256); OPENAL_SetPaused(channels[music1], true); @@ -2610,7 +2594,7 @@ void Game::Tick() } if(musictoggle){ - PlayStreamEx( stream_music3, strm[stream_music3], NULL, true); + PlayStreamEx( stream_music3, samp[stream_music3], NULL, true); OPENAL_SetPaused(channels[stream_music3], false); OPENAL_SetVolume(channels[stream_music3], 256); } @@ -2780,7 +2764,7 @@ void Game::Tick() mainmenu=9; } } - if(mainmenu==9){ + else if(mainmenu==9){ if(Input::Button()&&!oldbutton&&selected=0&&selected<=accountactive->getProgress()){ fireSound(); @@ -7679,7 +7663,7 @@ void Game::Tick() OPENAL_StopSound(OPENAL_ALL); // hack...OpenAL renderer isn't stopping music after tutorial goes to level menu... OPENAL_SetFrequency(OPENAL_ALL, 0.001); - PlayStreamEx( stream_music3, strm[stream_music3], NULL, true); + PlayStreamEx( stream_music3, samp[stream_music3], NULL, true); OPENAL_SetPaused(channels[stream_music3], false); OPENAL_SetVolume(channels[stream_music3], 256); @@ -7893,15 +7877,15 @@ void Game::TickOnceAfter(){ if(musictoggle){ if(musicvolume[0]>0&&oldmusicvolume[0]<=0){ - PlayStreamEx( music1, strm[music1], NULL, true); + PlayStreamEx( music1, samp[music1], NULL, true); OPENAL_SetPaused(channels[music1], false); } if(musicvolume[1]>0&&oldmusicvolume[1]<=0){ - PlayStreamEx( stream_music2, strm[stream_music2], NULL, true); + PlayStreamEx( stream_music2, samp[stream_music2], NULL, true); OPENAL_SetPaused(channels[stream_music2], false); } if(musicvolume[2]>0&&oldmusicvolume[2]<=0){ - PlayStreamEx( stream_music3, strm[stream_music3], NULL, true); + PlayStreamEx( stream_music3, samp[stream_music3], NULL, true); OPENAL_SetPaused(channels[stream_music3], false); } if(musicvolume[0]<=0&&oldmusicvolume[0]>0){