From 93ab25508f68481f307ec19f3f7459b2ea54f8b4 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Fri, 13 Apr 2018 17:32:04 +0200 Subject: Let rockets destroy decos. --- src/game/decos.cpp | 18 ++++++++++++------ src/game/game.cpp | 11 ++++------- src/game/game.hpp | 3 ++- 3 files changed, 18 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/game/decos.cpp b/src/game/decos.cpp index bbb1cee..53e9b88 100644 --- a/src/game/decos.cpp +++ b/src/game/decos.cpp @@ -38,7 +38,7 @@ static const struct { }, { &assets::deco.stone, - {-0.2f, +0.1f}, {+0.2f, +0.2f}, 0, + {-0.2f, +0.1f}, {+0.2f, +0.2f}, CF_DECOS, {-0.2f, -0.2f}, {+0.2f, +0.2f}, 0.0 }, { @@ -48,7 +48,7 @@ static const struct { }, { &assets::deco.eyething_dead, - {-0.4f, -0.4f}, {+0.4f, +0.4f}, 0, + {-0.4f, -0.4f}, {+0.4f, +0.4f}, CF_DECOS, {-0.4f, -1.2f}, {+0.4f, +0.4f}, 0.3 }, { @@ -58,17 +58,17 @@ static const struct { }, { &assets::deco.spike_broken, - {-0.4f, -0.4f}, {+0.4f, +0.4f}, 0, + {-0.4f, -0.4f}, {+0.4f, +0.4f}, CF_DECOS, {-0.4f, -1.2f}, {+0.4f, +0.4f}, 0.0 }, { &assets::deco.spike_small, - {-0.2f, +0.1f}, {+0.2f, +0.2f}, 0, + {-0.2f, +0.1f}, {+0.2f, +0.2f}, CF_DECOS, {-0.2f, -0.6f}, {+0.2f, +0.2f}, 0.0 }, { &assets::deco.wart, - {-0.2f, +0.1f}, {+0.2f, +0.2f}, 0, + {-0.2f, +0.1f}, {+0.2f, +0.2f}, CF_DECOS, {-0.2f, -0.2f}, {+0.2f, +0.2f}, 0.0 } }; @@ -105,8 +105,14 @@ void deco_t::damage(int points, unit_t *attacker) type = DECO_SPIKE_BROKEN; break; - default: + case DECO_STONE_CRACKED: + case DECO_EYETHING_DEAD: + case DECO_SPIKE_BROKEN: break; + + default: + delete this; + return; } cmodel.cflags = decos[type].cflags; diff --git a/src/game/game.cpp b/src/game/game.cpp index 03033fb..547d890 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -416,25 +416,22 @@ void state_t::explosion(v2f_t x) explosion = new fx_explosion_t(this, x); explosion->place(&world); - for (size_t i = 0; i < 30; i++) { + for (size_t i = 0; i < 60; i++) { v2f_t end; world::trace_t trace; entity_t *ent; int damage; end = x + prng.unit_vec2() * 6.0f; - trace = world.ray_v_all(x, end, CF_SOLID|CF_BODY|CF_BODY_SMALL, NULL); + trace = world.ray_v_all(x, end, CF_SOLID|CF_BODY|CF_BODY_SMALL|CF_DECOS, nullptr); if (!trace.hit) continue; if (!trace.ent) continue; - if (trace.ent->type != ET_UNIT) - continue; - - ent = dynamic_cast(trace.ent); - damage = pow(1 - trace.frac, 2.0f) * 40.0f; + ent = dynamic_cast(trace.ent); + damage = pow(1 - trace.frac, 2.0f) * 20.0f; ent->damage(damage, nullptr); } } diff --git a/src/game/game.hpp b/src/game/game.hpp index 20b2b41..089faf0 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -40,7 +40,8 @@ namespace game { CF_SOLID = 2, CF_BODY = 4, CF_BODY_SMALL = 8, - CF_WATER = 16 + CF_WATER = 16, + CF_DECOS = 32 }; enum { -- cgit