summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-04-25 12:44:03 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-04-25 12:44:03 +0200
commit273abc7c37e9bcdb7cf8d092ed356de01b906146 (patch)
tree748c0f589ce38bdba93b2fac615e62e04dcbe5ee /src/game
parent7fe865d745fede7e2628ecf0c91b38bb15154cb3 (diff)
Improve unit says a bit.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/unit_builder.cpp2
-rw-r--r--src/game/units.cpp14
2 files changed, 12 insertions, 4 deletions
diff --git a/src/game/unit_builder.cpp b/src/game/unit_builder.cpp
index 1ed7f58..d35a1fc 100644
--- a/src/game/unit_builder.cpp
+++ b/src/game/unit_builder.cpp
@@ -121,6 +121,8 @@ void unit_builder_t::command_build(v2f_t where, type_t what)
repairing = true;
building = true;
repairing_at = where;
+
+ say("Rozpoczynam budowę.");
}
void unit_builder_t::repair(void)
diff --git a/src/game/units.cpp b/src/game/units.cpp
index e9abda4..73ea43a 100644
--- a/src/game/units.cpp
+++ b/src/game/units.cpp
@@ -56,15 +56,21 @@ void unit_t::render_to(render::state_t *render)
if (move.moving && debug_draw_paths)
render->debug_path(x, &move.path);
- if (!dead && say_time + 5.0 > game->now) {
+ if (!dead && say_time + 3.0 > game->now) {
+ float anim, height;
v2f_t text_pos;
- float height;
+ sf::Color color;
+
+ anim = pow((game->now - say_time) / 3.0f, 5.0f);
text_pos = render_bounds[0] + v2f_t(render_bounds.dim(0) / 2, -render_bounds.dim(1) * 0.1);
height = size.dim_min() * 0.50f;
+
+ text_pos[1] -= anim * height * 2.0f;
+ color = sf::Color(255, 255, 255, 255.0f * (1.0f - anim));
+
render->render_text(text_pos, height, say_text,
- render::ALIGN_CENTER_BOTTOM,
- sf::Color::White);
+ render::ALIGN_CENTER_BOTTOM, color);
}
if (selected == selection_cookie && type != UNIT_SOLDIER &&