mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Do not abort battle opening sound, only allow actions
This commit is contained in:
@@ -103,12 +103,6 @@ BattleInterface::BattleInterface(const CCreatureSet *army1, const CCreatureSet *
|
||||
|
||||
void BattleInterface::playIntroSoundAndUnlockInterface()
|
||||
{
|
||||
if(settings["gameTweaks"]["skipBattleIntroMusic"].Bool())
|
||||
{
|
||||
onIntroSoundPlayed();
|
||||
return;
|
||||
}
|
||||
|
||||
auto onIntroPlayed = [this]()
|
||||
{
|
||||
if(LOCPLINT->battleInt)
|
||||
@@ -120,19 +114,22 @@ void BattleInterface::playIntroSoundAndUnlockInterface()
|
||||
|
||||
battleIntroSoundChannel = CCS->soundh->playSoundFromSet(CCS->soundh->battleIntroSounds);
|
||||
if (battleIntroSoundChannel != -1)
|
||||
{
|
||||
CCS->soundh->setCallback(battleIntroSoundChannel, onIntroPlayed);
|
||||
|
||||
if (settings["gameTweaks"]["skipBattleIntroMusic"].Bool())
|
||||
openingEnd();
|
||||
}
|
||||
else
|
||||
onIntroSoundPlayed();
|
||||
}
|
||||
|
||||
void BattleInterface::onIntroSoundPlayed()
|
||||
{
|
||||
onAnimationsFinished();
|
||||
if (openingPlaying())
|
||||
openingEnd();
|
||||
|
||||
CCS->musich->playMusicFromSet("battle", true, true);
|
||||
if(tacticsMode)
|
||||
tacticNextStack(nullptr);
|
||||
activateStack();
|
||||
battleIntroSoundChannel = -1;
|
||||
}
|
||||
|
||||
BattleInterface::~BattleInterface()
|
||||
@@ -532,13 +529,17 @@ bool BattleInterface::openingPlaying()
|
||||
return battleIntroSoundChannel != -1;
|
||||
}
|
||||
|
||||
void BattleInterface::openingAbort()
|
||||
void BattleInterface::openingEnd()
|
||||
{
|
||||
assert(openingPlaying());
|
||||
if (!openingPlaying())
|
||||
return;
|
||||
|
||||
// stop playing sound, causing SDL to call sound finished callback
|
||||
CCS->soundh->stopSound(battleIntroSoundChannel);
|
||||
onAnimationsFinished();
|
||||
if(tacticsMode)
|
||||
tacticNextStack(nullptr);
|
||||
activateStack();
|
||||
battleIntroSoundChannel = -1;
|
||||
}
|
||||
|
||||
bool BattleInterface::makingTurn() const
|
||||
|
@@ -146,7 +146,7 @@ public:
|
||||
static CondSh<BattleAction *> givenCommand; //data != nullptr if we have i.e. moved current unit
|
||||
|
||||
bool openingPlaying();
|
||||
void openingAbort();
|
||||
void openingEnd();
|
||||
|
||||
bool makingTurn() const;
|
||||
|
||||
|
@@ -181,7 +181,7 @@ void BattleWindow::keyPressed(const SDL_Keycode & key)
|
||||
{
|
||||
if (owner.openingPlaying())
|
||||
{
|
||||
owner.openingAbort();
|
||||
owner.openingEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user