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

Prevent black screen (glitch) when a movie is not found

This commit is contained in:
Mathieu Schroeter 2017-10-21 16:43:19 +02:00
parent e39c2eaedd
commit 04f127af19
3 changed files with 18 additions and 9 deletions

View File

@ -180,13 +180,14 @@ ReadConfig ()
/**
* \brief Main frame update.
*/
static void
static bool
UpdateFrame (void)
{
Rect clip, rcRect;
Uint32 phase;
Point posMouse;
Sint32 i, term, speed;
bool display = true;
posMouse = g_pEvent->GetLastMousePos ();
@ -259,7 +260,7 @@ UpdateFrame (void)
phase == EV_PHASE_H2MOVIE || phase == EV_PHASE_PLAYMOVIE ||
phase == EV_PHASE_WINMOVIE)
{
g_pEvent->MovieToStart (); // start a movie if necessary
display = g_pEvent->MovieToStart (); // start a movie if necessary
}
if (phase == EV_PHASE_INSERT)
@ -273,6 +274,8 @@ UpdateFrame (void)
if (term == 2)
g_pEvent->ChangePhase (EV_PHASE_WINMOVIE); // win
}
return display;
}
/**
@ -387,10 +390,12 @@ HandleEvent (const SDL_Event & event)
case EV_UPDATE:
if (!g_pEvent->IsMovie ()) // pas de film en cours ?
{
if (!g_pause)
UpdateFrame ();
bool display = true;
if (!g_pEvent->IsMovie ())
if (!g_pause)
display = UpdateFrame ();
if (!g_pEvent->IsMovie () && display)
g_pPixmap->Display ();
}
break;

View File

@ -3380,15 +3380,16 @@ CEvent::TryInsert ()
// Fait démarrer un film si nécessaire.
void
bool
CEvent::MovieToStart ()
{
bool movie = false;
if (m_movieToStart[0] != 0) // y a-t-il un film à démarrer ?
{
HideMouse (true); // cache la souris
if (StartMovie (m_movieToStart))
{
movie = true;
m_phase = m_phaseAfterMovie; // prochaine phase normale
}
else
@ -3396,6 +3397,8 @@ CEvent::MovieToStart ()
m_movieToStart[0] = 0;
}
return movie;
}
// Décale le décor.
@ -4248,6 +4251,7 @@ CEvent::StartMovie (const std::string & pFilename)
if (!m_pMovie->IsExist (pFilename))
return false;
HideMouse (true);
m_pSound->StopMusic ();
if (!m_pMovie->Play (pFilename))

View File

@ -99,7 +99,7 @@ public:
Sint32 GetImageWorld ();
bool IsHelpHide ();
bool ChangePhase (Uint32 phase);
void MovieToStart ();
bool MovieToStart ();
Uint32 GetPhase ();
void TryInsert ();