diff --git a/datasrc/network.py b/datasrc/network.py index fb90f8819..ebac4bd3c 100644 --- a/datasrc/network.py +++ b/datasrc/network.py @@ -1,7 +1,7 @@ from datatypes import * Emotes = ["NORMAL", "PAIN", "HAPPY", "SURPRISE", "ANGRY", "BLINK"] -PlayerFlags = ["CHATTING", "SCOREBOARD", "READY", "DEAD"] +PlayerFlags = ["CHATTING", "SCOREBOARD", "READY", "DEAD", "WATCHING"] GameFlags = ["TEAMS", "FLAGS", "SURVIVAL"] GameStateFlags = ["WARMUP", "SUDDENDEATH", "ROUNDOVER", "GAMEOVER", "PAUSED", "STARTCOUNTDOWN"] diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index 0c615dc8e..9e08e9b9d 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -98,9 +98,11 @@ void CScoreboard::RenderSpectators(float x, float y, float w) // spectator names y += 30.0f; - char aBuffer[1024*4]; - aBuffer[0] = 0; bool Multiple = false; + CTextCursor Cursor; + TextRender()->SetCursor(&Cursor, x+10.0f, y, 22.0f, TEXTFLAG_RENDER); + Cursor.m_LineWidth = w-20.0f; + Cursor.m_MaxLines = 4; for(int i = 0; i < MAX_CLIENTS; ++i) { const CNetObj_PlayerInfo *pInfo = m_pClient->m_Snap.m_paPlayerInfos[i]; @@ -108,15 +110,13 @@ void CScoreboard::RenderSpectators(float x, float y, float w) continue; if(Multiple) - str_append(aBuffer, ", ", sizeof(aBuffer)); - str_append(aBuffer, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, sizeof(aBuffer)); + TextRender()->TextEx(&Cursor, ", ", -1); + if(pInfo->m_PlayerFlags&PLAYERFLAG_WATCHING) + TextRender()->TextColor(1.0f, 1.0f, 0.0f, 1.0f); + TextRender()->TextEx(&Cursor, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, -1); + TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f); Multiple = true; } - CTextCursor Cursor; - TextRender()->SetCursor(&Cursor, x+10.0f, y, 22.0f, TEXTFLAG_RENDER); - Cursor.m_LineWidth = w-20.0f; - Cursor.m_MaxLines = 4; - TextRender()->TextEx(&Cursor, aBuffer, -1); } void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const char *pTitle) @@ -282,7 +282,9 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch // name // todo: improve visual player ready state if(!(pInfo->m_PlayerFlags&PLAYERFLAG_READY)) - TextRender()->TextColor(1.0f, 0.5f, 0.5f,ColorAlpha); + TextRender()->TextColor(1.0f, 0.5f, 0.5f, ColorAlpha); + else if(RenderDead && pInfo->m_PlayerFlags&PLAYERFLAG_WATCHING) + TextRender()->TextColor(1.0f, 1.0f, 0.0f, ColorAlpha); TextRender()->SetCursor(&Cursor, NameOffset, y+Spacing, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); Cursor.m_LineWidth = NameLength; TextRender()->TextEx(&Cursor, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, -1); diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index b97f9e1c2..34f3ca4e6 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -139,6 +139,8 @@ void CPlayer::Snap(int SnappingClient) pPlayerInfo->m_PlayerFlags |= PLAYERFLAG_READY; if(m_RespawnDisabled && (!GetCharacter() || !GetCharacter()->IsAlive())) pPlayerInfo->m_PlayerFlags |= PLAYERFLAG_DEAD; + if(SnappingClient != -1 && (m_Team == TEAM_SPECTATORS || m_DeadSpecMode) && SnappingClient == m_SpectatorID) + pPlayerInfo->m_PlayerFlags |= PLAYERFLAG_WATCHING; pPlayerInfo->m_Latency = SnappingClient == -1 ? m_Latency.m_Min : GameServer()->m_apPlayers[SnappingClient]->m_aActLatency[m_ClientID]; pPlayerInfo->m_Local = 0; pPlayerInfo->m_ClientID = m_ClientID;