summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/effects.cpp14
-rw-r--r--src/game/game.hpp3
-rw-r--r--src/game/unit_repl.cpp2
-rw-r--r--src/game/unit_soldier.cpp5
-rw-r--r--src/render.cpp1
5 files changed, 17 insertions, 8 deletions
diff --git a/src/game/effects.cpp b/src/game/effects.cpp
index 6f92f17..da045ef 100644
--- a/src/game/effects.cpp
+++ b/src/game/effects.cpp
@@ -63,12 +63,13 @@ void fx_tracer_t::render_to(render::state_t *render)
}
-fx_flash_t::fx_flash_t(state_t *game_, v2f_t x_, float radius_) : effect_t(game_)
+fx_flash_t::fx_flash_t(state_t *game_, v2f_t x_, float radius_, sf::Color color_) : effect_t(game_)
{
ttl = game->now + 0.07;
x = x_;
radius = radius_;
+ color = color_;
render_bounds[0] = x - v2f_t(radius, radius);
render_bounds[1] = x + v2f_t(radius, radius);
@@ -83,7 +84,7 @@ fx_flash_t::fx_flash_t(state_t *game_, v2f_t x_, float radius_) : effect_t(game_
void fx_flash_t::render_to(render::state_t *render)
{
- render->render(0.0f, &assets::fx.flash, render_bounds, sf::Color(255, 170, 50, 80));
+ render->render(0.0f, &assets::fx.flash, render_bounds, color);
}
fx_blood_t::fx_blood_t(state_t *game_, v2f_t x_, bool alien_) : effect_t(game_)
@@ -154,7 +155,9 @@ void fx_aim_marker_t::render_to(render::state_t *render)
fx_explosion_t::fx_explosion_t(state_t *game_, v2f_t x_) : effect_t(game_)
{
- ttl = game->now + 1.3;
+ fx_flash_t *flash;
+
+ ttl = game->now + 0.8;
x = x_;
@@ -168,11 +171,14 @@ fx_explosion_t::fx_explosion_t(state_t *game_, v2f_t x_) : effect_t(game_)
wake();
assets::fx.explosion_sound.play_3d(x);
+
+ flash = new fx_flash_t(game, x, 5.0f, sf::Color(255, 255, 170, 255));
+ flash->place(&game->world);
}
void fx_explosion_t::render_to(render::state_t *render)
{
- double phase = (game->now - ttl) / 1.3f;
+ double phase = (game->now - ttl) / 0.8f;
render->render(phase, &assets::fx.explosion, render_bounds, sf::Color::White);
}
diff --git a/src/game/game.hpp b/src/game/game.hpp
index 27faf46..8a6d2ba 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -334,9 +334,10 @@ namespace game {
class fx_flash_t : public effect_t {
v2f_t x;
float radius;
+ sf::Color color;
public:
- fx_flash_t(game::state_t *game_, v2f_t x_, float radius_);
+ fx_flash_t(game::state_t *game_, v2f_t x_, float radius_, sf::Color color_);
~fx_flash_t(void) {};
void render_to(render::state_t *render);
diff --git a/src/game/unit_repl.cpp b/src/game/unit_repl.cpp
index 11f49ae..c8c6f00 100644
--- a/src/game/unit_repl.cpp
+++ b/src/game/unit_repl.cpp
@@ -25,7 +25,7 @@ unit_repl_t::unit_repl_t(game::state_t *game_) : unit_t(game_, UNIT_REPL)
size[1] = {+0.4f, +0.6f};
render_size = size;
render_layer = render::LAYER_FLAT;
- cmodel.cflags = CF_BACKGROUND;
+ cmodel.cflags = CF_BODY_SMALL;
name = text::get(text::UNIT_NAME_REPL);
ignore_waking = false;
diff --git a/src/game/unit_soldier.cpp b/src/game/unit_soldier.cpp
index f4432bf..c6ed4dd 100644
--- a/src/game/unit_soldier.cpp
+++ b/src/game/unit_soldier.cpp
@@ -85,7 +85,8 @@ void unit_soldier_t::shoot(v2f_t aim)
end = x + (aim - x).norm() * 40;
trace = world->ray_v_all(x, end, CF_SOLID|CF_BODY|CF_BODY_SMALL, this);
- if (trace.hit && trace.ent && trace.ent->type == ET_UNIT) {
+ if (!manual_firing && trace.hit &&
+ trace.ent && trace.ent->type == ET_UNIT) {
unit_t *unit = dynamic_cast<unit_t*>(trace.ent);
// Refuse to shoot friendlies.
@@ -98,7 +99,7 @@ void unit_soldier_t::shoot(v2f_t aim)
tracer = new fx_tracer_t(game, muzzle_point, trace.end);
tracer->place(&game->world);
- flash = new fx_flash_t(game, muzzle_point, 5.0f);
+ flash = new fx_flash_t(game, muzzle_point, 5.0f, sf::Color(255, 170, 50, 80));
flash->place(&game->world);
last_attack = game->now;
diff --git a/src/render.cpp b/src/render.cpp
index 185e5e6..69e2d6c 100644
--- a/src/render.cpp
+++ b/src/render.cpp
@@ -336,6 +336,7 @@ void state_t::render(double phase, animated_texture_t *anim, rectf_t bounds, sf:
if (!anim->frame_count)
return;
+ phase += 0.001; // FIXME
frame = floor((phase - floor(phase)) * anim->frame_count);
wot_rect.setTexture(anim->frames + frame, true);