Move drop reset in air to P_CheckPosition

Fixes respawning over slopes after crossing a drop.
This commit is contained in:
James R 2020-10-15 15:51:31 -07:00
parent 9fb7ba77e4
commit 4569d9650a

View file

@ -1620,6 +1620,8 @@ static boolean PIT_CheckCameraLine(line_t *ld)
// //
static boolean PIT_CheckLine(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)) if (ld->polyobj && !(ld->polyobj->flags & POF_SOLID))
return true; return true;
@ -1707,7 +1709,10 @@ static boolean PIT_CheckLine(line_t *ld)
tmceilingrover = openceilingrover; tmceilingrover = openceilingrover;
tmceilingslope = opentopslope; tmceilingslope = opentopslope;
tmceilingstep = openceilingstep; tmceilingstep = openceilingstep;
tmthing->ceilingdrop = openceilingdrop; if (thingtop == tmthing->ceilingz)
{
tmthing->ceilingdrop = openceilingdrop;
}
} }
if (openbottom > tmfloorz) if (openbottom > tmfloorz)
@ -1716,7 +1721,10 @@ static boolean PIT_CheckLine(line_t *ld)
tmfloorrover = openfloorrover; tmfloorrover = openfloorrover;
tmfloorslope = openbottomslope; tmfloorslope = openbottomslope;
tmfloorstep = openfloorstep; tmfloorstep = openfloorstep;
tmthing->floordrop = openfloordrop; if (tmthing->z == tmthing->floorz)
{
tmthing->floordrop = openfloordrop;
}
} }
if (highceiling > tmdrpoffceilz) 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) 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; INT32 xl, xh, yl, yh, bx, by;
subsector_t *newsubsec; subsector_t *newsubsec;
boolean blockval = true; boolean blockval = true;
@ -1814,7 +1823,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
{ {
ffloor_t *rover; ffloor_t *rover;
fixed_t delta1, delta2; fixed_t delta1, delta2;
INT32 thingtop = thing->z + thing->height;
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) 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 if (po->validcount != validcount) // if polyobj hasn't been checked
{ {
sector_t *polysec; sector_t *polysec;
fixed_t delta1, delta2, thingtop; fixed_t delta1, delta2;
fixed_t polytop, polybottom; fixed_t polytop, polybottom;
po->validcount = validcount; po->validcount = validcount;
@ -1972,7 +1980,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
polybottom = INT32_MIN; polybottom = INT32_MIN;
} }
thingtop = thing->z + thing->height;
delta1 = thing->z - (polybottom + ((polytop - polybottom)/2)); delta1 = thing->z - (polybottom + ((polytop - polybottom)/2));
delta2 = thingtop - (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)) if (!P_BlockLinesIterator(bx, by, PIT_CheckLine))
blockval = false; blockval = false;
if (thingtop < thing->ceilingz)
{
thing->ceilingdrop = 0;
}
if (thing->z > thing->floorz)
{
thing->floordrop = 0;
}
return blockval; 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->eflags & MFE_VERTICALFLIP)
{ {
if (thing->z < tmfloorz) if (thing->z < tmfloorz)
{
return false; // mobj must raise itself to fit 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 // Ramp test
if ((maxstep > 0) && !(P_MobjTouchingSectorSpecial(thing, 1, 14, false))) if ((maxstep > 0) && !(P_MobjTouchingSectorSpecial(thing, 1, 14, false)))