Jelajahi Sumber

Fixes #831 - do not process any incoming Packs until opening is over

Ivan Savenko 2 tahun lalu
induk
melakukan
4d5311789e

+ 7 - 7
client/battle/BattleActionsController.cpp

@@ -230,13 +230,13 @@ void BattleActionsController::castThisSpell(SpellID spellID)
 	}
 }
 
-
-void BattleActionsController::handleHex(BattleHex myNumber, int eventType)
-{
-	if (!owner.myTurn || !owner.battleActionsStarted) //we are not permit to do anything
-		return;
-
-	// This function handles mouse move over hexes and l-clicking on them.
+
+void BattleActionsController::handleHex(BattleHex myNumber, int eventType)
+{
+	if (!owner.myTurn) //we are not permit to do anything
+		return;
+
+	// This function handles mouse move over hexes and l-clicking on them.
 	// First we decide what happens if player clicks on this hex and set appropriately
 	// consoleMsg, cursorFrame/Type and prepare lambda realizeAction.
 	//

+ 5 - 9
client/battle/BattleInterface.cpp

@@ -59,7 +59,6 @@ BattleInterface::BattleInterface(const CCreatureSet *army1, const CCreatureSet *
 	, myTurn(false)
 	, moveSoundHander(-1)
 	, bresult(nullptr)
-	, battleActionsStarted(false)
 {
 	OBJ_CONSTRUCTION;
 
@@ -169,13 +168,14 @@ BattleInterface::BattleInterface(const CCreatureSet *army1, const CCreatureSet *
 		tacticNextStack(nullptr);
 
 	CCS->musich->stopMusic();
+	setAnimationCondition(EAnimationEvents::OPENING, true);
 	battleIntroSoundChannel = CCS->soundh->playSoundFromSet(CCS->soundh->battleIntroSounds);
 	auto onIntroPlayed = [&]()
 	{
 		if(LOCPLINT->battleInt)
 		{
 			CCS->musich->playMusicFromSet("battle", true, true);
-			battleActionsStarted = true;
+			setAnimationCondition(EAnimationEvents::OPENING, false);
 			activateStack();
 			battleIntroSoundChannel = -1;
 		}
@@ -290,7 +290,7 @@ void BattleInterface::keyPressed(const SDL_KeyboardEvent & key)
 	}
 	else if(key.keysym.sym == SDLK_ESCAPE)
 	{
-		if(!battleActionsStarted)
+		if(getAnimationCondition(EAnimationEvents::OPENING) == true)
 			CCS->soundh->stopSound(battleIntroSoundChannel);
 		else
 			actionsController->endCastingSpell();
@@ -371,7 +371,7 @@ void BattleInterface::stackAttacking( const StackAttackInfo & attackInfo )
 
 void BattleInterface::newRoundFirst( int round )
 {
-	waitForAnimationCondition(EAnimationEvents::ACTION, false);
+	waitForAnimationCondition(EAnimationEvents::OPENING, false);
 }
 
 void BattleInterface::newRound(int number)
@@ -689,9 +689,6 @@ void BattleInterface::trySetActivePlayer( PlayerColor player )
 
 void BattleInterface::activateStack()
 {
-	if(!battleActionsStarted)
-		return; //"show" function should re-call this function
-
 	stacksController->activateStack();
 
 	const CStack * s = stacksController->getActiveStack();
@@ -905,8 +902,7 @@ void BattleInterface::show(SDL_Surface *to)
 
 	fieldController->renderBattlefield(canvas);
 
-	if(battleActionsStarted)
-		stacksController->updateBattleAnimations();
+	stacksController->updateBattleAnimations();
 
 	SDL_SetClipRect(to, &buf); //restoring previous clip_rect
 

+ 0 - 1
client/battle/BattleInterface.h

@@ -110,7 +110,6 @@ private:
 	ui8 animCount;
 
 	bool tacticsMode;
-	bool battleActionsStarted; //used for delaying battle actions until intro sound stops
 	int battleIntroSoundChannel; //required as variable for disabling it via ESC key
 
 	using AwaitingAnimationAction = std::function<void()>;