Rise waypoint to highest FOF below riser, or lowest above

This commit is contained in:
James R 2020-04-15 19:31:23 -07:00
parent 0b3b13b3b5
commit 62143d32b3

View file

@ -1791,7 +1791,8 @@ void K_AdjustWaypointsParameters (void)
boolean descending; boolean descending;
UINT16 fof_no; fixed_t sort;
fixed_t z;
for ( for (
waypointmobj = waypointcap; waypointmobj = waypointcap;
@ -1818,42 +1819,38 @@ void K_AdjustWaypointsParameters (void)
} }
else else
{ {
x = waypointmobj->x;
y = waypointmobj->y;
descending = ( riser->spawnpoint->options & MTF_OBJECTFLIP ); descending = ( riser->spawnpoint->options & MTF_OBJECTFLIP );
fof_no = ( riser->spawnpoint->options >> ZSHIFT );
if (descending) if (descending)
rover = sector->highest_ffloor; sort = sector->ceilingheight;
else else
rover = sector->lowest_ffloor; sort = sector->floorheight;
while (rover) for (
{ rover = sector->ffloors;
if (fof_no > 0) rover;
rover = rover->next
){
if (descending)
{ {
if (descending) z = P_GetFOFBottomZAt(rover, x, y);
rover = rover->lower;
else
rover = rover->higher;
fof_no--; if (z > riser->z && z < sort)
sort = z;
} }
else else
{ {
x = waypointmobj->x; z = P_GetFOFTopZAt(rover, x, y);
y = waypointmobj->y;
if (( waypointmobj->flags2 & MF2_OBJECTFLIP )) if (z < riser->z && z > sort)
{ sort = z;
waypointmobj->z = P_GetFOFBottomZAt(rover, x, y) -
waypointmobj->info->height;
}
else
waypointmobj->z = P_GetFOFTopZAt(rover, x, y);
break;
} }
} }
waypointmobj->z = sort;
} }
} }
} }