about summary refs log tree commit diff
path: root/src/game/client/components
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-08-30 08:26:36 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-08-30 08:26:36 +0000
commit2e2d31ccc359228f0031b9fa507b33f8ba935722 (patch)
tree90f7270a696e7f47238c2945f91381af485c5ac4 /src/game/client/components
parent71fa35606c268594f8cf4c52626057f86861c3de (diff)
downloadzcatch-2e2d31ccc359228f0031b9fa507b33f8ba935722.tar.gz
zcatch-2e2d31ccc359228f0031b9fa507b33f8ba935722.zip
fixed the motd correctly
Diffstat (limited to 'src/game/client/components')
-rw-r--r--src/game/client/components/motd.cpp48
-rw-r--r--src/game/client/components/motd.hpp4
-rw-r--r--src/game/client/components/scoreboard.cpp4
3 files changed, 38 insertions, 18 deletions
diff --git a/src/game/client/components/motd.cpp b/src/game/client/components/motd.cpp
index bd04d089..9e1013b6 100644
--- a/src/game/client/components/motd.cpp
+++ b/src/game/client/components/motd.cpp
@@ -11,33 +11,42 @@
 	
 void MOTD::on_reset()
 {
+	clear();
+}
+
+void MOTD::clear()
+{
 	server_motd_time = 0;
 }
 
+bool MOTD::is_active()
+{
+	return time_get() < server_motd_time;	
+}
+
 void MOTD::on_render()
 {
+	if(!is_active())
+		return;
+		
 	float width = 400*3.0f*gfx_screenaspect();
 	float height = 400*3.0f;
+
+	gfx_mapscreen(0, 0, width, height);
 	
-	// TODO: repair me
-	if(/* !do_scoreboard && */ time_get() < server_motd_time)
-	{
-		gfx_mapscreen(0, 0, width, height);
-		
-		float h = 800.0f;
-		float w = 650.0f;
-		float x = width/2 - w/2;
-		float y = 150.0f;
+	float h = 800.0f;
+	float w = 650.0f;
+	float x = width/2 - w/2;
+	float y = 150.0f;
 
-		gfx_blend_normal();
-		gfx_texture_set(-1);
-		gfx_quads_begin();
-		gfx_setcolor(0,0,0,0.5f);
-		draw_round_rect(x, y, w, h, 40.0f);
-		gfx_quads_end();
+	gfx_blend_normal();
+	gfx_texture_set(-1);
+	gfx_quads_begin();
+	gfx_setcolor(0,0,0,0.5f);
+	draw_round_rect(x, y, w, h, 40.0f);
+	gfx_quads_end();
 
-		gfx_text(0, x+40.0f, y+40.0f, 32.0f, server_motd, (int)(w-80.0f));
-	}
+	gfx_text(0, x+40.0f, y+40.0f, 32.0f, server_motd, (int)(w-80.0f));
 }
 
 void MOTD::on_message(int msgtype, void *rawmsg)
@@ -70,6 +79,11 @@ void MOTD::on_message(int msgtype, void *rawmsg)
 
 bool MOTD::on_input(INPUT_EVENT e)
 {
+	if(is_active() && e.flags&INPFLAG_PRESS && e.key == KEY_ESC)
+	{
+		clear();
+		return true;
+	}
 	return false;
 }
 
diff --git a/src/game/client/components/motd.hpp b/src/game/client/components/motd.hpp
index e26dff9b..bc2c962e 100644
--- a/src/game/client/components/motd.hpp
+++ b/src/game/client/components/motd.hpp
@@ -2,10 +2,12 @@
 
 class MOTD : public COMPONENT
 {
-public:
 	// motd
 	int64 server_motd_time;
 	char server_motd[900]; // FUGLY
+public:
+	void clear();
+	bool is_active();
 	
 	virtual void on_reset();
 	virtual void on_render();
diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp
index 8891b12d..bd8c7ea9 100644
--- a/src/game/client/components/scoreboard.cpp
+++ b/src/game/client/components/scoreboard.cpp
@@ -5,6 +5,7 @@
 #include <game/client/gameclient.hpp>
 #include <game/client/animstate.hpp>
 #include <game/client/gc_render.hpp>
+#include <game/client/components/motd.hpp>
 #include "scoreboard.hpp"
 
 
@@ -226,6 +227,9 @@ void SCOREBOARD::on_render()
 {
 	if(!active)
 		return;
+		
+	// if the score board is active, then we should clear the motd message aswell
+	gameclient.motd->clear();
 	
 	// TODO: repair me
 	/*