diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-13 17:32:04 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-13 17:32:04 +0200 |
commit | 93ab25508f68481f307ec19f3f7459b2ea54f8b4 (patch) | |
tree | a9c0382f3c8cb527bfb968291a845d37c1edf231 /src | |
parent | a055c2aa0aba2a3b80a37c49f3f89cc64d86abd6 (diff) |
Let rockets destroy decos.
Diffstat (limited to 'src')
-rw-r--r-- | src/game/decos.cpp | 18 | ||||
-rw-r--r-- | src/game/game.cpp | 11 | ||||
-rw-r--r-- | src/game/game.hpp | 3 |
3 files changed, 18 insertions, 14 deletions
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<unit_t*>(trace.ent); - damage = pow(1 - trace.frac, 2.0f) * 40.0f; + ent = dynamic_cast<entity_t*>(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 { |