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
This commit is contained in:
James R 2024-03-09 17:03:48 -08:00
parent 748ef17cf7
commit cee4c6106b

View file

@ -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;
}
}