Fix players and pushables not accounting for slopes on bustable FOFs

This commit is contained in:
Monster Iestyn 2016-09-02 21:41:45 +01:00
parent eae47c9808
commit 8f02c50c10
2 changed files with 24 additions and 17 deletions

View File

@ -1553,6 +1553,7 @@ static void P_PushableCheckBustables(mobj_t *mo)
if (node->m_sector->ffloors) if (node->m_sector->ffloors)
{ {
ffloor_t *rover; ffloor_t *rover;
fixed_t topheight, bottomheight;
for (rover = node->m_sector->ffloors; rover; rover = rover->next) for (rover = node->m_sector->ffloors; rover; rover = rover->next)
{ {
@ -1565,37 +1566,39 @@ static void P_PushableCheckBustables(mobj_t *mo)
if (!rover->master->frontsector->crumblestate) if (!rover->master->frontsector->crumblestate)
{ {
topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
// Height checks // Height checks
if (rover->flags & FF_SHATTERBOTTOM) if (rover->flags & FF_SHATTERBOTTOM)
{ {
if (mo->z+mo->momz + mo->height < *rover->bottomheight) if (mo->z+mo->momz + mo->height < bottomheight)
continue; continue;
if (mo->z+mo->height > *rover->bottomheight) if (mo->z+mo->height > bottomheight)
continue; continue;
} }
else if (rover->flags & FF_SPINBUST) else if (rover->flags & FF_SPINBUST)
{ {
if (mo->z+mo->momz > *rover->topheight) if (mo->z+mo->momz > topheight)
continue; continue;
if (mo->z+mo->height < *rover->bottomheight) if (mo->z+mo->height < bottomheight)
continue; continue;
} }
else if (rover->flags & FF_SHATTER) else if (rover->flags & FF_SHATTER)
{ {
if (mo->z+mo->momz > *rover->topheight) if (mo->z+mo->momz > topheight)
continue; continue;
if (mo->z+mo->momz + mo->height < *rover->bottomheight) if (mo->z+mo->momz + mo->height < bottomheight)
continue; continue;
} }
else else
{ {
if (mo->z >= *rover->topheight) if (mo->z >= topheight)
continue; continue;
if (mo->z+mo->height < *rover->bottomheight) if (mo->z+mo->height < bottomheight)
continue; continue;
} }

View File

@ -1692,6 +1692,7 @@ static void P_CheckBustableBlocks(player_t *player)
if (node->m_sector->ffloors) if (node->m_sector->ffloors)
{ {
ffloor_t *rover; ffloor_t *rover;
fixed_t topheight, bottomheight;
for (rover = node->m_sector->ffloors; rover; rover = rover->next) for (rover = node->m_sector->ffloors; rover; rover = rover->next)
{ {
@ -1717,42 +1718,45 @@ static void P_CheckBustableBlocks(player_t *player)
if (!(rover->flags & FF_SHATTER) && (rover->flags & FF_ONLYKNUX) && !(player->charability == CA_GLIDEANDCLIMB)) if (!(rover->flags & FF_SHATTER) && (rover->flags & FF_ONLYKNUX) && !(player->charability == CA_GLIDEANDCLIMB))
continue; continue;
topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
// Height checks // Height checks
if (rover->flags & FF_SHATTERBOTTOM) if (rover->flags & FF_SHATTERBOTTOM)
{ {
if (player->mo->z+player->mo->momz + player->mo->height < *rover->bottomheight) if (player->mo->z+player->mo->momz + player->mo->height < bottomheight)
continue; continue;
if (player->mo->z+player->mo->height > *rover->bottomheight) if (player->mo->z+player->mo->height > bottomheight)
continue; continue;
} }
else if (rover->flags & FF_SPINBUST) else if (rover->flags & FF_SPINBUST)
{ {
if (player->mo->z+player->mo->momz > *rover->topheight) if (player->mo->z+player->mo->momz > topheight)
continue; continue;
if (player->mo->z + player->mo->height < *rover->bottomheight) if (player->mo->z + player->mo->height < bottomheight)
continue; continue;
} }
else if (rover->flags & FF_SHATTER) else if (rover->flags & FF_SHATTER)
{ {
if (player->mo->z + player->mo->momz > *rover->topheight) if (player->mo->z + player->mo->momz > topheight)
continue; continue;
if (player->mo->z+player->mo->momz + player->mo->height < *rover->bottomheight) if (player->mo->z+player->mo->momz + player->mo->height < bottomheight)
continue; continue;
} }
else else
{ {
if (player->mo->z >= *rover->topheight) if (player->mo->z >= topheight)
continue; continue;
if (player->mo->z + player->mo->height < *rover->bottomheight) if (player->mo->z + player->mo->height < bottomheight)
continue; continue;
} }
// Impede the player's fall a bit // Impede the player's fall a bit
if (((rover->flags & FF_SPINBUST) || (rover->flags & FF_SHATTER)) && player->mo->z >= *rover->topheight) if (((rover->flags & FF_SPINBUST) || (rover->flags & FF_SHATTER)) && player->mo->z >= topheight)
player->mo->momz >>= 1; player->mo->momz >>= 1;
else if (rover->flags & FF_SHATTER) else if (rover->flags & FF_SHATTER)
{ {