Feature #1013 ยป 0059-Support-animated-action_decision_want-icon.patch
client/tilespec.c | ||
---|---|---|
int num_stack_sprites;
|
||
bool no_more_stack_sprites;
|
||
struct anim
|
||
*select;
|
||
*select,
|
||
*action_decision_want;
|
||
struct sprite
|
||
*hp_bar[NUM_TILES_HP_BAR],
|
||
*vet_lev[MAX_VET_LEVELS],
|
||
... | ... | |
*patrol,
|
||
*convert,
|
||
*battlegroup[MAX_NUM_BATTLEGROUPS],
|
||
*action_decision_want,
|
||
*lowfuel,
|
||
*tired;
|
||
} unit;
|
||
... | ... | |
return ret;
|
||
}
|
||
/************************************************************************//**
|
||
Proceed with the animation.
|
||
@param a Animation to advance
|
||
****************************************************************************/
|
||
static void anim_advance_time(struct anim *a)
|
||
{
|
||
a->current++;
|
||
a->current %= a->frames;
|
||
}
|
||
/************************************************************************//**
|
||
Setup the graphics for specialist types in the default sprite set.
|
||
****************************************************************************/
|
||
... | ... | |
SET_SPRITE(unit.lowfuel, "unit.lowfuel");
|
||
SET_SPRITE(unit.tired, "unit.tired");
|
||
SET_SPRITE_OPT(unit.action_decision_want, "unit.action_decision_want");
|
||
t->sprites.unit.action_decision_want = anim_load(t, "unit.action_decision_want");
|
||
for (i = 0; i < NUM_TILES_HP_BAR; i++) {
|
||
fc_snprintf(buffer, sizeof(buffer), "unit.hp_%d", i*10);
|
||
... | ... | |
#define ADD_SPRITE_FULL(s) \
|
||
ADD_SPRITE(s, TRUE, FULL_TILE_X_OFFSET, FULL_TILE_Y_OFFSET)
|
||
#define ADD_ANIM_SPRITE(s, draw_fog, x_offset, y_offset) \
|
||
ADD_SPRITE(s->sprites[s->current], draw_fog, x_offset, y_offset)
|
||
/************************************************************************//**
|
||
Assemble some data that is used in building the tile sprite arrays.
|
||
(map_x, map_y) : the (normalized) map position
|
||
... | ... | |
}
|
||
}
|
||
if (t->sprites.unit.action_decision_want != NULL
|
||
if (t->sprites.unit.action_decision_want != nullptr
|
||
&& should_ask_server_for_actions(punit)) {
|
||
ADD_SPRITE(t->sprites.unit.action_decision_want, TRUE,
|
||
FULL_TILE_X_OFFSET + t->activity_offset_x,
|
||
FULL_TILE_Y_OFFSET + t->activity_offset_y);
|
||
anim_advance_time(t->sprites.unit.action_decision_want);
|
||
ADD_ANIM_SPRITE(t->sprites.unit.action_decision_want, TRUE,
|
||
FULL_TILE_X_OFFSET + t->activity_offset_x,
|
||
FULL_TILE_Y_OFFSET + t->activity_offset_y);
|
||
}
|
||
if (punit->battlegroup != BATTLEGROUP_NONE) {
|
||
... | ... | |
&& t->sprites.unit.select != nullptr) {
|
||
/* Special case for drawing the selection rectangle. The blinking
|
||
* unit is handled separately, inside get_drawable_unit(). */
|
||
ADD_SPRITE(t->sprites.unit.select->sprites[t->sprites.unit.select->current], TRUE,
|
||
t->select_offset_x, t->select_offset_y);
|
||
ADD_ANIM_SPRITE(t->sprites.unit.select, TRUE,
|
||
t->select_offset_x, t->select_offset_y);
|
||
}
|
||
/* Load more stack number sprites if needed. no_more_stack_sprites guard
|
||
... | ... | |
void toggle_focus_unit_state(struct tileset *t)
|
||
{
|
||
if (t->sprites.unit.select != nullptr) {
|
||
t->sprites.unit.select->current++;
|
||
t->sprites.unit.select->current %= t->sprites.unit.select->frames;
|
||
anim_advance_time(t->sprites.unit.select);
|
||
} else {
|
||
focus_unit_state = !focus_unit_state;
|
||
}
|
||
... | ... | |
anim_free(t->sprites.unit.select);
|
||
t->sprites.unit.select = nullptr;
|
||
anim_free(t->sprites.unit.action_decision_want);
|
||
t->sprites.unit.action_decision_want = nullptr;
|
||
tileset_background_free(t);
|
||
}
|
data/amplio/tiles.spec | ||
---|---|---|
0, 18, "unit.auto_attack",
|
||
"unit.auto_worker"
|
||
0, 19, "unit.stack"
|
||
1, 16, "unit.action_decision_want"
|
||
1, 16, "unit.action_decision_want0"
|
||
1, 17, "unit.loaded"
|
||
1, 18, "unit.connect"
|
||
1, 19, "unit.auto_explore"
|
data/amplio2/activities.spec | ||
---|---|---|
4, 0, "unit.goto"
|
||
4, 1, "unit.convert"
|
||
4, 2, "unit.auto_explore"
|
||
4, 3, "unit.action_decision_want"
|
||
4, 3, "unit.action_decision_want0"
|
||
; [GS]
|
||
5, 0, "unit.irrigation"
|
data/hex2t/items.spec | ||
---|---|---|
; Unit activity letters: (note unit icons have just "u.")
|
||
0, 12, "unit.action_decision_want"
|
||
0, 12, "unit.action_decision_want0"
|
||
0, 13, "unit.convert"
|
||
0, 14, "unit.auto_attack",
|
||
"unit.auto_worker"
|
data/hexemplio/activities.spec | ||
---|---|---|
0, 4, "unit.goto" ;[?]
|
||
; 0, 5, "unit.patrol" ;[?]
|
||
0, 6, "unit.convert" ;[?][GS]
|
||
0, 7, "unit.action_decision_want"
|
||
0, 7, "unit.action_decision_want0"
|
||
; Unit activity letters: tile commands
|
||