diff options
| author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2022-01-30 22:43:52 +0700 |
|---|---|---|
| committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2022-01-30 22:43:52 +0700 |
| commit | ee01080a5b0cc81208c50a8c91f8c44615e44b25 (patch) | |
| tree | e456c1378a9b4f5a63dc7f9f3b14ce4d163720d9 /src/GameTick.cpp | |
| parent | 4b0a4cab242d1af142179c92d0b1139f9f5bf314 (diff) | |
| download | blackshades-ee01080a5b0cc81208c50a8c91f8c44615e44b25.tar.gz | |
Move nextLevel to own function
Diffstat (limited to 'src/GameTick.cpp')
| -rw-r--r-- | src/GameTick.cpp | 70 |
1 files changed, 32 insertions, 38 deletions
diff --git a/src/GameTick.cpp b/src/GameTick.cpp index cd206ae..fb98859 100644 --- a/src/GameTick.cpp +++ b/src/GameTick.cpp @@ -435,6 +435,36 @@ XYZ aimBot(Game* game, int j) 0, bot.playerrotation, 0); } +void nextLevel(Game* game) +{ + game->score += ++game->mission * 50 + 100; + game->highscore = std::max(game->score, game->highscore); + + game->flashamount = game->flashg = 1; + game->flashr = game->flashb = 0; + alSourcePlay(gSourceID[souloutsound]); + + if (game->mission >= game->nummissions) { + alSourcePause(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]); + + setMenu(game, game->beatgame = true); + game->gameinprogress = 0; + } else { + updateSong(game); + initGame(game); + } +} + void Game::Tick() { if (person[1].health <= 0 || person[0].health <= 0 || killedinnocent) @@ -442,34 +472,8 @@ void Game::Tick() else timeremaining -= multiplier; - if (timeremaining <= 0) { - score += ++mission * 50 + 100; - highscore = std::max(score, highscore); - - flashamount = flashg = 1; - flashr = flashb = 0; - alSourcePlay(gSourceID[souloutsound]); - - if (mission >= nummissions) { - alSourcePause(gSourceID[rainsound]); - alSourceStop(gSourceID[visionsound]); - alSourceStop(gSourceID[whichsong]); - alSourcef(gSourceID[whichsong], AL_MIN_GAIN, 0); - alSourcef(gSourceID[whichsong], AL_MAX_GAIN, 0); - - whichsong = mainmenusong; - alSourcef(gSourceID[whichsong], AL_PITCH, 1); - alSourcef(gSourceID[whichsong], AL_MIN_GAIN, 1); - alSourcef(gSourceID[whichsong], AL_MAX_GAIN, 1); - alSourcePlay(gSourceID[whichsong]); - - setMenu(this, beatgame = true); - gameinprogress = 0; - } else { - updateSong(this); - initGame(this); - } - } + if (timeremaining <= 0) + nextLevel(this); if (losedelay <= 0) { score -= (person[murderer].health > 0) ? 200 : 100; @@ -497,27 +501,17 @@ void Game::Tick() //Check collision with buildings int beginx,endx; int beginz,endz; - XYZ collpoint; - XYZ move; - int whichtri; - XYZ underpoint; - XYZ overpoint; - int pointnum; - float depth; - XYZ normalrotated; - bool inblock; //Check people collisions - for(int k=0;k<numpeople;k++){ // SBF - backing up the old coordinates makes // the most sense here. |
