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 22:38:56 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-08-30 22:38:56 +0000
commitcd7a3519a7a4e9914906d96b603cefdbf3a58a0e (patch)
tree75d5121c24bc6f449e399a227fcf7553f73e811f /src/game/client/components
parent432602c4ca5d47aee91d25271fa57ad0f6d67250 (diff)
downloadzcatch-cd7a3519a7a4e9914906d96b603cefdbf3a58a0e.tar.gz
zcatch-cd7a3519a7a4e9914906d96b603cefdbf3a58a0e.zip
added the loading screen again
Diffstat (limited to 'src/game/client/components')
-rw-r--r--src/game/client/components/chat.cpp2
-rw-r--r--src/game/client/components/chat.hpp3
-rw-r--r--src/game/client/components/console.cpp90
-rw-r--r--src/game/client/components/controls.cpp13
-rw-r--r--src/game/client/components/menus.cpp4
-rw-r--r--src/game/client/components/menus.hpp6
-rw-r--r--src/game/client/components/motd.hpp3
-rw-r--r--src/game/client/components/particles.cpp5
8 files changed, 20 insertions, 106 deletions
diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp
index ca1d6ea5..017a5d74 100644
--- a/src/game/client/components/chat.cpp
+++ b/src/game/client/components/chat.cpp
@@ -87,7 +87,7 @@ void CHAT::on_message(int msgtype, void *rawmsg)
 		NETMSG_SV_CHAT *msg = (NETMSG_SV_CHAT *)rawmsg;
 		add_line(msg->cid, msg->team, msg->message);
 
-		if(msg->cid >= 0) // TODO: repair me
+		if(msg->cid >= 0)
 			gameclient.sounds->play(SOUNDS::CHN_GUI, SOUND_CHAT_CLIENT, 0, vec2(0,0));
 		else
 			gameclient.sounds->play(SOUNDS::CHN_GUI, SOUND_CHAT_SERVER, 0, vec2(0,0));
diff --git a/src/game/client/components/chat.hpp b/src/game/client/components/chat.hpp
index fc21ce1f..12d3be96 100644
--- a/src/game/client/components/chat.hpp
+++ b/src/game/client/components/chat.hpp
@@ -38,10 +38,9 @@ class CHAT : public COMPONENT
 	static void con_chat(void *result, void *user_data);
 	
 public:
+	bool is_active() const { return mode != MODE_NONE; }
 	
 	void add_line(int client_id, int team, const char *line);
-	//void chat_reset();
-	//bool chat_input_handle(INPUT_EVENT e, void *user_data);
 	
 	void enable_mode(int team);
 	
diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp
index fe2ecfa5..77b85c97 100644
--- a/src/game/client/components/console.cpp
+++ b/src/game/client/components/console.cpp
@@ -367,14 +367,6 @@ void CONSOLE::on_init()
 	MACRO_REGISTER_COMMAND("toggle_remote_console", "", con_toggle_remote_console, this);
 }
 
