changed function for rank text to also include trailing dot
[rocksndiamonds.git] / src / screens.c
index a3f9de148b4dbd348b5ef384ce811dcf759d7b70..1d56c24c5aef821cd0160f9680b1e5ae8abb22d6 100644 (file)
@@ -297,7 +297,7 @@ static void execOfferUploadTapes(void);
 static void DrawHallOfFame_setScoreEntries(void);
 static void HandleHallOfFame_SelectLevel(int, int);
 static void HandleHallOfFame_SelectLevelOrScore(int, int);
-static char *getHallOfFameRankText(int);
+static char *getHallOfFameRankText(int, int);
 static char *getHallOfFameScoreText(int);
 
 static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS];
@@ -4932,28 +4932,24 @@ static void drawChooseTreeText(TreeInfo *ti, int y, boolean active)
     int font_size_1 = getFontWidth(font_nr1);
     int font_size_3 = getFontWidth(font_nr3);
     int font_size_4 = getFontWidth(font_nr4);
-    int text_size_1 = 3 * font_size_1;
+    int text_size_1 = 4 * font_size_1;
     int text_size_4 = 5 * font_size_4;
     int border = amSX - SX + getFontDrawOffsetX(font_nr1);
     int dx1 = 0;
-    int dx2 = text_size_1;
-    int dx3 = dx2 + font_size_1;
+    int dx3 = text_size_1;
     int dx4 = screen_width - startdx - 2 * border - text_size_4;
     int num_dots = (dx4 - dx3) / font_size_3;
     int startx1 = startx + dx1;
-    int startx2 = startx + dx2;
     int startx3 = startx + dx3;
     int startx4 = startx + dx4;
     int pos = node->pos;
-    char *pos_text = getHallOfFameRankText(pos);
-    char *dot_text = ".";
+    char *pos_text = getHallOfFameRankText(pos, 3);
     int i;
 
     DrawText(startx1, starty, pos_text, font_nr1);
-    DrawText(startx2, starty, dot_text, font_nr1);
 
     for (i = 0; i < num_dots; i++)
-      DrawText(startx3 + i * font_size_3, starty, dot_text, font_nr3);
+      DrawText(startx3 + i * font_size_3, starty, ".", font_nr3);
 
     if (!strEqual(scores.entry[pos].name, EMPTY_PLAYER_NAME))
       DrawText(startx3, starty, scores.entry[pos].name, font_nr2);
@@ -5784,11 +5780,15 @@ void DrawHallOfFame(int level_nr)
   DrawChooseTree(&score_entry_current);
 }
 
-static char *getHallOfFameRankText(int nr)
+static char *getHallOfFameRankText(int nr, int size)
 {
+  static char rank_text[10];
   boolean forced = (scores.force_last_added && nr == scores.last_added);
+  char *rank_text_raw = (forced ? "???" : int2str(nr + 1, size));
 
-  return (forced ? "???" : int2str(nr + 1, 3));
+  sprintf(rank_text, "%s%s", rank_text_raw, (size > 0 || !forced ? "." : ""));
+
+  return rank_text;
 }
 
 static char *getHallOfFameTimeText(int nr)
@@ -5832,6 +5832,7 @@ static void HandleHallOfFame_SelectLevel(int step, int direction)
 
     scores.last_level_nr = level_nr = new_level_nr;
 
+    LoadLevel(level_nr);
     LoadLocalAndServerScore(level_nr, TRUE);
 
     DrawHallOfFame_setScoreEntries();
@@ -5859,7 +5860,7 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
 static void DrawScoreInfo_Content(int entry_nr)
 {
   struct ScoreEntry *entry = &scores.entry[entry_nr];
-  char *pos_text = getHallOfFameRankText(entry_nr);
+  char *pos_text = getHallOfFameRankText(entry_nr, 0);
   int font_title = MENU_INFO_FONT_TITLE;
   int font_head  = MENU_INFO_FONT_HEAD;
   int font_text  = MENU_INFO_FONT_TEXT;
@@ -5874,7 +5875,14 @@ static void DrawScoreInfo_Content(int entry_nr)
   int ystart  = mSY - SY + menu.top_spacing[GAME_MODE_SCOREINFO];
   int ybottom = mSY - SY + SYSIZE - menu.bottom_spacing[GAME_MODE_SCOREINFO];
   int xstart1 = mSX - SX + 2 * xstep;
-  int xstart2 = mSX - SX + 14 * xstep;
+  int xstart2 = mSX - SX + 13 * xstep;
+  int font_width = getFontWidth(font_text);
+  int font_height = getFontHeight(font_text);
+  int pad_left = xstart2;
+  int pad_right = MENU_SCREEN_INFO_SPACE_RIGHT;
+  int max_chars_per_line = (SXSIZE - pad_left - pad_right) / font_width;
+  int max_lines_per_text = 5;
+  int lines;
 
   ClearField();
 
@@ -5888,12 +5896,16 @@ static void DrawScoreInfo_Content(int entry_nr)
   ystart += ystep_title;
 
   DrawTextF(xstart1, ystart, font_head, "Level Set");
-  DrawTextF(xstart2, ystart, font_text, leveldir_current->name);
-  ystart += ystep_line;
+  lines = DrawTextBufferS(xstart2, ystart, leveldir_current->name, font_text,
+                         max_chars_per_line, -1, max_lines_per_text, 0, -1,
+                         TRUE, FALSE, FALSE);
+  ystart += ystep_line + (lines > 0 ? lines - 1 : 0) * font_height;
 
-  DrawTextF(xstart1, ystart, font_head, "Level Name");
-  DrawTextF(xstart2, ystart, font_text, level.name);
-  ystart += ystep_para;
+  DrawTextF(xstart1, ystart, font_head, "Level");
+  lines = DrawTextBufferS(xstart2, ystart, level.name, font_text,
+                         max_chars_per_line, -1, max_lines_per_text, 0, -1,
+                         TRUE, FALSE, FALSE);
+  ystart += ystep_para + (lines > 0 ? lines - 1 : 0) * font_height;
 
   DrawTextF(xstart1, ystart, font_head, "Rank");
   DrawTextF(xstart2, ystart, font_text, pos_text);
@@ -5903,6 +5915,24 @@ static void DrawScoreInfo_Content(int entry_nr)
   DrawTextF(xstart2, ystart, font_text, entry->name);
   ystart += ystep_line;
 
+  DrawTextF(xstart1, ystart, font_head, "Platform");
+  DrawTextF(xstart2, ystart, font_text, entry->platform);
+  ystart += ystep_line;
+
+  DrawTextF(xstart1, ystart, font_head, "Version");
+  DrawTextF(xstart2, ystart, font_text, entry->version);
+  ystart += ystep_line;
+
+  DrawTextF(xstart1, ystart, font_head, "Country");
+  lines = DrawTextBufferS(xstart2, ystart, entry->country_name, font_text,
+                         max_chars_per_line, -1, max_lines_per_text, 0, -1,
+                         TRUE, FALSE, FALSE);
+  ystart += ystep_line + (lines > 0 ? lines - 1 : 0) * font_height;
+
+  DrawTextF(xstart1, ystart, font_head, "Tape Date");
+  DrawTextF(xstart2, ystart, font_text, entry->tape_date);
+  ystart += ystep_line;
+
   if (level.use_step_counter)
   {
     DrawTextF(xstart1, ystart, font_head, "Steps");