mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'stairjank-falloff' into 'master'
Reduce stair janking loss of control if momentum angle drifts too far from facing angle See merge request KartKrew/Kart!850
This commit is contained in:
commit
eb68c15c96
1 changed files with 33 additions and 1 deletions
34
src/p_user.c
34
src/p_user.c
|
|
@ -1792,6 +1792,38 @@ static void P_DoBubbleBreath(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline boolean P_IsMomentumAngleLocked(player_t *player)
|
||||||
|
{
|
||||||
|
// This timer is used for the animation too and the
|
||||||
|
// animation should continue for a bit after the physics
|
||||||
|
// stop.
|
||||||
|
|
||||||
|
if (player->stairjank > 8)
|
||||||
|
{
|
||||||
|
const angle_t th = K_MomentumAngle(player->mo);
|
||||||
|
const angle_t d = AngleDelta(th, player->mo->angle);
|
||||||
|
|
||||||
|
// A larger difference between momentum and facing
|
||||||
|
// angles awards back control.
|
||||||
|
// <45 deg: 3/4 tics
|
||||||
|
// >45 deg: 2/4 tics
|
||||||
|
// >90 deg: 1/4 tics
|
||||||
|
// >135 deg: 0/4 tics
|
||||||
|
|
||||||
|
if ((leveltime & 3) > (d / ANGLE_45))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (K_IsRidingFloatingTop(player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//#define OLD_MOVEMENT_CODE 1
|
//#define OLD_MOVEMENT_CODE 1
|
||||||
static void P_3dMovement(player_t *player)
|
static void P_3dMovement(player_t *player)
|
||||||
{
|
{
|
||||||
|
|
@ -1812,7 +1844,7 @@ static void P_3dMovement(player_t *player)
|
||||||
// Get the old momentum; this will be needed at the end of the function! -SH
|
// Get the old momentum; this will be needed at the end of the function! -SH
|
||||||
oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
|
oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
|
||||||
|
|
||||||
if ((player->stairjank > 8 && leveltime & 3) || K_IsRidingFloatingTop(player))
|
if (P_IsMomentumAngleLocked(player))
|
||||||
{
|
{
|
||||||
movepushangle = K_MomentumAngle(player->mo);
|
movepushangle = K_MomentumAngle(player->mo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue