diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 30ac6377c..f5e2f26e1 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1617,7 +1617,7 @@ static void FinalisePlaystateChange(INT32 playernum) // To attempt to discourage rage-spectators, we delay any rejoining. // If you're engaging in a DUEL and quit early, in addition to the // indignity of losing your PWR, you get a special extra-long delay. - if (netgame) + if (netgame && players[playernum].jointime > 1) { UINT8 pcount = 0; diff --git a/src/g_game.c b/src/g_game.c index 708479fbc..4a995e55e 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2374,7 +2374,7 @@ void G_Ticker(boolean run) && (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING // definitely good || gamestate == GS_WAITINGPLAYERS)) // definitely a problem if we don't do it at all in this gamestate, but might need more protection? { - K_CheckSpectateStatus(); + K_CheckSpectateStatus(true); } if (pausedelay && pausedelay != INT32_MIN) @@ -2436,6 +2436,8 @@ static inline void G_PlayerFinishLevel(INT32 player) p->starpostnum = 0; memset(&p->respawn, 0, sizeof (p->respawn)); + + p->spectatorReentry = 0; // Clean up any pending re-entry forbiddings } // diff --git a/src/k_kart.c b/src/k_kart.c index 4f570f3b5..d5077bbc2 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -11740,7 +11740,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) Obj_RingShooterInput(player); } -void K_CheckSpectateStatus(void) +void K_CheckSpectateStatus(boolean considermapreset) { UINT8 respawnlist[MAXPLAYERS]; UINT8 i, j, numingame = 0, numjoiners = 0; @@ -11770,7 +11770,7 @@ void K_CheckSpectateStatus(void) players[i].spectatewait = 0; } - if (gamestate != GS_LEVEL) + if (gamestate != GS_LEVEL || considermapreset == false) { players[i].spectatorReentry = 0; } @@ -11881,6 +11881,9 @@ void K_CheckSpectateStatus(void) break; } + if (considermapreset == false) + return; + // Reset the match when 2P joins 1P, DUEL mode // Reset the match when 3P joins 1P and 2P, DUEL mode must be disabled if (i > 0 && !mapreset && gamestate == GS_LEVEL && (numingame < 3 && numingame+i >= 2)) diff --git a/src/k_kart.h b/src/k_kart.h index 809c8673c..2f8eca77a 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -189,7 +189,7 @@ boolean K_FastFallBounce(player_t *player); fixed_t K_PlayerBaseFriction(player_t *player, fixed_t original); void K_AdjustPlayerFriction(player_t *player); void K_MoveKartPlayer(player_t *player, boolean onground); -void K_CheckSpectateStatus(void); +void K_CheckSpectateStatus(boolean considermapreset); UINT8 K_GetInvincibilityItemFrame(void); UINT8 K_GetOrbinautItemFrame(UINT8 count); boolean K_IsSPBInGame(void); diff --git a/src/p_mobj.c b/src/p_mobj.c index 103a1e452..e69faaefc 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11830,7 +11830,6 @@ void P_SpawnPlayer(INT32 playernum) else if (netgame && p->jointime <= 1 && pcount) { p->spectator = true; - p->spectatorReentry = 0; } else if (multiplayer && !netgame) { diff --git a/src/p_setup.c b/src/p_setup.c index 758c4b425..0c7c6738d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -8389,6 +8389,11 @@ void P_PostLoadLevel(void) { P_MapStart(); + if (G_GametypeHasSpectators()) + { + K_CheckSpectateStatus(false); + } + if (demo.playback) ; else if (grandprixinfo.gp == true)