rnd-20030809-1-src
[rocksndiamonds.git] / src / screens.c
index d096d3bb5ec12162b1e7d7a4c0fcd5b4d1d3226f..c3b75a318bc81cf494c839d925f33a5f5f1ad09f 100644 (file)
@@ -155,10 +155,10 @@ static void PlaySound_Menu_Continue(int sound)
 
 void DrawHeadline()
 {
-  int font1_width = getFontWidth(FONT_TITLE_1);
-  int font2_width = getFontWidth(FONT_TITLE_2);
-  int x1 = SX + (SXSIZE - strlen(PROGRAM_TITLE_STRING)   * font1_width) / 2;
-  int x2 = SX + (SXSIZE - strlen(WINDOW_SUBTITLE_STRING) * font2_width) / 2;
+  int text1_width = getTextWidth(PROGRAM_TITLE_STRING,   FONT_TITLE_1);
+  int text2_width = getTextWidth(WINDOW_SUBTITLE_STRING, FONT_TITLE_2);
+  int x1 = SX + (SXSIZE - text1_width) / 2;
+  int x2 = SX + (SXSIZE - text2_width) / 2;
 
   DrawText(x1, SY + 8,  PROGRAM_TITLE_STRING,   FONT_TITLE_1);
   DrawText(x2, SY + 46, WINDOW_SUBTITLE_STRING, FONT_TITLE_2);
@@ -192,13 +192,10 @@ void DrawMainMenu()
 {
   static LevelDirTree *leveldir_last_valid = NULL;
   char *name_text = (!options.network && setup.team_mode ? "Team:" : "Name:");
-  int font_width = getFontWidth(FONT_MENU_1);
-  int name_width = font_width * strlen("Name:");
-  int level_width = font_width * strlen("Level:");
+  int name_width  = getTextWidth("Name:",  FONT_MENU_1);
+  int level_width = getTextWidth("Level:", FONT_MENU_1);
   int i;
 
-  printf("::: CHECK A: '%s'\n", leveldir_current->graphics_path);
-
   UnmapAllGadgets();
   FadeSounds();
 
@@ -224,24 +221,16 @@ void DrawMainMenu()
   /* needed if last screen was the setup screen and fullscreen state changed */
   ToggleFullscreenIfNeeded();
 
-  printf("::: CHECK B.1: '%s'\n", leveldir_current->graphics_path);
-
-#if 1
   /* leveldir_current may be invalid (level group, parent link) */
   if (!validLevelSeries(leveldir_current))
     leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid);
 
   /* store valid level series information */
   leveldir_last_valid = leveldir_current;
-#endif
-
-  printf("::: CHECK B.2: '%s'\n", leveldir_current->graphics_path);
 
   /* needed if last screen (level choice) changed graphics, sounds or music */
   ReloadCustomArtwork();
 
-  printf("::: CHECK C: '%s'\n", leveldir_current->graphics_path);
-
 #ifdef TARGET_SDL
   SetDrawtoField(DRAW_BACKBUFFER);
 #endif
@@ -249,15 +238,6 @@ void DrawMainMenu()
   /* map gadgets for main menu screen */
   MapTapeButtons();
 
-#if 0
-  /* leveldir_current may be invalid (level group, parent link) */
-  if (!validLevelSeries(leveldir_current))
-    leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid);
-
-  /* store valid level series information */
-  leveldir_last_valid = leveldir_current;
-#endif
-
   /* level_nr may have been set to value over handicap with level editor */
   if (setup.handicap && level_nr > leveldir_current->handicap_level)
     level_nr = leveldir_current->handicap_level;
@@ -325,8 +305,6 @@ static void gotoTopLevelDir()
   /* move upwards to top level directory */
   while (leveldir_current->node_parent)
   {
-    printf("::: ---> '%s'\n", leveldir_current->graphics_path);
-
     /* write a "path" into level tree for easy navigation to last level */
     if (leveldir_current->node_parent->node_group->cl_first == -1)
     {
@@ -348,11 +326,7 @@ static void gotoTopLevelDir()
     }
 
     leveldir_current = leveldir_current->node_parent;
-
-    printf("::: +++> '%s'\n", leveldir_current->graphics_path);
   }
-
-  printf("::: ===> '%s'\n", leveldir_current->graphics_path);
 }
 
 void HandleMainMenu(int mx, int my, int dx, int dy, int button)
@@ -443,12 +417,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
          SaveLevelSetup_LastSeries();
          SaveLevelSetup_SeriesInfo();
 
-         printf("::: CHECK C.1: '%s'\n", leveldir_current->graphics_path);
-
          gotoTopLevelDir();
 
-         printf("::: CHECK C.2: '%s'\n", leveldir_current->graphics_path);
-
          DrawChooseLevel();
        }
       }