Author: cazfi Date: Mon Dec 14 00:21:20 2015 New Revision: 30970 URL: http://svn.gna.org/viewcvs/freeciv?rev=30970&view=rev Log: Added support for alternative upkeep icons layout.
See patch #6564 Modified: branches/S2_6/client/gui-sdl/citydlg.c branches/S2_6/client/gui-sdl2/citydlg.c branches/S2_6/client/tilespec.c branches/S2_6/client/tilespec.h branches/S2_6/data/alio.tilespec branches/S2_6/data/amplio.tilespec branches/S2_6/data/amplio2.tilespec branches/S2_6/data/cimpletoon.tilespec branches/S2_6/data/hex2t.tilespec branches/S2_6/data/hexemplio.tilespec branches/S2_6/data/isophex.tilespec branches/S2_6/data/isotrident.tilespec branches/S2_6/data/toonhex.tilespec branches/S2_6/data/trident.tilespec branches/S2_6/doc/README.graphics Modified: branches/S2_6/client/gui-sdl/citydlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl/citydlg.c?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/client/gui-sdl/citydlg.c (original) +++ branches/S2_6/client/gui-sdl/citydlg.c Mon Dec 14 00:21:20 2015 @@ -604,7 +604,7 @@ struct canvas *destcanvas; destcanvas = canvas_create_with_alpha(tileset_full_tile_width(tileset), - tileset_unit_with_upkeep_height(tileset)); + tileset_unit_with_small_upkeep_height(tileset)); put_unit(punit, destcanvas, 1.0, 0, 0); /* Get unit sprite width, but do not limit height by it */ @@ -628,7 +628,7 @@ step = pIcons->pFood->w; } - dest.y = tileset_unit_layout_offset_y(tileset); + dest.y = tileset_unit_layout_small_offset_y(tileset); dest.x = src_rect.x + src_rect.w / 8; for (i = 0; i < punit->upkeep[O_SHIELD]; i++) { Modified: branches/S2_6/client/gui-sdl2/citydlg.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl2/citydlg.c?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/client/gui-sdl2/citydlg.c (original) +++ branches/S2_6/client/gui-sdl2/citydlg.c Mon Dec 14 00:21:20 2015 @@ -600,7 +600,7 @@ struct canvas *destcanvas; destcanvas = canvas_create(tileset_full_tile_width(tileset), - tileset_unit_with_upkeep_height(tileset)); + tileset_unit_with_small_upkeep_height(tileset)); put_unit(punit, destcanvas, 1.0, 0, 0); @@ -627,7 +627,7 @@ step = pIcons->pFood->w; } - dest.y = tileset_unit_layout_offset_y(tileset); + dest.y = tileset_unit_layout_small_offset_y(tileset); dest.x = src_rect.x + src_rect.w / 8; for (i = 0; i < punit->upkeep[O_SHIELD]; i++) { Modified: branches/S2_6/client/tilespec.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/tilespec.c?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/client/tilespec.c (original) +++ branches/S2_6/client/tilespec.c Mon Dec 14 00:21:20 2015 @@ -493,6 +493,7 @@ int occupied_offset_x; int occupied_offset_y; int unit_upkeep_offset_y; + int unit_upkeep_small_offset_y; #define NUM_CORNER_DIRS 4 #define TILES_PER_CORNER 4 @@ -796,11 +797,29 @@ } /**************************************************************************** + Suitable canvas height for a unit icon that includes upkeep sprites, + using small space layout. +****************************************************************************/ +int tileset_unit_with_small_upkeep_height(const struct tileset *t) +{ + return tileset_unit_layout_small_offset_y(tileset) + tileset_upkeep_height(tileset); +} + +/**************************************************************************** Offset to layout extra unit sprites, such as upkeep. ****************************************************************************/ int tileset_unit_layout_offset_y(const struct tileset *t) { return t->unit_upkeep_offset_y; +} + +/**************************************************************************** + Offset to layout extra unit sprites, such as upkeep, requesting small + space layout. +****************************************************************************/ +int tileset_unit_layout_small_offset_y(const struct tileset *t) +{ + return t->unit_upkeep_small_offset_y; } /**************************************************************************** @@ -1860,6 +1879,8 @@ t->unit_upkeep_offset_y = secfile_lookup_int_default(file, tileset_tile_height(t), "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"); set_city_names_font_sizes(t->city_names_font_size, t->city_productions_font_size); Modified: branches/S2_6/client/tilespec.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/tilespec.h?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/client/tilespec.h (original) +++ branches/S2_6/client/tilespec.h Mon Dec 14 00:21:20 2015 @@ -382,7 +382,9 @@ int tileset_unit_width(const struct tileset *t); int tileset_unit_height(const struct tileset *t); int tileset_unit_with_upkeep_height(const struct tileset *t); +int tileset_unit_with_small_upkeep_height(const struct tileset *t); int tileset_unit_layout_offset_y(const struct tileset *t); +int tileset_unit_layout_small_offset_y(const struct tileset *t); int tileset_small_sprite_width(const struct tileset *t); int tileset_small_sprite_height(const struct tileset *t); int tileset_citybar_offset_y(const struct tileset *t); Modified: branches/S2_6/data/alio.tilespec URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/alio.tilespec?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/data/alio.tilespec (original) +++ branches/S2_6/data/alio.tilespec Mon Dec 14 00:21:20 2015 @@ -78,6 +78,11 @@ ; (typical in overhead tileset), or overlay lower part of the unit icon, ; if unit icon is higher than tiles (typical in iso tilesets) ;unit_upkeep_offset_y = 0 + +; Like unit_upkeep_offset_y, but to be used in case there's only small +; space for the overall icon produced. Defaults to unit_upkeep_offset_y - +; not having alternative layout. +;unit_upkeep_small_offset_y = 0 ; Font to use to draw city names: city_names_font = "9x15bold" Modified: branches/S2_6/data/amplio.tilespec URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/amplio.tilespec?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/data/amplio.tilespec (original) +++ branches/S2_6/data/amplio.tilespec Mon Dec 14 00:21:20 2015 @@ -68,6 +68,11 @@ ; (typical in overhead tileset), or overlay lower part of the unit icon, ; if unit icon is higher than tiles (typical in iso tilesets) ;unit_upkeep_offset_y = 0 + +; Like unit_upkeep_offset_y, but to be used in case there's only small +; space for the overall icon produced. Defaults to unit_upkeep_offset_y - +; not having alternative layout. +;unit_upkeep_small_offset_y = 0 ; Font size (points) to use to draw city names and productions: city_names_font_size = 10 Modified: branches/S2_6/data/amplio2.tilespec URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/amplio2.tilespec?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/data/amplio2.tilespec (original) +++ branches/S2_6/data/amplio2.tilespec Mon Dec 14 00:21:20 2015 @@ -68,6 +68,11 @@ ; (typical in overhead tileset), or overlay lower part of the unit icon, ; if unit icon is higher than tiles (typical in iso tilesets) ;unit_upkeep_offset_y = 0 + +; Like unit_upkeep_offset_y, but to be used in case there's only small +; space for the overall icon produced. Defaults to unit_upkeep_offset_y - +; not having alternative layout. +;unit_upkeep_small_offset_y = 0 ; Font size (points) to use to draw city names and productions: city_names_font_size = 10 Modified: branches/S2_6/data/cimpletoon.tilespec URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/cimpletoon.tilespec?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/data/cimpletoon.tilespec (original) +++ branches/S2_6/data/cimpletoon.tilespec Mon Dec 14 00:21:20 2015 @@ -68,6 +68,11 @@ ; (typical in overhead tileset), or overlay lower part of the unit icon, ; if unit icon is higher than tiles (typical in iso tilesets) ;unit_upkeep_offset_y = 0 + +; Like unit_upkeep_offset_y, but to be used in case there's only small +; space for the overall icon produced. Defaults to unit_upkeep_offset_y - +; not having alternative layout. +;unit_upkeep_small_offset_y = 0 ; Font size (points) to use to draw city names and productions: city_names_font_size = 10 Modified: branches/S2_6/data/hex2t.tilespec URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/hex2t.tilespec?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/data/hex2t.tilespec (original) +++ branches/S2_6/data/hex2t.tilespec Mon Dec 14 00:21:20 2015 @@ -71,6 +71,11 @@ ; (typical in overhead tileset), or overlay lower part of the unit icon, ; if unit icon is higher than tiles (typical in iso tilesets) ;unit_upkeep_offset_y = 0 + +; Like unit_upkeep_offset_y, but to be used in case there's only small +; space for the overall icon produced. Defaults to unit_upkeep_offset_y - +; not having alternative layout. +;unit_upkeep_small_offset_y = 0 ; Font to use to draw city names: city_names_font = "6x13bold" Modified: branches/S2_6/data/hexemplio.tilespec URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/hexemplio.tilespec?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/data/hexemplio.tilespec (original) +++ branches/S2_6/data/hexemplio.tilespec Mon Dec 14 00:21:20 2015 @@ -74,6 +74,11 @@ ; (typical in overhead tileset), or overlay lower part of the unit icon, ; if unit icon is higher than tiles (typical in iso tilesets) ;unit_upkeep_offset_y = 0 + +; Like unit_upkeep_offset_y, but to be used in case there's only small +; space for the overall icon produced. Defaults to unit_upkeep_offset_y - +; not having alternative layout. +;unit_upkeep_small_offset_y = 0 ; Font to use to draw city names: city_names_font = "9x15bold" Modified: branches/S2_6/data/isophex.tilespec URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/isophex.tilespec?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/data/isophex.tilespec (original) +++ branches/S2_6/data/isophex.tilespec Mon Dec 14 00:21:20 2015 @@ -71,6 +71,11 @@ ; (typical in overhead tileset), or overlay lower part of the unit icon, ; if unit icon is higher than tiles (typical in iso tilesets) ;unit_upkeep_offset_y = 0 + +; Like unit_upkeep_offset_y, but to be used in case there's only small +; space for the overall icon produced. Defaults to unit_upkeep_offset_y - +; not having alternative layout. +;unit_upkeep_small_offset_y = 0 ; Font to use to draw city names: city_names_font = "9x15bold" Modified: branches/S2_6/data/isotrident.tilespec URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/isotrident.tilespec?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/data/isotrident.tilespec (original) +++ branches/S2_6/data/isotrident.tilespec Mon Dec 14 00:21:20 2015 @@ -70,6 +70,11 @@ ; (typical in overhead tileset), or overlay lower part of the unit icon, ; if unit icon is higher than tiles (typical in iso tilesets) ;unit_upkeep_offset_y = 0 + +; Like unit_upkeep_offset_y, but to be used in case there's only small +; space for the overall icon produced. Defaults to unit_upkeep_offset_y - +; not having alternative layout. +;unit_upkeep_small_offset_y = 0 ; Font size (points) to use to draw city names and productions: city_names_font_size = 10 Modified: branches/S2_6/data/toonhex.tilespec URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/toonhex.tilespec?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/data/toonhex.tilespec (original) +++ branches/S2_6/data/toonhex.tilespec Mon Dec 14 00:21:20 2015 @@ -75,6 +75,11 @@ ; (typical in overhead tileset), or overlay lower part of the unit icon, ; if unit icon is higher than tiles (typical in iso tilesets) ;unit_upkeep_offset_y = 0 + +; Like unit_upkeep_offset_y, but to be used in case there's only small +; space for the overall icon produced. Defaults to unit_upkeep_offset_y - +; not having alternative layout. +;unit_upkeep_small_offset_y = 0 ; Font to use to draw city names: city_names_font = "9x15bold" Modified: branches/S2_6/data/trident.tilespec URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/trident.tilespec?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/data/trident.tilespec (original) +++ branches/S2_6/data/trident.tilespec Mon Dec 14 00:21:20 2015 @@ -70,6 +70,13 @@ ; (typical in overhead tileset), or overlay lower part of the unit icon, ; if unit icon is higher than tiles (typical in iso tilesets) ;unit_upkeep_offset_y = 0 + +; Like unit_upkeep_offset_y, but to be used in case there's only small +; space for the overall icon produced. Defaults to unit_upkeep_offset_y - +; not having alternative layout. +; Set it to overlay lower part of the unit icon instead of taking extra +; space below. +unit_upkeep_small_offset_y = 20 ; Font size (points) to use to draw city names and productions: city_names_font_size = 10 Modified: branches/S2_6/doc/README.graphics URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/doc/README.graphics?rev=30970&r1=30969&r2=30970&view=diff ============================================================================== --- branches/S2_6/doc/README.graphics (original) +++ branches/S2_6/doc/README.graphics Mon Dec 14 00:21:20 2015 @@ -139,6 +139,10 @@ equal to tile height (typical in overhead tileset) - Upkeep icons overlay lower part of the unit icon, if unit icon is higher than tile height (typical in iso tilesets) + unit_upkeep_small_offset_y: + Like unit_upkeep_offset_y, but to be used in case there's only small + space for the overall icon produced. Defaults to unit_upkeep_offset_y - + not having alternative layout. citybar_offset_y : Gives an offset from city tile origin at which to draw city bar text. hex_side : When is_hex is specified (see is_hex, below), this _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits