Fix lap times (the rest of f1f7edbe)

This commit is contained in:
GenericHeroGuy 2025-10-21 20:57:14 +02:00
parent 7471c89734
commit 389c2da098
5 changed files with 13 additions and 38 deletions

View file

@ -683,7 +683,6 @@ extern boolean startedInFreePlay;
extern tic_t bombflashtimer; // Used to avoid causing seizures if multiple mines explode close to you :)
extern boolean legitimateexit;
extern boolean comebackshowninfo;
extern tic_t curlap, bestlap;
extern tic_t antibumptime;
extern INT16 votelevels[12][2];

View file

@ -321,8 +321,6 @@ boolean startedInFreePlay; // Map was started in free play
tic_t bombflashtimer = 0; // Cooldown before another FlashPal can be intialized by a bomb exploding near a displayplayer. Avoids seizures.
boolean legitimateexit; // Did this client actually finish the match?
boolean comebackshowninfo; // Have you already seen the "ATTACK OR PROTECT" message?
tic_t curlap; // Current lap time
tic_t bestlap; // Best lap time
tic_t antibumptime; // Delay before players start bumping into one another.
typedef struct
@ -843,8 +841,8 @@ static void G_UpdateRecordReplays(void)
if (modeattacking == ATTACKING_TIME)
{
if (preset->bestlap == UINT32_MAX || bestlap < preset->bestlap)
preset->bestlap = bestlap;
if (preset->bestlap == UINT32_MAX || players[consoleplayer].laptime[LAP_BEST] < preset->bestlap)
preset->bestlap = players[consoleplayer].laptime[LAP_BEST];
}
else
{
@ -852,7 +850,7 @@ static void G_UpdateRecordReplays(void)
}
// Save demo!
G_SetDemoTime(players[consoleplayer].realtime, bestlap);
G_SetDemoTime(players[consoleplayer].realtime, players[consoleplayer].laptime[LAP_BEST]);
G_CheckDemoStatus();
gpath = G_GetRecordReplayFolder(true, modeattacking == ATTACKING_ITEMBREAK);

View file

@ -8105,7 +8105,6 @@ static void P_InitLevelSettings(boolean reloadinggamestate)
}
racecountdown = exitcountdown = exitfadestarted = 0;
curlap = bestlap = 0; // SRB2Kart
g_exit.losing = g_exit.retry = g_exit.hasfinished = false;

View file

@ -2097,13 +2097,6 @@ static void K_HandleLapIncrement(player_t *player)
player->laptime[LAP_LAST] = player->laptime[LAP_CUR];
player->laptime[LAP_CUR] = 0;
if (modeattacking && player == &players[consoleplayer])
{
// No need for redundant bullshit, just feed the calculated values.
bestlap = player->laptime[LAP_BEST];
curlap = player->laptime[LAP_CUR];
}
// Update power levels for this lap.
K_UpdatePowerLevels(player, player->laps, false);
}
@ -2150,10 +2143,6 @@ static void K_HandleLapDecrement(player_t *player)
player->starpostnum = numstarposts;
player->laps--;
K_UpdateAllPlayerPositions();
curlap = UINT32_MAX;
// Redundant, but we're only using laptimes for the timestamps as-is.
player->laptime[LAP_CUR] = UINT32_MAX;
}
}

View file

@ -2598,22 +2598,15 @@ static void P_DeathThink(player_t *player)
if (leveltime >= starttime)
{
player->realtime = leveltime - starttime;
if (player == &players[consoleplayer])
{
if (player->spectator || !circuitmap)
curlap = 0;
else if (curlap != UINT32_MAX)
curlap++; // This is too complicated to sync to realtime, just sorta hope for the best :V
player->laptime[LAP_CUR] = curlap;
}
if (player->spectator || !circuitmap)
player->laptime[LAP_CUR] = 0;
else if (player->laptime[LAP_CUR] != UINT32_MAX)
player->laptime[LAP_CUR]++; // This is too complicated to sync to realtime, just sorta hope for the best :V
}
else
{
player->realtime = 0;
player->laptime[LAP_CUR] = 0;
if (player == &players[consoleplayer])
curlap = 0;
}
}
@ -4099,19 +4092,16 @@ void P_PlayerThink(player_t *player)
if (leveltime >= starttime)
{
player->realtime = leveltime - starttime;
if (player == &players[consoleplayer])
{
if (player->spectator || !circuitmap)
curlap = 0;
else if (curlap != UINT32_MAX)
curlap++; // This is too complicated to sync to realtime, just sorta hope for the best :V
}
if (player->spectator || !circuitmap)
player->laptime[LAP_CUR] = 0;
else if (player->laptime[LAP_CUR] != UINT32_MAX)
player->laptime[LAP_CUR]++; // This is too complicated to sync to realtime, just sorta hope for the best :V
}
else
{
player->realtime = 0;
if (player == &players[consoleplayer])
curlap = 0;
player->laptime[LAP_CUR] = 0;
}
}