about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2007-08-22 21:13:33 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2007-08-22 21:13:33 +0000
commit0320d20a477e2edbf15f3d961add7c9cd5be7f94 (patch)
tree589005b1e64381b5144cf3106c78befdc692deb2 /src/game
parent01fa2a14a22a4be0a735597902d1b136469604a0 (diff)
downloadzcatch-0320d20a477e2edbf15f3d961add7c9cd5be7f94.tar.gz
zcatch-0320d20a477e2edbf15f3d961add7c9cd5be7f94.zip
fixed network hash versioning
Diffstat (limited to 'src/game')
-rw-r--r--src/game/client/game_client.cpp4
-rw-r--r--src/game/client/menu.cpp6
-rw-r--r--src/game/game.h157
-rw-r--r--src/game/game_protocol.h154
-rw-r--r--src/game/server/game_server.cpp3
-rw-r--r--src/game/version.h3
6 files changed, 170 insertions, 157 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp
index e5969fcf..2e093308 100644
--- a/src/game/client/game_client.cpp
+++ b/src/game/client/game_client.cpp
@@ -9,6 +9,7 @@ extern "C" {
 };
 
 #include "../game.h"
+#include "../version.h"
 #include "mapres_image.h"
 #include "mapres_tilemap.h"
 #include "data.h"
@@ -2204,3 +2205,6 @@ extern "C" void modc_message(int msg)
 		client_datas[cid].emoticon_start = client_tick();
 	}
 }
+
+
+extern "C" const char *modc_net_version() { return TEEWARS_NETVERSION; }
diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp
index 1e7f1edc..a307d176 100644
--- a/src/game/client/menu.cpp
+++ b/src/game/client/menu.cpp
@@ -8,12 +8,12 @@
 extern "C" {
 	#include <engine/system.h>
 	#include <engine/interface.h>
-	#include <engine/versions.h>
 	#include <engine/config.h>
 	#include <engine/client/ui.h>
 }
 
 #include "../mapres.h"
+#include "../version.h"
 
 #include "mapres_image.h"
 #include "mapres_tilemap.h"
@@ -1289,7 +1289,7 @@ int render_popup(const char *caption, const char *text, const char *button_text)
 	ui_do_label(x+w/2-tw/2, y+20, caption, 48.0f);
 	
 	tw = gfx_pretty_text_width(32.0f, text, -1);
-	ui_do_label(x+w/2-tw/2, y+130, text, 32.0f);
+    gfx_pretty_text(x+w/2-tw/2, y+130, 32.0f, text, -1);
 
 	if(button_text)
 	{
@@ -1366,6 +1366,8 @@ static int menu_render(bool ingame)
 		{
 			ui_do_image(data->images[IMAGE_BANNER].id, 200, 20, 512, 128);
 			ui_do_label(20.0f, 600.0f-40.0f, "Version: " TEEWARS_VERSION, 36);
+			if(config.debug)
+				ui_do_label(20.0f, 600.0f-60.0f, "Nethash: " TEEWARS_NETVERSION_HASH, 24);
 		}
 	}
 	else
diff --git a/src/game/game.h b/src/game/game.h
index 45a19105..5b860036 100644
--- a/src/game/game.h
+++ b/src/game/game.h
@@ -4,6 +4,8 @@
 #include "../engine/interface.h"
 #include "mapres_col.h"
 
