aboutsummaryrefslogtreecommitdiff
path: root/src/GameTick.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/GameTick.cpp')
-rw-r--r--src/GameTick.cpp70
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.