Stop monsters from being able to step into the lower part of solid pushers (fixing bug from content-overridees feature).

This commit is contained in:
Shpoike 2021-03-06 04:51:40 +00:00
parent 4b36084023
commit 58261f7580
3 changed files with 28 additions and 15 deletions

View file

@ -744,7 +744,7 @@ void SV_PushMove (edict_t *pusher, float movetime)
// see if the ent's bbox is inside the pusher's final position
if (pusher->v.skin < 0)
{ //a more precise check...
if (!SV_ClipMoveToEntity (pusher, check->v.origin, check->v.mins, check->v.maxs, check->v.origin).startsolid)
if (!SV_ClipMoveToEntity (pusher, check->v.origin, check->v.mins, check->v.maxs, check->v.origin, CONTENTMASK_ANYSOLID).startsolid)
continue;
}
else

View file

@ -810,7 +810,7 @@ Handles selection or creation of a clipping hull, and offseting (and
eventually rotation) of the end points
==================
*/
trace_t SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end)
trace_t SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, unsigned int hitcontents)
{
trace_t trace;
vec3_t offset;
@ -928,14 +928,24 @@ static void SV_ClipToLinks ( areanode_t *node, moveclip_t *clip )
continue; // don't clip against owner
}
if ((int)touch->v.flags & FL_MONSTER)
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins2, clip->maxs2, clip->end);
if (touch->v.skin < 0)
{
if (!(clip->hitcontents & (1<<-(int)touch->v.skin)))
continue; //not solid, don't bother trying to clip.
if ((int)touch->v.flags & FL_MONSTER)
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins2, clip->maxs2, clip->end, ~(1<<-CONTENTS_EMPTY));
else
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins, clip->maxs, clip->end, ~(1<<-CONTENTS_EMPTY));
if (trace.contents != CONTENTS_EMPTY)
trace.contents = touch->v.skin;
}
else
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins, clip->maxs, clip->end);
if (trace.contents == CONTENTS_SOLID && touch->v.skin < 0)
trace.contents = touch->v.skin;
if (!((1<<(-trace.contents)) & clip->hitcontents))
continue;
{
if ((int)touch->v.flags & FL_MONSTER)
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins2, clip->maxs2, clip->end, clip->hitcontents);
else
trace = SV_ClipMoveToEntity (touch, clip->start, clip->mins, clip->maxs, clip->end, clip->hitcontents);
}
if (trace.allsolid || trace.startsolid ||
trace.fraction < clip->trace.fraction)
@ -1154,8 +1164,13 @@ trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, e
memset ( &clip, 0, sizeof ( moveclip_t ) );
if (type & MOVE_HITALLCONTENTS)
clip.hitcontents = ~0u;
else
clip.hitcontents = CONTENTMASK_ANYSOLID;
// clip to world
clip.trace = SV_ClipMoveToEntity ( qcvm->edicts, start, mins, maxs, end );
clip.trace = SV_ClipMoveToEntity ( qcvm->edicts, start, mins, maxs, end, clip.hitcontents );
clip.start = start;
clip.end = end;
@ -1163,10 +1178,6 @@ trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, e
clip.maxs = maxs;
clip.type = type&3;
clip.passedict = passedict;
if (type & MOVE_HITALLCONTENTS)
clip.hitcontents = ~0u;
else
clip.hitcontents = (1<<(-CONTENTS_SOLID)) | (1<<(-CONTENTS_CLIP));
if (type == MOVE_MISSILE)
{

View file

@ -73,7 +73,9 @@ int SV_TruePointContents (vec3_t p);
edict_t *SV_TestEntityPosition (edict_t *ent);
trace_t SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end);
#define CONTENTMASK(c) (1u<<(-CONTENTS_##c))
#define CONTENTMASK_ANYSOLID (CONTENTMASK(SOLID) | CONTENTMASK(CLIP))
trace_t SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, unsigned int hitcontents);
trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict);
// mins and maxs are reletive