Make automatic respawn (from lap cheat prevention) more lenient

- When potential lap cheating is detected, start a 10
  second timer (previously 1 second)
- After 3 seconds, tell the player they can respawn with
  the Y button
  - You don't need to hold the Y button, just tap it
- After 10 seconds, automatically respawns the player
This commit is contained in:
James R 2024-03-04 19:16:48 -08:00
parent 359b63fd6d
commit ecbcc5addb
4 changed files with 15 additions and 6 deletions

View file

@ -671,7 +671,7 @@ struct player_t
mobj_t *ringShooter; // DEZ respawner object
tic_t airtime; // Used to track just air time, but has evolved over time into a general "karted" timer. Rename this variable?
tic_t lastairtime;
UINT8 bigwaypointgap; // timer counts down if finish line distance gap is too big to update waypoint
UINT16 bigwaypointgap; // timer counts down if finish line distance gap is too big to update waypoint
UINT8 startboost; // (0 to 125) - Boost you get from start of race
UINT8 dropdashboost; // Boost you get when holding A while respawning

View file

@ -8777,6 +8777,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
player->bigwaypointgap--;
if (!player->bigwaypointgap)
K_DoIngameRespawn(player);
else if (player->bigwaypointgap == AUTORESPAWN_THRESHOLD)
K_AddMessageForPlayer(player, "Press \xAE to respawn", true, false);
}
if (player->tripwireUnstuck && !player->mo->hitlag)
@ -8797,7 +8799,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->respawn.state == RESPAWNST_NONE && (player->cmd.buttons & BT_RESPAWN) == BT_RESPAWN)
{
player->finalfailsafe++; // Decremented by ringshooter to "freeze" this timer
if (player->finalfailsafe >= 4*TICRATE)
// Part-way through the auto-respawn timer, you can tap Ring Shooter to respawn early
if (player->finalfailsafe >= 4*TICRATE ||
(player->bigwaypointgap && player->bigwaypointgap < AUTORESPAWN_THRESHOLD))
{
K_DoIngameRespawn(player);
player->finalfailsafe = 0;
@ -10000,14 +10004,14 @@ static void K_UpdatePlayerWaypoints(player_t *const player)
// Start the auto respawn timer when the distance jumps.
if (!player->bigwaypointgap)
{
player->bigwaypointgap = 35;
player->bigwaypointgap = AUTORESPAWN_TIME;
}
}
}
else
{
// Reset the auto respawn timer if distance changes are back to normal.
if (player->bigwaypointgap == 1)
if (player->bigwaypointgap <= AUTORESPAWN_THRESHOLD + 1)
{
player->bigwaypointgap = 0;
}

View file

@ -70,6 +70,11 @@ Make sure this matches the actual number of states
// Delay the wavedash visuals until we're reasonably sure that it's a deliberate turn.
#define HIDEWAVEDASHCHARGE (60)
// Auto-respawn timer for when lap cheating or out of bounds
// is detected.
#define AUTORESPAWN_TIME (10*TICRATE)
#define AUTORESPAWN_THRESHOLD (7*TICRATE)
angle_t K_ReflectAngle(angle_t angle, angle_t against, fixed_t maxspeed, fixed_t yourspeed);
boolean K_IsDuelItem(mobjtype_t type);

View file

@ -418,7 +418,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT32(save->p, K_GetWaypointHeapIndex(players[i].nextwaypoint));
WRITEUINT32(save->p, players[i].airtime);
WRITEUINT32(save->p, players[i].lastairtime);
WRITEUINT8(save->p, players[i].bigwaypointgap);
WRITEUINT16(save->p, players[i].bigwaypointgap);
WRITEUINT8(save->p, players[i].startboost);
WRITEUINT8(save->p, players[i].dropdashboost);
@ -1006,7 +1006,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].nextwaypoint = (waypoint_t *)(size_t)READUINT32(save->p);
players[i].airtime = READUINT32(save->p);
players[i].lastairtime = READUINT32(save->p);
players[i].bigwaypointgap = READUINT8(save->p);
players[i].bigwaypointgap = READUINT16(save->p);
players[i].startboost = READUINT8(save->p);
players[i].dropdashboost = READUINT8(save->p);