diff options
Diffstat (limited to 'src/GameTick.cpp')
| -rw-r--r-- | src/GameTick.cpp | 57 |
1 files changed, 20 insertions, 37 deletions
diff --git a/src/GameTick.cpp b/src/GameTick.cpp index 75bcc9d..a449ae2 100644 --- a/src/GameTick.cpp +++ b/src/GameTick.cpp @@ -90,22 +90,18 @@ void updateSong(Game* game) if (environment == rainy_environment) alSourcePlay(gSourceID[rainsound]); else - alSourcePause(gSourceID[rainsound]); + alSourceStop(gSourceID[rainsound]); + if (!game->musictoggle) + return; alSourceStop(gSourceID[game->whichsong]); - alSourcef(gSourceID[game->whichsong], AL_MIN_GAIN, 0); - alSourcef(gSourceID[game->whichsong], AL_MAX_GAIN, 0); - if (game->type == zombie_type) game->whichsong = zombiesong; else if (game->person[0].whichgun == knife) game->whichsong = knifesong; else game->whichsong = shootsong; - alSourcef(gSourceID[game->whichsong], AL_PITCH, 1); - alSourcef(gSourceID[game->whichsong], AL_MIN_GAIN, 1); - alSourcef(gSourceID[game->whichsong], AL_MAX_GAIN, 1); alSourcePlay(gSourceID[game->whichsong]); } @@ -136,7 +132,6 @@ void click(Game* game, int button, int action, int mods) switch (game->mouseoverbutton) { case 1: - updateSong(game); game->flashr = game->flashg = game->flashb = 1.0f; game->flashamount = 1.0f; alSourcePlay(gSourceID[soulinsound]); @@ -146,6 +141,7 @@ void click(Game* game, int button, int action, int mods) initGame(game); } + updateSong(game); if (visions) alSourcePlay(gSourceID[visionsound]); @@ -443,23 +439,19 @@ void nextLevel(Game* game) alSourcePlay(gSourceID[souloutsound]); if (game->mission >= game->nummissions) { - alSourcePause(gSourceID[rainsound]); + alSourceStop(gSourceID[rainsound]); alSourceStop(gSourceID[visionsound]); - alSourceStop(gSourceID[game->whichsong]); - alSourcef(gSourceID[game->whichsong], AL_MIN_GAIN, 0); - alSourcef(gSourceID[game->whichsong], AL_MAX_GAIN, 0); - - game->whichsong = mainmenusong; - alSourcef(gSourceID[game->whichsong], AL_PITCH, 1); - alSourcef(gSourceID[game->whichsong], AL_MIN_GAIN, 1); - alSourcef(gSourceID[game->whichsong], AL_MAX_GAIN, 1); - alSourcePlay(gSourceID[game->whichsong]); - + if (game->musictoggle) { + alSourceStop(gSourceID[game->whichsong]); + game->whichsong = mainmenusong; + alSourcef(gSourceID[game->whichsong], AL_PITCH, 1); + alSourcePlay(gSourceID[game->whichsong]); + } setMenu(game, game->beatgame = true); game->gameinprogress = 0; } else { - updateSong(game); initGame(game); + updateSong(game); } } @@ -994,8 +986,8 @@ void Game::Tick() flashr = flashg = flashb = 0; alSourcePlay(gSourceID[soulinsound]); - updateSong(this); initGame(this); + updateSong(this); } spawnNpc(this); @@ -2404,24 +2396,15 @@ hit_terrain: person[i].oldhealth=person[i].health; } - if(slomo==2){ - psychicpower-=multiplier*15; - if(psychicpower<0){ - alSourceStop(gSourceID[whichsong]); - alSourcef(gSourceID[whichsong], AL_MIN_GAIN, 0); - alSourcef(gSourceID[whichsong], AL_MAX_GAIN, 0); - if(person[0].whichgun==knife)whichsong=knifesong; - if(person[0].whichgun!=knife)whichsong=shootsong; - if(type==zombie_type)whichsong=zombiesong; + if (slomo == 2) { + psychicpower -= multiplier*15; + if (psychicpower < 0) { alSourcef(gSourceID[whichsong], AL_PITCH, 1); - alSourcePlay(gSourceID[whichsong]); - alSourcef(gSourceID[whichsong], AL_MIN_GAIN, 1); - alSourcef(gSourceID[whichsong], AL_MAX_GAIN, 1); - slomo=0; + slomo = 0; alSourcePlay(gSourceID[soulinsound]); - psychicpower=0; - flashamount=.5; - flashr=1;flashg=1;flashb=1; + psychicpower = 0; + flashamount = 0.5f; + flashr = flashg = flashb = 1.0f; } } |
