From: Holger Schemel Date: Mon, 27 Mar 2023 07:48:35 +0000 (+0200) Subject: added support for tile size for game elements info screen X-Git-Tag: 4.3.5.3~14 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=e09651f7389e369d07f23cbdd009937a33ba37c5;p=rocksndiamonds.git added support for tile size for game elements info screen 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. --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 1b6ed53e..e2c7c350 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -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" }, diff --git a/src/files.c b/src/files.c index b162b968..093855df 100644 --- a/src/files.c +++ b/src/files.c @@ -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] }, diff --git a/src/main.h b/src/main.h index 5ccf7389..67e652d5 100644 --- a/src/main.h +++ b/src/main.h @@ -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]; diff --git a/src/screens.c b/src/screens.c index dee3b79c..3761775a 100644 --- a/src/screens.c +++ b/src/screens.c @@ -173,14 +173,16 @@ #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; diff --git a/src/tools.c b/src/tools.c index f2cffa56..124cab52 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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); diff --git a/src/tools.h b/src/tools.h index e0c4726d..e80efbf2 100644 --- a/src/tools.h +++ b/src/tools.h @@ -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);