Project

General

Profile

Feature #1123 » 0082-Animate-3Layer-extras-foreground.patch

Marko Lindqvist, 11/16/2024 01:30 AM

View differences:

client/tilespec.c
struct {
struct sprite
*background,
*middleground,
*middleground;
struct anim
*foreground;
} bmf;
struct {
......
sz_strlcpy(full_tag_name, tag);
strcat(full_tag_name, "_fg");
t->sprites.extras[id].u.bmf.foreground = load_sprite(t, full_tag_name,
TRUE, TRUE, FALSE);
t->sprites.extras[id].u.bmf.foreground = anim_load(t, full_tag_name, 0);
if (t->sprites.extras[id].u.bmf.background == NULL
&& t->sprites.extras[id].u.bmf.middleground == NULL
&& t->sprites.extras[id].u.bmf.foreground == NULL) {
if (t->sprites.extras[id].u.bmf.background == nullptr
&& t->sprites.extras[id].u.bmf.middleground == nullptr
&& t->sprites.extras[id].u.bmf.foreground == nullptr) {
/* There was an extra style definition but no matching graphics */
tileset_error(LOG_FATAL, tileset_name_get(t),
_("No graphics with tag \"%s_bg/mg/fg\" for extra \"%s\""),
......
ADD_SPRITE(anim_get_current_frame(s), draw_fog, x_offset, y_offset)
#define ADD_ANIM_SPRITE_SIMPLE(s) \
ADD_SPRITE(anim_get_current_frame(s), TRUE, 0, 0)
#define ADD_ANIM_FULL(s) \
ADD_SPRITE(anim_get_current_frame(s), TRUE, \
FULL_TILE_X_OFFSET, FULL_TILE_Y_OFFSET)
/************************************************************************//**
Assemble some data that is used in building the tile sprite arrays.
......
extra_type_list_iterate(t->style_lists[ESTYLE_3LAYER], pextra) {
if (is_extra_drawing_enabled(pextra)
&& tile_has_extra(ptile, pextra)
&& t->sprites.extras[extra_index(pextra)].u.bmf.foreground) {
&& t->sprites.extras[extra_index(pextra)].u.bmf.foreground != nullptr) {
bool hidden = FALSE;
extra_type_list_iterate(pextra->hiders, phider) {
......
} extra_type_list_iterate_end;
if (!hidden) {
if (t->sprites.extras[extra_index(pextra)].u.bmf.foreground) {
ADD_SPRITE_FULL(t->sprites.extras[extra_index(pextra)].u.bmf.foreground);
if (t->sprites.extras[extra_index(pextra)].u.bmf.foreground != nullptr) {
ADD_ANIM_FULL(t->sprites.extras[extra_index(pextra)].u.bmf.foreground);
}
}
}
......
}\
} while (FALSE)
#define ADD_ANIM_IF_NOT_NULL(x) do {\
if ((x) != nullptr) {\
ADD_ANIM_FULL(x);\
}\
} while (FALSE)
/* Corresponds to LAYER_SPECIAL{1,2,3} order. */
ADD_SPRITE_IF_NOT_NULL(t->sprites.extras[idx].u.bmf.background);
ADD_SPRITE_IF_NOT_NULL(t->sprites.extras[idx].u.bmf.middleground);
ADD_SPRITE_IF_NOT_NULL(t->sprites.extras[idx].u.bmf.foreground);
ADD_ANIM_IF_NOT_NULL(t->sprites.extras[idx].u.bmf.foreground);
#undef ADD_SPRITE_IF_NOT_NULL
#undef ADD_ANIM_IF_NOT_NULL
return sprs - saved_sprs;
}
data/alio/fortresses.spec
tiles = { "row", "column", "tag"
0, 0, "base.force_fortress_bg"
1, 0, "base.force_fortress_fg"
1, 0, "base.force_fortress_fg_0"
0, 1, "base.tower_bg"
1, 1, "base.tower_fg"
1, 1, "base.tower_fg_0"
}
data/amplio/moderncities.spec
0, 0, "city.disorder"
0, 1, "base.airbase_mg"
0, 2, "tx.airbase_full"
0, 4, "base.outpost_fg"
0, 4, "base.outpost_fg_0"
0, 5, "base.outpost_bg"
0, 6, "city.electricage_occupied_0"
0, 6, "city.modern_occupied_0"
......
0, 9, "extra.ruins_mg"
1, 1, "base.airstrip_mg"
1, 4, "base.fortress_fg"
1, 4, "base.fortress_fg_0"
1, 5, "base.fortress_bg"
;
; city tiles
data/amplio2/bases.spec
0, 0, "base.airbase_mg"
0, 1, "tx.airbase_full"
;[HH]
0, 3, "base.fortress_fg"
0, 3, "base.fortress_fg_0"
0, 4, "base.fortress_bg"
;[HH][GS]
1, 0, "base.airstrip_mg"
......
;[VC]
1, 2, "extra.ruins_mg"
;[HH][GS]
1, 3, "base.outpost_fg"
1, 3, "base.outpost_fg_0"
1, 4, "base.outpost_bg"
; [SK]
1, 5, "extra.transport_hub_mg"
;[Lexxie]
2, 2, "base.castle2_fg" ; alternate castle (larger 'closed' version which makes hidden units more plausible ...
2, 2, "base.castle2_fg_0" ; Alternate castle (larger 'closed' version which makes hidden units more plausible ...
2, 3, "base.castle2_bg" ; ... but also hides the terrain graphics)
2, 4, "base.castle_fg"
2, 4, "base.castle_fg_0"
2, 5, "base.castle_bg"
;[HH]
0, 2, "cd.occupied",
data/hex2t/items.spec
1, 3, "base.airstrip_mg"
1, 5, "base.buoy_mg"
1, 6, "extra.ruins_mg"
3, 8, "base.outpost_fg"
3, 8, "base.outpost_fg_0"
3, 9, "base.outpost_bg"
4, 8, "base.fortress_fg"
4, 8, "base.fortress_fg_0"
4, 9, "base.fortress_bg"
; default city tiles
data/hexemplio/bases.spec
0, 1, "base.airbase_mg"
1, 1, "tx.airbase_full"
;[HH][GS]
1, 2, "base.outpost_fg"
1, 2, "base.outpost_fg_0"
0, 2, "base.outpost_bg"
;[HH]
1, 3, "base.fortress_fg"
1, 3, "base.fortress_fg_0"
0, 3, "base.fortress_bg"
;[HH]
0, 4, "city.disorder"
data/isotrident/cities.spec
0, 1, "base.airbase_mg"
0, 2, "tx.airbase_full"
0, 3, "base.airstrip_mg"
0, 4, "base.fortress_fg"
0, 4, "base.fortress_fg_0"
0, 5, "base.fortress_bg"
0, 6, "extra.ruins_mg"
0, 7, "base.buoy_mg"
0, 8, "base.outpost_fg"
0, 8, "base.outpost_fg_0"
0, 9, "base.outpost_bg"
;
(1-1/2)