diff --git a/src/p_mobj.c b/src/p_mobj.c index ce0a788a0..8fd5edebf 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2480,55 +2480,58 @@ static void P_PlayerZMovement(mobj_t *mo) msecnode_t *node; boolean stopmovecut = false; - for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next) + if (numPolyObjects) { - sector_t *sec = node->m_sector; - subsector_t *newsubsec; - size_t i; - - for (i = 0; i < numsubsectors; i++) + for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next) { - newsubsec = &subsectors[i]; + sector_t *sec = node->m_sector; + subsector_t *newsubsec; + size_t i; - if (newsubsec->sector != sec) - continue; - - if (!newsubsec->polyList) - continue; - - polyobj_t *po = newsubsec->polyList; - sector_t *polysec; - - while(po) + for (i = 0; i < numsubsectors; i++) { - if (!P_MobjInsidePolyobj(po, mo) || !(po->flags & POF_SOLID)) - { - po = (polyobj_t *)(po->link.next); + newsubsec = &subsectors[i]; + + if (newsubsec->sector != sec) continue; - } - // We're inside it! Yess... - polysec = po->lines[0]->backsector; - - // Moving polyobjects should act like conveyors if the player lands on one. (I.E. none of the momentum cut thing below) -Red - if ((mo->z == polysec->ceilingheight || mo->z+mo->height == polysec->floorheight) && po->thinker) - stopmovecut = true; - - if (!(po->flags & POF_LDEXEC)) - { - po = (polyobj_t *)(po->link.next); + if (!newsubsec->polyList) continue; - } - if (mo->z == polysec->ceilingheight) + polyobj_t *po = newsubsec->polyList; + sector_t *polysec; + + while(po) { - // We're landing on a PO, so check for - // a linedef executor. - // Trigger tags are 32000 + the PO's ID number. - P_LinedefExecute((INT16)(32000 + po->id), mo, NULL); - } + if (!P_MobjInsidePolyobj(po, mo) || !(po->flags & POF_SOLID)) + { + po = (polyobj_t *)(po->link.next); + continue; + } - po = (polyobj_t *)(po->link.next); + // We're inside it! Yess... + polysec = po->lines[0]->backsector; + + // Moving polyobjects should act like conveyors if the player lands on one. (I.E. none of the momentum cut thing below) -Red + if ((mo->z == polysec->ceilingheight || mo->z+mo->height == polysec->floorheight) && po->thinker) + stopmovecut = true; + + if (!(po->flags & POF_LDEXEC)) + { + po = (polyobj_t *)(po->link.next); + continue; + } + + if (mo->z == polysec->ceilingheight) + { + // We're landing on a PO, so check for + // a linedef executor. + // Trigger tags are 32000 + the PO's ID number. + P_LinedefExecute((INT16)(32000 + po->id), mo, NULL); + } + + po = (polyobj_t *)(po->link.next); + } } } }