Suspend local camera during DRIFTEND kickout

This commit is contained in:
AJ Martinez 2023-02-24 21:16:53 -07:00
parent e3e567f303
commit c17f5c22ff
2 changed files with 20 additions and 15 deletions

View file

@ -1095,9 +1095,14 @@ static void G_DoAnglePrediction(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer, p
realtics--;
}
// In case of angle debugging, break glass
localangle[ssplayer - 1] += angleChange;
//player->angleturn = localangle[ssplayer - 1];
if (player->pflags & PF_DRIFTEND)
{
localangle[ssplayer - 1] = player->mo->angle;
}
else
{
localangle[ssplayer - 1] += angleChange;
}
}
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)

View file

@ -2137,39 +2137,39 @@ static void P_UpdatePlayerAngle(player_t *player)
if (!K_PlayerUsesBotMovement(player))
{
// With a full slam on the analog stick, how far could we steer in either direction?
INT16 steeringRight = K_UpdateSteeringValue(player->steering, KART_FULLTURN);
angle_t maxTurnRight = K_GetKartTurnValue(player, steeringRight) << TICCMD_REDUCE;
INT16 steeringLeft = K_UpdateSteeringValue(player->steering, -1 * KART_FULLTURN);
angle_t maxTurnLeft = K_GetKartTurnValue(player, steeringLeft) << TICCMD_REDUCE;
// Grab local camera angle from ticcmd. Where do we actually want to go?
angle_t targetAngle = (player->cmd.angle) << TICCMD_REDUCE;
angle_t targetDelta = targetAngle - (player->mo->angle);
//CONS_Printf("%u, steering by %u but we want %u, MTL %d %u, MTR %d %u\n", targetAngle, angleChange, targetDelta, steeringLeft, maxTurnLeft, steeringRight, maxTurnRight);
if (targetDelta == angleChange || player->pflags & PF_DRIFTEND)
{
//CONS_Printf("Facing correct, thank god\n");
// We are where we need to be. :)
// Alternatively, while in DRIFTEND we want to trust inputs for a bit, not camera.
// The game client doesn't know we're DRIFTEND until after a response gets back,
// so we momentarily ignore the camera angle and let the server trust our inputs instead.
// That way, even if you're steering blind, you get the intended "kick-out" effect.
}
else if (targetDelta >= ANGLE_180 && maxTurnLeft >= targetDelta)
else if (targetDelta >= ANGLE_180 && maxTurnLeft >= targetDelta) // Overshot, so just fudge it.
{
//CONS_Printf("undershoot left\n");
angleChange = targetDelta;
}
else if (targetDelta <= ANGLE_180 && maxTurnRight <= targetDelta)
else if (targetDelta <= ANGLE_180 && maxTurnRight <= targetDelta) // Overshot, so just fudge it.
{
//CONS_Printf("undershoot right\n");
angleChange = targetDelta;
}
else if (targetDelta >= ANGLE_180 && maxTurnLeft < targetDelta)
else if (targetDelta >= ANGLE_180 && maxTurnLeft < targetDelta) // Undershot, slam the stick.
{
//CONS_Printf("overshoot left\n");
angleChange = maxTurnLeft;
}
else if (targetDelta <= ANGLE_180 && maxTurnRight < targetDelta)
else if (targetDelta <= ANGLE_180 && maxTurnRight < targetDelta) // Undershot, slam the stick.
{
//CONS_Printf("overshoot right\n");
angleChange = maxTurnRight;
}
}