Merge branch 'p_isobjectongroundin-fixes' into 'next'

Fixes for Each Time and P_IsObjectOnGroundIn

Fixes the issue with Each Time reported here: https://mb.srb2.org/showthread.php?t=42818

Also fixes a separate issue with P_IsObjectOnGroundIn and intangible FOFs (where it determined that standing at the top height of them counted as being on the ground) which was also reproducable via the above bug funnily enough.

See merge request !204
This commit is contained in:
Monster Iestyn 2017-07-18 22:51:29 -04:00
commit 2456ae8260
2 changed files with 36 additions and 7 deletions

View File

@ -2021,6 +2021,33 @@ foundenemy:
P_RemoveThinker(&nobaddies->thinker);
}
//
// P_IsObjectOnRealGround
//
// Helper function for T_EachTimeThinker
// Like P_IsObjectOnGroundIn, except ONLY THE REAL GROUND IS CONSIDERED, NOT FOFS
// I'll consider whether to make this a more globally accessible function or whatever in future
// -- Monster Iestyn
//
static boolean P_IsObjectOnRealGround(mobj_t *mo, sector_t *sec)
{
// Is the object in reverse gravity?
if (mo->eflags & MFE_VERTICALFLIP)
{
// Detect if the player is on the ceiling.
if (mo->z+mo->height >= P_GetSpecialTopZ(mo, sec, sec))
return true;
}
// Nope!
else
{
// Detect if the player is on the floor.
if (mo->z <= P_GetSpecialBottomZ(mo, sec, sec))
return true;
}
return false;
}
//
// P_HavePlayersEnteredArea
//
@ -2224,7 +2251,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|| P_PlayerTouchingSectorSpecial(&players[i], 2, (GETSECSPECIAL(sec->special, 2))) == sec))
continue;
if (floortouch == true && P_IsObjectOnGroundIn(players[i].mo, sec))
if (floortouch == true && P_IsObjectOnRealGround(players[i].mo, sec))
{
if (i & 1)
eachtime->var2s[i/2] |= 1;

View File

@ -1221,11 +1221,12 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
if (!(rover->flags & FF_EXISTS))
continue;
// If the FOF is configured to let players through, continue.
if (!(rover->flags & FF_BLOCKPLAYER) && (rover->flags & FF_BLOCKOTHERS))
// If the FOF is configured to let the object through, continue.
if (!((rover->flags & FF_BLOCKPLAYER && mo->player)
|| (rover->flags & FF_BLOCKOTHERS && !mo->player)))
continue;
// If the the platform is intangile from below, continue.
// If the the platform is intangible from below, continue.
if (rover->flags & FF_PLATFORM)
continue;
@ -1254,11 +1255,12 @@ boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec)
if (!(rover->flags & FF_EXISTS))
continue;
// If the FOF is configured to let players through, continue.
if (!(rover->flags & FF_BLOCKPLAYER) && (rover->flags & FF_BLOCKOTHERS))
// If the FOF is configured to let the object through, continue.
if (!((rover->flags & FF_BLOCKPLAYER && mo->player)
|| (rover->flags & FF_BLOCKOTHERS && !mo->player)))
continue;
// If the the platform is intangile from above, continue.
// If the the platform is intangible from above, continue.
if (rover->flags & FF_REVERSEPLATFORM)
continue;