mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-04-19 16:51:53 +00:00
Fix wall transfer cap for slopes with angles beyond the first quadrant
This commit is contained in:
parent
03824651e2
commit
1152c8c41e
1 changed files with 25 additions and 3 deletions
|
@ -1046,15 +1046,37 @@ fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope)
|
|||
{
|
||||
vector3_t slopemom, axis;
|
||||
angle_t ang;
|
||||
angle_t advanceAng = ANG15;
|
||||
const boolean upwards = (slope->zangle < ANGLE_180);
|
||||
|
||||
if (slope->flags & SL_NOPHYSICS)
|
||||
return 0;
|
||||
|
||||
// If there's physics, time for launching.
|
||||
// Doesn't kill the vertical momentum as much as P_SlopeLaunch does.
|
||||
ang = slope->zangle + ANG15*((slope->zangle > 0) ? 1 : -1);
|
||||
if (ang > ANGLE_90 && ang < ANGLE_180)
|
||||
ang = ((slope->zangle > 0) ? ANGLE_90 : InvAngle(ANGLE_90)); // hard cap of directly upwards
|
||||
ang = slope->zangle;
|
||||
|
||||
// for the time being, let's pretend the slope inclines upwards only
|
||||
if (!upwards)
|
||||
{
|
||||
ang += ANGLE_180;
|
||||
}
|
||||
|
||||
// angles past 90 degrees need to shrink to get closer to 90 degrees
|
||||
if (ang > ANGLE_90)
|
||||
{
|
||||
advanceAng = InvAngle(advanceAng);
|
||||
}
|
||||
|
||||
// now we set the actual final angle
|
||||
if ((ang > ANGLE_90) != (ang + advanceAng > ANGLE_90)) // does advancing the angle push it past directly upwards?
|
||||
{
|
||||
ang = (upwards ? ANGLE_90 : InvAngle(ANGLE_90)); // hard cap of directly upwards
|
||||
}
|
||||
else
|
||||
{
|
||||
ang = slope->zangle + advanceAng;
|
||||
}
|
||||
|
||||
slopemom.x = mo->momx;
|
||||
slopemom.y = mo->momy;
|
||||
|
|
Loading…
Reference in a new issue