Give podium bots more traction

This commit is contained in:
Sally Coolatta 2023-02-24 18:33:26 -05:00
parent 4a8dd02320
commit e47f46d3bc
3 changed files with 33 additions and 3 deletions

View file

@ -2559,6 +2559,10 @@ void readmaincfg(MYFILE *f, boolean mainfile)
INT32 value;
boolean doClearLevels = false;
#ifdef DEVELOP
(void)mainfile;
#endif
do
{
if (myfgets(s, MAXLINELEN, f))
@ -2630,10 +2634,12 @@ void readmaincfg(MYFILE *f, boolean mainfile)
//clear_levels();
doClearLevels = true;
}
#ifndef DEVELOP
else if (!mainfile && !gamedataadded)
{
deh_warning("You must define a custom gamedata to use \"%s\"", word);
}
#endif
else if (fastcmp(word, "CLEARLEVELS"))
{
doClearLevels = (UINT8)(value == 0 || word2[0] == 'F' || word2[0] == 'N');

View file

@ -53,9 +53,15 @@
boolean K_PodiumSequence(void)
{
// FIXME: Cache so we don't have to iterate all map headers every time
INT32 podiumMapNum = nummapheaders;
if (grandprixinfo.gp == false)
{
return false;
}
// FIXME: This function is used a lot during gameplay.
// Cache so we don't have to iterate all map headers every time.
if (podiummap && ((podiumMapNum = G_MapNumber(podiummap)) < nummapheaders))
{
return (gamemap == podiumMapNum+1);
@ -3422,7 +3428,7 @@ fixed_t K_GetNewSpeed(player_t *player)
// Don't calculate the acceleration as ever being above top speed
if (oldspeed > p_speed)
oldspeed = p_speed;
newspeed = FixedDiv(FixedDiv(FixedMul(oldspeed, accelmax - p_accel) + FixedMul(p_speed, p_accel), accelmax), ORIG_FRICTION);
newspeed = FixedDiv(FixedDiv(FixedMul(oldspeed, accelmax - p_accel) + FixedMul(p_speed, p_accel), accelmax), K_PlayerBaseFriction(ORIG_FRICTION));
finalspeed = newspeed - oldspeed;
@ -10007,18 +10013,35 @@ static void K_AirFailsafe(player_t *player)
}
}
//
// K_PlayerBaseFriction
//
fixed_t K_PlayerBaseFriction(fixed_t original)
{
fixed_t frict = original;
if (K_PodiumSequence() == true)
{
frict -= 4096;
}
return frict;
}
//
// K_AdjustPlayerFriction
//
void K_AdjustPlayerFriction(player_t *player)
{
fixed_t prevfriction = player->mo->friction;
const fixed_t prevfriction = K_PlayerBaseFriction(player->mo->friction);
if (P_IsObjectOnGround(player->mo) == false)
{
return;
}
player->mo->friction = prevfriction;
// Reduce friction after hitting a spring
if (player->tiregrease)
{

View file

@ -178,6 +178,7 @@ fixed_t K_3dKartMovement(player_t *player);
boolean K_PlayerEBrake(player_t *player);
SINT8 K_Sliptiding(player_t *player);
boolean K_FastFallBounce(player_t *player);
fixed_t K_PlayerBaseFriction(fixed_t original);
void K_AdjustPlayerFriction(player_t *player);
void K_MoveKartPlayer(player_t *player, boolean onground);
void K_CheckSpectateStatus(void);