about summary refs log tree commit diff
path: root/src/game/client/components/chat.cpp
diff options
context:
space:
mode:
authorThomas <lordskelethom@gmail.com>2010-05-30 12:01:11 +0000
committerThomas <lordskelethom@gmail.com>2010-05-30 12:01:11 +0000
commit361380d63039737df51c1ed684d5f70758c96790 (patch)
tree6709a802772f65dc26eb6acf332023b89bf193f8 /src/game/client/components/chat.cpp
parent47b68170ad8a0d6b4fd5be182d8ba0c953114cb4 (diff)
downloadzcatch-361380d63039737df51c1ed684d5f70758c96790.tar.gz
zcatch-361380d63039737df51c1ed684d5f70758c96790.zip
*some esthetic changes
*split "CHud::RenderGoals()"
*added "reload" command
*added the ability to show last chat lines (+show_chat)
*updated french.txt
Diffstat (limited to 'src/game/client/components/chat.cpp')
-rw-r--r--src/game/client/components/chat.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp
index 1a2c828d..da56206f 100644
--- a/src/game/client/components/chat.cpp
+++ b/src/game/client/components/chat.cpp
@@ -28,6 +28,8 @@ void CChat::OnReset()
 		m_aLines[i].m_aText[0] = 0;
 		m_aLines[i].m_aName[0] = 0;
 	}
+	
+	m_Show = false;
 }
 
 void CChat::OnStateChange(int NewState, int OldState)
@@ -62,11 +64,17 @@ void CChat::ConChat(IConsole::IResult *pResult, void *pUserData)
 		dbg_msg("console", "expected all or team as mode");
 }
 
+void CChat::ConShowChat(IConsole::IResult *pResult, void *pUserData)
+{
+	((CChat *)pUserData)->m_Show = pResult->GetInteger(0) != 0;
+}
+
 void CChat::OnConsoleInit()
 {
 	Console()->Register("say", "r", CFGFLAG_CLIENT, ConSay, this, "Say in chat");
 	Console()->Register("say_team", "r", CFGFLAG_CLIENT, ConSayTeam, this, "Say in team chat");
 	Console()->Register("chat", "s", CFGFLAG_CLIENT, ConChat, this, "Enable chat with all/team mode");
+	Console()->Register("+show_chat", "", CFGFLAG_CLIENT, ConShowChat, this, "Show chat");
 }
 
 bool CChat::OnInput(IInput::CEvent e)
@@ -202,11 +210,11 @@ void CChat::OnRender()
 	for(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())
+		if(Now > m_aLines[r].m_Time+15*time_freq() && !m_Show)
 			break;
 
 		float Begin = x;
-		float FontSize = 7.0f;
+		float FontSize = 5.0f;
 		
 		// get the y offset
 		CTextCursor Cursor;
@@ -217,7 +225,8 @@ void CChat::OnRender()
 		y -= Cursor.m_Y + Cursor.m_FontSize;
 
 		// cut off if msgs waste too much space
-		if(y < 200.0f)
+		int HeightLimit = m_Show ? 0.0f : 200.0f;
+		if(y < HeightLimit)
 			break;
 		
 		// reset the cursor