- CBF_DROPOFF Fixes

- Fixed: CBF_DROPOFF didn't actually check the coordinates passed to it for dropoff height values. It only checked to see if it was stuck in lines.
This commit is contained in:
MajorCooke 2016-04-09 14:44:17 -05:00 committed by Christoph Oelckers
parent dc72e7f3c2
commit 8b8c879994
3 changed files with 17 additions and 4 deletions

View file

@ -221,7 +221,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 P_CheckMove(AActor *thing, const DVector2 &pos, bool dropoff = false);
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,7 +2410,7 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
// //
//========================================================================== //==========================================================================
bool P_CheckMove(AActor *thing, const DVector2 &pos) bool P_CheckMove(AActor *thing, const DVector2 &pos, bool dropoff)
{ {
FCheckPosition tm; FCheckPosition tm;
double newz = thing->Z(); double newz = thing->Z();
@ -2469,6 +2469,17 @@ bool P_CheckMove(AActor *thing, const DVector2 &pos)
return false; return false;
} }
} }
else if (dropoff)
{
const DVector3 oldpos = thing->Pos();
thing->SetOrigin(pos.X, pos.Y, newz, true);
bool hcheck = (newz - thing->MaxDropOffHeight > thing->floorz);
thing->SetOrigin(oldpos, true);
if (hcheck && !(thing->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF))
{
return false;
}
}
} }
if (thing->flags2 & MF2_CANTLEAVEFLOORPIC if (thing->flags2 & MF2_CANTLEAVEFLOORPIC

View file

@ -6707,7 +6707,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock)
if (flags & CBF_DROPOFF) if (flags & CBF_DROPOFF)
{ {
mobj->SetZ(pos.Z); mobj->SetZ(pos.Z);
checker = P_CheckMove(mobj, pos); checker = P_CheckMove(mobj, pos, true);
mobj->SetZ(oldpos.Z); mobj->SetZ(oldpos.Z);
} }
else else
@ -6742,8 +6742,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock)
} }
//[MC] I don't know why I let myself be persuaded not to include a flag. //[MC] I don't know why I let myself be persuaded not to include a flag.
//If an actor is loaded with pointers, they don't really have any options to spare. //If an actor is loaded with pointers, they don't really have any options to spare.
//Also, fail if a dropoff or a step is too great to pass over when checking for dropoffs.
if ((!(flags & CBF_NOACTORS) && (mobj->BlockingMobj)) || (!(flags & CBF_NOLINES) && mobj->BlockingLine != NULL)) if ((!(flags & CBF_NOACTORS) && (mobj->BlockingMobj)) || (!(flags & CBF_NOLINES) && mobj->BlockingLine != NULL) ||
((flags & CBF_DROPOFF) && !checker))
{ {
ACTION_RETURN_STATE(block); ACTION_RETURN_STATE(block);
} }