fixed changing viewport properties not before fading out last screen (more)
authorHolger Schemel <info@artsoft.org>
Thu, 2 Jun 2016 18:02:57 +0000 (20:02 +0200)
committerHolger Schemel <info@artsoft.org>
Thu, 2 Jun 2016 18:02:57 +0000 (20:02 +0200)
src/editor.c
src/game.c
src/screens.c

index 3338b0f8d2c5735ff722348b386ad8df7c5c3b12..85859907ce83431874cabff2ab6c03f393dcab02 100644 (file)
@@ -7625,14 +7625,14 @@ void DrawLevelEd()
 
   FadeSoundsAndMusic();
 
-  /* needed if different viewport properties defined for editor */
-  ChangeViewportPropertiesIfNeeded();
-
   if (CheckIfGlobalBorderHasChanged())
     fade_mask = REDRAW_ALL;
 
   FadeOut(fade_mask);
 
+  /* needed if different viewport properties defined for editor */
+  ChangeViewportPropertiesIfNeeded();
+
   ClearField();
 
   InitZoomLevelSettings();
index 81ac077ad0e57d8d635b96365a6a8d45223e2f03..9b20bd43fe64a51fb22a8d0bea525b4529a2884c 100644 (file)
@@ -3103,9 +3103,6 @@ void InitGame()
 
   SetGameStatus(GAME_MODE_PLAYING);
 
-  /* needed if different viewport properties defined for playing */
-  ChangeViewportPropertiesIfNeeded();
-
   if (level_editor_test_game)
     FadeSkipNextFadeIn();
   else
@@ -3120,6 +3117,9 @@ void InitGame()
 
   FadeOut(fade_mask);
 
+  /* needed if different viewport properties defined for playing */
+  ChangeViewportPropertiesIfNeeded();
+
   ClearField();
 
   OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
index 1748b1aa9adad2a11c185f7138aeeccd8e553fa6..12fa233140c51fff4c586e54ad711c3026f64661 100644 (file)
@@ -1600,12 +1600,12 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 
     FadeOut(REDRAW_ALL);
 
-    /* only required to update logic for redrawing global border */
-    ClearField();
-
     /* title screens may have different window size */
     ChangeViewportPropertiesIfNeeded();
 
+    /* only required to update logic for redrawing global border */
+    ClearField();
+
     if (tci->is_image)
       DrawTitleScreenImage(tci->local_nr, tci->initial);
     else
@@ -1851,8 +1851,6 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
 
     SetGameStatus(GAME_MODE_LEVELNR);
 
-    ChangeViewportPropertiesIfNeeded();
-
     DrawChooseLevelNr();
   }
   else if (pos >= MAIN_CONTROL_NAME && pos <= MAIN_CONTROL_QUIT)
@@ -1893,8 +1891,6 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
          if (setup.internal.choose_from_top_leveldir)
            gotoTopLevelDir();
 
-         ChangeViewportPropertiesIfNeeded();
-
          DrawChooseLevelSet();
        }
       }
@@ -1928,8 +1924,6 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
 
        info_mode = INFO_MODE_MAIN;
 
-       ChangeViewportPropertiesIfNeeded();
-
        DrawInfoScreen();
       }
       else if (pos == MAIN_CONTROL_GAME)
@@ -1944,8 +1938,6 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
 
        setup_mode = SETUP_MODE_MAIN;
 
-       ChangeViewportPropertiesIfNeeded();
-
        DrawSetupScreen();
       }
       else if (pos == MAIN_CONTROL_QUIT)
@@ -2164,8 +2156,11 @@ static void DrawInfoScreen_Main()
 
   FadeOut(fade_mask);
 
+  /* needed if different viewport properties defined for info screen */
   ChangeViewportPropertiesIfNeeded();
 
+  SetMainBackgroundImage(IMG_BACKGROUND_INFO);
+
   ClearField();
 
   OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
@@ -3501,8 +3496,6 @@ void HandleInfoScreen_LevelSet(int button)
 
 static void DrawInfoScreen()
 {
-  SetMainBackgroundImage(IMG_BACKGROUND_INFO);
-
   if (info_mode == INFO_MODE_TITLE)
     DrawInfoScreen_TitleScreen();
   else if (info_mode == INFO_MODE_ELEMENTS)
@@ -3660,6 +3653,14 @@ static void DrawChooseTree(TreeInfo **ti_ptr)
 
   FadeOut(fade_mask);
 
+  /* needed if different viewport properties defined for choosing level (set) */
+  ChangeViewportPropertiesIfNeeded();
+
+  if (game_status == GAME_MODE_LEVELNR)
+    SetMainBackgroundImage(IMG_BACKGROUND_LEVELNR);
+  else if (game_status == GAME_MODE_LEVELS)
+    SetMainBackgroundImage(IMG_BACKGROUND_LEVELS);
+
   ClearField();
 
   OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
@@ -4054,8 +4055,6 @@ void DrawChooseLevelSet()
 {
   FadeSoundsAndMusic();
 
-  SetMainBackgroundImage(IMG_BACKGROUND_LEVELS);
-
   DrawChooseTree(&leveldir_current);
 
   PlayMenuSound();
@@ -4117,8 +4116,6 @@ void DrawChooseLevelNr()
   if (level_number_current == NULL)
     level_number_current = level_number;
 
-  SetMainBackgroundImage(IMG_BACKGROUND_LEVELNR);
-
   DrawChooseTree(&level_number_current);
 
   PlayMenuSound();
@@ -5772,6 +5769,11 @@ static void DrawSetupScreen_Generic()
 
   FadeOut(fade_mask);
 
+  /* needed if different viewport properties defined for setup screen */
+  ChangeViewportPropertiesIfNeeded();
+
+  SetMainBackgroundImage(IMG_BACKGROUND_SETUP);
+
   ClearField();
 
   OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
@@ -6476,8 +6478,6 @@ void DrawSetupScreen()
 {
   DeactivateJoystick();
 
-  SetMainBackgroundImage(IMG_BACKGROUND_SETUP);
-
   if (setup_mode == SETUP_MODE_INPUT)
     DrawSetupScreen_Input();
   else if (setup_mode == SETUP_MODE_CHOOSE_GAME_SPEED)