diff --git a/src/d_player.h b/src/d_player.h index 4630224dc..8eba8f205 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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 diff --git a/src/k_kart.c b/src/k_kart.c index a68293cf4..a7904a182 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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; } diff --git a/src/k_kart.h b/src/k_kart.h index 17ab9640f..3224e1256 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -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); diff --git a/src/p_saveg.c b/src/p_saveg.c index e95837d97..b89ee4412 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -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);