- Fixed: A_CheckBlock's dropoff check ignored the specifications of NOACTORS and NOLINES due to P_CheckMove blindly failing if P_CheckPosition failed. This lead to false positives such as blocking actors being detected when they shouldn't be.

This commit is contained in:
MajorCooke 2016-04-10 11:51:40 -05:00 committed by Christoph Oelckers
parent 76c18820cb
commit 76f00131ff
3 changed files with 32 additions and 7 deletions

View file

@ -186,7 +186,12 @@ enum WARPF
WARPF_COPYPITCH = 0x8000, WARPF_COPYPITCH = 0x8000,
}; };
enum PCM
{
PCM_DROPOFF = 1,
PCM_NOACTORS = 1 << 1,
PCM_NOLINES = 1 << 2,
};
AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, int, void *), void *params = NULL); AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, int, void *), void *params = NULL);
@ -221,7 +226,7 @@ void P_FakeZMovement (AActor *mo);
bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false); bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false);
bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL); bool P_TryMove(AActor* thing, const DVector2 &pos, int dropoff, const secplane_t * onfloor = NULL);
bool P_CheckMove(AActor *thing, const DVector2 &pos, bool dropoff = false); bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags = 0);
void P_ApplyTorque(AActor *mo); void P_ApplyTorque(AActor *mo);
bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modifyactor = true); // [RH] Added z and telefrag parameters bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modifyactor = true); // [RH] Added z and telefrag parameters

View file

@ -2410,15 +2410,27 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
// //
//========================================================================== //==========================================================================
bool P_CheckMove(AActor *thing, const DVector2 &pos, bool dropoff) bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags)
{ {
FCheckPosition tm; FCheckPosition tm;
double newz = thing->Z(); double newz = thing->Z();
if (!P_CheckPosition(thing, pos, tm)) if (!P_CheckPosition(thing, pos, tm))
{
// Ignore PCM_DROPOFF. Not necessary here: a little later it is.
if (!flags || (!(flags & PCM_NOACTORS) && !(flags & PCM_NOLINES)))
{ {
return false; return false;
} }
if (!(flags & PCM_NOACTORS) && thing->BlockingMobj)
{
return false;
}
if (!(flags & PCM_NOLINES) && thing->BlockingLine)
{
return false;
}
}
if (thing->flags3 & MF3_FLOORHUGGER) if (thing->flags3 & MF3_FLOORHUGGER)
{ {
@ -2469,7 +2481,7 @@ bool P_CheckMove(AActor *thing, const DVector2 &pos, bool dropoff)
return false; return false;
} }
} }
else if (dropoff) else if (flags & PCM_DROPOFF)
{ {
const DVector3 oldpos = thing->Pos(); const DVector3 oldpos = thing->Pos();
thing->SetOrigin(pos.X, pos.Y, newz, true); thing->SetOrigin(pos.X, pos.Y, newz, true);

View file

@ -6706,8 +6706,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock)
bool checker = false; bool checker = false;
if (flags & CBF_DROPOFF) if (flags & CBF_DROPOFF)
{ {
// Unfortunately, whenever P_CheckMove returned false, that means it could
// ignore a variety of flags mainly because of P_CheckPosition. This
// results in picking up false positives due to actors or lines being in the way
// when they clearly should not be.
int fpass = PCM_DROPOFF;
if (flags & CBF_NOACTORS) fpass |= PCM_NOACTORS;
if (flags & CBF_NOLINES) fpass |= PCM_NOLINES;
mobj->SetZ(pos.Z); mobj->SetZ(pos.Z);
checker = P_CheckMove(mobj, pos, true); checker = P_CheckMove(mobj, pos, fpass);
mobj->SetZ(oldpos.Z); mobj->SetZ(oldpos.Z);
} }
else else