Refactor P_PushableCheckBustables
This commit is contained in:
parent
bc2d0dcea6
commit
ddb4c2c97f
35
src/p_mobj.c
35
src/p_mobj.c
|
@ -1673,28 +1673,34 @@ static void P_PushableCheckBustables(mobj_t *mo)
|
||||||
P_SetThingPosition(mo);
|
P_SetThingPosition(mo);
|
||||||
|
|
||||||
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||||
{
|
|
||||||
if (!node->m_sector)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (node->m_sector->ffloors)
|
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
ffloor_t *rover;
|
||||||
fixed_t topheight, bottomheight;
|
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)
|
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
|
// 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);
|
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);
|
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)
|
||||||
{
|
{
|
||||||
|
@ -1735,16 +1741,13 @@ static void P_PushableCheckBustables(mobj_t *mo)
|
||||||
if (rover->master->flags & ML_EFFECT5)
|
if (rover->master->flags & ML_EFFECT5)
|
||||||
P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector);
|
P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector);
|
||||||
|
|
||||||
goto bustupdone;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bustupdone:
|
|
||||||
P_UnsetThingPosition(mo);
|
P_UnsetThingPosition(mo);
|
||||||
mo->x = oldx;
|
mo->x = oldx;
|
||||||
mo->y = oldy;
|
mo->y = oldy;
|
||||||
P_SetThingPosition(mo);
|
P_SetThingPosition(mo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue