removed unused variable
[rocksndiamonds.git] / src / screens.c
index 469239d18b48fc4b779cc9f0f9823d94718ed1e4..e453e4a732e05c4f154e8962cf6603f5051d6173 100644 (file)
@@ -1309,9 +1309,6 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading)
   KeyboardAutoRepeatOn();
   ActivateJoystick();
 
-  SetDrawDeactivationMask(REDRAW_NONE);
-  SetDrawBackgroundMask(REDRAW_FIELD);
-
   audio.sound_deactivated = FALSE;
 
   GetPlayerConfig();
@@ -1373,6 +1370,10 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading)
   LoadLevel(level_nr);
   LoadScore(level_nr);
 
+  // set this after "ChangeViewportPropertiesIfNeeded()" (which may reset it)
+  SetDrawDeactivationMask(REDRAW_NONE);
+  SetDrawBackgroundMask(REDRAW_FIELD);
+
   SetMainBackgroundImage(IMG_BACKGROUND_MAIN);
 
   if (fade_mask == REDRAW_ALL)
@@ -2089,7 +2090,7 @@ void DrawInfoScreen_NotAvailable(char *text_title, char *text_error)
   int ystart2 = mSY - SY + 150;
   int ybottom = mSY - SY + SYSIZE - 20;
 
-  SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET);
+  SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO);
 
   FadeOut(REDRAW_FIELD);
 
@@ -3016,6 +3017,41 @@ void DrawInfoScreen_LevelSet()
 {
   struct TitleMessageInfo *tmi = &readme;
   char *filename = getLevelSetInfoFilename();
+  char *title = "Level Set Information:";
+  int ystart1 = mSY - SY + 100;
+  int ybottom = mSY - SY + SYSIZE - 20;
+
+  if (filename == NULL)
+  {
+    DrawInfoScreen_NotAvailable(title, "No information for this level set.");
+
+    return;
+  }
+
+  SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET);
+
+  FadeOut(REDRAW_FIELD);
+
+  ClearField();
+  DrawHeadline();
+
+  DrawTextSCentered(ystart1, FONT_TEXT_1, title);
+
+  /* if x position set to "-1", automatically determine by playfield width */
+  if (tmi->x == -1)
+    tmi->x = SXSIZE / 2;
+
+  /* if y position set to "-1", use static default value */
+  if (tmi->y == -1)
+    tmi->y = 150;
+
+  /* if width set to "-1", automatically determine by playfield width */
+  if (tmi->width == -1)
+    tmi->width = SXSIZE - 2 * TILEX;
+
+  /* if height set to "-1", automatically determine by playfield height */
+  if (tmi->height == -1)
+    tmi->height = SYSIZE - 20 - tmi->y - 10;
 
   /* if chars set to "-1", automatically determine by text and font width */
   if (tmi->chars == -1)
@@ -3029,25 +3065,12 @@ void DrawInfoScreen_LevelSet()
   else
     tmi->height = tmi->lines * getFontHeight(tmi->font);
 
-  SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET);
-
-  FadeOut(REDRAW_FIELD);
-
-  ClearField();
-  DrawHeadline();
-
-  DrawTextCentered(mSY + 100, FONT_TEXT_1, "Level Set Information:");
-
-  if (filename != NULL)
-    DrawTextFile(mSX + ALIGNED_TEXT_XPOS(tmi), mSY + ALIGNED_TEXT_YPOS(tmi),
-                filename, tmi->font, tmi->chars, -1, tmi->lines, 0, -1,
-                tmi->autowrap, tmi->centered, tmi->parse_comments);
-  else
-    DrawTextCentered(mSY + ALIGNED_TEXT_YPOS(tmi), FONT_TEXT_2,
-                    "No information for this level set.");
+  DrawTextFile(mSX + ALIGNED_TEXT_XPOS(tmi), mSY + ALIGNED_TEXT_YPOS(tmi),
+              filename, tmi->font, tmi->chars, -1, tmi->lines, 0, -1,
+              tmi->autowrap, tmi->centered, tmi->parse_comments);
 
-  DrawTextCentered(mSY + SYSIZE - 20, FONT_TEXT_4,
-                  "Press any key or button for info menu");
+  DrawTextSCentered(ybottom, FONT_TEXT_4,
+                   "Press any key or button for info menu");
 
   FadeIn(REDRAW_FIELD);
 }
@@ -3228,6 +3251,8 @@ void HandleTypeName(int newxpos, Key key)
 
 static void DrawChooseTree(TreeInfo **ti_ptr)
 {
+  int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD);
+
   UnmapAllGadgets();
 
   FreeScreenGadgets();
@@ -3235,14 +3260,14 @@ static void DrawChooseTree(TreeInfo **ti_ptr)
 
   CloseDoor(DOOR_CLOSE_2);
 
-  FadeOut(REDRAW_FIELD);
+  FadeOut(fade_mask);
 
   ClearField();
 
   HandleChooseTree(0, 0, 0, 0, MB_MENU_INITIALIZE, ti_ptr);
   MapScreenTreeGadgets(*ti_ptr);
 
-  FadeIn(REDRAW_FIELD);
+  FadeIn(fade_mask);
 
   InitAnimation();
 }
@@ -3744,6 +3769,8 @@ void HandleChooseLevelNr(int mx, int my, int dx, int dy, int button)
 
 void DrawHallOfFame(int highlight_position)
 {
+  int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD);
+
   UnmapAllGadgets();
   FadeSoundsAndMusic();
 
@@ -3762,7 +3789,7 @@ void DrawHallOfFame(int highlight_position)
 
   FadeSetEnterScreen();
 
-  FadeOut(REDRAW_FIELD);
+  FadeOut(fade_mask);
 
   InitAnimation();
 
@@ -3771,7 +3798,7 @@ void DrawHallOfFame(int highlight_position)
 
   HandleHallOfFame(highlight_position, 0, 0, 0, MB_MENU_INITIALIZE);
 
-  FadeIn(REDRAW_FIELD);
+  FadeIn(fade_mask);
 }
 
 static void drawHallOfFameList(int first_entry, int highlight_position)
@@ -5289,6 +5316,7 @@ static void drawSetupInfoList(struct TokenInfo *setup_info,
 
 static void DrawSetupScreen_Generic()
 {
+  int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD);
   boolean redraw_all = FALSE;
   char *title_string = NULL;
   int i;
@@ -5303,7 +5331,7 @@ static void DrawSetupScreen_Generic()
   if (redraw_mask & REDRAW_ALL)
     redraw_all = TRUE;
 
-  FadeOut(REDRAW_FIELD);
+  FadeOut(fade_mask);
 
   ClearField();
 
@@ -5390,9 +5418,9 @@ static void DrawSetupScreen_Generic()
   MapScreenGadgets(max_setup_info);
 
   if (redraw_all)
-    redraw_mask = REDRAW_ALL;
+    redraw_mask = fade_mask = REDRAW_ALL;
 
-  FadeIn(redraw_mask);
+  FadeIn(fade_mask);
 
   InitAnimation();
 }