1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Do not play the win sound while the win video is playing

The win sound must be played only with the win screens.
This commit is contained in:
Mathieu Schroeter 2019-09-06 23:34:55 +02:00
parent 85d90c2872
commit 5a54a14c13
2 changed files with 27 additions and 17 deletions

View File

@ -77,10 +77,11 @@ bool g_restoreMidi = false; // restore music playback based on midi files
bool g_renderQuality = true; // use the best render quality with scaling
int g_settingsOverload = 0;
bool g_bTermInit = false; // initialisation en cours
Uint32 g_lastPhase = 999;
RestartMode g_restart = RestartMode::NO;
static bool g_pause;
bool g_bTermInit = false; // initialisation en cours
Uint32 g_lastPhase = 999;
RestartMode g_restart = RestartMode::NO;
static bool g_pause;
static Uint32 g_prevPhase = 0;
#ifdef USE_CURL
struct url_data {
@ -292,6 +293,27 @@ Update (void)
g_pEvent->ChangePhase (EV_PHASE_WINMOVIE); // win
}
if (g_prevPhase != phase)
{
Point pos;
pos.x = LXIMAGE () / 2;
pos.y = LYIMAGE () / 2;
if (phase == EV_PHASE_LOST)
{
if (!g_pSound->PlayImage (SOUND_LOST, pos))
g_pSound->PlayImage (SOUND_GOAL, pos);
}
else if (phase == EV_PHASE_WIN || phase == EV_PHASE_LASTWIN)
{
if (!g_pSound->PlayImage (SOUND_WIN, pos))
g_pSound->PlayImage (SOUND_GOAL, pos);
}
}
g_prevPhase = phase;
return display;
}

View File

@ -4713,20 +4713,8 @@ CDecor::IsTerminated ()
delay:
m_winCount = count;
if (m_winCount == 0)
{
if (out == 1) // perdu ?
{
if (!m_pSound->PlayImage (SOUND_LOST, pos))
m_pSound->PlayImage (SOUND_GOAL, pos);
}
else
{
if (!m_pSound->PlayImage (SOUND_WIN, pos))
m_pSound->PlayImage (SOUND_GOAL, pos);
}
return out; // perdu/gagné
}
m_winCount--;
return 0; // continue
}