about summary refs log tree commit diff
path: root/src/game/client
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-08-18 03:57:35 +0200
committeroy <Tom_Adams@web.de>2010-08-18 03:57:35 +0200
commit538d968349faaec96ca010cc3fa0efdc13a05aed (patch)
treebf6d1d791aa580e8a05df553a58a6efd26cd771e /src/game/client
parent0f72fd19ef9f03b335c9bc4e4dae764079e1f30d (diff)
downloadzcatch-538d968349faaec96ca010cc3fa0efdc13a05aed.tar.gz
zcatch-538d968349faaec96ca010cc3fa0efdc13a05aed.zip
fixed that scoreboard overlaps the chat. Closes #14
Diffstat (limited to 'src/game/client')
-rw-r--r--src/game/client/components/chat.cpp11
-rw-r--r--src/game/client/components/scoreboard.cpp5
-rw-r--r--src/game/client/components/scoreboard.h2
-rw-r--r--src/game/client/gameclient.cpp1
-rw-r--r--src/game/client/gameclient.h1
5 files changed, 15 insertions, 5 deletions
diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp
index 21fa0e00..4429837b 100644
--- a/src/game/client/components/chat.cpp
+++ b/src/game/client/components/chat.cpp
@@ -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);
diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp
index 27e577e8..5f9aeea7 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 5aa2f0a7..f94c6b49 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 8c500079..841571b1 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 211e3b11..888188db 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);