-
-/*
-void console_rcon_print(const char *line)
-{
-	// TODO: repair me
-	//remote_console.print_line(line);
-}*/
-
 /*
 static void con_team(void *result, void *user_data)
 {
@@ -388,34 +380,6 @@ static void con_kill(void *result, void *user_data)
 
 void send_kill(int client_id);
 
-
-
-static void con_key_input_state(void *result, void *user_data)
-{
-	((int *)user_data)[0] = console_arg_int(result, 0);
-}
-
-static void con_key_input_counter(void *result, void *user_data)
-{
-	int *v = (int *)user_data;
-	if(((*v)&1) != console_arg_int(result, 0))
-		(*v)++;
-	*v &= INPUT_STATE_MASK;
-}
-
-static void con_key_input_weapon(void *result, void *user_data)
-{
-	int w = (char *)user_data - (char *)0;
-	if(console_arg_int(result, 0))
-		input_data.wanted_weapon = w;
-}
-
-static void con_key_input_nextprev_weapon(void *result, void *user_data)
-{
-	con_key_input_counter(result, user_data);
-	input_data.wanted_weapon = 0;
-}
-
 static void con_emote(void *result, void *user_data)
 {
 	send_emoticon(console_arg_int(result, 0));
@@ -425,66 +389,12 @@ extern void con_chat(void *result, void *user_data);
 
 void client_console_init()
 {
-	console_register_print_callback(client_console_print);
-
-	//
-	MACRO_REGISTER_COMMAND("toggle_local_console", "", con_toggle_local_console, 0x0);
-	MACRO_REGISTER_COMMAND("toggle_remote_console", "", con_toggle_remote_console, 0x0);
-
 	//
 	MACRO_REGISTER_COMMAND("team", "i", con_team, 0x0);
 	MACRO_REGISTER_COMMAND("kill", "", con_kill, 0x0);
-	
-	// bindings
-	MACRO_REGISTER_COMMAND("bind", "sr", con_bind, 0x0);
-	MACRO_REGISTER_COMMAND("unbind", "s", con_unbind, 0x0);
-	MACRO_REGISTER_COMMAND("unbindall", "", con_unbindall, 0x0);
-	
-	MACRO_REGISTER_COMMAND("dump_binds", "", con_dump_binds, 0x0);
 
 	// chatting
 	MACRO_REGISTER_COMMAND("emote", "i", con_emote, 0);
 	MACRO_REGISTER_COMMAND("+emote", "", con_key_input_state, &emoticon_selector_active);
 }
-
-bool console_input_cli(INPUT_EVENT e, void *user_data)
-{
-	if(!console_active())
-		return false;
-	
-	if(e.key == KEY_ESC && (e.flags&INPFLAG_PRESS))
-		console_toggle(console_type);
-	else
-		current_console()->handle_event(e);
-	return true;
-}
-
-static bool console_execute_event(INPUT_EVENT e)
-{
-	// don't handle invalid events and keys that arn't set to anything
-	if(e.key <= 0 || e.key >= KEY_LAST || keybindings[e.key][0] == 0)
-		return false;
-
-	int stroke = 0;
-	if(e.flags&INPFLAG_PRESS)
-		stroke = 1;
-	console_execute_line_stroked(stroke, keybindings[e.key]);
-	return true;
-}
-
-bool console_input_special_binds(INPUT_EVENT e, void *user_data)
-{
-	// only handle function keys
-	if(e.key < KEY_F1 || e.key > KEY_F25)
-		return false;
-	return console_execute_event(e);
-}
-
-bool console_input_normal_binds(INPUT_EVENT e, void *user_data)
-{
-	// need to be ingame for these binds
-	if(client_state() != CLIENTSTATE_ONLINE)
-		return false;
-	return console_execute_event(e);
-}
 */
diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp
index 15bb1388..0cf8b861 100644
--- a/src/game/client/components/controls.cpp
+++ b/src/game/client/components/controls.cpp
@@ -3,6 +3,8 @@
 #include <game/collision.hpp>
 #include <game/client/gameclient.hpp>
 #include <game/client/component.hpp>
+#include <game/client/components/chat.hpp>
+#include <game/client/components/menus.hpp>
 
 #include "controls.hpp"
 
@@ -69,17 +71,16 @@ int CONTROLS::snapinput(int *data)
 	static int64 last_send_time = 0;
 	
 	// update player state
-	/*if(chat_mode != CHATMODE_NONE) // TODO: repair me
+	if(gameclient.chat->is_active())
 		input_data.player_state = PLAYERSTATE_CHATTING;
-	else if(menu_active)
+	else if(gameclient.menus->is_active())
 		input_data.player_state = PLAYERSTATE_IN_MENU;
 	else
-		input_data.player_state = PLAYERSTATE_PLAYING;*/
+		input_data.player_state = PLAYERSTATE_PLAYING;
 	last_data.player_state = input_data.player_state;
 	
 	// we freeze the input if chat or menu is activated
