small code cleanup
[rocksndiamonds.git] / src / screens.c
index 4967ebde6f9c90a52b384e22f690289423eb07d7..127333bcb1408058c3793f57886a78bb8d4e75e7 100644 (file)
@@ -5980,6 +5980,8 @@ static void ToggleNetworkModeIfNeeded(void)
   DrawTextSCentered(ybottom, font_foot,
                    "Press any key or button for setup menu");
 
+  WaitForEventToContinue();
+
   DrawSetupScreen();
 }
 
@@ -6487,10 +6489,12 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw)
   int ypos = MENU_SCREEN_START_YPOS + screen_pos;
   int startx = mSX + xpos * 32;
   int starty = mSY + ypos * 32;
-  int font_nr, font_nr_default, font_width_default;
   int type = si->type;
   void *value = si->value;
   char *value_string = getSetupValue(type, value);
+  int font_nr_default = getSetupValueFont(type, value);
+  int font_width_default = getFontWidth(font_nr_default);
+  int font_nr = font_nr_default;
   int i;
 
   if (value_string == NULL)
@@ -6525,10 +6529,6 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw)
 
   startx = mSX + xpos * 32;
   starty = mSY + ypos * 32;
-  font_nr_default = getSetupValueFont(type, value);
-  font_width_default = getFontWidth(font_nr_default);
-
-  font_nr = font_nr_default;
 
   // special check if right-side setup values moved left due to scrollbar
   if (scrollbar_needed && xpos > MENU_SCREEN_START_XPOS)
@@ -6594,10 +6594,17 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw)
 
   if (type & TYPE_PLAYER)
   {
+    struct FontBitmapInfo *font = getFontBitmapInfo(font_nr);
     int player_nr = *(int *)value;
-    int xoff = getFontWidth(font_nr);
+    int xoff = font->draw_xoffset + getFontWidth(font_nr);
+    int yoff = font->draw_yoffset + (getFontHeight(font_nr) - TILEY) / 2;
+    int startx2 = startx + xoff;
+    int starty2 = starty + yoff;
+
+    if (DrawingOnBackground(startx2, starty2))
+      ClearRectangleOnBackground(drawto, startx2, starty2, TILEX, TILEY);
 
-    DrawFixedGraphicThruMaskExt(drawto, startx + xoff, starty,
+    DrawFixedGraphicThruMaskExt(drawto, startx2, starty2,
                                PLAYER_NR_GFX(IMG_PLAYER_1, player_nr), 0);
   }