code cleanup
[rocksndiamonds.git] / src / screens.c
index 3245e4474e97a78c89ab312416431b95784a566c..3c5f6b9a1572b77b32abd3e73303068617ea1779 100644 (file)
@@ -3621,10 +3621,9 @@ void HandleInfoScreen_Credits(int button)
   {
     screen_nr = 0;
 
-    // DrawInfoScreen_CreditsScreen(screen_nr);
+    DrawInfoScreen_CreditsScreen(screen_nr);
   }
-
-  if (button == MB_MENU_LEAVE)
+  else if (button == MB_MENU_LEAVE)
   {
     PlaySound(SND_MENU_ITEM_SELECTING);
 
@@ -3633,14 +3632,11 @@ void HandleInfoScreen_Credits(int button)
 
     return;
   }
-  else if (button == MB_MENU_CHOICE || button == MB_MENU_INITIALIZE)
+  else if (button == MB_MENU_CHOICE)
   {
-    if (button != MB_MENU_INITIALIZE)
-    {
-      PlaySound(SND_MENU_ITEM_SELECTING);
+    PlaySound(SND_MENU_ITEM_SELECTING);
 
-      screen_nr++;
-    }
+    screen_nr++;
 
     if (screen_nr >= num_screens)
     {
@@ -3655,13 +3651,11 @@ void HandleInfoScreen_Credits(int button)
     if (screen_nr > 0)
       FadeSetNextScreen();
 
-    if (button != MB_MENU_INITIALIZE)
-      FadeOut(REDRAW_FIELD);
+    FadeOut(REDRAW_FIELD);
 
     DrawInfoScreen_CreditsScreen(screen_nr);
 
-    if (button != MB_MENU_INITIALIZE)
-      FadeIn(REDRAW_FIELD);
+    FadeIn(REDRAW_FIELD);
   }
   else
   {
@@ -4833,6 +4827,8 @@ static int getAlignYOffsetFromTreeInfo(TreeInfo *ti)
 static void DrawChooseTree(TreeInfo **ti_ptr)
 {
   int fade_mask = REDRAW_FIELD;
+  boolean restart_music = (game_status != game_status_last_screen &&
+                          game_status_last_screen != GAME_MODE_SCOREINFO);
 
   if (CheckFadeAll())
     fade_mask = REDRAW_ALL;
@@ -4858,7 +4854,7 @@ static void DrawChooseTree(TreeInfo **ti_ptr)
   FreeScreenGadgets();
   CreateScreenGadgets();
 
-  if (game_status != game_status_last_screen)
+  if (restart_music)
     FadeMenuSoundsAndMusic();
 
   FadeOut(fade_mask);
@@ -4889,7 +4885,7 @@ static void DrawChooseTree(TreeInfo **ti_ptr)
 
   DrawMaskedBorder(fade_mask);
 
-  if (game_status != game_status_last_screen)
+  if (restart_music)
     PlayMenuSoundsAndMusic();
 
   FadeIn(fade_mask);
@@ -4941,7 +4937,7 @@ static void drawChooseTreeText(TreeInfo *ti, int y, boolean active)
     int border = amSX - SX + getFontDrawOffsetX(font_nr1);
     int dx1 = 0;
     int dx3 = text_size_1;
-    int dx4 = screen_width - startdx - 2 * border - text_size_4;
+    int dx4 = SXSIZE - 2 * startdx - 2 * border - text_size_4;
     int num_dots = (dx4 - dx3) / font_size_3;
     int startx1 = startx + dx1;
     int startx3 = startx + dx3;
@@ -5713,7 +5709,9 @@ void HandleChooseLevelNr(int mx, int my, int dx, int dy, int button)
 
 static void DrawHallOfFame_setScoreEntries(void)
 {
-  int num_visible_score_entries = NUM_MENU_ENTRIES_ON_SCREEN - 1;
+  int max_empty_entries = 10;  // at least show "top ten" list, if empty
+  int max_visible_entries = NUM_MENU_ENTRIES_ON_SCREEN - 1;   // w/o back link
+  int min_score_entries = MIN(max_empty_entries, max_visible_entries);
   int score_pos = (scores.last_added >= 0 ? scores.last_added : 0);
   int i;
 
@@ -5729,7 +5727,7 @@ static void DrawHallOfFame_setScoreEntries(void)
     // do not add empty score entries if off-screen
     if (scores.entry[i].score == 0 &&
        scores.entry[i].time == 0 &&
-       i >= num_visible_score_entries)
+       i >= min_score_entries)
       break;
 
     TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_SCORE_ENTRY);