Respawn: move lastsafelap check to K_UpdateDistanceFromFinishLine

- Order of operations; it is possible in specific
  circumstances to respawn (K_DoIngameRespawn) before the
  lap increments
- In this case, the lap would be reset to lastsafelap and
  then incremented afterward
- This would allow someone to skip the first lap
- It was possible to do this in many maps where the finish
  line intersects a respawn line, by driving into the
  corner where the lines meet
This commit is contained in:
James R 2024-02-23 22:46:18 -08:00
parent 1919471ae4
commit a03cc5489c
2 changed files with 8 additions and 6 deletions

View file

@ -9669,6 +9669,14 @@ void K_UpdateDistanceFromFinishLine(player_t *const player)
waypoint_t *finishline = K_GetFinishLineWaypoint(); waypoint_t *finishline = K_GetFinishLineWaypoint();
waypoint_t *nextwaypoint = NULL; waypoint_t *nextwaypoint = NULL;
if (player->respawn.state == RESPAWNST_MOVE &&
player->respawn.init == true &&
player->lastsafelap < player->laps)
{
player->laps = player->lastsafelap;
player->cheatchecknum = player->lastsafecheatcheck;
}
if (player->spectator) if (player->spectator)
{ {
// Don't update waypoints while spectating // Don't update waypoints while spectating

View file

@ -318,12 +318,6 @@ void K_DoIngameRespawn(player_t *player)
player->respawn.fast = true; player->respawn.fast = true;
player->respawn.returnspeed = 0; player->respawn.returnspeed = 0;
if (player->lastsafelap < player->laps)
{
player->laps = player->lastsafelap;
player->cheatchecknum = player->lastsafecheatcheck;
}
player->respawn.airtimer = player->airtime; player->respawn.airtimer = player->airtime;
player->respawn.truedeath = !!(player->pflags & PF_FAULT); player->respawn.truedeath = !!(player->pflags & PF_FAULT);