1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

Restored ambient sounds functionality

This commit is contained in:
Ivan Savenko
2023-03-01 17:20:05 +02:00
parent cdcd5a29dd
commit b57a07b10f
18 changed files with 361 additions and 133 deletions

View File

@ -95,7 +95,7 @@ BattleInterface::BattleInterface(const CCreatureSet *army1, const CCreatureSet *
effectsController.reset(new BattleEffectsController(*this));
obstacleController.reset(new BattleObstacleController(*this));
CCS->musich->stopMusic();
adventureInt->onAudioPaused();
setAnimationCondition(EAnimationEvents::OPENING, true);
GH.pushInt(windowObject);
@ -144,12 +144,8 @@ BattleInterface::~BattleInterface()
CPlayerInterface::battleInt = nullptr;
givenCommand.cond.notify_all(); //that two lines should make any stacksController->getActiveStack() waiting thread to finish
if (adventureInt && adventureInt->curArmy())
{
//FIXME: this should be moved to adventureInt which should restore correct track based on selection/active player
const auto * terrain = LOCPLINT->cb->getTile(adventureInt->curArmy()->visitablePos())->terType;
CCS->musich->playMusicFromSet("terrain", terrain->getJsonKey(), true, false);
}
if (adventureInt)
adventureInt->onAudioResumed();
// may happen if user decided to close game while in battle
if (getAnimationCondition(EAnimationEvents::ACTION) == true)