mirror of
https://github.com/yquake2/xatrix.git
synced 2024-11-10 14:52:06 +00:00
Merge pull request #79 from BjossiAlfreds/collision
Prevent dead bodies from obstructing elevators and falling through them
This commit is contained in:
commit
b5149f927c
1 changed files with 20 additions and 10 deletions
30
src/g_phys.c
30
src/g_phys.c
|
@ -35,15 +35,18 @@
|
||||||
edict_t *
|
edict_t *
|
||||||
SV_TestEntityPosition(edict_t *ent)
|
SV_TestEntityPosition(edict_t *ent)
|
||||||
{
|
{
|
||||||
|
trace_t trace;
|
||||||
|
int mask;
|
||||||
|
|
||||||
if (!ent)
|
if (!ent)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace_t trace;
|
/* dead bodies are supposed to not be solid so lets
|
||||||
int mask;
|
ensure they only collide with BSP during pushmoves
|
||||||
|
*/
|
||||||
if (ent->clipmask)
|
if (ent->clipmask && !(ent->svflags & SVF_MONSTER))
|
||||||
{
|
{
|
||||||
mask = ent->clipmask;
|
mask = ent->clipmask;
|
||||||
}
|
}
|
||||||
|
@ -52,12 +55,8 @@ SV_TestEntityPosition(edict_t *ent)
|
||||||
mask = MASK_SOLID;
|
mask = MASK_SOLID;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace = gi.trace(ent->s.origin,
|
trace = gi.trace(ent->s.origin, ent->mins, ent->maxs,
|
||||||
ent->mins,
|
ent->s.origin, ent, mask);
|
||||||
ent->maxs,
|
|
||||||
ent->s.origin,
|
|
||||||
ent,
|
|
||||||
mask);
|
|
||||||
|
|
||||||
if (trace.startsolid)
|
if (trace.startsolid)
|
||||||
{
|
{
|
||||||
|
@ -505,6 +504,17 @@ retry:
|
||||||
|
|
||||||
trace = gi.trace(start, ent->mins, ent->maxs, end, ent, mask);
|
trace = gi.trace(start, ent->mins, ent->maxs, end, ent, mask);
|
||||||
|
|
||||||
|
/* startsolid treats different-content volumes
|
||||||
|
as continuous, like the bbox of a monster/player
|
||||||
|
and the floor of an elevator. So do another trace
|
||||||
|
that only collides with BSP so that we make a best
|
||||||
|
effort to keep these entities inside non-solid space
|
||||||
|
*/
|
||||||
|
if (trace.startsolid && (mask & ~MASK_SOLID))
|
||||||
|
{
|
||||||
|
trace = gi.trace (start, ent->mins, ent->maxs, end, ent, MASK_SOLID);
|
||||||
|
}
|
||||||
|
|
||||||
VectorCopy(trace.endpos, ent->s.origin);
|
VectorCopy(trace.endpos, ent->s.origin);
|
||||||
gi.linkentity(ent);
|
gi.linkentity(ent);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue