fixed that scoreboard overlaps the chat. Closes #14

This commit is contained in:
oy 2010-08-18 03:57:35 +02:00 committed by GreYFoXGTi
parent d972e4ed69
commit 1cfa122521
5 changed files with 15 additions and 5 deletions

View file

@ -9,6 +9,7 @@
#include <game/client/gameclient.h>
#include <game/client/components/scoreboard.h>
#include <game/client/components/sounds.h>
#include <game/localization.h>
@ -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);

View file

@ -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);
}

View file

@ -17,6 +17,8 @@ public:
virtual void OnReset();
virtual void OnConsoleInit();
virtual void OnRender();
bool Active();
};
#endif

View file

@ -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);

View file

@ -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);