From 6cd479a756f8a3df5367de9dab82851cfee18169 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 22 Jul 2023 05:29:02 +0300 Subject: [PATCH 17/17] Define svg_height in tilesets See osdn #48110 Signed-off-by: Marko Lindqvist --- client/mapview_common.c | 3 +-- client/tilespec.c | 13 +++++++++++++ client/tilespec.h | 1 + data/alio.tilespec | 3 +++ data/amplio.tilespec | 3 +++ data/amplio2.tilespec | 3 +++ data/cimpletoon.tilespec | 3 +++ data/hex2t.tilespec | 3 +++ data/hexemplio.tilespec | 3 +++ data/isophex.tilespec | 3 +++ data/isotrident.tilespec | 3 +++ data/toonhex.tilespec | 3 +++ data/trident.tilespec | 3 +++ doc/README.graphics | 2 ++ 14 files changed, 47 insertions(+), 2 deletions(-) diff --git a/client/mapview_common.c b/client/mapview_common.c index 44a4726401..e711734799 100644 --- a/client/mapview_common.c +++ b/client/mapview_common.c @@ -1947,8 +1947,7 @@ static void show_full_citybar(struct canvas *pcanvas, } } - /* TODO: Configurable "svg_height" (here 44) */ - get_flag_dimensions(flag, &flag_rect, 44); + get_flag_dimensions(flag, &flag_rect, tileset_svg_flag_height(tileset)); flag_rect.w *= map_zoom; flag_rect.h *= map_zoom; get_sprite_dimensions(occupy, &occupy_rect.w, &occupy_rect.h); occupy_rect.w *= map_zoom; occupy_rect.h *= map_zoom; diff --git a/client/tilespec.c b/client/tilespec.c index f988d65fa2..b43241c0c2 100644 --- a/client/tilespec.c +++ b/client/tilespec.c @@ -502,6 +502,7 @@ struct tileset { int small_sprite_width, small_sprite_height; int max_upkeep_height; + int svg_height; char *main_intro_filename; @@ -2191,6 +2192,8 @@ static struct tileset *tileset_read_toplevel(const char *tileset_name, "tilespec.unit_upkeep_offset_y"); t->unit_upkeep_small_offset_y = secfile_lookup_int_default(file, t->unit_upkeep_offset_y, "tilespec.unit_upkeep_small_offset_y"); + t->svg_height = secfile_lookup_int_default(file, 44, "tilespec.svg_height"); + t->city_size_offset_x = t->scale * t->city_size_offset_x; t->city_size_offset_y = t->scale * t->city_size_offset_y; t->select_offset_x = t->scale * t->select_offset_x; @@ -2211,6 +2214,8 @@ static struct tileset *tileset_read_toplevel(const char *tileset_name, t->tilelabel_offset_y = t->scale * t->tilelabel_offset_y; t->occupied_offset_x = t->scale * t->occupied_offset_x; t->occupied_offset_y = t->scale * t->occupied_offset_y; + t->svg_height *= t->scale; + if (t->scale != 1.0f && t->unit_upkeep_offset_y != tileset_tile_height(t)) { t->unit_upkeep_offset_y = t->scale * t->unit_upkeep_offset_y; @@ -7537,3 +7542,11 @@ int tileset_topo_index(struct tileset *t) { return t->ts_topo_idx; } + +/************************************************************************//** + Return tileset svg flag height +****************************************************************************/ +int tileset_svg_flag_height(struct tileset *t) +{ + return t->svg_height; +} diff --git a/client/tilespec.h b/client/tilespec.h index 36252e59d8..f3565b6dff 100644 --- a/client/tilespec.h +++ b/client/tilespec.h @@ -460,6 +460,7 @@ const char *tileset_summary(struct tileset *t); const char *tileset_description(struct tileset *t); char *tileset_what_ruleset(struct tileset *t); int tileset_topo_index(struct tileset *t); +int tileset_svg_flag_height(struct tileset *t); #ifdef __cplusplus } diff --git a/data/alio.tilespec b/data/alio.tilespec index 6a640ef904..1824171e1b 100644 --- a/data/alio.tilespec +++ b/data/alio.tilespec @@ -33,6 +33,9 @@ normal_tile_height = 64 small_tile_width = 15 small_tile_height = 20 +; The height svg flags should be drawn to, if they are used +svg_height = 44 + ; Basic tile style. hex_side = 16 is_hex = TRUE diff --git a/data/amplio.tilespec b/data/amplio.tilespec index f0fd5769a0..4000dbadd5 100644 --- a/data/amplio.tilespec +++ b/data/amplio.tilespec @@ -27,6 +27,9 @@ normal_tile_height = 48 small_tile_width = 15 small_tile_height = 20 +; The height svg flags should be drawn to, if they are used +svg_height = 44 + ; Basic tile style. type = "isometric" is_hex = FALSE diff --git a/data/amplio2.tilespec b/data/amplio2.tilespec index 1be5a1f1a3..1308f95e18 100644 --- a/data/amplio2.tilespec +++ b/data/amplio2.tilespec @@ -27,6 +27,9 @@ normal_tile_height = 48 small_tile_width = 15 small_tile_height = 20 +; The height svg flags should be drawn to, if they are used +svg_height = 44 + ; Basic tile style. type = "isometric" is_hex = FALSE diff --git a/data/cimpletoon.tilespec b/data/cimpletoon.tilespec index 782a0f763a..1d083c7f8d 100644 --- a/data/cimpletoon.tilespec +++ b/data/cimpletoon.tilespec @@ -30,6 +30,9 @@ normal_tile_height = 48 small_tile_width = 15 small_tile_height = 20 +; The height svg flags should be drawn to, if they are used +svg_height = 44 + ; Basic tile style. type = "isometric" is_hex = FALSE diff --git a/data/hex2t.tilespec b/data/hex2t.tilespec index 2fe2149808..73de5e44a2 100644 --- a/data/hex2t.tilespec +++ b/data/hex2t.tilespec @@ -27,6 +27,9 @@ normal_tile_height = 72 small_tile_width = 15 small_tile_height = 20 +; The height svg flags should be drawn to, if they are used +svg_height = 44 + ; Basic tile style. type = "overhead" hex_side = 24 diff --git a/data/hexemplio.tilespec b/data/hexemplio.tilespec index 16bf64602a..864c8fab6d 100644 --- a/data/hexemplio.tilespec +++ b/data/hexemplio.tilespec @@ -29,6 +29,9 @@ normal_tile_height = 64 small_tile_width = 15 small_tile_height = 20 +; The height svg flags should be drawn to, if they are used +svg_height = 44 + ; Basic tile style. hex_side = 16 is_hex = TRUE diff --git a/data/isophex.tilespec b/data/isophex.tilespec index eb08a67cae..8e91eac8b5 100644 --- a/data/isophex.tilespec +++ b/data/isophex.tilespec @@ -27,6 +27,9 @@ normal_tile_height = 32 small_tile_width = 15 small_tile_height = 20 +; The height svg flags should be drawn to, if they are used +svg_height = 44 + ; Basic tile style. type = "isometric" hex_side = 16 diff --git a/data/isotrident.tilespec b/data/isotrident.tilespec index bc6760a9b5..ec86e5fb2c 100644 --- a/data/isotrident.tilespec +++ b/data/isotrident.tilespec @@ -27,6 +27,9 @@ normal_tile_height = 32 small_tile_width = 15 small_tile_height = 20 +; The height svg flags should be drawn to, if they are used +svg_height = 44 + ; Basic tile style. type = "isometric" is_hex = FALSE diff --git a/data/toonhex.tilespec b/data/toonhex.tilespec index 86c413906c..fd38442da3 100644 --- a/data/toonhex.tilespec +++ b/data/toonhex.tilespec @@ -31,6 +31,9 @@ normal_tile_height = 64 small_tile_width = 15 small_tile_height = 20 +; The height svg flags should be drawn to, if they are used +svg_height = 44 + ; Basic tile style. hex_side = 16 is_hex = TRUE diff --git a/data/trident.tilespec b/data/trident.tilespec index 87ab410635..dfbfbe3c8c 100644 --- a/data/trident.tilespec +++ b/data/trident.tilespec @@ -26,6 +26,9 @@ normal_tile_height = 30 small_tile_width = 15 small_tile_height = 20 +; The height svg flags should be drawn to, if they are used +svg_height = 44 + ; Basic tile style. type = "overhead" is_hex = FALSE diff --git a/doc/README.graphics b/doc/README.graphics index e3165f279c..f17671f7f4 100644 --- a/doc/README.graphics +++ b/doc/README.graphics @@ -97,6 +97,8 @@ options include: height in isometric tileset small_tile_width : the width of icon sprites small_tile_height : the height of icon sprites + svg_height : The height svg flags should be drawn to, + if they are used fog_style : Specifies how fog is drawn. "Auto" : Code automatically adds fog. "Sprite : A single fog sprite is drawn on top of all -- 2.40.1