+#include "game_protocol.h"
+
 inline vec2 get_direction(int angle)
 {
 	float a = angle/256.0f;
@@ -25,161 +27,6 @@ inline float get_angle(vec2 dir)
 inline bool col_check_point(float x, float y) { return col_check_point((int)x, (int)y) != 0; }
 inline bool col_check_point(vec2 p) { return col_check_point(p.x, p.y); }
 
-// Network stuff
-
-enum
-{
-	OBJTYPE_NULL=0,
-	OBJTYPE_GAME,
-	OBJTYPE_PLAYER,
-	OBJTYPE_PROJECTILE,
-	OBJTYPE_POWERUP,
-	OBJTYPE_FLAG,
-	EVENT_EXPLOSION,
-	EVENT_DAMAGEINDICATION,
-	EVENT_SOUND,
-	EVENT_SMOKE,
-	EVENT_SPAWN,
-	EVENT_DEATH,
-};
-
-enum
-{
-	MSG_NULL=0,
-	MSG_SAY,
-	MSG_CHAT,
-	MSG_SETNAME,
-	MSG_KILLMSG,
-	MSG_SWITCHTEAM,
-	MSG_JOIN,
-	MSG_QUIT,
-	MSG_EMOTICON,
-	MSG_CHANGENAME,
-};
-
-enum
-{
-	EMOTE_NORMAL=0,
-	EMOTE_PAIN,
-	EMOTE_HAPPY,
-	EMOTE_SURPRISE,
-	EMOTE_ANGRY,
-	EMOTE_BLINK,
-};
-
-enum
-{
-	STATE_UNKNOWN=0,
-	STATE_PLAYING,
-	STATE_IN_MENU,
-	STATE_CHATTING,
-};
-
-struct player_input
-{
-	int left;
-	int right;
-	
-	int target_x;
-	int target_y;
-	
-	int jump;
-	int fire;
-	int hook;
-	int blink;
-	int activeweapon;
-	int state;
-};
-
-
-struct ev_explosion
-{
-	int x, y;
-};
-
-struct ev_spawn
-{
-	int x, y;
-};
-
-struct ev_death
-{
-	int x, y;
-};
-
-struct ev_sound
-{
-	int x, y;
-	int sound; // if (0x80000000 flag is set -> looping) if (0x40000000 is set -> stop looping
-};
-
-struct ev_damageind
-{
-	int x, y;
-	int angle;
-};
-
-struct obj_game
-{
-	int round_start_tick;
-	int game_over;
-	int sudden_death;
-	int paused;
-	
-	int score_limit;
-	int time_limit;
-	int gametype;
-};
-
-struct obj_projectile
-{
-	int type;
-	int x, y;
-	int vx, vy; // should be an angle instead
-};
-
-struct obj_powerup
-{
-	int x, y;
-	int type; // why do we need two types?
-	int subtype;
-};
-
-struct obj_flag
-{
-	int x, y;
-	int team;
-};
-
-struct obj_player
-{
-	int local;
-	int clientid;
-	int state;
-
-	int health;
-	int armor;
-	int ammocount;
-	
-	int x, y;
-	int vx, vy;
-	int angle;
-	
-	int weapon; // current active weapon
-
-	int attacktick; // num attack ticks left of current attack
-	
-	int score;
-	int latency;
-	int latency_flux;
-	int emote;
-	
-	int hook_active;
-	int hook_x, hook_y;
-	int team;
-};
-
-
 struct mapres_spawnpoint
 {
 	int x, y;
diff --git a/src/game/game_protocol.h b/src/game/game_protocol.h
new file mode 100644
index 00000000..f04df148
--- /dev/null
+++ b/src/game/game_protocol.h
@@ -0,0 +1,154 @@
+// NOTE: Be very careful when editing this file as it will change the network version
+
+// Network stuff
+enum
+{
+	OBJTYPE_NULL=0,
+	OBJTYPE_GAME,
+	OBJTYPE_PLAYER,
+	OBJTYPE_PROJECTILE,
+	OBJTYPE_POWERUP,
+	OBJTYPE_FLAG,
+	EVENT_EXPLOSION,
+	EVENT_DAMAGEINDICATION,
+	EVENT_SOUND,
+	EVENT_SMOKE,
+	EVENT_SPAWN,
+	EVENT_DEATH,
+};
+
+enum
+{
+	MSG_NULL=0,
+	MSG_SAY,
+	MSG_CHAT,
+	MSG_SETNAME,
+	MSG_KILLMSG,
+	MSG_SWITCHTEAM,
+	MSG_JOIN,
+	MSG_QUIT,
+	MSG_EMOTICON,
+	MSG_CHANGENAME,
+};
+
+enum
+{
+	EMOTE_NORMAL=0,
+	EMOTE_PAIN,
+	EMOTE_HAPPY,
+	EMOTE_SURPRISE,
+	EMOTE_ANGRY,
+	EMOTE_BLINK,
+};
+
+enum
+{
+	STATE_UNKNOWN=0,
+	STATE_PLAYING,
+	STATE_IN_MENU,
+	STATE_CHATTING,
+};
+
+struct player_input
+{
+	int left;
+	int right;
+	
+	int target_x;
+	int target_y;
+	
+	int jump;
+	int fire;
+	int hook;
+	int blink;
+	int activeweapon;
+	int state;
+};
+
+
+struct ev_explosion
+{
+	int x, y;
+};
+
+struct ev_spawn
+{
+	int x, y;
+};
+
+struct ev_death
+{
+	int x, y;
+};
+
+struct ev_sound
+{
+	int x, y;
+	int sound; // if (0x80000000 flag is set -> looping) if (0x40000000 is set -> stop looping
+};
+
+struct ev_damageind
+{
+	int x, y;
+	int angle;
+};
+
+struct obj_game
+{
+	int round_start_tick;
+	int game_over;
+	int sudden_death;
+	int paused;
+	
+	int score_limit;
+	int time_limit;
+	int gametype;
+};
+
+struct obj_projectile
+{
+	int type;
+	int x, y;
+	int vx, vy; // should be an angle instead
+};
+
+struct obj_powerup
+{
+	int x, y;
+	int type; // why do we need two types?
+	int subtype;
+};
+
+struct obj_flag
+{
+	int x, y;
+	int team;
+};
+
+struct obj_player
+{
+	int local;
+	int clientid;
+	int state;
+
+	int health;
+	int armor;
+	int ammocount;
+	
+	int x, y;
+	int vx, vy;
+	int angle;
+	
+	int weapon; // current active weapon
+
+	int attacktick; // num attack ticks left of current attack
+	
+	int score;
+	int latency;
+	int latency_flux;
+	int emote;
+	
+	int hook_active;
+	int hook_x, hook_y;
+	int team;
+};
diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp
index f7bf976e..711a0d1b 100644
--- a/src/game/server/game_server.cpp
+++ b/src/game/server/game_server.cpp
@@ -3,6 +3,7 @@
 #include <string.h>
 #include <engine/config.h>
 #include "../game.h"
+#include "../version.h"
 #include "data.h"
 #include "game_server.h"
 
@@ -2189,3 +2190,5 @@ void mods_init()
 void mods_shutdown() {}
 void mods_presnap() {}
 void mods_postsnap() {}
+
+extern "C" const char *mods_net_version() { return TEEWARS_NETVERSION; }
diff --git a/src/game/version.h b/src/game/version.h
new file mode 100644
index 00000000..10a03af0
--- /dev/null
+++ b/src/game/version.h
@@ -0,0 +1,3 @@
+#include "nethash.c"
+#define TEEWARS_VERSION "0.3.0-dev"
+#define TEEWARS_NETVERSION "0.3 " TEEWARS_NETVERSION_HASH