added support for tile size for game elements info screen
authorHolger Schemel <info@artsoft.org>
Mon, 27 Mar 2023 07:48:35 +0000 (09:48 +0200)
committerHolger Schemel <info@artsoft.org>
Mon, 27 Mar 2023 07:58:51 +0000 (09:58 +0200)
This adds support for the following two graphics configuration options
to customize the element tile size and the space between element
graphic and element description on the game elements info screen:

* menu.tile_size.INFO[ELEMENTS]      - tile size of element graphics
* menu.middle_spacing.INFO[ELEMENTS] - space between element and text

Supported tile sizes are game tile size as defined by "game.tile_size"
and the usual standard tile sizes 32, 16, 8 and 4 pixels.

src/conf_gfx.c
src/files.c
src/main.h
src/screens.c
src/tools.c
src/tools.h

index 1b6ed53ec9a2538a417cfcf2c80df75bc9ce231e..e2c7c3504397288cd88b1d6007cafc1b4292ad9c 100644 (file)
@@ -8084,6 +8084,8 @@ struct ConfigInfo image_config[] =
 
   { "menu.list_entry_size.INFO[ELEMENTS]",     "-1"                    },
 
+  { "menu.tile_size.INFO[ELEMENTS]",           "-1"                    },
+
   { "menu.left_spacing.SCOREINFO",             "16"                    },
   { "menu.left_spacing.INFO",                  "16"                    },
   { "menu.left_spacing.INFO[TITLE]",           "16"                    },
@@ -8095,6 +8097,8 @@ struct ConfigInfo image_config[] =
   { "menu.left_spacing.INFO[LEVELSET]",                "16"                    },
   { "menu.left_spacing.SETUP[INPUT]",          "16"                    },
 
+  { "menu.middle_spacing.INFO[ELEMENTS]",      "16"                    },
+
   { "menu.right_spacing.SCOREINFO",            "16"                    },
   { "menu.right_spacing.INFO",                 "16"                    },
   { "menu.right_spacing.INFO[TITLE]",          "16"                    },
index b162b9683126c4381a60c761f117cb7f163b0ede..093855df77b69063585f4db9be8b1f16ba193681 100644 (file)
@@ -12480,7 +12480,8 @@ static void LoadMenuDesignSettingsFromFilename(char *filename)
       { "menu.draw_xoffset.INFO",      &menu.draw_xoffset_info[i]      },
       { "menu.draw_yoffset.INFO",      &menu.draw_yoffset_info[i]      },
       { "menu.list_size.INFO",         &menu.list_size_info[i]         },
-      { "menu.list_entry_size.INFO",   &menu.list_entry_size_info[i]   }
+      { "menu.list_entry_size.INFO",   &menu.list_entry_size_info[i]   },
+      { "menu.tile_size.INFO",         &menu.tile_size_info[i]         }
     };
 
     for (j = 0; j < ARRAY_SIZE(menu_config); j++)
@@ -12520,6 +12521,7 @@ static void LoadMenuDesignSettingsFromFilename(char *filename)
     struct TokenIntPtrInfo menu_config[] =
     {
       { "menu.left_spacing.INFO",      &menu.left_spacing_info[i]      },
+      { "menu.middle_spacing.INFO",    &menu.middle_spacing_info[i]    },
       { "menu.right_spacing.INFO",     &menu.right_spacing_info[i]     },
       { "menu.top_spacing.INFO",       &menu.top_spacing_info[i]       },
       { "menu.bottom_spacing.INFO",    &menu.bottom_spacing_info[i]    },
index 5ccf7389285cb05c60e737eef07af8a2d17fc2bc..67e652d531cf34d0acfbcd6cfbd841b2ae73d010 100644 (file)
@@ -2884,10 +2884,12 @@ struct MenuInfo
   int list_size[NUM_SPECIAL_GFX_ARGS];
   int list_size_info[NUM_SPECIAL_GFX_INFO_ARGS];
   int list_entry_size_info[NUM_SPECIAL_GFX_INFO_ARGS];
+  int tile_size_info[NUM_SPECIAL_GFX_INFO_ARGS];
 
   int left_spacing[NUM_SPECIAL_GFX_ARGS];
   int left_spacing_info[NUM_SPECIAL_GFX_INFO_ARGS];
   int left_spacing_setup[NUM_SPECIAL_GFX_SETUP_ARGS];
+  int middle_spacing_info[NUM_SPECIAL_GFX_INFO_ARGS];
   int right_spacing[NUM_SPECIAL_GFX_ARGS];
   int right_spacing_info[NUM_SPECIAL_GFX_INFO_ARGS];
   int right_spacing_setup[NUM_SPECIAL_GFX_SETUP_ARGS];
index dee3b79cd4dcc3e8662416489131cdfbcd9e5bf6..3761775a80e9f430a4e6396378c32c1ea31aa9ed 100644 (file)
 #define MENU_INFO_FONT_FOOT            FONT_TEXT_4
 #define MENU_INFO_SPACE_HEAD           (menu.headline2_spacing_info[info_mode])
 #define MENU_SCREEN_INFO_SPACE_LEFT    (menu.left_spacing_info[info_mode])
+#define MENU_SCREEN_INFO_SPACE_MIDDLE  (menu.middle_spacing_info[info_mode])
 #define MENU_SCREEN_INFO_SPACE_RIGHT   (menu.right_spacing_info[info_mode])
 #define MENU_SCREEN_INFO_SPACE_TOP     (menu.top_spacing_info[info_mode])
 #define MENU_SCREEN_INFO_SPACE_BOTTOM  (menu.bottom_spacing_info[info_mode])
 #define MENU_SCREEN_INFO_SPACE_LINE    (menu.line_spacing_info[info_mode])
 #define MENU_SCREEN_INFO_SPACE_EXTRA   (menu.extra_spacing_info[info_mode])
+#define MENU_SCREEN_INFO_TILE_SIZE     (menu.tile_size_info[info_mode])
 #define MENU_SCREEN_INFO_ENTRY_SIZE_RAW        (menu.list_entry_size_info[info_mode])
 #define MENU_SCREEN_INFO_ENTRY_SIZE    (MAX(MENU_SCREEN_INFO_ENTRY_SIZE_RAW, \
-                                            TILEY))
+                                            MENU_SCREEN_INFO_TILE_SIZE))
 #define MENU_SCREEN_INFO_YSTART                MENU_SCREEN_INFO_SPACE_TOP
 #define MENU_SCREEN_INFO_YSTEP         (MENU_SCREEN_INFO_ENTRY_SIZE + \
                                         MENU_SCREEN_INFO_SPACE_EXTRA)
