Turn confirm goes back to neutral when they aren't trying to turn.

This commit is contained in:
Sally Coolatta 2021-02-05 21:34:16 -05:00
parent 64d6453331
commit b5d7434caa

View file

@ -720,11 +720,15 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
// Complete override of all ticcmd functionality // Complete override of all ticcmd functionality
if (LUAh_BotTiccmd(player, cmd)) if (LUAh_BotTiccmd(player, cmd))
{
return; return;
}
// Start boost handler // Start boost handler
if (leveltime <= starttime) if (leveltime <= starttime)
{ {
// TODO: Move towards finish line during position, but not too close.
tic_t length = (TICRATE/6); tic_t length = (TICRATE/6);
tic_t boosthold = starttime - K_GetSpindashChargeTime(player); tic_t boosthold = starttime - K_GetSpindashChargeTime(player);
@ -869,6 +873,7 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
if (turnamt > 0) if (turnamt > 0)
{ {
// Count up
if (player->botvars.turnconfirm < BOTTURNCONFIRM) if (player->botvars.turnconfirm < BOTTURNCONFIRM)
{ {
player->botvars.turnconfirm++; player->botvars.turnconfirm++;
@ -876,11 +881,24 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
} }
else if (turnamt < 0) else if (turnamt < 0)
{ {
// Count down
if (player->botvars.turnconfirm > -BOTTURNCONFIRM) if (player->botvars.turnconfirm > -BOTTURNCONFIRM)
{ {
player->botvars.turnconfirm--; player->botvars.turnconfirm--;
} }
} }
else
{
// Back to neutral
if (player->botvars.turnconfirm < 0)
{
player->botvars.turnconfirm++;
}
else if (player->botvars.turnconfirm > 0)
{
player->botvars.turnconfirm--;
}
}
if (abs(player->botvars.turnconfirm) >= BOTTURNCONFIRM) if (abs(player->botvars.turnconfirm) >= BOTTURNCONFIRM)
{ {