mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-02 13:12:50 +00:00
Merge branch 'online-handling' into 'master'
Digital-friendly handling responsiveness See merge request KartKrew/Kart!1160
This commit is contained in:
commit
7f50e4cfa9
2 changed files with 30 additions and 5 deletions
13
src/k_kart.c
13
src/k_kart.c
|
|
@ -8855,10 +8855,21 @@ INT16 K_UpdateSteeringValue(INT16 inputSteering, INT16 destSteering)
|
|||
// player->steering is the turning value, but with easing applied.
|
||||
// Keeps micro-turning from old easing, but isn't controller dependent.
|
||||
|
||||
const INT16 amount = KART_FULLTURN/3;
|
||||
INT16 amount = KART_FULLTURN/3;
|
||||
INT16 diff = destSteering - inputSteering;
|
||||
INT16 outputSteering = inputSteering;
|
||||
|
||||
|
||||
// We switched steering directions, lighten up on easing for a more responsive countersteer.
|
||||
// (Don't do this for steering 0, let digital inputs tap-adjust!)
|
||||
if ((inputSteering > 0 && destSteering < 0) || (inputSteering < 0 && destSteering > 0))
|
||||
{
|
||||
// Don't let small turns in direction X allow instant turns in direction Y.
|
||||
INT16 countersteer = min(KART_FULLTURN, abs(inputSteering)); // The farthest we should go is to 0 -- neutral.
|
||||
amount = max(countersteer, amount); // But don't reduce turning strength from baseline either.
|
||||
}
|
||||
|
||||
|
||||
if (abs(diff) <= amount)
|
||||
{
|
||||
// Reached the intended value, set instantly.
|
||||
|
|
|
|||
22
src/p_user.c
22
src/p_user.c
|
|
@ -2235,16 +2235,30 @@ static void P_UpdatePlayerAngle(player_t *player)
|
|||
angle_t leniency = (4*ANG1/3) * min(player->cmd.latency, 6);
|
||||
// Don't force another turning tic, just give them the desired angle!
|
||||
|
||||
if (targetDelta == angleChange || K_Sliptiding(player) || (maxTurnRight == 0 && maxTurnLeft == 0))
|
||||
if (targetDelta == angleChange || (maxTurnRight == 0 && maxTurnLeft == 0))
|
||||
{
|
||||
// Either we're dead on, we can't steer, or we're in a special handling state.
|
||||
// Stuff like sliptiding requires some blind-faith steering:
|
||||
// if a camera correction stops our turn input, the sliptide randomly fails!
|
||||
// Either we're dead on or we can't steer at all.
|
||||
player->steering = targetsteering;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're off. Try to legally steer the player towards their camera.
|
||||
|
||||
if (K_Sliptiding(player) && P_IsObjectOnGround(player->mo) && (player->cmd.turning != 0) && ((player->cmd.turning > 0) == (player->aizdriftstrat > 0)))
|
||||
{
|
||||
// Don't change handling direction if someone's inputs are sliptiding, you'll break the sliptide!
|
||||
if (player->cmd.turning > 0)
|
||||
{
|
||||
steeringLeft = max(steeringLeft, 1);
|
||||
steeringRight = max(steeringRight, steeringLeft);
|
||||
}
|
||||
else
|
||||
{
|
||||
steeringRight = min(steeringRight, -1);
|
||||
steeringLeft = min(steeringLeft, steeringRight);
|
||||
}
|
||||
}
|
||||
|
||||
player->steering = P_FindClosestTurningForAngle(player, targetDelta, steeringLeft, steeringRight);
|
||||
angleChange = K_GetKartTurnValue(player, player->steering) << TICCMD_REDUCE;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue