fixed fading complete screen if playfield viewport has changed
authorHolger Schemel <info@artsoft.org>
Fri, 3 Nov 2017 13:39:54 +0000 (14:39 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:15 +0000 (23:21 +0100)
src/editor.c
src/game.c
src/screens.c
src/tools.c
src/tools.h

index fb40606a0239b4ffb4973c3956a9fc7fe594d80a..5f9b2b9d9e0f95807b7e5b9142c67bd6104e2842 100644 (file)
@@ -8264,7 +8264,7 @@ void DrawLevelEd()
 
   FadeSoundsAndMusic();
 
-  if (CheckIfGlobalBorderHasChanged())
+  if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged())
     fade_mask = REDRAW_ALL;
 
   FadeOut(fade_mask);
index 76f348990e8c5a593fc480199b4bb6332cde29af..1de51be5b909b1e0cc2b0f735fa0e7f989fc7771 100644 (file)
@@ -3298,7 +3298,7 @@ void InitGame()
   else
     FadeSetEnterScreen();
 
-  if (CheckIfGlobalBorderHasChanged())
+  if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged())
     fade_mask = REDRAW_ALL;
 
   FadeLevelSoundsAndMusic();
index 7513842e43eb8781fb8c469c05833be96cc0c7ec..9c02fc9e3a7f697a1792f00656d9e77d3de7b393 100644 (file)
@@ -1486,7 +1486,7 @@ void DrawMainMenu()
   if (redraw_mask & REDRAW_ALL)
     fade_mask = REDRAW_ALL;
 
-  if (CheckIfGlobalBorderHasChanged())
+  if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged())
     fade_mask = REDRAW_ALL;
 
   FadeOut(fade_mask);
@@ -2186,7 +2186,7 @@ static void DrawInfoScreen_Main()
   if (redraw_mask & REDRAW_ALL)
     fade_mask = REDRAW_ALL;
 
-  if (CheckIfGlobalBorderHasChanged())
+  if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged())
     fade_mask = REDRAW_ALL;
 
   UnmapAllGadgets();
@@ -3838,7 +3838,7 @@ static void DrawChooseTree(TreeInfo **ti_ptr)
 {
   int fade_mask = REDRAW_FIELD;
 
-  if (CheckIfGlobalBorderHasChanged())
+  if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged())
     fade_mask = REDRAW_ALL;
 
   if (strEqual((*ti_ptr)->subdir, STRING_TOP_DIRECTORY))
@@ -4357,7 +4357,7 @@ void DrawHallOfFame(int highlight_position)
 {
   int fade_mask = REDRAW_FIELD;
 
-  if (CheckIfGlobalBorderHasChanged())
+  if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged())
     fade_mask = REDRAW_ALL;
 
   UnmapAllGadgets();
@@ -6010,7 +6010,7 @@ static void DrawSetupScreen_Generic()
   char *title_string = NULL;
   int i;
 
-  if (CheckIfGlobalBorderHasChanged())
+  if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged())
     fade_mask = REDRAW_ALL;
 
   UnmapAllGadgets();
index b87d7201018950e61db340d14f24b0838e83a7fb..2838908d99e93954787d83d96547b9df58cb95e2 100644 (file)
@@ -8973,6 +8973,31 @@ void ResetFontStatus()
   SetFontStatus(-1);
 }
 
+boolean CheckIfPlayfieldViewportHasChanged()
+{
+  // if game status has not changed, playfield viewport has not changed either
+  if (game_status == game_status_last)
+    return FALSE;
+
+  // check if playfield viewport has changed with current game status
+  struct RectWithBorder *vp_playfield = &viewport.playfield[game_status];
+  int new_real_sx      = vp_playfield->x;
+  int new_real_sy      = vp_playfield->y;
+  int new_full_sxsize  = vp_playfield->width;
+  int new_full_sysize  = vp_playfield->height;
+
+  return (new_real_sx != REAL_SX ||
+         new_real_sy != REAL_SY ||
+         new_full_sxsize != FULL_SXSIZE ||
+         new_full_sysize != FULL_SYSIZE);
+}
+
+boolean CheckIfGlobalBorderOrPlayfieldViewportHasChanged()
+{
+  return (CheckIfGlobalBorderHasChanged() ||
+         CheckIfPlayfieldViewportHasChanged());
+}
+
 void ChangeViewportPropertiesIfNeeded()
 {
   boolean use_mini_tilesize = (level.game_engine_type == GAME_ENGINE_TYPE_MM ?
index 794cc085adb300a8b8878cac7de7af26dcc7d0d2..2efb705d828d136bf6ed1a3e8d1d09d68a54b8f8 100644 (file)
@@ -276,4 +276,7 @@ void ResetFontStatus();
 void ToggleFullscreenOrChangeWindowScalingIfNeeded();
 void ChangeViewportPropertiesIfNeeded();
 
+boolean CheckIfPlayfieldViewportHasChanged();
+boolean CheckIfGlobalBorderOrPlayfieldViewportHasChanged();
+
 #endif /* TOOLS_H */