From 0f9b89fc74a24d65427600bdaa4539232320b0b8 Mon Sep 17 00:00:00 2001 From: def Date: Tue, 19 Mar 2019 08:12:56 +0100 Subject: [PATCH] Color authed players in spec (fixes #1497) --- src/game/client/components/scoreboard.cpp | 29 +++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index 4b8424a6f..4234cd586 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -116,9 +116,13 @@ 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_paInfoByName[i]; @@ -126,21 +130,22 @@ void CScoreboard::RenderSpectators(float x, float y, float w) continue; if(Multiple) - str_append(aBuffer, ", ", sizeof(aBuffer)); + TextRender()->TextEx(&Cursor, ", ", 2); + + if(m_pClient->m_aClients[pInfo->m_ClientID].m_AuthLevel) + TextRender()->TextColor(0.78f, 1.0f, 0.8f, 1.0f); + if(g_Config.m_ClShowIDs) { - char aId[5]; - str_format(aId,sizeof(aId),"%d: ",pInfo->m_ClientID); - str_append(aBuffer, aId, sizeof(aBuffer)); + char aBuffer[4]; + int size = str_format(aBuffer, sizeof(aBuffer), "%d: ", pInfo->m_ClientID); + TextRender()->TextEx(&Cursor, aBuffer, size); } - str_append(aBuffer, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, sizeof(aBuffer)); + 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)