Add PF_TRUSTWAYPOINTS player flag, disable lap cheat prevention next time finish line distance is calculated

This commit is contained in:
James R 2024-03-05 05:33:33 -08:00
parent b5f318b405
commit 1015d6964b
3 changed files with 9 additions and 5 deletions

View file

@ -104,8 +104,9 @@ typedef enum
PF_RINGLOCK = 1<<13, // Prevent picking up rings while SPB is locked on
PF_ANALOGSTICK = 1<<14, // This player is using an analog joystick
PF_TRUSTWAYPOINTS = 1<<15, // Do not activate lap cheat prevention next time finish line distance is updated
//15-17 free, was previously itemflags stuff
//16-17 free, was previously itemflags stuff
PF_DRIFTINPUT = 1<<18, // Drifting!
PF_GETSPARKS = 1<<19, // Can get sparks

View file

@ -4016,7 +4016,7 @@ const char *const PLAYERFLAG_LIST[] = {
"RINGLOCK", // Prevent picking up rings while SPB is locked on
"ANALOGSTICK", // This player is using an analog joystick
"\x01", // Free
"TRUSTWAYPOINTS", // Do not activate lap cheat prevention next time finish line distance is updated
"\x01", // Free
"\x01", // Free

View file

@ -9987,10 +9987,11 @@ static void K_UpdatePlayerWaypoints(player_t *const player)
player->distancetofinishprev = player->distancetofinish;
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 && old_currentwaypoint != NULL)
if (delta > distance_threshold &&
player->respawn.state == RESPAWNST_NONE && // Respawning should be a full reset.
old_currentwaypoint != NULL && // So should touching the first waypoint ever.
!(player->pflags & PF_TRUSTWAYPOINTS)) // Special exception.
{
extern consvar_t cv_debuglapcheat;
#define debug_args "Player %s: waypoint ID %d too far away (%u > %u)\n", \
@ -10036,6 +10037,8 @@ static void K_UpdatePlayerWaypoints(player_t *const player)
player->lastsafelap = player->laps;
player->lastsafecheatcheck = player->cheatchecknum;
}
player->pflags &= ~PF_TRUSTWAYPOINTS; // clear special exception
}
INT32 K_GetKartRingPower(const player_t *player, boolean boosted)