[planetblupi] 17/61: Prevent black screen (glitch) when a movie is not found

Didier Raboud odyx at moszumanska.debian.org
Thu Nov 2 19:24:52 UTC 2017


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository planetblupi.

commit 04f127af19c6f3eeaf5ea9f370b3d1055f093917
Author: Mathieu Schroeter <mathieu at schroetersa.ch>
Date:   Sat Oct 21 16:43:19 2017 +0200

    Prevent black screen (glitch) when a movie is not found
---
 src/blupi.cxx | 13 +++++++++----
 src/event.cxx | 10 +++++++---
 src/event.h   |  2 +-
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/blupi.cxx b/src/blupi.cxx
index 3f8c4c8..b0d405f 100644
--- a/src/blupi.cxx
+++ b/src/blupi.cxx
@@ -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 ?
       {
+        bool display = true;
+
         if (!g_pause)
-          UpdateFrame ();
+          display = UpdateFrame ();
 
-        if (!g_pEvent->IsMovie ())
+        if (!g_pEvent->IsMovie () && display)
           g_pPixmap->Display ();
       }
       break;
diff --git a/src/event.cxx b/src/event.cxx
index 3754626..6f3ea8f 100644
--- a/src/event.cxx
+++ b/src/event.cxx
@@ -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))
diff --git a/src/event.h b/src/event.h
index 90069b1..4fb8a93 100644
--- a/src/event.h
+++ b/src/event.h
@@ -99,7 +99,7 @@ public:
   Sint32 GetImageWorld ();
   bool   IsHelpHide ();
   bool   ChangePhase (Uint32 phase);
-  void   MovieToStart ();
+  bool   MovieToStart ();
   Uint32 GetPhase ();
   void   TryInsert ();
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/planetblupi.git



More information about the Pkg-games-commits mailing list