From 478c6d955abc27024599aefbf483f55efe39da55 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 21 Apr 2018 21:54:19 +0200 Subject: Shoot from the human's center but keep the vfx as-is. --- src/game/unit_soldier.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/game') diff --git a/src/game/unit_soldier.cpp b/src/game/unit_soldier.cpp index db206d1..221667b 100644 --- a/src/game/unit_soldier.cpp +++ b/src/game/unit_soldier.cpp @@ -77,6 +77,7 @@ void unit_soldier_t::shoot(v2f_t from, v2f_t at, int damage) { world::trace_t trace; fx_tracer_t *tracer; + v2f_t muzzle_point; trace = world->ray_v_all_p3d(from, at, CF_SOLID|CF_BODY|CF_BODY_SMALL, -1, this); if (trace.hit && trace.ent) { @@ -84,7 +85,8 @@ void unit_soldier_t::shoot(v2f_t from, v2f_t at, int damage) ent->damage(damage, this); } - tracer = new fx_tracer_t(game, from, trace.end); + muzzle_point = x + v2f_t(0, -0.7f); + tracer = new fx_tracer_t(game, muzzle_point, trace.end); tracer->place(&game->world); if (trace.hit && (!trace.ent || trace.ent->type == ET_UNIT)) { @@ -106,8 +108,6 @@ void unit_soldier_t::fire_shotgun(v2f_t aim) if (next_attack && game->time < next_attack) return; - muzzle_point = x + v2f_t(0, -0.7f); - trace = world->ray_v_all_p3d(x, aim, CF_SOLID|CF_BODY|CF_BODY_SMALL, -1, this); if (!manual_firing && trace.hit && trace.ent && trace.ent->type == ET_UNIT) { @@ -121,11 +121,11 @@ void unit_soldier_t::fire_shotgun(v2f_t aim) for (size_t i = 0; i < 7; i++) { v2f_t end; - end = spread_aim(muzzle_point, aim, 0.15f, &game->prng); - shoot(muzzle_point, end, 2); + end = spread_aim(x, aim, 0.15f, &game->prng); + shoot(x, end, 2); } - flash = new fx_flash_t(game, muzzle_point, 5.0f, sf::Color(255, 170, 50, 80)); + flash = new fx_flash_t(game, x, 5.0f, sf::Color(255, 170, 50, 80)); flash->place(&game->world); assets::soldier.fire.play_3d(x); game->hivemind_alert(x, 14.0f, true, x); -- cgit