From 1cfa122521bf36556571234eeff2cf2476dd7f7a Mon Sep 17 00:00:00 2001 From: oy Date: Wed, 18 Aug 2010 03:57:35 +0200 Subject: [PATCH] fixed that scoreboard overlaps the chat. Closes #14 --- src/game/client/components/chat.cpp | 11 ++++++----- src/game/client/components/scoreboard.cpp | 5 +++++ src/game/client/components/scoreboard.h | 2 ++ src/game/client/gameclient.cpp | 1 + src/game/client/gameclient.h | 1 + 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index 7b64aac7b..0ecafa6cf 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -9,6 +9,7 @@ #include +#include #include #include @@ -205,9 +206,10 @@ void CChat::OnRender() y -= 8.0f; - int i; int64 Now = time_get(); - for(i = 0; i < MAX_LINES; i++) + float LineWidth = m_pClient->m_pScoreboard->Active() ? 95.0f : 200.0f; + float HeightLimit = m_pClient->m_pScoreboard->Active() ? 220.0f : m_Show ? 50.0f : 200.0f; + for(int i = 0; i < MAX_LINES; i++) { int r = ((m_CurrentLine-i)+MAX_LINES)%MAX_LINES; if(Now > m_aLines[r].m_Time+15*time_freq() && !m_Show) @@ -219,19 +221,18 @@ void CChat::OnRender() // get the y offset CTextCursor Cursor; TextRender()->SetCursor(&Cursor, Begin, 0, FontSize, 0); - Cursor.m_LineWidth = 200.0f; + Cursor.m_LineWidth = LineWidth; TextRender()->TextEx(&Cursor, m_aLines[r].m_aName, -1); TextRender()->TextEx(&Cursor, m_aLines[r].m_aText, -1); y -= Cursor.m_Y + Cursor.m_FontSize; // cut off if msgs waste too much space - float HeightLimit = m_Show ? 0.0f : 200.0f; if(y < HeightLimit) break; // reset the cursor TextRender()->SetCursor(&Cursor, Begin, y, FontSize, TEXTFLAG_RENDER); - Cursor.m_LineWidth = 200.0f; + Cursor.m_LineWidth = LineWidth; // render name TextRender()->TextColor(0.8f,0.8f,0.8f,1); diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index 27e577e82..5f9aeea76 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -322,3 +322,8 @@ void CScoreboard::OnRender() RenderGoals(Width/2-w/2, 150+750+25, w); RenderSpectators(Width/2-w/2, 150+750+25+50+25, w); } + +bool CScoreboard::Active() +{ + return m_Active | (m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver); +} diff --git a/src/game/client/components/scoreboard.h b/src/game/client/components/scoreboard.h index 5aa2f0a71..f94c6b49f 100644 --- a/src/game/client/components/scoreboard.h +++ b/src/game/client/components/scoreboard.h @@ -17,6 +17,8 @@ public: virtual void OnReset(); virtual void OnConsoleInit(); virtual void OnRender(); + + bool Active(); }; #endif diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index acf29eb7e..a1f863bc9 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -134,6 +134,7 @@ void CGameClient::OnConsoleInit() m_pDamageind = &::gsDamageInd; m_pMapimages = &::gs_MapImages; m_pVoting = &::gs_Voting; + m_pScoreboard = &::gs_Scoreboard; // make a list of all the systems, make sure to add them in the corrent render order m_All.Add(m_pSkins); diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 211e3b11b..888188db6 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -205,6 +205,7 @@ public: class CMotd *m_pMotd; class CMapImages *m_pMapimages; class CVoting *m_pVoting; + class CScoreboard *m_pScoreboard; }; extern const char *Localize(const char *Str);