-	/* repair me
-	if(menu_active || chat_mode != CHATMODE_NONE || console_active())
+	if(input_data.player_state != PLAYERSTATE_PLAYING)
 	{
 		last_data.direction = 0;
 		last_data.hook = 0;
@@ -89,7 +90,7 @@ int CONTROLS::snapinput(int *data)
 			
 		mem_copy(data, &input_data, sizeof(input_data));
 		return sizeof(input_data);
-	}*/
+	}
 	
 	input_data.target_x = (int)mouse_pos.x;
 	input_data.target_y = (int)mouse_pos.y;
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp
index 4284f84c..6d0cbf38 100644
--- a/src/game/client/components/menus.cpp
+++ b/src/game/client/components/menus.cpp
@@ -22,6 +22,7 @@ extern "C" {
 
 #include <game/generated/gc_data.hpp>
 #include <game/client/components/binds.hpp>
+#include <game/client/components/motd.hpp>
 #include <game/client/gameclient.hpp>
 #include <game/client/animstate.hpp>
 #include <game/client/gc_render.hpp>
@@ -738,8 +739,7 @@ void MENUS::render_serverinfo(RECT main_view)
 	RECT view;
 	ui_margin(&main_view, 10.0f, &view);
 	//void gfx_text(void *font, float x, float y, float size, const char *text, int max_width);
-	// TODO: repair me
-	//gfx_text(0, view.x, view.y, 16, server_motd, -1);
+	gfx_text(0, view.x, view.y, 16, gameclient.motd->server_motd, -1);
 }
 
 void MENUS::init()
diff --git a/src/game/client/components/menus.hpp b/src/game/client/components/menus.hpp
index 71128498..f1c87270 100644
--- a/src/game/client/components/menus.hpp
+++ b/src/game/client/components/menus.hpp
@@ -72,7 +72,7 @@ class MENUS : public COMPONENT
 	// found in menus.cpp
 	int render();
 	void render_background();
-	void render_loading(float percent);
+	//void render_loading(float percent);
 	int render_menubar(RECT r);
 	void render_news(RECT main_view);
 	void render_game(RECT main_view);
@@ -91,6 +91,10 @@ class MENUS : public COMPONENT
 public:
 	MENUS();
 
+	void render_loading(float percent);
+
+	bool is_active() const { return menu_active; }
+
 	void init();
 
 	virtual void on_statechange(int new_state, int old_state);
diff --git a/src/game/client/components/motd.hpp b/src/game/client/components/motd.hpp
index bc2c962e..5ee16086 100644
--- a/src/game/client/components/motd.hpp
+++ b/src/game/client/components/motd.hpp
@@ -4,8 +4,9 @@ class MOTD : public COMPONENT
 {
 	// motd
 	int64 server_motd_time;
-	char server_motd[900]; // FUGLY
 public:
+	char server_motd[900];
+
 	void clear();
 	bool is_active();
 	
diff --git a/src/game/client/components/particles.cpp b/src/game/client/components/particles.cpp
index 0c449263..58af6f55 100644
--- a/src/game/client/components/particles.cpp
+++ b/src/game/client/components/particles.cpp
@@ -1,6 +1,7 @@
 #include <base/math.hpp>
 #include <game/generated/gc_data.hpp>
 #include <game/client/gc_render.hpp>
+#include <game/gamecore.hpp>
 #include "particles.hpp"
 
 PARTICLES::PARTICLES()
@@ -82,9 +83,7 @@ void PARTICLES::update(float time_passed)
 			
 			// move the point
 			vec2 vel = particles[i].vel*time_passed;
-			
-			// TODO: repair me
-			//move_point(&particles[i].pos, &vel, 0.1f+0.9f*frandom(), NULL);
+			move_point(&particles[i].pos, &vel, 0.1f+0.9f*frandom(), NULL);
 			particles[i].vel = vel* (1.0f/time_passed);
 			
 			particles[i].life += time_passed;