From 1a25fcee4e1c5eadd2246d7ba6e2f6c01a6af11e Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 1 Apr 2022 16:05:49 -0400 Subject: [PATCH] Improve spindash conditions --- src/k_bot.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/k_bot.c b/src/k_bot.c index dcacf0120..0aee5902e 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -309,12 +309,15 @@ boolean K_BotCanTakeCut(player_t *player) --------------------------------------------------*/ static fixed_t K_BotSpeedScaled(player_t *player, fixed_t speed) { - fixed_t moveFactor = player->mo->movefactor; fixed_t result = speed; -#if 0 // I still think this is a good idea, but it makes them move way slower on ice. Needs investigating. - if (moveFactor != FRACUNIT) + // I still think this is a good idea, but it makes them move way slower on ice / slopes. + // Needs investigating. +#if 0 + if (player->mo->movefactor != FRACUNIT) { + fixed_t moveFactor = player->mo->movefactor; + if (moveFactor == 0) { moveFactor = 1; @@ -330,7 +333,6 @@ static fixed_t K_BotSpeedScaled(player_t *player, fixed_t speed) result = FixedMul(result, moveFactor); } -#endif if (player->mo->standingslope != NULL) { @@ -352,6 +354,7 @@ static fixed_t K_BotSpeedScaled(player_t *player, fixed_t speed) result = FixedMul(result, (FRACUNIT*9/10) + (slopeMul/10)); } } +#endif return result; } @@ -1439,7 +1442,7 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd) // We're in about the right place, let's do whatever we want to. - if (player->kartspeed > 3) + if (player->kartspeed >= 5) { // Faster characters want to spindash. // Slower characters will use their momentum. @@ -1473,9 +1476,17 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd) { turnamt = bullyTurn; - trySpindash = false; - cmd->buttons |= BT_ACCELERATE; - cmd->forwardmove = MAXPLMOVE; + // If already spindashing, wait until we get a relatively OK charge first. + if (player->spindash > 0 && player->spindash <= TICRATE) + { + trySpindash = true; + } + else + { + trySpindash = false; + cmd->buttons |= BT_ACCELERATE; + cmd->forwardmove = MAXPLMOVE; + } } } else