Fix long standing bug of dead parasites falling through the world model.

It's unclear were this comes from, maybe it's a bug in the collision
detection. Because the collision detection is ununderstandable for
people without 'special brain type game programming' like me and even
bugfixes to it have a very high chance to break things, work around
it. Save current position, perform move, check if we're in the world
model. If we are revert to old position.

Debugged and work arounf suggested by @BjossiAlfreds. Fixes #443.
This commit is contained in:
Yamagi Burmeister 2019-09-06 07:46:59 +02:00
parent 281aaeebbd
commit c41f61f8fb

View file

@ -1085,6 +1085,8 @@ SV_Physics_Step(edict_t *ent)
float friction;
edict_t *groundentity;
int mask;
vec3_t oldorig;
trace_t tr;
if (!ent)
{
@ -1210,8 +1212,24 @@ SV_Physics_Step(edict_t *ent)
mask = MASK_SOLID;
}
VectorCopy(ent->s.origin, oldorig);
SV_FlyMove(ent, FRAMETIME, mask);
/* Evil hack to work around dead parasites (and maybe other monster)
falling through the worldmodel into the void. We copy the current
origin (see above) and after the SV_FlyMove() was performend we
checl if we're stuck in the world model. If yes we're undoing the
move. */
if (!VectorCompare(ent->s.origin, oldorig))
{
tr = gi.trace(ent->s.origin, ent->mins, ent->maxs, ent->s.origin, ent, mask);
if (tr.startsolid)
{
VectorCopy(oldorig, ent->s.origin);
}
}
gi.linkentity(ent);
G_TouchTriggers(ent);