summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/effects.cpp2
-rw-r--r--src/game/game.cpp38
-rw-r--r--src/game/rocket.cpp1
3 files changed, 22 insertions, 19 deletions
diff --git a/src/game/effects.cpp b/src/game/effects.cpp
index b69647c..858da5a 100644
--- a/src/game/effects.cpp
+++ b/src/game/effects.cpp
@@ -174,8 +174,6 @@ fx_explosion_t::fx_explosion_t(state_t *game_, v2f_t x_) : effect_t(game_)
flash = new fx_flash_t(game, x, 5.0f, sf::Color(255, 255, 170, 255));
flash->place(&game->world);
-
- game->hivemind_alert(x, 20.0f, false, v2f_t(0, 0));
}
void fx_explosion_t::render_to(render::state_t *render)
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 72aabf2..361fa83 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -431,33 +431,37 @@ void state_t::compute_ambience(render::state_t *render)
void state_t::explosion(v2f_t x)
{
fx_explosion_t *explosion;
+ const float r = 5.0f;
+ rectf_t rect;
- explosion = new fx_explosion_t(this, x);
- explosion->place(&world);
+ rect[0] = x - v2f_t(r, r);
+ rect[1] = x + v2f_t(r, r);
- for (size_t i = 0; i < 60; i++) {
- v2f_t end;
+ for (world::entity_t *ent : world.get_entities(rect, -1)) {
+ v2f_t center;
+ float dist, damage;
world::trace_t trace;
- fx_tracer_t *tracer;
- entity_t *ent;
- int damage;
+ entity_t *g_ent;
- end = x + prng.unit_vec2() * 6.0f;
- trace = world.ray_v_all(x, end, CF_SURFACE|CF_SOLID|CF_BODY|CF_BODY_SMALL|CF_DECOS, nullptr);
+ center = ent->cmodel.bounds.center();
- tracer = new fx_tracer_t(this, x, trace.end);
- tracer->place(&world);
-
- if (!trace.hit)
+ dist = (center - x).len();
+ if (dist > r)
continue;
- if (!trace.ent)
+ trace = world.ray_v_all(x, center, CF_SOLID, ent);
+ if (trace.frac < 1.0f)
continue;
- ent = dynamic_cast<entity_t*>(trace.ent);
- damage = pow(1 - trace.frac, 2.0f) * 20.0f;
- ent->damage(damage, nullptr);
+ damage = clamp(40.0f / dist, 0.0f, 1000.0f);
+ g_ent = dynamic_cast<entity_t*>(ent);
+ g_ent->damage((int)damage, nullptr);
}
+
+ explosion = new fx_explosion_t(this, x);
+ explosion->place(&world);
+
+ hivemind_alert(x, 20.0f, false, v2f_t(0, 0));
}
} //namespace game
diff --git a/src/game/rocket.cpp b/src/game/rocket.cpp
index 5310922..ccdc788 100644
--- a/src/game/rocket.cpp
+++ b/src/game/rocket.cpp
@@ -64,6 +64,7 @@ void rocket_t::on_think(void)
bullet_miss = new fx_bullet_miss_t(game, trace.end, true);
bullet_miss->place(world);
} else {
+ cmodel.ignore = true;
game->explosion(trace.end);
}