mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Sliptide-aware camera steering, fix countersteer easing
This commit is contained in:
parent
94cf9fc47b
commit
b4ffc33fcb
2 changed files with 23 additions and 5 deletions
|
|
@ -8859,9 +8859,13 @@ INT16 K_UpdateSteeringValue(INT16 inputSteering, INT16 destSteering)
|
||||||
INT16 outputSteering = 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))
|
if ((inputSteering > 0 && destSteering < 0) || (inputSteering < 0 && destSteering > 0))
|
||||||
{
|
{
|
||||||
amount = max(min(KART_FULLTURN, abs(inputSteering)), amount);
|
// 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.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
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);
|
angle_t leniency = (4*ANG1/3) * min(player->cmd.latency, 6);
|
||||||
// Don't force another turning tic, just give them the desired angle!
|
// 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.
|
// Either we're dead on or we can't steer at all.
|
||||||
// Stuff like sliptiding requires some blind-faith steering:
|
|
||||||
// if a camera correction stops our turn input, the sliptide randomly fails!
|
|
||||||
player->steering = targetsteering;
|
player->steering = targetsteering;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We're off. Try to legally steer the player towards their camera.
|
// 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)
|
||||||
|
{
|
||||||
|
steeringRight = max(steeringRight, max(steeringLeft, 1));
|
||||||
|
steeringLeft = max(steeringLeft, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
steeringLeft = min(steeringLeft, max(steeringRight, -1));
|
||||||
|
steeringRight = min(steeringLeft, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
player->steering = P_FindClosestTurningForAngle(player, targetDelta, steeringLeft, steeringRight);
|
player->steering = P_FindClosestTurningForAngle(player, targetDelta, steeringLeft, steeringRight);
|
||||||
angleChange = K_GetKartTurnValue(player, player->steering) << TICCMD_REDUCE;
|
angleChange = K_GetKartTurnValue(player, player->steering) << TICCMD_REDUCE;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue