commit 18055aa0
Fixed music then near death
git-svn-id: https://blockattack.svn.sourceforge.net/svnroot/blockattack/trunk@155 9d7177f8-192b-0410-8f35-a16a89829b06
Changed files
| M | source/code/BlockGame.cpp before |
| M | source/code/BlockGame.hpp before |
| M | source/code/main.cpp before |
| M | source/code/mainVars.hpp before |
diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp
index b654c7f..d6ed099 100644
--- a/source/code/BlockGame.cpp
+++ b/source/code/BlockGame.cpp
@@ -1963,11 +1963,6 @@ void BlockGame::Update()
stop+=1000;
}
- if ((TowerHeight>12)&&(!puzzleMode)&&(!bGameOver))
- {
- bNearDeath = true;
- }
-
while (nowTime>nrStops*40+gameStartedAt) //Increase stops, till we reach nowTime
{
if (stop>0)
@@ -2081,6 +2076,13 @@ void BlockGame::Update()
}
}
+bool BlockGame::IsNearDeath() {
+ if ((TowerHeight>12)&&(!puzzleMode)&&(!bGameOver))
+ return true;
+ else
+ return false;
+}
+
void BlockGame::UpdateInternal(int newtick)
{
while(newtick >= ticks+50)
diff --git a/source/code/BlockGame.hpp b/source/code/BlockGame.hpp
index 1a92851..f5aa929 100644
--- a/source/code/BlockGame.hpp
+++ b/source/code/BlockGame.hpp
@@ -199,6 +199,7 @@ public:
//prints "Game Over" and ends game
void SetGameOver();
bool GetAIenabled();
+ bool IsNearDeath();
//Moves the cursor, receaves N,S,E or W as a char an moves as desired
void MoveCursor(char way);
//switches the two blocks at the cursor position, unless game over
diff --git a/source/code/main.cpp b/source/code/main.cpp
index 98fb977..c820a26 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -3613,6 +3613,7 @@ int runGame(int gametype, int level)
drawBalls = true;
puzzleLoaded = false;
bool weWhereConnected = false;
+ bool bNearDeath; //Play music faster or louder while tru
//Things used for repeating keystrokes:
bool repeatingS[2] = {false,false};
@@ -4384,7 +4385,7 @@ int runGame(int gametype, int level)
//set bNearDeath to false theGame*.Update() will change to true as needed
- bNearDeath = false;
+ bNearDeath = theGame.IsNearDeath() || theGame2.IsNearDeath();
//Updates the objects
theGame.Update(SDL_GetTicks());
theGame2.Update(SDL_GetTicks());
diff --git a/source/code/mainVars.hpp b/source/code/mainVars.hpp
index 1b61538..8b77ff7 100644
--- a/source/code/mainVars.hpp
+++ b/source/code/mainVars.hpp
@@ -190,7 +190,6 @@ static bool NoSound; //if true, absolutely no sound will be played, can be se
//prevents crash on systems without a soundcard
bool MusicEnabled; //true if background music is enabled
bool SoundEnabled; //true if sound effects is enabled
-static bool bNearDeath; //Play music faster or louder while tru
static bool bNearDeathPrev; //Near death status last time checked.
bool bFullscreen; //true if game is running fullscreen
static bool puzzleLoaded; //true if the puzzle levels have been loaded