Refactor P_PushableCheckBustables

This commit is contained in:
MascaraSnake 2020-05-02 15:30:56 +02:00
parent bc2d0dcea6
commit ddb4c2c97f
1 changed files with 64 additions and 61 deletions

View File

@ -1673,28 +1673,34 @@ static void P_PushableCheckBustables(mobj_t *mo)
P_SetThingPosition(mo);
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (!node->m_sector)
break;
if (node->m_sector->ffloors)
{
ffloor_t *rover;
fixed_t topheight, bottomheight;
if (!node->m_sector)
break;
if (!node->m_sector->ffloors)
continue;
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_EXISTS))
continue;
if (!(rover->flags & FF_BUSTUP)) continue;
if (!(rover->flags & FF_BUSTUP))
continue;
// Needs ML_EFFECT4 flag for pushables to break it
if (!(rover->master->flags & ML_EFFECT4)) continue;
if (!(rover->master->flags & ML_EFFECT4))
continue;
if (rover->master->frontsector->crumblestate != CRUMBLE_NONE)
continue;
if (rover->master->frontsector->crumblestate == CRUMBLE_NONE)
{
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
if (rover->flags & FF_SHATTERBOTTOM)
{
@ -1735,16 +1741,13 @@ static void P_PushableCheckBustables(mobj_t *mo)
if (rover->master->flags & ML_EFFECT5)
P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector);
goto bustupdone;
}
}
}
}
bustupdone:
P_UnsetThingPosition(mo);
mo->x = oldx;
mo->y = oldy;
P_SetThingPosition(mo);
return;
}
}
}
//