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 7f9761e069
commit b25259df51
3 changed files with 18 additions and 9 deletions

View File

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

View File

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

View File

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