Alternative take on neutral drift speed boost

This commit is contained in:
Sally Coolatta 2025-04-29 00:32:58 -04:00
parent 7eb01bd553
commit f9d0cfa1af
4 changed files with 39 additions and 20 deletions

View file

@ -806,7 +806,6 @@ struct player_t
UINT8 flamelength; // Flame Shield dash meter, number of segments
UINT16 counterdash; // Flame Shield boost without the flame, largely. Used in places where awarding thrust would affect player control.
UINT16 neutraldash; // Neutral drifting is marginally faster.
UINT16 ballhogcharge; // Ballhog charge up -- the higher this value, the more projectiles
boolean ballhogtap; // Ballhog released during charge: used to allow semirapid tapfire

View file

@ -3648,16 +3648,47 @@ static void K_GetKartBoostPower(player_t *player)
ADDBOOST(player->vortexBoost/6, FRACUNIT/10, 0); // + ???% top speed, + 10% acceleration, +0% handling
}
if (player->neutraldash) // Neutral drifts are marginally faster
if (player->drift != 0) // Neutral drifts are marginally faster
{
ADDBOOST(
FRACUNIT/5, // + 20% top speed
FRACUNIT/4, // + 25% acceleration
0 // 0 handling
);
numboosts--; // No afterimage!
}
// Trying to emulate the old leniency timer being stat-based.
// I dunno if this is overkill because turning is already stat-based.
// Should this be a pure constant instead?
const INT16 max_steer_threshold = (KART_FULLTURN * 5) / 6;
INT32 steer_threshold = FixedMul((FRACUNIT * player->kartweight) / 9, max_steer_threshold);
INT32 steering = abs(player->steering);
fixed_t frac = 0;
if (steering < steer_threshold)
{
frac = FixedDiv(steer_threshold - steering, steer_threshold);
}
// Weaken the effect with drifts that were just started.
frac = (frac * abs(player->drift)) / 5;
if (frac > 0)
{
if (frac > FRACUNIT)
{
// Clamp between reasonable bounds.
frac = FRACUNIT;
}
// Get multiplier from easing function, to
// heavily reward being near exactly 0.
fixed_t multiplier = Easing_InExpo(frac, 0, FRACUNIT);
if (multiplier > 0)
{
ADDBOOST(
FixedMul(multiplier, FRACUNIT/5), // + 20% top speed
FixedMul(multiplier, FRACUNIT/4), // + 25% acceleration
0 // 0 handling
);
numboosts--; // No afterimage!
}
}
}
if (player->trickcharge)
{
@ -9364,11 +9395,6 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->counterdash)
player->counterdash--;
if (abs(player->drift)==5 && player->cmd.turning == 0)
player->neutraldash = min(player->neutraldash + 1, 1 + player->kartweight/2);
else if (player->neutraldash)
player->neutraldash--;
if ((player->sneakertimer || player->panelsneakertimer) && player->wipeoutslow > 0 && player->wipeoutslow < wipeoutslowtime+1)
player->wipeoutslow = wipeoutslowtime+1;

View file

@ -466,8 +466,6 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->flamedash);
else if (fastcmp(field,"counterdash"))
lua_pushinteger(L, plr->counterdash);
else if (fastcmp(field,"neutraldash"))
lua_pushinteger(L, plr->neutraldash);
else if (fastcmp(field,"flamemeter"))
lua_pushinteger(L, plr->flamemeter);
else if (fastcmp(field,"flamelength"))
@ -1072,8 +1070,6 @@ static int player_set(lua_State *L)
plr->flamedash = luaL_checkinteger(L, 3);
else if (fastcmp(field,"counterdash"))
plr->counterdash = luaL_checkinteger(L, 3);
else if (fastcmp(field,"neutraldash"))
plr->neutraldash = luaL_checkinteger(L, 3);
else if (fastcmp(field,"flamemeter"))
plr->flamemeter = luaL_checkinteger(L, 3);
else if (fastcmp(field,"flamelength"))

View file

@ -530,7 +530,6 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].bubbleblowup);
WRITEUINT16(save->p, players[i].flamedash);
WRITEUINT16(save->p, players[i].counterdash);
WRITEUINT16(save->p, players[i].neutraldash);
WRITEUINT16(save->p, players[i].flamemeter);
WRITEUINT8(save->p, players[i].flamelength);
@ -1166,7 +1165,6 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].bubbleblowup = READUINT8(save->p);
players[i].flamedash = READUINT16(save->p);
players[i].counterdash = READUINT16(save->p);
players[i].neutraldash = READUINT16(save->p);
players[i].flamemeter = READUINT16(save->p);
players[i].flamelength = READUINT8(save->p);