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()
|
void BattleInterface::playIntroSoundAndUnlockInterface()
|
||||||
{
|
{
|
||||||
if(settings["gameTweaks"]["skipBattleIntroMusic"].Bool())
|
|
||||||
{
|
|
||||||
onIntroSoundPlayed();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto onIntroPlayed = [this]()
|
auto onIntroPlayed = [this]()
|
||||||
{
|
{
|
||||||
if(LOCPLINT->battleInt)
|
if(LOCPLINT->battleInt)
|
||||||
@@ -120,19 +114,22 @@ void BattleInterface::playIntroSoundAndUnlockInterface()
|
|||||||
|
|
||||||
battleIntroSoundChannel = CCS->soundh->playSoundFromSet(CCS->soundh->battleIntroSounds);
|
battleIntroSoundChannel = CCS->soundh->playSoundFromSet(CCS->soundh->battleIntroSounds);
|
||||||
if (battleIntroSoundChannel != -1)
|
if (battleIntroSoundChannel != -1)
|
||||||
|
{
|
||||||
CCS->soundh->setCallback(battleIntroSoundChannel, onIntroPlayed);
|
CCS->soundh->setCallback(battleIntroSoundChannel, onIntroPlayed);
|
||||||
|
|
||||||
|
if (settings["gameTweaks"]["skipBattleIntroMusic"].Bool())
|
||||||
|
openingEnd();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
onIntroSoundPlayed();
|
onIntroSoundPlayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleInterface::onIntroSoundPlayed()
|
void BattleInterface::onIntroSoundPlayed()
|
||||||
{
|
{
|
||||||
onAnimationsFinished();
|
if (openingPlaying())
|
||||||
|
openingEnd();
|
||||||
|
|
||||||
CCS->musich->playMusicFromSet("battle", true, true);
|
CCS->musich->playMusicFromSet("battle", true, true);
|
||||||
if(tacticsMode)
|
|
||||||
tacticNextStack(nullptr);
|
|
||||||
activateStack();
|
|
||||||
battleIntroSoundChannel = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleInterface::~BattleInterface()
|
BattleInterface::~BattleInterface()
|
||||||
@@ -532,13 +529,17 @@ bool BattleInterface::openingPlaying()
|
|||||||
return battleIntroSoundChannel != -1;
|
return battleIntroSoundChannel != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleInterface::openingAbort()
|
void BattleInterface::openingEnd()
|
||||||
{
|
{
|
||||||
|
assert(openingPlaying());
|
||||||
if (!openingPlaying())
|
if (!openingPlaying())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// stop playing sound, causing SDL to call sound finished callback
|
onAnimationsFinished();
|
||||||
CCS->soundh->stopSound(battleIntroSoundChannel);
|
if(tacticsMode)
|
||||||
|
tacticNextStack(nullptr);
|
||||||
|
activateStack();
|
||||||
|
battleIntroSoundChannel = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleInterface::makingTurn() const
|
bool BattleInterface::makingTurn() const
|
||||||
|
@@ -146,7 +146,7 @@ public:
|
|||||||
static CondSh<BattleAction *> givenCommand; //data != nullptr if we have i.e. moved current unit
|
static CondSh<BattleAction *> givenCommand; //data != nullptr if we have i.e. moved current unit
|
||||||
|
|
||||||
bool openingPlaying();
|
bool openingPlaying();
|
||||||
void openingAbort();
|
void openingEnd();
|
||||||
|
|
||||||
bool makingTurn() const;
|
bool makingTurn() const;
|
||||||
|
|
||||||
|
@@ -181,7 +181,7 @@ void BattleWindow::keyPressed(const SDL_Keycode & key)
|
|||||||
{
|
{
|
||||||
if (owner.openingPlaying())
|
if (owner.openingPlaying())
|
||||||
{
|
{
|
||||||
owner.openingAbort();
|
owner.openingEnd();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user