about summary refs log tree commit diff
path: root/src/game/client/gameclient.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/client/gameclient.hpp')
-rw-r--r--src/game/client/gameclient.hpp109
1 files changed, 109 insertions, 0 deletions
diff --git a/src/game/client/gameclient.hpp b/src/game/client/gameclient.hpp
new file mode 100644
index 00000000..335c3695
--- /dev/null
+++ b/src/game/client/gameclient.hpp
@@ -0,0 +1,109 @@
+
+#include <base/vmath.hpp>
+#include <game/gamecore.hpp>
+#include "gc_render.hpp"
+
+class GAMECLIENT
+{
+	class STACK
+	{
+	public:
+		enum
+		{
+			MAX_COMPONENTS = 64,
+		};
+	
+		STACK();
+		void add(class COMPONENT *component);
+		
+		class COMPONENT *components[MAX_COMPONENTS];
+		int num;
+	};
+	
+	STACK all;
+	STACK input;
+	
+	void dispatch_input();
+	void process_events();
+	void update_local_character_pos();
+
+	int predicted_tick;
+	int last_new_predicted_tick;
+
+public:
+
+	vec2 local_character_pos;
+	vec2 local_target_pos;
+
+	// snap pointers
+	struct SNAPSTATE
+	{
+		const NETOBJ_CHARACTER *local_character;
+		const NETOBJ_CHARACTER *local_prev_character;
+		const NETOBJ_PLAYER_INFO *local_info;
+		const NETOBJ_FLAG *flags[2];
+		const NETOBJ_GAME *gameobj;
+
+		const NETOBJ_PLAYER_INFO *player_infos[MAX_CLIENTS];
+		const NETOBJ_PLAYER_INFO *info_by_score[MAX_CLIENTS];
+		int num_players;
+	};
+
+	SNAPSTATE snap;
+	
+	// client data
+	struct CLIENT_DATA
+	{
+		char name[64];
+		char skin_name[64];
+		int skin_id;
+		int skin_color;
+		int team;
+		int emoticon;
+		int emoticon_start;
+		CHARACTER_CORE predicted;
+		
+		TEE_RENDER_INFO skin_info; // this is what the server reports
+		TEE_RENDER_INFO render_info; // this is what we use
+		
+		float angle;
+		
+		void update_render_info();
+	};
+
+	CLIENT_DATA clients[MAX_CLIENTS];
+	
+	void on_reset();
+
+	// hooks
+	void on_connected();
+	void on_render();
+	void on_init();
+	void on_statechange(int new_state, int old_state);
+	void on_message(int msgtype);
+	void on_snapshot();
+	void on_predict();
+	int on_snapinput(int *data);
+
+	// actions
+	// TODO: move these
+	void send_switch_team(int team);
+	void send_info(bool start);
+	void send_kill(int client_id);
+	
+	// pointers to all systems
+	class CONSOLE *console;
+	class BINDS *binds;
+	class PARTICLES *particles;
+	class MENUS *menus;
+	class SKINS *skins;
+	class FLOW *flow;
+	class CHAT *chat;
+	class DAMAGEIND *damageind;
+	class CAMERA *camera;
+	class CONTROLS *controls;
+	class EFFECTS *effects;
+};
+
+extern GAMECLIENT gameclient;
+