From 7d7875d7bedaf31d102bb4ec7b45ae2bc62e395e Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 15 May 2023 06:49:31 -0400 Subject: [PATCH] Bots: New spindash conditions are more specific - Uphill check is ignored if you have slope resistance, or if you're moving fast enough to overpower it. - Offroad check is ignored if it wouldn't slow you down. - Made slow acceleration check have a higher range. --- src/k_bot.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/k_bot.c b/src/k_bot.c index dd777b0bb..7756c7fe6 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -927,12 +927,13 @@ static UINT8 K_TrySpindash(player_t *player) } \ } - if (player->mo->standingslope != NULL) + if (K_SlopeResistance(player) == false && player->mo->standingslope != NULL) { const pslope_t *slope = player->mo->standingslope; - if (!(slope->flags & SL_NOPHYSICS) && abs(slope->zdelta) >= FRACUNIT/21) + if ((slope->flags & SL_NOPHYSICS) == 0 && abs(slope->zdelta) >= FRACUNIT/21) { + const fixed_t speedPercent = FixedDiv(player->speed, 20 * player->mo->scale); fixed_t slopeDot = 0; angle_t angle = K_MomentumAngle(player->mo) - slope->xydirection; @@ -942,14 +943,14 @@ static UINT8 K_TrySpindash(player_t *player) } slopeDot = FINECOSINE(angle >> ANGLETOFINESHIFT); - uphill = (slopeDot < -FRACUNIT/2); + uphill = ((slopeDot + (speedPercent / 2)) < -FRACUNIT/2); } } - AddForCondition(player->offroad > 0); // In offroad - AddForCondition(speedDiff < (baseAccel >> 4)); // Moving too slowly + AddForCondition(K_ApplyOffroad(player) == true && player->offroad > 0); // Slowed by offroad + AddForCondition(speedDiff < (baseAccel >> 3)); // Accelerating slower than expected AddForCondition(angleDiff > ANG60); // Being pushed backwards - AddForCondition(uphill == true); // Going up a steep slope + AddForCondition(uphill == true); // Going up a steep slope without speed if (player->cmomx || player->cmomy) {