about summary refs log tree commit diff
path: root/src/game/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/client')
-rw-r--r--src/game/client/components/binds.cpp5
-rw-r--r--src/game/client/components/chat.cpp5
-rw-r--r--src/game/client/components/console.cpp5
-rw-r--r--src/game/client/components/console.hpp13
-rw-r--r--src/game/client/components/controls.cpp7
-rw-r--r--src/game/client/components/scoreboard.cpp24
-rw-r--r--src/game/client/components/scoreboard.hpp8
-rw-r--r--src/game/client/gameclient.cpp3
-rw-r--r--src/game/client/gc_hooks.cpp2
9 files changed, 41 insertions, 31 deletions
diff --git a/src/game/client/components/binds.cpp b/src/game/client/components/binds.cpp
index 5d033ad4..05165e5e 100644
--- a/src/game/client/components/binds.cpp
+++ b/src/game/client/components/binds.cpp
@@ -1,7 +1,4 @@
-extern "C" {
-	#include <engine/e_console.h>
-}
-
+#include <engine/e_client_interface.h>
 #include "binds.hpp"
 
 BINDS::BINDS()
diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp
index 2e481215..1bdc7e85 100644
--- a/src/game/client/components/chat.cpp
+++ b/src/game/client/components/chat.cpp
@@ -1,15 +1,10 @@
 #include <string.h> // strcmp
 
-extern "C" {
-	#include <engine/e_console.h>
-}
-
 #include <engine/e_client_interface.h>
 #include <game/generated/g_protocol.hpp>
 #include <game/generated/gc_data.hpp>
 
 #include <game/client/gameclient.hpp>
-//#include <game/client/gc_anim.hpp>
 #include <game/client/gc_client.hpp>
 
 #include "chat.hpp"
diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp
index a67a1138..8b1abfaa 100644
--- a/src/game/client/components/console.cpp
+++ b/src/game/client/components/console.cpp
@@ -3,10 +3,9 @@
 
 #include <base/system.h>
 
+#include <engine/e_client_interface.h>
+
 extern "C" {
-	#include <engine/e_client_interface.h>
-	#include <engine/e_config.h>
-	#include <engine/e_console.h>
 	#include <engine/e_ringbuffer.h>
 	#include <engine/client/ec_font.h>
 }
diff --git a/src/game/client/components/console.hpp b/src/game/client/components/console.hpp
index 8c6a9c72..9b60185c 100644
--- a/src/game/client/components/console.hpp
+++ b/src/game/client/components/console.hpp
@@ -1,11 +1,4 @@
-extern "C" {
-	#include <engine/e_client_interface.h>
-	#include <engine/e_config.h>
-	#include <engine/e_console.h>
-	#include <engine/e_ringbuffer.h>
-	#include <engine/client/ec_font.h>
-}
-
+#include <engine/e_client_interface.h>
 #include <game/client/component.hpp>
 
 class CONSOLE : public COMPONENT
@@ -14,11 +7,11 @@ class CONSOLE : public COMPONENT
 	{
 	public:
 		char history_data[65536];
-		RINGBUFFER *history;
+		struct RINGBUFFER *history;
 		char *history_entry;
 		
 		char backlog_data[65536];
-		RINGBUFFER *backlog;
+		struct RINGBUFFER *backlog;
 
 		LINEINPUT input;
 		
diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp
index 9f0ba30a..886542e2 100644
--- a/src/game/client/components/controls.cpp
+++ b/src/game/client/components/controls.cpp
@@ -1,9 +1,4 @@
-extern "C" {
-	#include <engine/e_config.h>
-	#include <engine/e_console.h>
-	#include <engine/e_client_interface.h>
-}
-
+#include <engine/e_client_interface.h>
 #include <base/math.hpp>
 #include <game/collision.hpp>
 #include <game/client/gameclient.hpp>
diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp
index 075f249e..5823ab8d 100644
--- a/src/game/client/components/scoreboard.cpp
+++ b/src/game/client/components/scoreboard.cpp
@@ -1,5 +1,4 @@
 #include <string.h>
-
 #include <engine/e_client_interface.h>
 #include <game/generated/g_protocol.hpp>
 #include <game/generated/gc_data.hpp>
@@ -8,6 +7,27 @@
 #include <game/client/gc_render.hpp>
 #include "scoreboard.hpp"
 
+
+SCOREBOARD::SCOREBOARD()
+{
+	on_reset();
+}
+
+void SCOREBOARD::con_key_scoreboard(void *result, void *user_data)
+{
+	((SCOREBOARD *)user_data)->active = console_arg_int(result, 0) != 0;
+}
+
+void SCOREBOARD::on_reset()
+{
+	active = false;
+}
+
+void SCOREBOARD::on_init()
+{
+	MACRO_REGISTER_COMMAND("+scoreboard", "", con_key_scoreboard, this);
+}
+
 void SCOREBOARD::render_goals(float x, float y, float w)
 {
 	float h = 50.0f;
@@ -204,6 +224,8 @@ void SCOREBOARD::render_scoreboard(float x, float y, float w, int team, const ch
 
 void SCOREBOARD::on_render()
 {
+	if(!active)
+		return;
 	
 	// TODO: repair me
 	/*
diff --git a/src/game/client/components/scoreboard.hpp b/src/game/client/components/scoreboard.hpp
index b1913cec..ba5b0a3d 100644
--- a/src/game/client/components/scoreboard.hpp
+++ b/src/game/client/components/scoreboard.hpp
@@ -5,7 +5,15 @@ class SCOREBOARD : public COMPONENT
 	void render_goals(float x, float y, float w);
 	void render_spectators(float x, float y, float w);
 	void render_scoreboard(float x, float y, float w, int team, const char *title);
+
+	static void con_key_scoreboard(void *result, void *user_data);
+	
+	bool active;
+	
 public:
+	SCOREBOARD();
+	virtual void on_reset();
+	virtual void on_init();
 	virtual void on_render();
 };
 
diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp
index 0222b6b9..40682297 100644
--- a/src/game/client/gameclient.cpp
+++ b/src/game/client/gameclient.cpp
@@ -21,6 +21,7 @@
 #include "components/debughud.hpp"
 #include "components/controls.hpp"
 #include "components/effects.hpp"
+#include "components/scoreboard.hpp"
 
 GAMECLIENT gameclient;
 
@@ -40,6 +41,7 @@ static HUD hud;
 static DEBUGHUD debughud;
 static CONTROLS controls;
 static EFFECTS effects;
+static SCOREBOARD scoreboard;
 
 static PLAYERS players;
 static ITEMS items;
@@ -85,6 +87,7 @@ void GAMECLIENT::on_init()
 	all.add(chat);
 	all.add(&broadcast);
 	all.add(&debughud);
+	all.add(&scoreboard);
 	all.add(&motd);
 	all.add(menus);
 	all.add(console);
diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp
index bef6f508..4d0be686 100644
--- a/src/game/client/gc_hooks.cpp
+++ b/src/game/client/gc_hooks.cpp
@@ -3,9 +3,7 @@
 #include <engine/e_client_interface.h>
 
 extern "C" {
-	#include <engine/e_config.h>
 	#include <engine/client/ec_font.h>
-	#include <engine/e_console.h>
 };
 
 #include <game/generated/gc_data.hpp>