diff --git a/src/k_kart.c b/src/k_kart.c index 678a36216..4d09d1c3a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9903,16 +9903,17 @@ static void K_UpdatePlayerWaypoints(player_t *const player) K_UpdateDistanceFromFinishLine(player); // Respawning should be a full reset. + // So should touching the first waypoint ever. UINT32 delta = u32_delta(player->distancetofinish, player->distancetofinishprev); - if (player->respawn.state == RESPAWNST_NONE && delta > distance_threshold) + if (player->respawn.state == RESPAWNST_NONE && delta > distance_threshold && old_currentwaypoint != NULL) { CONS_Debug(DBG_GAMELOGIC, "Player %s: waypoint ID %d too far away (%u > %u)\n", sizeu1(player - players), K_GetWaypointID(player->nextwaypoint), delta, distance_threshold); - // Distance jump is too great, keep the old waypoints and recalculate distance. + // Distance jump is too great, keep the old waypoints and old distance. player->currentwaypoint = old_currentwaypoint; player->nextwaypoint = old_nextwaypoint; - K_UpdateDistanceFromFinishLine(player); + player->distancetofinish = player->distancetofinishprev; // Start the auto respawn timer when the distance jumps. if (!player->bigwaypointgap) @@ -9923,11 +9924,15 @@ static void K_UpdatePlayerWaypoints(player_t *const player) else { // Reset the auto respawn timer if distance changes are back to normal. - player->bigwaypointgap = 0; + if (player->bigwaypointgap == 1) + { + player->bigwaypointgap = 0; + } } // Respawn point should only be updated when we're going to a nextwaypoint if ((updaterespawn) && + (player->bigwaypointgap == 0) && (player->respawn.state == RESPAWNST_NONE) && (player->nextwaypoint != old_nextwaypoint) && (K_GetWaypointIsSpawnpoint(player->nextwaypoint)) && @@ -10884,7 +10889,7 @@ void K_UpdateAllPlayerPositions(void) if (player->respawn.state == RESPAWNST_MOVE && player->respawn.init == true && - player->lastsafelap < player->laps) + player->lastsafelap != player->laps) { player->laps = player->lastsafelap; player->cheatchecknum = player->lastsafecheatcheck; diff --git a/src/p_spec.c b/src/p_spec.c index 41b0f4841..ff68cc509 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1911,6 +1911,8 @@ static void K_HandleLapIncrement(player_t *player) { if (player) { + if (player->respawn.state == RESPAWNST_MOVE || player->bigwaypointgap) + return; if (!G_TimeAttackStart() && leveltime < starttime && !(gametyperules & GTR_ROLLINGSTART)) { // freeze 'em until fault penalty is over @@ -2182,7 +2184,7 @@ static void K_HandleLapDecrement(player_t *player) { if (player) { - if (player->respawn.state == RESPAWNST_MOVE) + if (player->respawn.state == RESPAWNST_MOVE || player->bigwaypointgap) return; if ((player->cheatchecknum == 0) && (player->laps > 0)) {