mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-23 04:52:07 +00:00
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:
parent
281aaeebbd
commit
c41f61f8fb
1 changed files with 18 additions and 0 deletions
|
@ -1085,6 +1085,8 @@ SV_Physics_Step(edict_t *ent)
|
||||||
float friction;
|
float friction;
|
||||||
edict_t *groundentity;
|
edict_t *groundentity;
|
||||||
int mask;
|
int mask;
|
||||||
|
vec3_t oldorig;
|
||||||
|
trace_t tr;
|
||||||
|
|
||||||
if (!ent)
|
if (!ent)
|
||||||
{
|
{
|
||||||
|
@ -1210,8 +1212,24 @@ SV_Physics_Step(edict_t *ent)
|
||||||
mask = MASK_SOLID;
|
mask = MASK_SOLID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VectorCopy(ent->s.origin, oldorig);
|
||||||
SV_FlyMove(ent, FRAMETIME, mask);
|
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);
|
gi.linkentity(ent);
|
||||||
G_TouchTriggers(ent);
|
G_TouchTriggers(ent);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue