From 36508c24e388feb15d91c06b08afd9ab1fb8fb2b Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 3 Feb 2025 14:41:51 +0100 Subject: [PATCH] apparently those temp variable are not needed --- src/p_maputl.c | 171 ++++++++++++++++--------------------------------- 1 file changed, 55 insertions(+), 116 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 02369675c..0ec49f59d 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -287,46 +287,30 @@ void P_CameraLineOpening(line_t *linedef) // If you can see through it, why not move the camera through it too? if (front->camsec >= 0) { - frontfloor = sectors[front->camsec].floorheight; - frontceiling = sectors[front->camsec].ceilingheight; - if (sectors[front->camsec].f_slope) - frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera[0].x, camera[0].y); - if (sectors[front->camsec].c_slope) - frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera[0].x, camera[0].y); + frontfloor = P_GetSectorFloorZAt (§ors[front->camsec], camera[0].x, camera[0].y); + frontceiling = P_GetSectorCeilingZAt(§ors[front->camsec], camera[0].x, camera[0].y); } else if (front->heightsec >= 0) { - frontfloor = sectors[front->heightsec].floorheight; - frontceiling = sectors[front->heightsec].ceilingheight; - if (sectors[front->heightsec].f_slope) - frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera[0].x, camera[0].y); - if (sectors[front->heightsec].c_slope) - frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera[0].x, camera[0].y); + frontfloor = P_GetSectorFloorZAt (§ors[front->heightsec], camera[0].x, camera[0].y); + frontceiling = P_GetSectorCeilingZAt(§ors[front->heightsec], camera[0].x, camera[0].y); } else { - frontfloor = P_CameraGetFloorZ(mapcampointer, front, tmx, tmy, linedef); + frontfloor = P_CameraGetFloorZ (mapcampointer, front, tmx, tmy, linedef); frontceiling = P_CameraGetCeilingZ(mapcampointer, front, tmx, tmy, linedef); } if (back->camsec >= 0) { - backfloor = sectors[back->camsec].floorheight; - backceiling = sectors[back->camsec].ceilingheight; - if (sectors[back->camsec].f_slope) - frontfloor = P_GetZAt(sectors[back->camsec].f_slope, camera[0].x, camera[0].y); - if (sectors[back->camsec].c_slope) - frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera[0].x, camera[0].y); + backfloor = P_GetSectorFloorZAt (§ors[back->camsec], camera[0].x, camera[0].y); + backceiling = P_GetSectorCeilingZAt(§ors[back->camsec], camera[0].x, camera[0].y); } else if (back->heightsec >= 0) { - backfloor = sectors[back->heightsec].floorheight; - backceiling = sectors[back->heightsec].ceilingheight; - if (sectors[back->heightsec].f_slope) - frontfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera[0].x, camera[0].y); - if (sectors[back->heightsec].c_slope) - frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera[0].x, camera[0].y); + backfloor = P_GetSectorFloorZAt (§ors[back->heightsec], camera[0].x, camera[0].y); + backceiling = P_GetSectorCeilingZAt(§ors[back->heightsec], camera[0].x, camera[0].y); } else { @@ -362,10 +346,6 @@ void P_CameraLineOpening(line_t *linedef) if (front->ffloors || back->ffloors) { ffloor_t *rover; - fixed_t highestceiling = highceiling; - fixed_t lowestceiling = opentop; - fixed_t highestfloor = openbottom; - fixed_t lowestfloor = lowfloor; fixed_t delta1, delta2; // Check for frontsector's fake floors @@ -384,15 +364,15 @@ void P_CameraLineOpening(line_t *linedef) delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); - if (bottomheight < lowestceiling && delta1 >= delta2) - lowestceiling = bottomheight; - else if (bottomheight < highestceiling && delta1 >= delta2) - highestceiling = bottomheight; + if (bottomheight < opentop && delta1 >= delta2) + opentop = bottomheight; + else if (bottomheight < highceiling && delta1 >= delta2) + highceiling = bottomheight; - if (topheight > highestfloor && delta1 < delta2) - highestfloor = topheight; - else if (topheight > lowestfloor && delta1 < delta2) - lowestfloor = topheight; + if (topheight > openbottom && delta1 < delta2) + openbottom = topheight; + else if (topheight > lowfloor && delta1 < delta2) + lowfloor = topheight; } } @@ -412,29 +392,17 @@ void P_CameraLineOpening(line_t *linedef) delta1 = abs(mapcampointer->z - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); - if (bottomheight < lowestceiling && delta1 >= delta2) - lowestceiling = bottomheight; - else if (bottomheight < highestceiling && delta1 >= delta2) - highestceiling = bottomheight; + if (bottomheight < opentop && delta1 >= delta2) + opentop = bottomheight; + else if (bottomheight < highceiling && delta1 >= delta2) + highceiling = bottomheight; - if (topheight > highestfloor && delta1 < delta2) - highestfloor = topheight; - else if (topheight > lowestfloor && delta1 < delta2) - lowestfloor = topheight; + if (topheight > openbottom && delta1 < delta2) + openbottom = topheight; + else if (topheight > lowfloor && delta1 < delta2) + lowfloor = topheight; } } - - if (highestceiling < highceiling) - highceiling = highestceiling; - - if (highestfloor > openbottom) - openbottom = highestfloor; - - if (lowestceiling < opentop) - opentop = lowestceiling; - - if (lowestfloor > lowfloor) - lowfloor = lowestfloor; } openrange = opentop - openbottom; @@ -559,14 +527,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (front->ffloors || back->ffloors || linedef->polyobj) { ffloor_t *rover; - - fixed_t highestceiling = highceiling; - fixed_t lowestceiling = opentop; - fixed_t highestfloor = openbottom; - fixed_t lowestfloor = lowfloor; fixed_t delta1, delta2; - pslope_t *ceilingslope = opentopslope; - pslope_t *floorslope = openbottomslope; // Check for frontsector's fake floors for (rover = front->ffloors; rover; rover = rover->next) @@ -590,24 +551,22 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF { - if (bottomheight < lowestceiling) - { - lowestceiling = bottomheight; - ceilingslope = *rover->b_slope; + if (bottomheight < opentop) { + opentop = bottomheight; + opentopslope = *rover->b_slope; } - else if (bottomheight < highestceiling) - highestceiling = bottomheight; + else if (bottomheight < highceiling) + highceiling = bottomheight; } if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF { - if (topheight > highestfloor) - { - highestfloor = topheight; - floorslope = *rover->t_slope; + if (topheight > openbottom) { + openbottom = topheight; + openbottomslope = *rover->t_slope; } - else if (topheight > lowestfloor) - lowestfloor = topheight; + else if (topheight > lowfloor) + lowfloor = topheight; } } @@ -632,24 +591,22 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF { - if (bottomheight < lowestceiling) - { - lowestceiling = bottomheight; - ceilingslope = *rover->b_slope; + if (bottomheight < opentop) { + opentop = bottomheight; + opentopslope = *rover->b_slope; } - else if (bottomheight < highestceiling) - highestceiling = bottomheight; + else if (bottomheight < highceiling) + highceiling = bottomheight; } if (delta1 < delta2 && !(rover->flags & FF_REVERSEPLATFORM)) // thing is above FOF { - if (topheight > highestfloor) - { - highestfloor = topheight; - floorslope = *rover->t_slope; + if (topheight > openbottom) { + openbottom = topheight; + openbottomslope = *rover->t_slope; } - else if (topheight > lowestfloor) - lowestfloor = topheight; + else if (topheight > lowfloor) + lowfloor = topheight; } } @@ -661,40 +618,22 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) delta1 = abs(mobj->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); - if (polysec->floorheight < lowestceiling && delta1 >= delta2) + if (polysec->floorheight < opentop && delta1 >= delta2) { - lowestceiling = polysec->floorheight; - ceilingslope = NULL; + opentop = polysec->floorheight; + opentopslope = NULL; } - else if (polysec->floorheight < highestceiling && delta1 >= delta2) - highestceiling = polysec->floorheight; + else if (polysec->floorheight < highceiling && delta1 >= delta2) + highceiling = polysec->floorheight; - if (polysec->ceilingheight > highestfloor && delta1 < delta2) + if (polysec->ceilingheight > openbottom && delta1 < delta2) { - highestfloor = polysec->ceilingheight; - floorslope = NULL; + openbottom = polysec->ceilingheight; + openbottomslope = NULL; } - else if (polysec->ceilingheight > lowestfloor && delta1 < delta2) - lowestfloor = polysec->ceilingheight; + else if (polysec->ceilingheight > lowfloor && delta1 < delta2) + lowfloor = polysec->ceilingheight; } - - if (highestceiling < highceiling) - highceiling = highestceiling; - - if (highestfloor > openbottom) - { - openbottom = highestfloor; - openbottomslope = floorslope; - } - - if (lowestceiling < opentop) - { - opentop = lowestceiling; - opentopslope = ceilingslope; - } - - if (lowestfloor > lowfloor) - lowfloor = lowestfloor; } }