From 49f92a0c724f51ceffb44e760e217389b004f65b Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Wed, 12 Oct 2011 07:50:52 +0000 Subject: [PATCH] Correctly destroy blocking entities and derefernce entities destroyed by the killbox --- src/g_func.c | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/src/g_func.c b/src/g_func.c index 2ba9285..14878b0 100644 --- a/src/g_func.c +++ b/src/g_func.c @@ -487,7 +487,15 @@ void plat_blocked (edict_t *self, edict_t *other) T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); // if it's still there, nuke it if (other) - BecomeExplosion1 (other); + { + /* Hack for entity without it's origin near the model */ + vec3_t save; + VectorCopy(other->s.origin,save); + VectorMA (other->absmin, 0.5, other->size, other->s.origin); + + BecomeExplosion1(other); + } + return; } @@ -1262,7 +1270,15 @@ void door_blocked (edict_t *self, edict_t *other) T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); // if it's still there, nuke it if (other) - BecomeExplosion1 (other); + { + /* Hack for entitiy without their origin near the model */ + vec3_t save; + VectorCopy(other->s.origin,save); + VectorMA (other->absmin, 0.5, other->size, other->s.origin); + + BecomeExplosion1(other); + } + return; } @@ -1655,7 +1671,15 @@ void train_blocked (edict_t *self, edict_t *other) T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); // if it's still there, nuke it if (other) - BecomeExplosion1 (other); + { + /* Hack for entity without an origin near the model */ + vec3_t save; + VectorCopy(other->s.origin,save); + VectorMA (other->absmin, 0.5, other->size, other->s.origin); + + BecomeExplosion1(other); + } + return; } @@ -2219,7 +2243,15 @@ void door_secret_blocked (edict_t *self, edict_t *other) T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); // if it's still there, nuke it if (other) - BecomeExplosion1 (other); + { + /* Hack for entities without their origin near the model */ + vec3_t save; + VectorCopy(other->s.origin,save); + VectorMA (other->absmin, 0.5, other->size, other->s.origin); + + BecomeExplosion1(other); + } + return; } @@ -2310,6 +2342,15 @@ Kills everything inside when fired, irrespective of protection. void use_killbox (edict_t *self, edict_t *other, edict_t *activator) { KillBox (self); + + /* Hack to make sure that really everything is killed */ + self->count--; + + if (!self->count) + { + self->think = G_FreeEdict; + self->nextthink = level.time + 1; + } } void SP_func_killbox (edict_t *ent)