diff options
Diffstat (limited to 'src/game/units.cpp')
-rw-r--r-- | src/game/units.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/game/units.cpp b/src/game/units.cpp index f760304..a6edc48 100644 --- a/src/game/units.cpp +++ b/src/game/units.cpp @@ -7,11 +7,14 @@ unit_t::unit_t(game::state_t *game_, unit_t::type_t type_) : game::entity_t(game type = type_; } -void unit_t::render_to(render::state_t *render) +void unit_t::render_to_pre(render::state_t *render) { - if (selected == selection_cookie) - render->render_hlrect(render_bounds, sf::Color::Blue); + if (!dead && selected == selection_cookie) + render->render(0.0, &assets::unit_selected, cmodel.bounds); +} +void unit_t::render_to(render::state_t *render) +{ if (!dead && health < max_health) { rectf_t bar; @@ -270,8 +273,8 @@ unit_soldier_t::unit_soldier_t(game::state_t *game) : unit_t(game, UNIT_SOLDIER) { size[0] = v2f_t(-0.3f, +0.0f); size[1] = v2f_t(+0.3f, +0.3f); - render_size[0] = v2f_t(-0.5f, -1.0f); - render_size[1] = v2f_t(+0.5f, +0.5f); + render_size[0] = v2f_t(-0.5f, -1.2f); + render_size[1] = v2f_t(+0.5f, +0.3f); cmodel.cflags = CF_BODY; move.cflags = CF_SOLID | CF_BODY | CF_WATER; @@ -436,6 +439,8 @@ void unit_soldier_t::on_death(void) void unit_soldier_t::render_to(render::state_t *render) { + unit_t::render_to_pre(render); + if (!dead) { render::oriented_sprite_t *legs, *body; float body_angle; @@ -544,6 +549,8 @@ void unit_spider_t::render_to(render::state_t *render) { bool moving; + unit_t::render_to_pre(render); + moving = move.moving && !move.blocked; if (!dead) @@ -621,6 +628,8 @@ void unit_nest_t::on_death(void) void unit_nest_t::render_to(render::state_t *render) { + unit_t::render_to_pre(render); + if (!dead) render->render(game->now, &assets::nest.idle, render_bounds); else |