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.
This commit is contained in:
Sally Coolatta 2023-05-15 06:49:31 -04:00
parent 12ff9dc2ba
commit 7d7875d7be

View file

@ -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; 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; fixed_t slopeDot = 0;
angle_t angle = K_MomentumAngle(player->mo) - slope->xydirection; angle_t angle = K_MomentumAngle(player->mo) - slope->xydirection;
@ -942,14 +943,14 @@ static UINT8 K_TrySpindash(player_t *player)
} }
slopeDot = FINECOSINE(angle >> ANGLETOFINESHIFT); slopeDot = FINECOSINE(angle >> ANGLETOFINESHIFT);
uphill = (slopeDot < -FRACUNIT/2); uphill = ((slopeDot + (speedPercent / 2)) < -FRACUNIT/2);
} }
} }
AddForCondition(player->offroad > 0); // In offroad AddForCondition(K_ApplyOffroad(player) == true && player->offroad > 0); // Slowed by offroad
AddForCondition(speedDiff < (baseAccel >> 4)); // Moving too slowly AddForCondition(speedDiff < (baseAccel >> 3)); // Accelerating slower than expected
AddForCondition(angleDiff > ANG60); // Being pushed backwards 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) if (player->cmomx || player->cmomy)
{ {