From 9d827b13dabc34fedec5f24bb9da034865625741 Mon Sep 17 00:00:00 2001 From: Yamagi Date: Sat, 5 Feb 2022 16:49:42 +0100 Subject: [PATCH] Force an empty clip mask for thrown heads. The ThrowHead() and ThrowClientHead() functions are special. They transform the entity given in `self` (mostly the caller itself) into a ripped off head. They don't reset the entities clip mask, which may cause problems in interactions with other entities. Fix that by reseting the clip mask to `0`. `0` should be save, because that's the default and and least SV_TestEntityPosition() handles `0` clip masks. Suggested by @BjossiAlfreds. --- src/game/g_misc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/game/g_misc.c b/src/game/g_misc.c index 29dcff32..cae25074 100644 --- a/src/game/g_misc.c +++ b/src/game/g_misc.c @@ -277,6 +277,10 @@ ThrowHead(edict_t *self, char *gibname, int damage, int type) self->targetname = NULL; self->die = gib_die; + // The entity still has the monsters clipmaks. + // Reset it to 0 to be on the save side. + self->clipmask = 0; + if (type == GIB_ORGANIC) { self->movetype = MOVETYPE_TOSS; @@ -335,6 +339,10 @@ ThrowClientHead(edict_t *self, int damage) self->s.sound = 0; self->flags |= FL_NO_KNOCKBACK; + // The entity still has the monsters clipmaks. + // Reset it to 0 to be on the save side. + self->clipmask = 0; + self->movetype = MOVETYPE_BOUNCE; VelocityForDamage(damage, vd); VectorAdd(self->velocity, vd, self->velocity);