about summary refs log tree commit diff
path: root/src/game/client
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-12-16 04:20:50 +0100
committeroy <Tom_Adams@web.de>2010-12-16 04:20:50 +0100
commitec09fbf23b826ad3b0675f508ab75f516b035fe6 (patch)
tree0397bd12821c9d70b0b10dcff4e3892de3fbc631 /src/game/client
parent0121f273112624d531d57fb37cb1bdf9e7c537df (diff)
downloadzcatch-ec09fbf23b826ad3b0675f508ab75f516b035fe6.tar.gz
zcatch-ec09fbf23b826ad3b0675f508ab75f516b035fe6.zip
let the chat lines disappear gradually. Closes #342
Diffstat (limited to 'src/game/client')
-rw-r--r--src/game/client/components/chat.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp
index 057cc786..b13eb615 100644
--- a/src/game/client/components/chat.cpp
+++ b/src/game/client/components/chat.cpp
@@ -324,7 +324,7 @@ void CChat::OnRender()
 	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)
+		if(Now > m_aLines[r].m_Time+16*time_freq() && !m_Show)
 			break;
 		
 		// get the y offset (calculate it if we haven't done that yet)
@@ -342,35 +342,37 @@ void CChat::OnRender()
 		if(y < HeightLimit)
 			break;
 		
+		float Blend = Now > m_aLines[r].m_Time+14*time_freq() && !m_Show ? 1.0f-(Now-m_aLines[r].m_Time-14*time_freq())/(2.0f*time_freq()) : 1.0f;
+
 		// reset the cursor
 		TextRender()->SetCursor(&Cursor, Begin, y, FontSize, TEXTFLAG_RENDER);
 		Cursor.m_LineWidth = LineWidth;
 
 		// render name
 		if(m_aLines[r].m_ClientId == -1)
-			TextRender()->TextColor(1.0f, 1.0f, 0.5f, 1.0f); // system
+			TextRender()->TextColor(1.0f, 1.0f, 0.5f, Blend); // system
 		else if(m_aLines[r].m_Team)
-			TextRender()->TextColor(0.45f, 0.9f, 0.45f, 1.0f); // team message
+			TextRender()->TextColor(0.45f, 0.9f, 0.45f, Blend); // team message
 		else if(m_aLines[r].m_NameColor == 0)
-			TextRender()->TextColor(1.0f, 0.5f, 0.5f, 1.0f); // red
+			TextRender()->TextColor(1.0f, 0.5f, 0.5f, Blend); // red
 		else if(m_aLines[r].m_NameColor == 1)
-			TextRender()->TextColor(0.7f, 0.7f, 1.0f, 1.0f); // blue
+			TextRender()->TextColor(0.7f, 0.7f, 1.0f, Blend); // blue
 		else if(m_aLines[r].m_NameColor == -1)
-			TextRender()->TextColor(0.75f, 0.5f, 0.75f, 1.0f); // spectator
+			TextRender()->TextColor(0.75f, 0.5f, 0.75f, Blend); // spectator
 		else
-			TextRender()->TextColor(0.8f, 0.8f, 0.8f, 1.0f);
+			TextRender()->TextColor(0.8f, 0.8f, 0.8f, Blend);
 			
 		TextRender()->TextEx(&Cursor, m_aLines[r].m_aName, -1);
 
 		// render line
 		if(m_aLines[r].m_ClientId == -1)
-			TextRender()->TextColor(1.0f, 1.0f, 0.5f, 1.0f); // system
+			TextRender()->TextColor(1.0f, 1.0f, 0.5f, Blend); // system
 		else if(m_aLines[r].m_Highlighted)
-			TextRender()->TextColor(1.0f, 0.5f, 0.5f, 1.0f); // highlighted
+			TextRender()->TextColor(1.0f, 0.5f, 0.5f, Blend); // highlighted
 		else if(m_aLines[r].m_Team)
-			TextRender()->TextColor(0.65f, 1.0f, 0.65f, 1.0f); // team message
+			TextRender()->TextColor(0.65f, 1.0f, 0.65f, Blend); // team message
 		else
-			TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
+			TextRender()->TextColor(1.0f, 1.0f, 1.0f, Blend);
 
 		TextRender()->TextEx(&Cursor, m_aLines[r].m_aText, -1);
 	}