Start condition rework

This commit is contained in:
Antonio Martinez 2025-08-02 22:36:25 -04:00
parent 59ae7240f5
commit e6091cc8b4
2 changed files with 109 additions and 79 deletions

View file

@ -345,6 +345,7 @@ void K_TimerInit(void)
if (G_TimeAttackStart()) if (G_TimeAttackStart())
{ {
starttime = TIMEATTACK_START; // Longest permitted start. No half-laps in reverse. starttime = TIMEATTACK_START; // Longest permitted start. No half-laps in reverse.
rainbowstartavailable = true;
// (Changed on finish line cross later, don't worry.) // (Changed on finish line cross later, don't worry.)
} }
@ -9630,6 +9631,54 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
K_DropItems(player); K_DropItems(player);
} }
if (G_TimeAttackStart() && !linecrossed && player->speed && leveltime > introtime)
{
linecrossed = leveltime;
/*
if (starttime > leveltime) // Overlong starts shouldn't reset time on cross
{
// Award some Amps for a fast start, to counterbalance Obvious Rainbow Driftboost
tic_t starthaste = starttime - leveltime; // How much time we had left to cross
starthaste = TIMEATTACK_START - starthaste; // How much time we wasted before crossing
tic_t leniency = TICRATE*4; // How long we can take to cross with no penalty to amp payout
if (starthaste <= leniency)
starthaste = 0;
else
starthaste -= leniency;
// fixed_t ampreward = Easing_OutQuart(starthaste*FRACUNIT/TIMEATTACK_START, 60*FRACUNIT, 0);
// K_SpawnAmps(player, ampreward/FRACUNIT, player->mo);
UINT8 baseboost = 125;
player->startboost = Easing_OutQuart(starthaste*FRACUNIT/TIMEATTACK_START, baseboost, 0);
if (player->startboost == baseboost)
{
K_SpawnDriftBoostExplosion(player, 4);
K_SpawnDriftElectricSparks(player, SKINCOLOR_SILVER, false);
}
else
{
K_SpawnDriftBoostExplosion(player, 3);
// K_SpawnDriftElectricSparks(player, SKINCOLOR_SILVER, false);
}
// And reset our time to 0.
starttime = leveltime;
}
*/
starttime = leveltime;
if (demo.recording)
demo_extradata[player-players] |= DXD_START;
Music_Stop("position");
}
if (player->transfer) if (player->transfer)
{ {
if (player->fastfall) if (player->fastfall)
@ -13272,6 +13321,9 @@ static void K_KartSpindashDust(mobj_t *parent)
); );
flip = P_MobjFlip(dust); flip = P_MobjFlip(dust);
if (G_TimeAttackStart() && leveltime < starttime)
dust->scale = 3 * dust->scale / 2;
dust->momx = FixedMul(hmomentum, FINECOSINE(ang >> ANGLETOFINESHIFT)); dust->momx = FixedMul(hmomentum, FINECOSINE(ang >> ANGLETOFINESHIFT));
dust->momy = FixedMul(hmomentum, FINESINE(ang >> ANGLETOFINESHIFT)); dust->momy = FixedMul(hmomentum, FINESINE(ang >> ANGLETOFINESHIFT));
dust->momz = vmomentum * flip; dust->momz = vmomentum * flip;
@ -13334,6 +13386,12 @@ static void K_KartSpindash(player_t *player)
{ {
fixed_t thrust = FixedMul(player->mo->scale, min(player->spindash, MAXCHARGETIME)*FRACUNIT/5); fixed_t thrust = FixedMul(player->mo->scale, min(player->spindash, MAXCHARGETIME)*FRACUNIT/5);
if (G_TimeAttackStart() && leveltime < starttime)
{
thrust *= 2;
player->spindashspeed += FRACUNIT/2;
}
// Old behavior, before emergency zero-ring spindash // Old behavior, before emergency zero-ring spindash
/* /*
if (gametyperules & GTR_CLOSERPLAYERS) if (gametyperules & GTR_CLOSERPLAYERS)
@ -13467,16 +13525,30 @@ static void K_KartSpindash(player_t *player)
{ {
UINT8 ringdropframes = 2 + (player->kartspeed + player->kartweight); UINT8 ringdropframes = 2 + (player->kartspeed + player->kartweight);
boolean spawnOldEffect = true; boolean spawnOldEffect = true;
boolean normalsound = true;
INT16 chargetime = MAXCHARGETIME - ++player->spindash; INT16 chargetime = MAXCHARGETIME - ++player->spindash;
if (player->rings <= 0 && chargetime >= 0) // Desperation spindash if (player->rings <= 0 && chargetime >= 0) // Desperation spindash
{ {
player->spindash++; player->spindash++;
normalsound = false;
if (!S_SoundPlaying(player->mo, sfx_kc38)) if (!S_SoundPlaying(player->mo, sfx_kc38))
S_StartSound(player->mo, sfx_kc38); S_StartSound(player->mo, sfx_kc38);
} }
if (G_TimeAttackStart() && leveltime < starttime && chargetime >= 0)
{
if (player->spindash == 1)
{
S_ReducedVFXSound(player->mo, sfx_s3kab, player);
S_ReducedVFXSound(player->mo, sfx_s3k9c, player);
}
normalsound = false;
player->spindash += 4;
}
if (player->spindash >= SPINDASHTHRUSTTIME) if (player->spindash >= SPINDASHTHRUSTTIME)
{ {
K_KartSpindashDust(player->mo); K_KartSpindashDust(player->mo);
@ -13514,7 +13586,7 @@ static void K_KartSpindash(player_t *player)
while ((soundcharge += ++add) < chargetime); while ((soundcharge += ++add) < chargetime);
if (soundcharge == chargetime) if (soundcharge == chargetime && normalsound)
{ {
if (spawnOldEffect == true) if (spawnOldEffect == true)
K_SpawnDashDustRelease(player); K_SpawnDashDustRelease(player);

View file

@ -2038,49 +2038,6 @@ static void K_HandleLapIncrement(player_t *player)
K_UpdateAllPlayerPositions(); // P_DoPlayerExit calls this K_UpdateAllPlayerPositions(); // P_DoPlayerExit calls this
} }
if (G_TimeAttackStart() && !linecrossed)
{
linecrossed = leveltime;
if (starttime > leveltime) // Overlong starts shouldn't reset time on cross
{
// Award some Amps for a fast start, to counterbalance Obvious Rainbow Driftboost
tic_t starthaste = starttime - leveltime; // How much time we had left to cross
starthaste = TIMEATTACK_START - starthaste; // How much time we wasted before crossing
tic_t leniency = TICRATE*4; // How long we can take to cross with no penalty to amp payout
if (starthaste <= leniency)
starthaste = 0;
else
starthaste -= leniency;
// fixed_t ampreward = Easing_OutQuart(starthaste*FRACUNIT/TIMEATTACK_START, 60*FRACUNIT, 0);
// K_SpawnAmps(player, ampreward/FRACUNIT, player->mo);
UINT8 baseboost = 125;
player->startboost = Easing_OutQuart(starthaste*FRACUNIT/TIMEATTACK_START, baseboost, 0);
if (player->startboost == baseboost)
{
K_SpawnDriftBoostExplosion(player, 4);
K_SpawnDriftElectricSparks(player, SKINCOLOR_SILVER, false);
}
else
{
K_SpawnDriftBoostExplosion(player, 3);
// K_SpawnDriftElectricSparks(player, SKINCOLOR_SILVER, false);
}
// And reset our time to 0.
starttime = leveltime;
}
if (demo.recording)
demo_extradata[player-players] |= DXD_START;
Music_Stop("position");
}
if (rainbowstartavailable == true && player->mo->hitlag == 0) if (rainbowstartavailable == true && player->mo->hitlag == 0)
{ {
if (K_InRaceDuel()) if (K_InRaceDuel())
@ -2097,6 +2054,7 @@ static void K_HandleLapIncrement(player_t *player)
K_SpawnDriftBoostExplosion(player, 4); K_SpawnDriftBoostExplosion(player, 4);
K_SpawnDriftElectricSparks(player, SKINCOLOR_SILVER, false); K_SpawnDriftElectricSparks(player, SKINCOLOR_SILVER, false);
if (!G_TimeAttackStart())
K_SpawnAmps(player, (K_InRaceDuel()) ? 20 : 35, player->mo); K_SpawnAmps(player, (K_InRaceDuel()) ? 20 : 35, player->mo);
if (g_teamplay) if (g_teamplay)