From 878b1b2d16f9f8cd5e1c130af817bfa73e3d275c Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 23 Dec 2018 23:38:07 -0500 Subject: [PATCH] Fix move by waypoints not checking for sector changes It seemed weird at first, but the polyobject sector (backsector) itself DOESN'T need checked (although I still am doing it for safety). Rather, the in-level sector just needs checked. If someone manually modifies the polyobject sector though, then this bug can still occur... but this fixes it for the most common use-case where this can happen. I'll try to tackle the rarer cases in my next commit. --- src/p_polyobj.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 8d0f4dab6..82c57c85b 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1859,6 +1859,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th) diffz = po->lines[0]->backsector->floorheight - (target->z - amtz); po->lines[0]->backsector->floorheight = target->z - amtz; po->lines[0]->backsector->ceilingheight = target->z + amtz; + // Sal: Remember to check your sectors! + P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); + P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); // Apply action to mirroring polyobjects as well start = 0; while ((po = Polyobj_GetChild(oldpo, &start))) @@ -1870,6 +1873,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th) // TODO: use T_MovePlane po->lines[0]->backsector->floorheight += diffz; // move up/down by same amount as the parent did po->lines[0]->backsector->ceilingheight += diffz; + // Sal: Remember to check your sectors! + P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); + P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); } po = oldpo; @@ -2030,6 +2036,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th) // TODO: use T_MovePlane po->lines[0]->backsector->floorheight += momz; po->lines[0]->backsector->ceilingheight += momz; + // Sal: Remember to check your sectors! + P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); // frontsector is NEEDED for crushing + P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); // backsector may not be necessary, but just in case // Apply action to mirroring polyobjects as well start = 0; @@ -2042,6 +2051,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th) // TODO: use T_MovePlane po->lines[0]->backsector->floorheight += momz; po->lines[0]->backsector->ceilingheight += momz; + // Sal: Remember to check your sectors! + P_CheckSector(po->lines[0]->frontsector, (boolean)(po->damage)); + P_CheckSector(po->lines[0]->backsector, (boolean)(po->damage)); } }