From cee4c6106bec1a28c3be823c8746c9baa42a8e1d Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 9 Mar 2024 17:03:48 -0800 Subject: [PATCH] Lap cheat prevention: always reset lap to safelap when timer is reset - This was done implicitly by respawn - However, it is sometimes possible to: - Cross the finish line forward - Gain a lap - Lap cheat prevention activates afterward - Drive backward over the finish line again - Must still have the lap cheat prevention timer running - Do not lose a lap - Timer resets once you're behind the line - Now: - You are behind the finish line - Lap cheat prevention is not active - You still have the lap gained from crossing the finish line the first time - To fix this: - Reset your current lap to your lap safe when the timer resets - Safelap does not change while lap cheat prevention is active - Basically I am fixing an oversight in the lap cheat prevention system, because the timer, safelap and your current waypoints are all tied together already - It's just the current lap that was not being tied together with the rest of it --- src/k_kart.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index a57dd3cb3..768e0601f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10029,9 +10029,14 @@ static void K_UpdatePlayerWaypoints(player_t *const player) else { // Reset the auto respawn timer if distance changes are back to normal. - if (player->bigwaypointgap <= AUTORESPAWN_THRESHOLD + 1) + if (player->bigwaypointgap && player->bigwaypointgap <= AUTORESPAWN_THRESHOLD + 1) { player->bigwaypointgap = 0; + + // While the player was in the "bigwaypointgap" state, laps did not change from crossing finish lines. + // So reset the lap back to normal, in case they were able to get behind the line. + player->laps = player->lastsafelap; + player->cheatchecknum = player->lastsafecheatcheck; } }