diff --git a/src/doomstat.h b/src/doomstat.h index ab0900f8f..a345a4434 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -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]; diff --git a/src/g_game.c b/src/g_game.c index 635e48922..bf0d2a491 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -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); diff --git a/src/p_setup.c b/src/p_setup.c index 8f0742428..60ae6591c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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; diff --git a/src/p_spec.c b/src/p_spec.c index a72d053b2..fc9837b51 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -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; } } diff --git a/src/p_user.c b/src/p_user.c index ef07e728f..d13c794a1 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -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; } }