Launch / step-down changes

- Launch / wall-transfer off of no-physics slopes
- Prevent step down when trying to move upwards
- E-brake enables launching again
- Removed old comment talking about slope nerf
This commit is contained in:
Sally Coolatta 2022-09-10 14:46:12 -04:00
parent 5b42b3b41a
commit 79f6d0643b
4 changed files with 27 additions and 8 deletions

View file

@ -2601,7 +2601,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
return false; // mobj must lower itself to fit
}
}
else if (!(P_MobjTouchingSectorSpecial(thing, 1, 14, false))) // Step down
else if (thing->momz * P_MobjFlip(thing) <= 0 // Step down requires moving down.
&& !(P_MobjTouchingSectorSpecial(thing, 1, 14, false)))
{
// 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.

View file

@ -1800,8 +1800,7 @@ void P_XYMovement(mobj_t *mo)
*/
}
else if (predictedz - mo->z > abs(slopemom.z/2)
&& P_CanApplySlopePhysics(mo, mo->standingslope) == true) // Sryder 2018-11-26: Don't launch here if it's a slope without physics, we stick to those like glue anyway
else if (predictedz - mo->z > abs(slopemom.z / 2))
{
// Now check if we were supposed to stick to this slope
//CONS_Printf("%d-%d > %d\n", (predictedz), (mo->z), (slopemom.z/2));

View file

@ -928,6 +928,27 @@ boolean P_CanApplySlopePhysics(mobj_t *mo, pslope_t *slope)
return true;
}
// Returns true if we should run slope launch code on an object.
boolean P_CanApplySlopeLaunch(mobj_t *mo, pslope_t *slope)
{
if (slope == NULL || mo == NULL || P_MobjWasRemoved(mo) == true)
{
// Invalid input.
return false;
}
// No physics slopes are fine to launch off of.
if (slope->normal.x == 0 && slope->normal.y == 0)
{
// Flat slope? No such thing, man. No such thing.
return false;
}
// We can do slope launching.
return true;
}
//
// P_QuantizeMomentumToSlope
//
@ -963,11 +984,8 @@ void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope)
// Handles slope ejection for objects
void P_SlopeLaunch(mobj_t *mo)
{
if (P_CanApplySlopePhysics(mo, mo->standingslope) == true) // If there's physics, time for launching.
if (P_CanApplySlopeLaunch(mo, mo->standingslope) == true) // If there's physics, time for launching.
{
// Double the pre-rotation Z, then halve the post-rotation Z. This reduces the
// vertical launch given from slopes while increasing the horizontal launch
// given. Good for SRB2's gravity and horizontal speeds.
vector3_t slopemom;
slopemom.x = mo->momx;
slopemom.y = mo->momy;
@ -1002,7 +1020,7 @@ fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope)
vector3_t slopemom, axis;
angle_t ang;
if (P_CanApplySlopePhysics(mo, mo->standingslope) == false)
if (P_CanApplySlopeLaunch(mo, mo->standingslope) == false)
{
return false;
}

View file

@ -83,6 +83,7 @@ fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y);
// Lots of physics-based bullshit
boolean P_CanApplySlopePhysics(mobj_t *mo, pslope_t *slope);
boolean P_CanApplySlopeLaunch(mobj_t *mo, pslope_t *slope);
void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
void P_SlopeLaunch(mobj_t *mo);