Make it flatten out faster & while rising, add a cap to the flattening, flatten out completely while respawning.

This commit is contained in:
Sally Coolatta 2022-03-28 22:14:45 -04:00
parent 421d850a5b
commit 60d72b5c20
2 changed files with 16 additions and 11 deletions

View file

@ -3415,7 +3415,7 @@ static angle_t K_TumbleSlope(mobj_t *mobj, angle_t pitch, angle_t roll)
return FixedMul(pitch, pitchMul) + FixedMul(roll, rollMul);
}
#define STEEP_VAL (ANGLE_45 - ANGLE_11hh) // (ANG60)
#define STEEP_VAL (ANGLE_45)
void K_CheckSlopeTumble(player_t *player, angle_t oldPitch, angle_t oldRoll)
{

View file

@ -2811,41 +2811,46 @@ void P_PlayerZMovement(mobj_t *mo)
// Even out pitch & roll slowly over time when falling.
// Helps give OpenGL models a bit of the tumble tell.
if (P_MobjFlip(mo) * mo->momz <= 0)
{
const angle_t evenSpeed = (ANG1 << 1) / 3; // 0.66 degrees
const angle_t speed = ANG1;
angle_t dest = ANGLE_45 + (ANG10 >> 1);
INT32 pitchDelta = AngleDeltaSigned(mo->pitch, 0);
INT32 rollDelta = AngleDeltaSigned(mo->roll, 0);
if (abs(pitchDelta) <= evenSpeed)
if (mo->player->respawn.state != RESPAWNST_NONE)
{
dest = 0;
}
if (abs(pitchDelta) <= speed && dest == 0)
{
mo->pitch = 0;
}
else
else if (abs(pitchDelta) > dest)
{
if (pitchDelta > 0)
{
mo->pitch -= evenSpeed;
mo->pitch -= speed;
}
else
{
mo->pitch += evenSpeed;
mo->pitch += speed;
}
}
if (abs(rollDelta) <= evenSpeed)
if (abs(rollDelta) <= speed && dest == 0)
{
mo->roll = 0;
}
else
else if (abs(rollDelta) > dest)
{
if (rollDelta > 0)
{
mo->roll -= evenSpeed;
mo->roll -= speed;
}
else
{
mo->roll += evenSpeed;
mo->roll += speed;
}
}
}