@@ -3120,7 +3122,8 @@ void DrawInfoScreen_HelpAnim(int start, int max_anims, boolean init)
   int ybottom = mSY - SY + MENU_SCREEN_INFO_YBOTTOM;
   int ystep = MENU_SCREEN_INFO_YSTEP;
   int row_height = MENU_SCREEN_INFO_ENTRY_SIZE;
-  int yoffset = (row_height - TILEY) / 2;
+  int tilesize = MENU_SCREEN_INFO_TILE_SIZE;
+  int yoffset = (row_height - tilesize) / 2;
   int element, action, direction;
   int graphic;
   int delay;
@@ -3206,9 +3209,9 @@ void DrawInfoScreen_HelpAnim(int start, int max_anims, boolean init)
 
     j++;
 
-    ClearRectangleOnBackground(drawto, xstart, ystart_pos, TILEX, TILEY);
-    DrawFixedGraphicAnimationExt(drawto, xstart, ystart_pos,
-                                graphic, sync_frame, USE_MASKING);
+    ClearRectangleOnBackground(drawto, xstart, ystart_pos, tilesize, tilesize);
+    DrawSizedGraphicAnimationExt(drawto, xstart, ystart_pos,
+                                graphic, sync_frame, tilesize, USE_MASKING);
 
     if (init)
       DrawInfoScreen_HelpText(element, action, direction, ypos);
@@ -3242,13 +3245,17 @@ void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos)
   int font_width = getFontWidth(font_nr);
   int font_height = getFontHeight(font_nr);
   int line_spacing = MENU_SCREEN_INFO_SPACE_LINE;
+  int left_spacing = MENU_SCREEN_INFO_SPACE_LEFT;
+  int middle_spacing = MENU_SCREEN_INFO_SPACE_MIDDLE;
+  int right_spacing = MENU_SCREEN_INFO_SPACE_RIGHT;
   int line_height = font_height + line_spacing;
   int row_height = MENU_SCREEN_INFO_ENTRY_SIZE;
-  int xstart = mSX + MENU_SCREEN_INFO_SPACE_LEFT + TILEX + MINI_TILEX;
+  int tilesize = MENU_SCREEN_INFO_TILE_SIZE;
+  int xstart = mSX + left_spacing + tilesize + middle_spacing;
   int ystart = mSY + MENU_SCREEN_INFO_YSTART + getHeadlineSpacing();
   int ystep = MENU_SCREEN_INFO_YSTEP;
   int pad_left = xstart - SX;
-  int pad_right = MENU_SCREEN_INFO_SPACE_RIGHT;
+  int pad_right = right_spacing;
   int max_chars_per_line = (SXSIZE - pad_left - pad_right) / font_width;
   int max_lines_per_text = (row_height + line_spacing) / line_height;
   char *text = NULL;
index f2cffa56ba65aad73edd527e338b5a2b08eff30e..124cab52fd644914325f55ea753b1535a8dfab15 100644 (file)
@@ -3948,6 +3948,18 @@ void DrawFixedGraphicAnimationExt(DrawBuffer *dst_bitmap, int x, int y,
     DrawFixedGraphicExt(dst_bitmap, x, y, graphic, frame);
 }
 
+void DrawSizedGraphicAnimationExt(DrawBuffer *dst_bitmap, int x, int y,
+                                 int graphic, int sync_frame, int tilesize,
+                                 int mask_mode)
+{
+  int frame = getGraphicAnimationFrame(graphic, sync_frame);
+
+  if (mask_mode == USE_MASKING)
+    DrawSizedGraphicThruMaskExt(dst_bitmap, x, y, graphic, frame, tilesize);
+  else
+    DrawSizedGraphicExt(dst_bitmap, x, y, graphic, frame, tilesize);
+}
+
 static void DrawGraphicAnimation(int x, int y, int graphic)
 {
   int lx = LEVELX(x), ly = LEVELY(y);
index e0c4726d4c5e260b7d7cb08e5257425488b63ba8..e80efbf2057908d46b705d0da47d3fbb84fcfad8 100644 (file)
@@ -138,6 +138,7 @@ int getGraphicAnimationFrameXY(int, int, int);
 
 void DrawFixedGraphicAnimation(int, int, int);
 void DrawFixedGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
+void DrawSizedGraphicAnimationExt(DrawBuffer *, int, int, int, int, int, int);
 
 void DrawLevelGraphicAnimation(int, int, int);
 void DrawLevelElementAnimation(int, int, int);