Auto respawn after 35 tics if distancetofinish jumped too much

This commit is contained in:
James R 2024-02-28 18:13:01 -08:00
parent b4402a9486
commit 9d4f57ddfb
4 changed files with 26 additions and 0 deletions

View file

@ -671,6 +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
UINT8 startboost; // (0 to 125) - Boost you get from start of race
UINT8 dropdashboost; // Boost you get when holding A while respawning

View file

@ -5527,6 +5527,11 @@ static void K_DrawWaypointDebugger(void)
put("Cheat Check:", "{} / {}", stplyr->cheatchecknum, numcheatchecks);
put("Last Safe Cheat Check:", "{}", stplyr->lastsafecheatcheck);
}
if (stplyr->bigwaypointgap)
{
put("Auto Respawn Timer:", "{}", stplyr->bigwaypointgap);
}
}
static void K_DrawBotDebugger(void)

View file

@ -8709,6 +8709,13 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
K_DoIngameRespawn(player);
}
if (player->bigwaypointgap)
{
player->bigwaypointgap--;
if (!player->bigwaypointgap)
K_DoIngameRespawn(player);
}
if (player->tripwireUnstuck && !player->mo->hitlag)
player->tripwireUnstuck--;
@ -9874,6 +9881,17 @@ static void K_UpdatePlayerWaypoints(player_t *const player)
player->currentwaypoint = old_currentwaypoint;
player->nextwaypoint = old_nextwaypoint;
K_UpdateDistanceFromFinishLine(player);
// Start the auto respawn timer when the distance jumps.
if (!player->bigwaypointgap)
{
player->bigwaypointgap = 35;
}
}
else
{
// Reset the auto respawn timer if distance changes are back to normal.
player->bigwaypointgap = 0;
}
// Respawn point should only be updated when we're going to a nextwaypoint

View file

@ -417,6 +417,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);
WRITEUINT8(save->p, players[i].startboost);
WRITEUINT8(save->p, players[i].dropdashboost);
@ -996,6 +997,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].startboost = READUINT8(save->p);
players[i].dropdashboost = READUINT8(save->p);