1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fix battle start with disabled opening sounds

This commit is contained in:
Ivan Savenko 2022-12-28 16:51:44 +02:00
parent fa355c3356
commit da7766e90b
2 changed files with 17 additions and 6 deletions

View File

@ -104,12 +104,7 @@ BattleInterface::BattleInterface(const CCreatureSet *army1, const CCreatureSet *
if(LOCPLINT->battleInt)
{
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
CCS->musich->playMusicFromSet("battle", true, true);
setAnimationCondition(EAnimationEvents::OPENING, false);
if(tacticsMode)
tacticNextStack(nullptr);
activateStack();
battleIntroSoundChannel = -1;
onIntroSoundPlayed();
}
};
@ -120,6 +115,16 @@ BattleInterface::BattleInterface(const CCreatureSet *army1, const CCreatureSet *
windowObject->updateQueue();
}
void BattleInterface::onIntroSoundPlayed()
{
setAnimationCondition(EAnimationEvents::OPENING, false);
CCS->musich->playMusicFromSet("battle", true, true);
if(tacticsMode)
tacticNextStack(nullptr);
activateStack();
battleIntroSoundChannel = -1;
}
BattleInterface::~BattleInterface()
{
CPlayerInterface::battleInt = nullptr;
@ -223,6 +228,11 @@ void BattleInterface::stackAttacking( const StackAttackInfo & attackInfo )
void BattleInterface::newRoundFirst( int round )
{
if (battleIntroSoundChannel == -1 &&
getAnimationCondition(EAnimationEvents::OPENING) == true)
{
onIntroSoundPlayed();
}
waitForAnimationCondition(EAnimationEvents::OPENING, false);
}

View File

@ -113,6 +113,7 @@ class BattleInterface
/// defender interface, not null if attacker is human in our vcmiclient
std::shared_ptr<CPlayerInterface> defenderInt;
void onIntroSoundPlayed();
public:
/// copy of initial armies (for result window)
const CCreatureSet *army1;