mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-04 04:36:21 +00:00
Merge branch 'dont-cheat-lap' into 'master'
Finish line cheese Super Prevention See merge request KartKrew/Kart!1972
This commit is contained in:
commit
6c60d7165d
2 changed files with 13 additions and 6 deletions
15
src/k_kart.c
15
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;
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue