From 02521d15eb6020ddac536714d2eefedd69fd0f6e Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Tue, 21 Feb 2023 21:17:25 +0300 Subject: [PATCH] game: fix spectator mode switch --- src/game/g_game.pas | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/game/g_game.pas b/src/game/g_game.pas index fc06d89..3105360 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -2259,8 +2259,16 @@ begin (* spectator state check from render *) - if (gPlayer1 = nil) and (gPlayer2 = nil) and (gSpectMode = SPECT_NONE) then - gSpectMode := SPECT_STATS; + if (gPlayer1 = nil) and (gPlayer2 = nil) then + begin + (* no local players -> automatically enable to spectator mode *) + if gSpectMode = SPECT_NONE then gSpectMode := SPECT_STATS; + end + else + begin + (* at least one local player -> automatically disable spectator mode *) + gSpectMode := SPECT_NONE; + end; if IsActivePlayer(g_Player_Get(gSpectPID1)) = false then gSpectPID1 := GetActivePlayerID_Next(); -- 2.29.2