mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Fix conflicting step up/down code
This commit is contained in:
parent
2c35034960
commit
e5a9bfc968
1 changed files with 38 additions and 41 deletions
79
src/p_map.c
79
src/p_map.c
|
|
@ -2525,60 +2525,57 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||||
|
|
||||||
floatok = true;
|
floatok = true;
|
||||||
|
|
||||||
thingtop = thing->z + thing->height;
|
if (maxstep > 0)
|
||||||
|
|
||||||
// Step up
|
|
||||||
if (thing->z < tmfloorz)
|
|
||||||
{
|
{
|
||||||
if (tmfloorz - thing->z <= maxstep)
|
thingtop = thing->z + thing->height;
|
||||||
{
|
|
||||||
thing->z = thing->floorz = tmfloorz;
|
|
||||||
thing->floorrover = tmfloorrover;
|
|
||||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false; // mobj must raise itself to fit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (tmceilingz < thingtop)
|
|
||||||
return false; // mobj must lower itself to fit
|
|
||||||
|
|
||||||
// Ramp test
|
// Step up
|
||||||
if ((maxstep > 0) && !(P_MobjTouchingSectorSpecial(thing, 1, 14, false)))
|
if (thing->z < tmfloorz)
|
||||||
{
|
|
||||||
// If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS
|
|
||||||
// step down! Formerly required a Section1:13 sector for the full MAXSTEPMOVE, but no more.
|
|
||||||
|
|
||||||
if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep)
|
|
||||||
{
|
{
|
||||||
|
if (tmfloorstep <= maxstep)
|
||||||
|
{
|
||||||
|
thing->z = thing->floorz = tmfloorz;
|
||||||
|
thing->floorrover = tmfloorrover;
|
||||||
|
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false; // mobj must raise itself to fit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (tmceilingz < thingtop)
|
||||||
|
{
|
||||||
|
if (tmceilingstep <= maxstep)
|
||||||
|
{
|
||||||
|
thing->z = ( thing->ceilingz = tmceilingz ) - thing->height;
|
||||||
|
thing->ceilingrover = tmceilingrover;
|
||||||
|
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false; // mobj must lower itself to fit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!(P_MobjTouchingSectorSpecial(thing, 1, 14, false))) // Step down
|
||||||
|
{
|
||||||
|
// If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS
|
||||||
|
// step down! Formerly required a Section1:13 sector for the full MAXSTEPMOVE, but no more.
|
||||||
|
|
||||||
if (thingtop == thing->ceilingz && tmceilingz > thingtop && thing->ceilingdrop <= maxstep)
|
if (thingtop == thing->ceilingz && tmceilingz > thingtop && thing->ceilingdrop <= maxstep)
|
||||||
{
|
{
|
||||||
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
|
thing->z = (thing->ceilingz = tmceilingz) - thing->height;
|
||||||
thing->ceilingrover = tmceilingrover;
|
thing->ceilingrover = tmceilingrover;
|
||||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||||
thing->ceilingdrop = 0;
|
thing->ceilingdrop = 0;
|
||||||
}
|
}
|
||||||
else if (tmceilingz < thingtop && tmceilingstep <= maxstep)
|
else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->floordrop <= maxstep)
|
||||||
{
|
{
|
||||||
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
|
thing->z = thing->floorz = tmfloorz;
|
||||||
thing->ceilingrover = tmceilingrover;
|
thing->floorrover = tmfloorrover;
|
||||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||||
|
thing->floordrop = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 && tmfloorstep <= maxstep)
|
|
||||||
{
|
|
||||||
thing->z = thing->floorz = tmfloorz;
|
|
||||||
thing->floorrover = tmfloorrover;
|
|
||||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allowdropoff && !(thing->flags & MF_FLOAT) && thing->type != MT_SKIM && !tmfloorthing)
|
if (!allowdropoff && !(thing->flags & MF_FLOAT) && thing->type != MT_SKIM && !tmfloorthing)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue