Got_Teamchange: Do not repeatedly declare a player has become a spectator if they already were

This commit is contained in:
toaster 2023-04-13 20:22:02 +01:00
parent 1c9ee9f907
commit d50e3a1895

View file

@ -3864,7 +3864,7 @@ static void Command_ServerTeamChange_f(void)
static void Got_Teamchange(UINT8 **cp, INT32 playernum) static void Got_Teamchange(UINT8 **cp, INT32 playernum)
{ {
changeteam_union NetPacket; changeteam_union NetPacket;
boolean error = false; boolean error = false, wasspectator = false;
NetPacket.value.l = NetPacket.value.b = READINT16(*cp); NetPacket.value.l = NetPacket.value.b = READINT16(*cp);
if (!G_GametypeHasTeams() && !G_GametypeHasSpectators()) //Make sure you're in the right gametype. if (!G_GametypeHasTeams() && !G_GametypeHasSpectators()) //Make sure you're in the right gametype.
@ -3935,7 +3935,9 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
//Safety first! //Safety first!
// (not respawning spectators here...) // (not respawning spectators here...)
if (!players[playernum].spectator && gamestate == GS_LEVEL) wasspectator = (players[playernum].spectator == true);
if (!wasspectator && gamestate == GS_LEVEL)
{ {
if (players[playernum].mo) if (players[playernum].mo)
{ {
@ -3996,7 +3998,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
{ {
CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x84', M_GetText("Blue Team"), '\x80'); CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x84', M_GetText("Blue Team"), '\x80');
} }
else if (NetPacket.packet.newteam == 0) else if (NetPacket.packet.newteam == 0 && !wasspectator)
HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame HU_AddChatText(va("\x82*%s became a spectator.", player_names[playernum]), false); // "entered the game" text was moved to P_SpectatorJoinGame
/*if (G_GametypeHasTeams()) /*if (G_GametypeHasTeams())