From 0d116b39c5434bbfe8eeff9f19c325d4c6990f6f Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 13 Oct 2020 20:27:36 -0700 Subject: [PATCH 01/11] Compare height for step up on edge of sector This is for slopes. When moving across a slope the height changes. Therefore compare the height at the edge where slopes meet so only a wall will block the player, and not a very steep slope. --- src/p_map.c | 11 +++++++++-- src/p_maputl.c | 35 +++++++++++++++++++++++++++++++++++ src/p_maputl.h | 2 ++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 93c885241..c6044c6f9 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -58,6 +58,8 @@ mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz mobj_t *tmhitthing; // the solid thing you bumped into (for collisions) ffloor_t *tmfloorrover, *tmceilingrover; pslope_t *tmfloorslope, *tmceilingslope; +static fixed_t tmfloordiff; +static fixed_t tmceilingdiff; // keep track of the line that lowers the ceiling, // so missiles don't explode against sky hack walls @@ -1704,6 +1706,7 @@ static boolean PIT_CheckLine(line_t *ld) ceilingline = ld; tmceilingrover = openceilingrover; tmceilingslope = opentopslope; + tmceilingdiff = openceilingdiff; } if (openbottom > tmfloorz) @@ -1711,6 +1714,7 @@ static boolean PIT_CheckLine(line_t *ld) tmfloorz = openbottom; tmfloorrover = openfloorrover; tmfloorslope = openbottomslope; + tmfloordiff = openfloordiff; } if (highceiling > tmdrpoffceilz) @@ -1800,6 +1804,9 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) tmfloorslope = newsubsec->sector->f_slope; tmceilingslope = newsubsec->sector->c_slope; + tmfloordiff = 0; + tmceilingdiff = 0; + // Check list of fake floors and see if tmfloorz/tmceilingz need to be altered. if (newsubsec->sector->ffloors) { @@ -2517,7 +2524,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->ceilingrover = tmceilingrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } - else if (tmceilingz < thingtop && thingtop - tmceilingz <= maxstep) + else if (tmceilingz < thingtop && tmceilingdiff <= maxstep) { thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->ceilingrover = tmceilingrover; @@ -2530,7 +2537,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->floorrover = tmfloorrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } - else if (tmfloorz > thing->z && tmfloorz - thing->z <= maxstep) + else if (tmfloorz > thing->z && tmfloordiff <= maxstep) { thing->z = thing->floorz = tmfloorz; thing->floorrover = tmfloorrover; diff --git a/src/p_maputl.c b/src/p_maputl.c index de6feb143..a0ef680fb 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -279,6 +279,8 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1) fixed_t opentop, openbottom, openrange, lowfloor, highceiling; pslope_t *opentopslope, *openbottomslope; ffloor_t *openfloorrover, *openceilingrover; +fixed_t openfloordiff; +fixed_t openceilingdiff; // P_CameraLineOpening // P_LineOpening, but for camera @@ -424,6 +426,7 @@ void P_CameraLineOpening(line_t *linedef) void P_LineOpening(line_t *linedef, mobj_t *mobj) { sector_t *front, *back; + vertex_t cross; if (linedef->sidenum[1] == 0xffff) { @@ -432,6 +435,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) return; } + P_ClosestPointOnLine(tmx, tmy, linedef, &cross); + // Treat polyobjects kind of like 3D Floors if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) { @@ -456,6 +461,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) highceiling = INT32_MIN; lowfloor = INT32_MAX; opentopslope = openbottomslope = NULL; + openfloordiff = 0; + openceilingdiff = 0; } else { // Set open and high/low values here @@ -492,6 +499,18 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) lowfloor = frontheight; openbottomslope = back->f_slope; } + + openfloordiff = + abs( + P_GetSectorFloorZAt(front, cross.x, cross.y) - + P_GetSectorFloorZAt(back, cross.x, cross.y) + ); + + openceilingdiff = + abs( + P_GetSectorCeilingZAt(front, cross.x, cross.y) - + P_GetSectorCeilingZAt(back, cross.x, cross.y) + ); } if (mobj) @@ -548,10 +567,16 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 > delta2) { // Below if (opentop > texbottom) + { + openceilingdiff = ( opentop - texbottom ); opentop = texbottom; + } } else { // Above if (openbottom < textop) + { + openfloordiff = ( textop - openbottom ); openbottom = textop; + } } } } @@ -579,14 +604,24 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) delta2 = abs(thingtop - (polybottom + ((polytop - polybottom)/2))); if (polybottom < opentop && delta1 >= delta2) + { + openceilingdiff = ( opentop - polybottom ); opentop = polybottom; + } else if (polybottom < highceiling && delta1 >= delta2) + { highceiling = polybottom; + } if (polytop > openbottom && delta1 < delta2) + { + openfloordiff = ( polytop - openbottom ); openbottom = polytop; + } else if (polytop > lowfloor && delta1 < delta2) + { lowfloor = polytop; + } } // otherwise don't do anything special, pretend there's nothing else there } diff --git a/src/p_maputl.h b/src/p_maputl.h index 1c071c2cd..1a885c586 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -58,6 +58,8 @@ void P_HitSpecialLines(mobj_t *thing, fixed_t x, fixed_t y, fixed_t momx, fixed_ extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling; extern pslope_t *opentopslope, *openbottomslope; extern ffloor_t *openfloorrover, *openceilingrover; +extern fixed_t openfloordiff; +extern fixed_t openceilingdiff; void P_LineOpening(line_t *plinedef, mobj_t *mobj); From dab116a0bd305e7b66bd874a16acdb6e954a8281 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 13 Oct 2020 21:43:37 -0700 Subject: [PATCH 02/11] CODE --- src/p_maputl.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index a0ef680fb..12365067a 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -467,6 +467,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) else { // Set open and high/low values here fixed_t frontheight, backheight; + sector_t * sector; frontheight = P_GetCeilingZ(mobj, front, tmx, tmy, linedef); backheight = P_GetCeilingZ(mobj, back, tmx, tmy, linedef); @@ -475,15 +476,18 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) { opentop = frontheight; highceiling = backheight; - opentopslope = front->c_slope; + sector = front; } else { opentop = backheight; highceiling = frontheight; - opentopslope = back->c_slope; + sector = back; } + opentopslope = sector->c_slope; + openceilingdiff = ( mobj->z + mobj->height - P_GetSectorCeilingZAt(sector, cross.x, cross.y) ); + frontheight = P_GetFloorZ(mobj, front, tmx, tmy, linedef); backheight = P_GetFloorZ(mobj, back, tmx, tmy, linedef); @@ -491,26 +495,17 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) { openbottom = frontheight; lowfloor = backheight; - openbottomslope = front->f_slope; + sector = front; } else { openbottom = backheight; lowfloor = frontheight; - openbottomslope = back->f_slope; + sector = back; } - openfloordiff = - abs( - P_GetSectorFloorZAt(front, cross.x, cross.y) - - P_GetSectorFloorZAt(back, cross.x, cross.y) - ); - - openceilingdiff = - abs( - P_GetSectorCeilingZAt(front, cross.x, cross.y) - - P_GetSectorCeilingZAt(back, cross.x, cross.y) - ); + openbottomslope = sector->f_slope; + openfloordiff = ( P_GetSectorFloorZAt(sector, cross.x, cross.y) - mobj->z ); } if (mobj) From 3a4a687da06275d59b29b1a0e9ad8dc61652556b Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 14 Oct 2020 21:10:02 -0700 Subject: [PATCH 03/11] Use height difference between front and backside of line when stepping down This should fix the janky falling off steep slopes and let you cling to them. Because when falling off a sector the edge of the player must not intersect the edge of the higher sector, it is trickier than step up. The height difference at the line must be stored to be useful. --- src/p_map.c | 27 +++++++++++++++--- src/p_maputl.c | 74 +++++++++++++++++++++++++++----------------------- src/p_maputl.h | 2 ++ src/p_mobj.h | 2 ++ 4 files changed, 67 insertions(+), 38 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index c6044c6f9..4d4a7ea67 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1707,6 +1707,7 @@ static boolean PIT_CheckLine(line_t *ld) tmceilingrover = openceilingrover; tmceilingslope = opentopslope; tmceilingdiff = openceilingdiff; + tmthing->ceilingdrop = openceilingdrop; } if (openbottom > tmfloorz) @@ -1715,6 +1716,7 @@ static boolean PIT_CheckLine(line_t *ld) tmfloorrover = openfloorrover; tmfloorslope = openbottomslope; tmfloordiff = openfloordiff; + tmthing->floordrop = openfloordrop; } if (highceiling > tmdrpoffceilz) @@ -2505,10 +2507,25 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thing->eflags & MFE_VERTICALFLIP) { if (thing->z < tmfloorz) + { return false; // mobj must raise itself to fit + } + else if (thing->z > thing->floorz) + { + thing->floordrop = 0; + } + } + else + { + if (tmceilingz < thingtop) + { + return false; // mobj must lower itself to fit + } + else if (thingtop < thing->ceilingz) + { + thing->ceilingdrop = 0; + } } - else if (tmceilingz < thingtop) - return false; // mobj must lower itself to fit // Ramp test if ((maxstep > 0) && !(P_MobjTouchingSectorSpecial(thing, 1, 14, false))) @@ -2518,11 +2535,12 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thing->eflags & MFE_VERTICALFLIP) { - if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep) + if (thingtop == thing->ceilingz && tmceilingz > thingtop && thing->ceilingdrop <= maxstep) { thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->ceilingrover = tmceilingrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; + thing->ceilingdrop = 0; } else if (tmceilingz < thingtop && tmceilingdiff <= maxstep) { @@ -2531,11 +2549,12 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->eflags |= MFE_JUSTSTEPPEDDOWN; } } - else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep) + else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->floordrop <= maxstep) { thing->z = thing->floorz = tmfloorz; thing->floorrover = tmfloorrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; + thing->floordrop = 0; } else if (tmfloorz > thing->z && tmfloordiff <= maxstep) { diff --git a/src/p_maputl.c b/src/p_maputl.c index 12365067a..cbb06dfe3 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -281,6 +281,8 @@ pslope_t *opentopslope, *openbottomslope; ffloor_t *openfloorrover, *openceilingrover; fixed_t openfloordiff; fixed_t openceilingdiff; +fixed_t openfloordrop; +fixed_t openceilingdrop; // P_CameraLineOpening // P_LineOpening, but for camera @@ -466,46 +468,50 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) } else { // Set open and high/low values here - fixed_t frontheight, backheight; - sector_t * sector; + fixed_t height[2]; + const sector_t * sector[2] = { front, back }; - frontheight = P_GetCeilingZ(mobj, front, tmx, tmy, linedef); - backheight = P_GetCeilingZ(mobj, back, tmx, tmy, linedef); + int high; - if (frontheight < backheight) - { - opentop = frontheight; - highceiling = backheight; - sector = front; - } - else - { - opentop = backheight; - highceiling = frontheight; - sector = back; - } +#define low ! high - opentopslope = sector->c_slope; - openceilingdiff = ( mobj->z + mobj->height - P_GetSectorCeilingZAt(sector, cross.x, cross.y) ); + height[0] = P_GetCeilingZ(mobj, front, tmx, tmy, linedef); + height[1] = P_GetCeilingZ(mobj, back, tmx, tmy, linedef); - frontheight = P_GetFloorZ(mobj, front, tmx, tmy, linedef); - backheight = P_GetFloorZ(mobj, back, tmx, tmy, linedef); + high = ( height[0] < height[1] ); - if (frontheight > backheight) - { - openbottom = frontheight; - lowfloor = backheight; - sector = front; - } - else - { - openbottom = backheight; - lowfloor = frontheight; - sector = back; - } + opentop = height[low]; + highceiling = height[high]; + opentopslope = sector[low]->c_slope; - openbottomslope = sector->f_slope; - openfloordiff = ( P_GetSectorFloorZAt(sector, cross.x, cross.y) - mobj->z ); + openceilingdiff = ( mobj->z + mobj->height - + P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) ); + + openceilingdrop = + ( + P_GetSectorCeilingZAt(sector[high], cross.x, cross.y) - + P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) + ); + + height[0] = P_GetFloorZ(mobj, front, tmx, tmy, linedef); + height[1] = P_GetFloorZ(mobj, back, tmx, tmy, linedef); + + high = ( height[0] < height[1] ); + + openbottom = height[high]; + lowfloor = height[low]; + openbottomslope = sector[high]->f_slope; + + openfloordiff = + ( P_GetSectorFloorZAt(sector[high], cross.x, cross.y) - mobj->z ); + + openfloordrop = + ( + P_GetSectorFloorZAt(sector[high], cross.x, cross.y) - + P_GetSectorFloorZAt(sector[low], cross.x, cross.y) + ); + +#undef low } if (mobj) diff --git a/src/p_maputl.h b/src/p_maputl.h index 1a885c586..237170bac 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -60,6 +60,8 @@ extern pslope_t *opentopslope, *openbottomslope; extern ffloor_t *openfloorrover, *openceilingrover; extern fixed_t openfloordiff; extern fixed_t openceilingdiff; +extern fixed_t openfloordrop; +extern fixed_t openceilingdrop; void P_LineOpening(line_t *plinedef, mobj_t *mobj); diff --git a/src/p_mobj.h b/src/p_mobj.h index eaf97c441..cd0cc3bc7 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -326,6 +326,8 @@ typedef struct mobj_s fixed_t ceilingz; // Nearest ceiling above. struct ffloor_s *floorrover; // FOF referred by floorz struct ffloor_s *ceilingrover; // FOF referred by ceilingz + fixed_t floordrop; + fixed_t ceilingdrop; // For movement checking. fixed_t radius; From 894860b9bc049d503db8e215ad8db36691d7de61 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 15 Oct 2020 02:58:29 -0700 Subject: [PATCH 04/11] Step up fake floors --- src/p_maputl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/p_maputl.c b/src/p_maputl.c index cbb06dfe3..97d24c938 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -634,6 +634,9 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) ffloor_t *rover; fixed_t delta1, delta2; + const fixed_t oldopentop = opentop; + const fixed_t oldopenbottom = openbottom; + // Check for frontsector's fake floors for (rover = front->ffloors; rover; rover = rover->next) { @@ -717,6 +720,18 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) lowfloor = topheight; } } + + if (opentop < oldopentop) + { + openceilingdiff = ( thingtop - + P_GetFFloorBottomZAt(openceilingrover, cross.x, cross.y) ); + } + + if (openbottom > oldopenbottom) + { + openfloordiff = + ( P_GetFFloorTopZAt(openfloorrover, cross.x, cross.y) - mobj->z ); + } } } } From 9723283055dc452f2fc72792e78c05b241669d4e Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 15 Oct 2020 03:33:37 -0700 Subject: [PATCH 05/11] FOF step down --- src/p_maputl.c | 97 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 75 insertions(+), 22 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 97d24c938..d87c89cb1 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -427,9 +427,15 @@ void P_CameraLineOpening(line_t *linedef) void P_LineOpening(line_t *linedef, mobj_t *mobj) { + enum { HIGH, LOW }; + sector_t *front, *back; vertex_t cross; + /* these init to shut compiler up */ + fixed_t topedge[2] = {0}; + fixed_t botedge[2] = {0}; + if (linedef->sidenum[1] == 0xffff) { // single sided line @@ -487,11 +493,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) openceilingdiff = ( mobj->z + mobj->height - P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) ); - openceilingdrop = - ( - P_GetSectorCeilingZAt(sector[high], cross.x, cross.y) - - P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) - ); + topedge[HIGH] = P_GetSectorCeilingZAt(sector[high], cross.x, cross.y); + topedge[LOW] = P_GetSectorCeilingZAt(sector[low], cross.x, cross.y); + + openceilingdrop = ( topedge[HIGH] - topedge[LOW] ); height[0] = P_GetFloorZ(mobj, front, tmx, tmy, linedef); height[1] = P_GetFloorZ(mobj, back, tmx, tmy, linedef); @@ -505,11 +510,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) openfloordiff = ( P_GetSectorFloorZAt(sector[high], cross.x, cross.y) - mobj->z ); - openfloordrop = - ( - P_GetSectorFloorZAt(sector[high], cross.x, cross.y) - - P_GetSectorFloorZAt(sector[low], cross.x, cross.y) - ); + botedge[HIGH] = P_GetSectorFloorZAt(sector[high], cross.x, cross.y); + botedge[LOW] = P_GetSectorFloorZAt(sector[low], cross.x, cross.y); + + openfloordrop = ( botedge[HIGH] - botedge[LOW] ); #undef low } @@ -634,6 +638,23 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) ffloor_t *rover; fixed_t delta1, delta2; + enum { FRONT, BACK }; + + /* yuck */ + struct + { + fixed_t top; + fixed_t bottom; + ffloor_t * ceilingrover; + ffloor_t * floorrover; + } open[2] = { + { opentop, openbottom, openceilingrover, openfloorrover }, + { opentop, openbottom, openceilingrover, openfloorrover }, + }; + + int lo; + int hi; + const fixed_t oldopentop = opentop; const fixed_t oldopenbottom = openbottom; @@ -658,10 +679,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 >= delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_PLATFORM) // thing is below FOF { - if (bottomheight < opentop) { - opentop = bottomheight; + if (bottomheight < open[FRONT].top) { + open[FRONT].top = bottomheight; opentopslope = *rover->b_slope; - openceilingrover = rover; + open[FRONT].ceilingrover = rover; } else if (bottomheight < highceiling) highceiling = bottomheight; @@ -669,10 +690,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 < delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_REVERSEPLATFORM) // thing is above FOF { - if (topheight > openbottom) { - openbottom = topheight; + if (topheight > open[FRONT].bottom) { + open[FRONT].bottom = topheight; openbottomslope = *rover->t_slope; - openfloorrover = rover; + open[FRONT].floorrover = rover; } else if (topheight > lowfloor) lowfloor = topheight; @@ -700,10 +721,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 >= delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_PLATFORM) // thing is below FOF { - if (bottomheight < opentop) { - opentop = bottomheight; + if (bottomheight < open[BACK].top) { + open[BACK].top = bottomheight; opentopslope = *rover->b_slope; - openceilingrover = rover; + open[BACK].ceilingrover = rover; } else if (bottomheight < highceiling) highceiling = bottomheight; @@ -711,26 +732,58 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 < delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_REVERSEPLATFORM) // thing is above FOF { - if (topheight > openbottom) { - openbottom = topheight; + if (topheight > open[BACK].bottom) { + open[BACK].bottom = topheight; openbottomslope = *rover->t_slope; - openfloorrover = rover; + open[BACK].floorrover = rover; } else if (topheight > lowfloor) lowfloor = topheight; } } + lo = ( open[0].top > open[1].top ); + + opentop = open[lo].top; + if (opentop < oldopentop) { + openceilingrover = open[lo].ceilingrover; openceilingdiff = ( thingtop - P_GetFFloorBottomZAt(openceilingrover, cross.x, cross.y) ); + + hi = ! lo; + + topedge[LOW] = P_GetFFloorBottomZAt(open[lo].ceilingrover, cross.x, cross.y); + + if (open[hi].top < oldopentop) + { + topedge[HIGH] = P_GetFFloorBottomZAt(open[hi].ceilingrover, cross.x, cross.y); + } + + openceilingdrop = ( topedge[HIGH] - topedge[LOW] ); } + hi = ( open[0].bottom < open[1].bottom ); + + openbottom = open[hi].bottom; + if (openbottom > oldopenbottom) { + openfloorrover = open[hi].floorrover; openfloordiff = ( P_GetFFloorTopZAt(openfloorrover, cross.x, cross.y) - mobj->z ); + + lo = ! hi; + + botedge[HIGH] = P_GetFFloorTopZAt(open[hi].floorrover, cross.x, cross.y); + + if (open[lo].bottom > oldopenbottom) + { + botedge[LOW] = P_GetFFloorTopZAt(open[lo].floorrover, cross.x, cross.y); + } + + openfloordrop = ( botedge[HIGH] - botedge[LOW] ); } } } From 75b3fffc04593e68ba0ee337d6c8cdfde5095604 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 15 Oct 2020 04:23:28 -0700 Subject: [PATCH 06/11] AAAAAAAAAAA --- src/p_maputl.c | 50 +++++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index d87c89cb1..4826c2fdc 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -427,7 +427,7 @@ void P_CameraLineOpening(line_t *linedef) void P_LineOpening(line_t *linedef, mobj_t *mobj) { - enum { HIGH, LOW }; + enum { FRONT, BACK }; sector_t *front, *back; vertex_t cross; @@ -481,8 +481,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) #define low ! high - height[0] = P_GetCeilingZ(mobj, front, tmx, tmy, linedef); - height[1] = P_GetCeilingZ(mobj, back, tmx, tmy, linedef); + height[FRONT] = P_GetCeilingZ(mobj, front, tmx, tmy, linedef); + height[BACK] = P_GetCeilingZ(mobj, back, tmx, tmy, linedef); high = ( height[0] < height[1] ); @@ -493,13 +493,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) openceilingdiff = ( mobj->z + mobj->height - P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) ); - topedge[HIGH] = P_GetSectorCeilingZAt(sector[high], cross.x, cross.y); - topedge[LOW] = P_GetSectorCeilingZAt(sector[low], cross.x, cross.y); + topedge[FRONT] = P_GetSectorCeilingZAt(front, cross.x, cross.y); + topedge[BACK] = P_GetSectorCeilingZAt(back, cross.x, cross.y); - openceilingdrop = ( topedge[HIGH] - topedge[LOW] ); + openceilingdrop = ( topedge[high] - topedge[low] ); - height[0] = P_GetFloorZ(mobj, front, tmx, tmy, linedef); - height[1] = P_GetFloorZ(mobj, back, tmx, tmy, linedef); + height[FRONT] = P_GetFloorZ(mobj, front, tmx, tmy, linedef); + height[BACK] = P_GetFloorZ(mobj, back, tmx, tmy, linedef); high = ( height[0] < height[1] ); @@ -510,10 +510,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) openfloordiff = ( P_GetSectorFloorZAt(sector[high], cross.x, cross.y) - mobj->z ); - botedge[HIGH] = P_GetSectorFloorZAt(sector[high], cross.x, cross.y); - botedge[LOW] = P_GetSectorFloorZAt(sector[low], cross.x, cross.y); + botedge[FRONT] = P_GetSectorFloorZAt(front, cross.x, cross.y); + botedge[BACK] = P_GetSectorFloorZAt(back, cross.x, cross.y); - openfloordrop = ( botedge[HIGH] - botedge[LOW] ); + openfloordrop = ( botedge[high] - botedge[low] ); #undef low } @@ -638,8 +638,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) ffloor_t *rover; fixed_t delta1, delta2; - enum { FRONT, BACK }; - /* yuck */ struct { @@ -648,8 +646,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) ffloor_t * ceilingrover; ffloor_t * floorrover; } open[2] = { - { opentop, openbottom, openceilingrover, openfloorrover }, - { opentop, openbottom, openceilingrover, openfloorrover }, + { INT32_MAX, INT32_MIN, NULL, NULL }, + { INT32_MAX, INT32_MIN, NULL, NULL }, }; int lo; @@ -744,46 +742,44 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) lo = ( open[0].top > open[1].top ); - opentop = open[lo].top; - - if (opentop < oldopentop) + if (open[lo].top <= oldopentop) { + opentop = open[lo].top; openceilingrover = open[lo].ceilingrover; openceilingdiff = ( thingtop - P_GetFFloorBottomZAt(openceilingrover, cross.x, cross.y) ); hi = ! lo; - topedge[LOW] = P_GetFFloorBottomZAt(open[lo].ceilingrover, cross.x, cross.y); + topedge[lo] = P_GetFFloorBottomZAt(open[lo].ceilingrover, cross.x, cross.y); if (open[hi].top < oldopentop) { - topedge[HIGH] = P_GetFFloorBottomZAt(open[hi].ceilingrover, cross.x, cross.y); + topedge[hi] = P_GetFFloorBottomZAt(open[hi].ceilingrover, cross.x, cross.y); } - openceilingdrop = ( topedge[HIGH] - topedge[LOW] ); + openceilingdrop = ( topedge[hi] - topedge[lo] ); } hi = ( open[0].bottom < open[1].bottom ); - openbottom = open[hi].bottom; - - if (openbottom > oldopenbottom) + if (open[hi].bottom >= oldopenbottom) { + openbottom = open[hi].bottom; openfloorrover = open[hi].floorrover; openfloordiff = ( P_GetFFloorTopZAt(openfloorrover, cross.x, cross.y) - mobj->z ); lo = ! hi; - botedge[HIGH] = P_GetFFloorTopZAt(open[hi].floorrover, cross.x, cross.y); + botedge[hi] = P_GetFFloorTopZAt(open[hi].floorrover, cross.x, cross.y); if (open[lo].bottom > oldopenbottom) { - botedge[LOW] = P_GetFFloorTopZAt(open[lo].floorrover, cross.x, cross.y); + botedge[lo] = P_GetFFloorTopZAt(open[lo].floorrover, cross.x, cross.y); } - openfloordrop = ( botedge[HIGH] - botedge[LOW] ); + openfloordrop = ( botedge[hi] - botedge[lo] ); } } } From 1db22403bb3b47904eb8e3a4b73a66330e829292 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 15 Oct 2020 04:30:48 -0700 Subject: [PATCH 07/11] Guard with mobj?? --- src/p_maputl.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 4826c2fdc..a7e45b016 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -430,6 +430,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) enum { FRONT, BACK }; sector_t *front, *back; + fixed_t thingtop = 0; vertex_t cross; /* these init to shut compiler up */ @@ -460,6 +461,11 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) I_Assert(front != NULL); I_Assert(back != NULL); + if (mobj) + { + thingtop = mobj->z + mobj->height; + } + openfloorrover = openceilingrover = NULL; if (linedef->polyobj) { @@ -490,13 +496,16 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) highceiling = height[high]; opentopslope = sector[low]->c_slope; - openceilingdiff = ( mobj->z + mobj->height - - P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) ); + if (mobj) + { + openceilingdiff = ( thingtop - + P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) ); - topedge[FRONT] = P_GetSectorCeilingZAt(front, cross.x, cross.y); - topedge[BACK] = P_GetSectorCeilingZAt(back, cross.x, cross.y); + topedge[FRONT] = P_GetSectorCeilingZAt(front, cross.x, cross.y); + topedge[BACK] = P_GetSectorCeilingZAt(back, cross.x, cross.y); - openceilingdrop = ( topedge[high] - topedge[low] ); + openceilingdrop = ( topedge[high] - topedge[low] ); + } height[FRONT] = P_GetFloorZ(mobj, front, tmx, tmy, linedef); height[BACK] = P_GetFloorZ(mobj, back, tmx, tmy, linedef); @@ -507,21 +516,22 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) lowfloor = height[low]; openbottomslope = sector[high]->f_slope; - openfloordiff = - ( P_GetSectorFloorZAt(sector[high], cross.x, cross.y) - mobj->z ); + if (mobj) + { + openfloordiff = + ( P_GetSectorFloorZAt(sector[high], cross.x, cross.y) - mobj->z ); - botedge[FRONT] = P_GetSectorFloorZAt(front, cross.x, cross.y); - botedge[BACK] = P_GetSectorFloorZAt(back, cross.x, cross.y); + botedge[FRONT] = P_GetSectorFloorZAt(front, cross.x, cross.y); + botedge[BACK] = P_GetSectorFloorZAt(back, cross.x, cross.y); - openfloordrop = ( botedge[high] - botedge[low] ); + openfloordrop = ( botedge[high] - botedge[low] ); + } #undef low } if (mobj) { - fixed_t thingtop = mobj->z + mobj->height; - // Check for collision with front side's midtexture if Effect 4 is set if (linedef->flags & ML_EFFECT4 && !linedef->polyobj // don't do anything for polyobjects! ...for now From 0bf00aad359532c6b48c50210b478c9430d34444 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 15 Oct 2020 14:23:02 -0700 Subject: [PATCH 08/11] Condense variables, rename 'diff' to 'step' --- src/p_map.c | 16 +++++------ src/p_maputl.c | 74 ++++++++++++++++++++------------------------------ src/p_maputl.h | 6 ++-- 3 files changed, 41 insertions(+), 55 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 4d4a7ea67..be7f09387 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -58,8 +58,8 @@ mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz mobj_t *tmhitthing; // the solid thing you bumped into (for collisions) ffloor_t *tmfloorrover, *tmceilingrover; pslope_t *tmfloorslope, *tmceilingslope; -static fixed_t tmfloordiff; -static fixed_t tmceilingdiff; +static fixed_t tmfloorstep; +static fixed_t tmceilingstep; // keep track of the line that lowers the ceiling, // so missiles don't explode against sky hack walls @@ -1706,7 +1706,7 @@ static boolean PIT_CheckLine(line_t *ld) ceilingline = ld; tmceilingrover = openceilingrover; tmceilingslope = opentopslope; - tmceilingdiff = openceilingdiff; + tmceilingstep = openceilingstep; tmthing->ceilingdrop = openceilingdrop; } @@ -1715,7 +1715,7 @@ static boolean PIT_CheckLine(line_t *ld) tmfloorz = openbottom; tmfloorrover = openfloorrover; tmfloorslope = openbottomslope; - tmfloordiff = openfloordiff; + tmfloorstep = openfloorstep; tmthing->floordrop = openfloordrop; } @@ -1806,8 +1806,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) tmfloorslope = newsubsec->sector->f_slope; tmceilingslope = newsubsec->sector->c_slope; - tmfloordiff = 0; - tmceilingdiff = 0; + tmfloorstep = 0; + tmceilingstep = 0; // Check list of fake floors and see if tmfloorz/tmceilingz need to be altered. if (newsubsec->sector->ffloors) @@ -2542,7 +2542,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->eflags |= MFE_JUSTSTEPPEDDOWN; thing->ceilingdrop = 0; } - else if (tmceilingz < thingtop && tmceilingdiff <= maxstep) + else if (tmceilingz < thingtop && tmceilingstep <= maxstep) { thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->ceilingrover = tmceilingrover; @@ -2556,7 +2556,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->eflags |= MFE_JUSTSTEPPEDDOWN; thing->floordrop = 0; } - else if (tmfloorz > thing->z && tmfloordiff <= maxstep) + else if (tmfloorz > thing->z && tmfloorstep <= maxstep) { thing->z = thing->floorz = tmfloorz; thing->floorrover = tmfloorrover; diff --git a/src/p_maputl.c b/src/p_maputl.c index a7e45b016..733adc6ad 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -279,10 +279,10 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1) fixed_t opentop, openbottom, openrange, lowfloor, highceiling; pslope_t *opentopslope, *openbottomslope; ffloor_t *openfloorrover, *openceilingrover; -fixed_t openfloordiff; -fixed_t openceilingdiff; -fixed_t openfloordrop; +fixed_t openceilingstep; fixed_t openceilingdrop; +fixed_t openfloorstep; +fixed_t openfloordrop; // P_CameraLineOpening // P_LineOpening, but for camera @@ -437,6 +437,9 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) fixed_t topedge[2] = {0}; fixed_t botedge[2] = {0}; + int hi; + int lo; + if (linedef->sidenum[1] == 0xffff) { // single sided line @@ -475,59 +478,53 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) highceiling = INT32_MIN; lowfloor = INT32_MAX; opentopslope = openbottomslope = NULL; - openfloordiff = 0; - openceilingdiff = 0; + openceilingstep = 0; + openceilingdrop = 0; + openfloorstep = 0; + openfloordrop = 0; } else { // Set open and high/low values here fixed_t height[2]; const sector_t * sector[2] = { front, back }; - int high; - -#define low ! high - height[FRONT] = P_GetCeilingZ(mobj, front, tmx, tmy, linedef); height[BACK] = P_GetCeilingZ(mobj, back, tmx, tmy, linedef); - high = ( height[0] < height[1] ); + hi = ( height[0] < height[1] ); + lo = ! hi; - opentop = height[low]; - highceiling = height[high]; - opentopslope = sector[low]->c_slope; + opentop = height[lo]; + highceiling = height[hi]; + opentopslope = sector[lo]->c_slope; if (mobj) { - openceilingdiff = ( thingtop - - P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) ); - topedge[FRONT] = P_GetSectorCeilingZAt(front, cross.x, cross.y); topedge[BACK] = P_GetSectorCeilingZAt(back, cross.x, cross.y); - openceilingdrop = ( topedge[high] - topedge[low] ); + openceilingstep = ( thingtop - topedge[lo] ); + openceilingdrop = ( topedge[hi] - topedge[lo] ); } height[FRONT] = P_GetFloorZ(mobj, front, tmx, tmy, linedef); height[BACK] = P_GetFloorZ(mobj, back, tmx, tmy, linedef); - high = ( height[0] < height[1] ); + hi = ( height[0] < height[1] ); + lo = ! hi; - openbottom = height[high]; - lowfloor = height[low]; - openbottomslope = sector[high]->f_slope; + openbottom = height[hi]; + lowfloor = height[lo]; + openbottomslope = sector[hi]->f_slope; if (mobj) { - openfloordiff = - ( P_GetSectorFloorZAt(sector[high], cross.x, cross.y) - mobj->z ); - botedge[FRONT] = P_GetSectorFloorZAt(front, cross.x, cross.y); botedge[BACK] = P_GetSectorFloorZAt(back, cross.x, cross.y); - openfloordrop = ( botedge[high] - botedge[low] ); + openfloorstep = ( botedge[hi] - mobj->z ); + openfloordrop = ( botedge[hi] - botedge[lo] ); } - -#undef low } if (mobj) @@ -583,13 +580,11 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 > delta2) { // Below if (opentop > texbottom) { - openceilingdiff = ( opentop - texbottom ); opentop = texbottom; } } else { // Above if (openbottom < textop) { - openfloordiff = ( textop - openbottom ); openbottom = textop; } } @@ -620,7 +615,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (polybottom < opentop && delta1 >= delta2) { - openceilingdiff = ( opentop - polybottom ); opentop = polybottom; } else if (polybottom < highceiling && delta1 >= delta2) @@ -630,7 +624,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (polytop > openbottom && delta1 < delta2) { - openfloordiff = ( polytop - openbottom ); openbottom = polytop; } else if (polytop > lowfloor && delta1 < delta2) @@ -660,9 +653,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) { INT32_MAX, INT32_MIN, NULL, NULL }, }; - int lo; - int hi; - const fixed_t oldopentop = opentop; const fixed_t oldopenbottom = openbottom; @@ -754,11 +744,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (open[lo].top <= oldopentop) { - opentop = open[lo].top; - openceilingrover = open[lo].ceilingrover; - openceilingdiff = ( thingtop - - P_GetFFloorBottomZAt(openceilingrover, cross.x, cross.y) ); - hi = ! lo; topedge[lo] = P_GetFFloorBottomZAt(open[lo].ceilingrover, cross.x, cross.y); @@ -768,6 +753,9 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) topedge[hi] = P_GetFFloorBottomZAt(open[hi].ceilingrover, cross.x, cross.y); } + opentop = open[lo].top; + openceilingrover = open[lo].ceilingrover; + openceilingstep = ( thingtop - topedge[lo] ); openceilingdrop = ( topedge[hi] - topedge[lo] ); } @@ -775,11 +763,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (open[hi].bottom >= oldopenbottom) { - openbottom = open[hi].bottom; - openfloorrover = open[hi].floorrover; - openfloordiff = - ( P_GetFFloorTopZAt(openfloorrover, cross.x, cross.y) - mobj->z ); - lo = ! hi; botedge[hi] = P_GetFFloorTopZAt(open[hi].floorrover, cross.x, cross.y); @@ -789,6 +772,9 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) botedge[lo] = P_GetFFloorTopZAt(open[lo].floorrover, cross.x, cross.y); } + openbottom = open[hi].bottom; + openfloorrover = open[hi].floorrover; + openfloorstep = ( botedge[hi] - mobj->z ); openfloordrop = ( botedge[hi] - botedge[lo] ); } } diff --git a/src/p_maputl.h b/src/p_maputl.h index 237170bac..9349d0e53 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -58,10 +58,10 @@ void P_HitSpecialLines(mobj_t *thing, fixed_t x, fixed_t y, fixed_t momx, fixed_ extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling; extern pslope_t *opentopslope, *openbottomslope; extern ffloor_t *openfloorrover, *openceilingrover; -extern fixed_t openfloordiff; -extern fixed_t openceilingdiff; -extern fixed_t openfloordrop; +extern fixed_t openceilingstep; extern fixed_t openceilingdrop; +extern fixed_t openfloorstep; +extern fixed_t openfloordrop; void P_LineOpening(line_t *plinedef, mobj_t *mobj); From 9fb7ba77e4247303900b548b43adef6397d161f1 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 15 Oct 2020 14:47:10 -0700 Subject: [PATCH 09/11] Midtexture step up/down --- src/p_maputl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 733adc6ad..ee1fb5a42 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -437,8 +437,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) fixed_t topedge[2] = {0}; fixed_t botedge[2] = {0}; - int hi; - int lo; + int hi = 0; + int lo = 0; if (linedef->sidenum[1] == 0xffff) { @@ -580,12 +580,20 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 > delta2) { // Below if (opentop > texbottom) { + topedge[lo] -= ( opentop - texbottom ); + opentop = texbottom; + openceilingstep = ( thingtop - topedge[lo] ); + openceilingdrop = ( topedge[hi] - topedge[lo] ); } } else { // Above if (openbottom < textop) { + botedge[hi] += ( textop - openbottom ); + openbottom = textop; + openfloorstep = ( botedge[hi] - mobj->z ); + openfloordrop = ( botedge[hi] - botedge[lo] ); } } } From 4569d9650aeca5baacbbef1337e037ae765c4b9f Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 15 Oct 2020 15:51:31 -0700 Subject: [PATCH 10/11] Move drop reset in air to P_CheckPosition Fixes respawning over slopes after crossing a drop. --- src/p_map.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index be7f09387..3b367340e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1620,6 +1620,8 @@ static boolean PIT_CheckCameraLine(line_t *ld) // static boolean PIT_CheckLine(line_t *ld) { + const fixed_t thingtop = tmthing->z + tmthing->height; + if (ld->polyobj && !(ld->polyobj->flags & POF_SOLID)) return true; @@ -1707,7 +1709,10 @@ static boolean PIT_CheckLine(line_t *ld) tmceilingrover = openceilingrover; tmceilingslope = opentopslope; tmceilingstep = openceilingstep; - tmthing->ceilingdrop = openceilingdrop; + if (thingtop == tmthing->ceilingz) + { + tmthing->ceilingdrop = openceilingdrop; + } } if (openbottom > tmfloorz) @@ -1716,7 +1721,10 @@ static boolean PIT_CheckLine(line_t *ld) tmfloorrover = openfloorrover; tmfloorslope = openbottomslope; tmfloorstep = openfloorstep; - tmthing->floordrop = openfloordrop; + if (tmthing->z == tmthing->floorz) + { + tmthing->floordrop = openfloordrop; + } } if (highceiling > tmdrpoffceilz) @@ -1771,6 +1779,7 @@ static boolean PIT_CheckLine(line_t *ld) // boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) { + INT32 thingtop = thing->z + thing->height; INT32 xl, xh, yl, yh, bx, by; subsector_t *newsubsec; boolean blockval = true; @@ -1814,7 +1823,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) { ffloor_t *rover; fixed_t delta1, delta2; - INT32 thingtop = thing->z + thing->height; for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { @@ -1946,7 +1954,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) if (po->validcount != validcount) // if polyobj hasn't been checked { sector_t *polysec; - fixed_t delta1, delta2, thingtop; + fixed_t delta1, delta2; fixed_t polytop, polybottom; po->validcount = validcount; @@ -1972,7 +1980,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) polybottom = INT32_MIN; } - thingtop = thing->z + thing->height; delta1 = thing->z - (polybottom + ((polytop - polybottom)/2)); delta2 = thingtop - (polybottom + ((polytop - polybottom)/2)); @@ -2028,6 +2035,16 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) if (!P_BlockLinesIterator(bx, by, PIT_CheckLine)) blockval = false; + if (thingtop < thing->ceilingz) + { + thing->ceilingdrop = 0; + } + + if (thing->z > thing->floorz) + { + thing->floordrop = 0; + } + return blockval; } @@ -2507,25 +2524,10 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thing->eflags & MFE_VERTICALFLIP) { if (thing->z < tmfloorz) - { return false; // mobj must raise itself to fit - } - else if (thing->z > thing->floorz) - { - thing->floordrop = 0; - } - } - else - { - if (tmceilingz < thingtop) - { - return false; // mobj must lower itself to fit - } - else if (thingtop < thing->ceilingz) - { - thing->ceilingdrop = 0; - } } + else if (tmceilingz < thingtop) + return false; // mobj must lower itself to fit // Ramp test if ((maxstep > 0) && !(P_MobjTouchingSectorSpecial(thing, 1, 14, false))) From 99c1f8dba57b1a36d2ccad7aa297e8537f5ca7c9 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 15 Oct 2020 15:53:44 -0700 Subject: [PATCH 11/11] Move higher --- src/p_map.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 3b367340e..10f048e77 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1818,6 +1818,16 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) tmfloorstep = 0; tmceilingstep = 0; + if (thingtop < thing->ceilingz) + { + thing->ceilingdrop = 0; + } + + if (thing->z > thing->floorz) + { + thing->floordrop = 0; + } + // Check list of fake floors and see if tmfloorz/tmceilingz need to be altered. if (newsubsec->sector->ffloors) { @@ -2035,16 +2045,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) if (!P_BlockLinesIterator(bx, by, PIT_CheckLine)) blockval = false; - if (thingtop < thing->ceilingz) - { - thing->ceilingdrop = 0; - } - - if (thing->z > thing->floorz) - { - thing->floordrop = 0; - } - return blockval; }