about summary refs log tree commit diff
path: root/datasrc
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2010-05-29 07:25:38 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2010-05-29 07:25:38 +0000
commit72c06a258940696093f255fb1061beb58e1cdd0b (patch)
tree36b9a7712eec2d4f07837eab9c38ef1c5af85319 /datasrc
parente56feb597bc743677633432f77513b02907fd169 (diff)
downloadzcatch-72c06a258940696093f255fb1061beb58e1cdd0b.tar.gz
zcatch-72c06a258940696093f255fb1061beb58e1cdd0b.zip
copied refactor to trunk
Diffstat (limited to 'datasrc')
-rw-r--r--datasrc/compile.py245
-rw-r--r--datasrc/datatypes.py71
-rw-r--r--datasrc/network.py307
3 files changed, 361 insertions, 262 deletions
diff --git a/datasrc/compile.py b/datasrc/compile.py
index 179020fd..4b7be441 100644
--- a/datasrc/compile.py
+++ b/datasrc/compile.py
@@ -76,7 +76,7 @@ if gen_client_content_header or gen_server_content_header:
 		EmitTypeDeclaration(content.__dict__[name])
 		
 	# the container pointer
-	print 'extern DATACONTAINER *data;';
+	print 'extern DATACONTAINER *g_pData;';
 	
 	# enums
 	EmitEnum(["IMAGE_%s"%i.name.value.upper() for i in content.container.images.items], "NUM_IMAGES")
@@ -85,17 +85,17 @@ if gen_client_content_header or gen_server_content_header:
 
 if gen_client_content_source or gen_server_content_source:
 	if gen_client_content_source:
-		print '#include "gc_data.hpp"'
+		print '#include "client_data.h"'
 	if gen_server_content_source:
-		print '#include "gs_data.hpp"'
+		print '#include "server_data.h"'
 	EmitDefinition(content.container, "datacontainer")
-	print 'DATACONTAINER *data = &datacontainer;';
+	print 'DATACONTAINER *g_pData = &datacontainer;';
 
 # NETWORK
 if gen_network_header:
 	
-	print "#ifndef FILE_G_PROTOCOL_H"
-	print "#define FILE_G_PROTOCOL_H"
+	print "#ifndef GAME_GENERATED_PROTOCOL_H"
+	print "#define GAME_GENERATED_PROTOCOL_H"
 	print network.RawHeader
 	
 	for e in network.Enums:
@@ -119,126 +119,199 @@ if gen_network_header:
 	EmitEnum(["SOUND_%s"%i.name.value.upper() for i in content.container.sounds.items], "NUM_SOUNDS")
 	EmitEnum(["WEAPON_%s"%i.name.value.upper() for i in content.container.weapons.id.items], "NUM_WEAPONS")
 
-	print "int netobj_validate(int type, void *data, int size);"
-	print "const char *netobj_get_name(int type);"
-	print "int netobj_get_size(int type);"
-	print "void *netmsg_secure_unpack(int type);"
-	print "const char *netmsg_get_name(int type);"
-	print "const char *netmsg_failed_on();"
-	print "int netobj_num_corrections();"
-	print "const char *netobj_corrected_on();"
-	print "#endif // FILE_G_PROTOCOL_H"
+	print """
+
+class CNetObjHandler
+{
+	const char *m_pMsgFailedOn;
+	const char *m_pObjCorrectedOn;
+	char m_aMsgData[1024];
+	int m_NumObjCorrections;
+	int ClampInt(const char *pErrorMsg, int Value, int Min, int Max);
+	
+	static const char *ms_apObjNames[];
+	static int ms_aObjSizes[];
+	static const char *ms_apMsgNames[];
+	
+public:
+	CNetObjHandler();
+
+	int ValidateObj(int Type, void *pData, int Size);
+	const char *GetObjName(int Type);
+	int GetObjSize(int Type);
+	int NumObjCorrections();
+	const char *CorrectedObjOn();
+	
+	const char *GetMsgName(int Type);
+	void *SecureUnpackMsg(int Type, CUnpacker *pUnpacker);
+	const char *FailedMsgOn();
+};
+
+"""
+
+	print "#endif // GAME_GENERATED_PROTOCOL_H"
 	
 
 if gen_network_source:
 	# create names
 	lines = []
 	
-	lines += ['#include <engine/e_common_interface.h>']
-	lines += ['#include "g_protocol.hpp"']
+	lines += ['#include <engine/shared/protocol.h>']
+	lines += ['#include <engine/message.h>']
+	lines += ['#include "protocol.h"']
+	
+	lines += ['CNetObjHandler::CNetObjHandler()']
+	lines += ['{']
+	lines += ['\tm_pMsgFailedOn = "";']
+	lines += ['\tm_pObjCorrectedOn = "";']
+	lines += ['\tm_NumObjCorrections = 0;']
+	lines += ['}']
+	lines += ['']
+	lines += ['int CNetObjHandler::NumObjCorrections() { return m_NumObjCorrections; }']
+	lines += ['const char *CNetObjHandler::CorrectedObjOn() { return m_pObjCorrectedOn; }']
+	lines += ['const char *CNetObjHandler::FailedMsgOn() { return m_pMsgFailedOn; }']
+	lines += ['']
+	lines += ['']
+	lines += ['']
+	lines += ['']
+	lines += ['']
 
-	lines += ['const char *msg_failed_on = "";']
-	lines += ['const char *obj_corrected_on = "";']
-	lines += ['static int num_corrections = 0;']
-	lines += ['int netobj_num_corrections() { return num_corrections; }']
-	lines += ['const char *netobj_corrected_on() { return obj_corrected_on; }']
-	lines += ['const char *netmsg_failed_on() { return msg_failed_on; }']
-	lines += ['const int max_int = 0x7fffffff;']
+	lines += ['static const int max_int = 0x7fffffff;']
 
-	lines += ['static int netobj_clamp_int(const char *error_msg, int v, int min, int max)']
+	lines += ['int CNetObjHandler::ClampInt(const char *pErrorMsg, int Value, int Min, int Max)']
 	lines += ['{']
-	lines += ['\tif(v<min) { obj_corrected_on = error_msg; num_corrections++; return min; }']
-	lines += ['\tif(v>max) { obj_corrected_on = error_msg; num_corrections++; return max; }']
-	lines += ['\treturn v;']
+	lines += ['\tif(Value < Min) { m_pObjCorrectedOn = pErrorMsg; m_NumObjCorrections++; return Min; }']
+	lines += ['\tif(Value > Max) { m_pObjCorrectedOn = pErrorMsg; m_NumObjCorrections++; return Max; }']
+	lines += ['\treturn Value;']
 	lines += ['}']
 
-	lines += ["static const char *netobj_names[] = {"]
+	lines += ["const char *CNetObjHandler::ms_apObjNames[] = {"]
 	lines += ['\t"invalid",']
 	lines += ['\t"%s",' % o.name for o in network.Objects]
 	lines += ['\t""', "};", ""]
 
-	lines += ["static int netobj_sizes[] = {"]
+	lines += ["int CNetObjHandler::ms_aObjSizes[] = {"]
 	lines += ['\t0,']
 	lines += ['\tsizeof(%s),' % o.struct_name for o in network.Objects]
 	lines += ['\t0', "};", ""]
-	for l in lines:
-		print l
 
-	for item in network.Objects:
-		for line in item.emit_validate():
-			print line
-		print ""
 
-	# create validate tables
-	lines = []
-	lines += ['static int validate_invalid(void *data, int size) { return -1; }']
-	lines += ["typedef int(*VALIDATEFUNC)(void *data, int size);"]
-	lines += ["static VALIDATEFUNC validate_funcs[] = {"]
-	lines += ['\tvalidate_invalid,']
-	lines += ['\tvalidate_%s,' % o.name for o in network.Objects]
-	lines += ["\t0x0", "};", ""]
-
-	lines += ["int netobj_validate(int type, void *data, int size)"]
-	lines += ["{"]
-	lines += ["\tif(type < 0 || type >= NUM_NETOBJTYPES) return -1;"]
-	lines += ["\treturn validate_funcs[type](data, size);"]
-	lines += ["};", ""]
-	
-	lines += ['const char *netobj_get_name(int type)']
+	lines += ['const char *CNetObjHandler::ms_apMsgNames[] = {']
+	lines += ['\t"invalid",']
+	for msg in network.Messages:
+		lines += ['\t"%s",' % msg.name]
+	lines += ['\t""']
+	lines += ['};']
+	lines += ['']
+	
+	lines += ['const char *CNetObjHandler::GetObjName(int Type)']
 	lines += ['{']
-	lines += ['\tif(type < 0 || type >= NUM_NETOBJTYPES) return "(out of range)";']
-	lines += ['\treturn netobj_names[type];']
+	lines += ['\tif(Type < 0 || Type >= NUM_NETOBJTYPES) return "(out of range)";']
+	lines += ['\treturn ms_apObjNames[Type];']
 	lines += ['};']
 	lines += ['']
 
-	lines += ['int netobj_get_size(int type)']
+	lines += ['int CNetObjHandler::GetObjSize(int Type)']
 	lines += ['{']
-	lines += ['\tif(type < 0 || type >= NUM_NETOBJTYPES) return 0;']
-	lines += ['\treturn netobj_sizes[type];']
+	lines += ['\tif(Type < 0 || Type >= NUM_NETOBJTYPES) return 0;']
+	lines += ['\treturn ms_aObjSizes[Type];']
 	lines += ['};']
 	lines += ['']
 	
-	for item in network.Messages:
-		for line in item.emit_unpack():
-			print line
-		print ""
-
-	lines += ['static void *secure_unpack_invalid() { return 0; }']
-	lines += ['typedef void *(*SECUREUNPACKFUNC)();']
-	lines += ['static SECUREUNPACKFUNC secure_unpack_funcs[] = {']
-	lines += ['\tsecure_unpack_invalid,']
-	for msg in network.Messages:
-		lines += ['\tsecure_unpack_%s,' % msg.name]
-	lines += ['\t0x0']
-	lines += ['};']
 	
-	#
-	lines += ['void *netmsg_secure_unpack(int type)']
+	lines += ['const char *CNetObjHandler::GetMsgName(int Type)']
 	lines += ['{']
-	lines += ['\tvoid *msg;']
-	lines += ['\tmsg_failed_on = "";']
-	lines += ['\tif(type < 0 || type >= NUM_NETMSGTYPES) { msg_failed_on = "(type out of range)"; return 0; }']
-	lines += ['\tmsg = secure_unpack_funcs[type]();']
-	lines += ['\tif(msg_unpack_error()) { msg_failed_on = "(unpack error)"; return 0; }']
-	lines += ['\treturn msg;']
+	lines += ['\tif(Type < 0 || Type >= NUM_NETMSGTYPES) return "(out of range)";']
+	lines += ['\treturn ms_apMsgNames[Type];']
 	lines += ['};']
 	lines += ['']
+		
+	
+	for l in lines:
+		print l
 
-	lines += ['static const char *message_names[] = {']
-	lines += ['\t"invalid",']
-	for msg in network.Messages:
-		lines += ['\t"%s",' % msg.name]
-	lines += ['\t""']
+	if 0:
+		for item in network.Objects:
+			for line in item.emit_validate():
+				print line
+			print ""
+
+	# create validate tables
+		lines = []
+		lines += ['static int validate_invalid(void *data, int size) { return -1; }']
+		lines += ["typedef int(*VALIDATEFUNC)(void *data, int size);"]
+		lines += ["static VALIDATEFUNC validate_funcs[] = {"]
+		lines += ['\tvalidate_invalid,']
+		lines += ['\tvalidate_%s,' % o.name for o in network.Objects]
+		lines += ["\t0x0", "};", ""]
+
+		lines += ["int netobj_validate(int type, void *data, int size)"]
+		lines += ["{"]
+		lines += ["\tif(type < 0 || type >= NUM_NETOBJTYPES) return -1;"]
+		lines += ["\treturn validate_funcs[type](data, size);"]
+		lines += ["};", ""]
+
+	lines = []
+	lines += ['int CNetObjHandler::ValidateObj(int Type, void *pData, int Size)']
+	lines += ['{']
+	lines += ['\tswitch(Type)']
+	lines += ['\t{']
+	
+	for item in network.Objects:
+		for line in item.emit_validate():
+			lines += ["\t" + line]
+		lines += ['\t']
+	lines += ['\t}']
+	lines += ['\treturn -1;']
 	lines += ['};']
 	lines += ['']
+		
+ #int Validate(int Type, void *pData, int Size);	
+	
+	if 0:
+		for item in network.Messages:
+			for line in item.emit_unpack():
+				print line
+			print ""
 
-	lines += ['const char *netmsg_get_name(int type)']
+		lines += ['static void *secure_unpack_invalid(CUnpacker *pUnpacker) { return 0; }']
+		lines += ['typedef void *(*SECUREUNPACKFUNC)(CUnpacker *pUnpacker);']
+		lines += ['static SECUREUNPACKFUNC secure_unpack_funcs[] = {']
+		lines += ['\tsecure_unpack_invalid,']
+		for msg in network.Messages:
+			lines += ['\tsecure_unpack_%s,' % msg.name]
+		lines += ['\t0x0']
+		lines += ['};']
+	
+	#
+	lines += ['void *CNetObjHandler::SecureUnpackMsg(int Type, CUnpacker *pUnpacker)']
 	lines += ['{']
-	lines += ['\tif(type < 0 || type >= NUM_NETMSGTYPES) return "(out of range)";']
-	lines += ['\treturn message_names[type];']
+	lines += ['\tm_pMsgFailedOn = 0;']
+	lines += ['\tswitch(Type)']
+	lines += ['\t{']
+	
+	
+	for item in network.Messages:
+		for line in item.emit_unpack():
+			lines += ["\t" + line]
+		lines += ['\t']
+		
+	lines += ['\tdefault:']
+	lines += ['\t\tm_pMsgFailedOn = "(type out of range)";']
+	lines += ['\t\tbreak;']
+	lines += ['\t}']
+	lines += ['\t']
+	lines += ['\tif(pUnpacker->Error())']
+	lines += ['\t\tm_pMsgFailedOn = "(unpack error)";']
+	lines += ['\t']
+	lines += ['\tif(m_pMsgFailedOn)']
+	lines += ['\t\treturn 0;']
+	lines += ['\tm_pMsgFailedOn = "";']
+	lines += ['\treturn m_aMsgData;']
 	lines += ['};']
 	lines += ['']
 
+
 	for l in lines:
 		print l
 	
diff --git a/datasrc/datatypes.py b/datasrc/datatypes.py
index a35d3d18..e4459e48 100644
--- a/datasrc/datatypes.py
+++ b/datasrc/datatypes.py
@@ -8,6 +8,27 @@ def GetID():
 def GetUID():
 	return "x%d"%GetID()
 
+def FixCasing(Str):
+	NewStr = ""
+	NextUpperCase = True
+	for c in Str:
+		if NextUpperCase:
+			NextUpperCase = False
+			NewStr += c.upper()
+		else:
+			if c == "_":
+				NextUpperCase = True
+			else:
+				NewStr += c.lower()
+	return NewStr
+	
+def FormatName(type, name):
+	if "*" in type:
+		return "m_p" + FixCasing(name)
+	if "[]" in type:
+		return "m_a" + FixCasing(name)
+	return "m_" + FixCasing(name)
+
 class BaseType:
 	def __init__(self, type_name):
 		self._type_name = type_name
@@ -20,7 +41,7 @@ class BaseType:
 	def ID(self): return self._id;
 	
 	def EmitDeclaration(self, name):
-		return ["%s %s;"%(self.TypeName(), name)]
+		return ["%s %s;"%(self.TypeName(), FormatName(self.TypeName(), name))]
 	def EmitPreDefinition(self, target_name):
 		self._target_name = target_name
 		return []
@@ -83,8 +104,8 @@ class Array(BaseType):
 			error("bah")
 		self.items += [instance]
 	def EmitDeclaration(self, name):
-		return ["int num_%s;"%(name),
-			"%s *%s;"%(self.TypeName(), name)]
+		return ["int m_Num%s;"%(FixCasing(name)),
+			"%s *%s;"%(self.TypeName(), FormatName("[]", name))]
 	def EmitPreDefinition(self, target_name):
 		BaseType.EmitPreDefinition(self, target_name)
 
@@ -179,12 +200,12 @@ class Flags:
 class NetObject:
 	def __init__(self, name, variables):
 		l = name.split(":")
-		self.name = l[0].lower()
+		self.name = l[0]
 		self.base = ""
 		if len(l) > 1:
 			self.base = l[1]
-		self.base_struct_name = "NETOBJ_%s" % self.base.upper()
-		self.struct_name = "NETOBJ_%s" % self.name.upper()
+		self.base_struct_name = "CNetObj_%s" % self.base
+		self.struct_name = "CNetObj_%s" % self.name
 		self.enum_name = "NETOBJTYPE_%s" % self.name.upper()
 		self.variables = variables
 	def emit_declaration(self):
@@ -197,10 +218,10 @@ class NetObject:
 		lines += ["};"]
 		return lines
 	def emit_validate(self):
-		lines = ["static int validate_%s(void *data, int size)" % self.name]
+		lines = ["case %s:" % self.enum_name]
 		lines += ["{"]
-		lines += ["\t%s *obj = (%s *)data;"%(self.struct_name, self.struct_name)]
-		lines += ["\tif(sizeof(*obj) != size) return -1;"]
+		lines += ["\t%s *pObj = (%s *)pData;"%(self.struct_name, self.struct_name)]
+		lines += ["\tif(sizeof(*pObj) != Size) return -1;"]
 		for v in self.variables:
 			lines += ["\t"+line for line in v.emit_validate()]
 		lines += ["\treturn 0;"]
@@ -218,29 +239,31 @@ class NetEvent(NetObject):
 class NetMessage(NetObject):
 	def __init__(self, name, variables):
 		NetObject.__init__(self, name, variables)
-		self.base_struct_name = "NETMSG_%s" % self.base.upper()
-		self.struct_name = "NETMSG_%s" % self.name.upper()
+		self.base_struct_name = "CNetMsg_%s" % self.base
+		self.struct_name = "CNetMsg_%s" % self.name
 		self.enum_name = "NETMSGTYPE_%s" % self.name.upper()
 	def emit_unpack(self):
 		lines = []
-		lines += ["static void *secure_unpack_%s()" % self.name]
+		lines += ["case %s:" % self.enum_name]
 		lines += ["{"]
-		lines += ["\tstatic %s msg;" % self.struct_name]
+		lines += ["\t%s *pMsg = (%s *)m_aMsgData;" % (self.struct_name, self.struct_name)]
+		lines += ["\t(void)pMsg;"]
 		for v in self.variables:
 			lines += ["\t"+line for line in v.emit_unpack()]
 		for v in self.variables:
 			lines += ["\t"+line for line in v.emit_unpack_check()]
-		lines += ["\treturn &msg;"]
-		lines += ["}"]
+		lines += ["} break;"]
 		return lines
 	def emit_declaration(self):
 		extra = []
-		extra += ["\tvoid pack(int flags)"]
+		extra += ["\tint MsgID() const { return %s; }" % self.enum_name]
+		extra += ["\t"]
+		extra += ["\tbool Pack(CMsgPacker *pPacker)"]
 		extra += ["\t{"]
-		extra += ["\t\tmsg_pack_start(%s, flags);"%self.enum_name]
+		#extra += ["\t\tmsg_pack_start(%s, flags);"%self.enum_name]
 		for v in self.variables:
 			extra += ["\t\t"+line for line in v.emit_pack()]
-		extra += ["\t\tmsg_pack_end();"]
+		extra += ["\t\treturn pPacker->Error() != 0;"]
 		extra += ["\t}"]
 		
 		
@@ -267,17 +290,17 @@ class NetString(NetVariable):
 	def emit_declaration(self):
 		return ["const char *%s;"%self.name]
 	def emit_unpack(self):
-		return ["msg.%s = msg_unpack_string();" % self.name]
+		return ["pMsg->%s = pUnpacker->GetString();" % self.name]
 	def emit_pack(self):
-		return ["msg_pack_string(%s, -1);" % self.name]
+		return ["pPacker->AddString(%s, -1);" % self.name]
 
 class NetIntAny(NetVariable):
 	def emit_declaration(self):
 		return ["int %s;"%self.name]
 	def emit_unpack(self):
-		return ["msg.%s = msg_unpack_int();" % self.name]
+		return ["pMsg->%s = pUnpacker->GetInt();" % self.name]
 	def emit_pack(self):
-		return ["msg_pack_int(%s);" % self.name]
+		return ["pPacker->AddInt(%s);" % self.name]
 
 class NetIntRange(NetIntAny):
 	def __init__(self, name, min, max):
@@ -285,9 +308,9 @@ class NetIntRange(NetIntAny):
 		self.min = str(min)
 		self.max = str(max)
 	def emit_validate(self):
-		return ["netobj_clamp_int(\"%s\", obj->%s, %s, %s);"%(self.name,self.name, self.min, self.max)]
+		return ["ClampInt(\"%s\", pObj->%s, %s, %s);"%(self.name,self.name, self.min, self.max)]
 	def emit_unpack_check(self):
-		return ["if(msg.%s < %s || msg.%s > %s) { msg_failed_on = \"%s\"; return 0; }" % (self.name, self.min, self.name, self.max, self.name)]
+		return ["if(pMsg->%s < %s || pMsg->%s > %s) { m_pMsgFailedOn = \"%s\"; break; }" % (self.name, self.min, self.name, self.max, self.name)]
 
 class NetBool(NetIntRange):
 	def __init__(self, name):
diff --git a/datasrc/network.py b/datasrc/network.py
index 12ae34d3..e31c0b3d 100644
--- a/datasrc/network.py
+++ b/datasrc/network.py
@@ -9,6 +9,9 @@ Emoticons = [str(x) for x in xrange(1,16)]
 Powerups = ["HEALTH", "ARMOR", "WEAPON", "NINJA"]
 
 RawHeader = '''
+
+#include <engine/message.h>
+
 enum
 {
 	INPUT_STATE_MASK=0x3f,
@@ -16,8 +19,8 @@ enum
 '''
 
 RawSource = '''
-#include <engine/e_common_interface.h>
-#include "g_protocol.hpp"
+#include <engine/message.h>
+#include "protocol.h"
 '''
 
 Enums = [
@@ -33,138 +36,138 @@ Flags = [
 
 Objects = [
 
-	NetObject("Player_Input", [
-		NetIntAny("direction"),
-		NetIntAny("target_x"),
-		NetIntAny("target_y"),
+	NetObject("PlayerInput", [
+		NetIntAny("m_Direction"),
+		NetIntAny("m_TargetX"),
+		NetIntAny("m_TargetY"),
 		
-		NetIntAny("jump"),
-		NetIntAny("fire"),
-		NetIntAny("hook"),
+		NetIntAny("m_Jump"),
+		NetIntAny("m_Fire"),
+		NetIntAny("m_Hook"),
 		
-		NetIntRange("player_state", 0, len(PlayerStates)),
+		NetIntRange("m_PlayerState", 0, len(PlayerStates)),
 		
-		NetIntAny("wanted_weapon"),
-		NetIntAny("next_weapon"),
-		NetIntAny("prev_weapon"),
+		NetIntAny("m_WantedWeapon"),
+		NetIntAny("m_NextWeapon"),
+		NetIntAny("m_PrevWeapon"),
 	]),
 	
 	NetObject("Projectile", [
-		NetIntAny("x"),
-		NetIntAny("y"),
-		NetIntAny("vx"),
-		NetIntAny("vy"),
+		NetIntAny("m_X"),
+		NetIntAny("m_Y"),
+		NetIntAny("m_VelX"),
+		NetIntAny("m_VelY"),
 		
-		NetIntRange("type", 0, 'NUM_WEAPONS-1'),
-		NetTick("start_tick"),
+		NetIntRange("m_Type", 0, 'NUM_WEAPONS-1'),
+		NetTick("m_StartTick"),
 	]),
 
 	NetObject("Laser", [
-		NetIntAny("x"),
-		NetIntAny("y"),
-		NetIntAny("from_x"),
-		NetIntAny("from_y"),
+		NetIntAny("m_X"),
+		NetIntAny("m_Y"),
+		NetIntAny("m_FromX"),
+		NetIntAny("m_FromY"),
 		
-		NetTick("start_tick"),
+		NetTick("m_StartTick"),
 	]),
 
 	NetObject("Pickup", [
-		NetIntAny("x"),
-		NetIntAny("y"),
+		NetIntAny("m_X"),
+		NetIntAny("m_Y"),
 		
-		NetIntRange("type", 0, 'max_int'),
-		NetIntRange("subtype", 0, 'max_int'),
+		NetIntRange("m_Type", 0, 'max_int'),
+		NetIntRange("m_Subtype", 0, 'max_int'),
 	]),
 
 	NetObject("Flag", [
-		NetIntAny("x"),
-		NetIntAny("y"),
+		NetIntAny("m_X"),
+		NetIntAny("m_Y"),
 		
-		NetIntRange("team", 0, 1),
-		NetIntRange("carried_by", -2, 'MAX_CLIENTS-1')
+		NetIntRange("m_Team", 0, 1),
+		NetIntRange("m_CarriedBy", -2, 'MAX_CLIENTS-1')
 	]),
 
 	NetObject("Game", [
-		NetIntRange("flags", 0, 256),
-		NetTick("round_start_tick"),
+		NetIntRange("m_Flags", 0, 256),
+		NetTick("m_RoundStartTick"),
 		
-		NetIntRange("game_over", 0, 1),
-		NetIntRange("sudden_death", 0, 1),
-		NetIntRange("paused", 0, 1),
+		NetIntRange("m_GameOver", 0, 1),
+		NetIntRange("m_SuddenDeath", 0, 1),
+		NetIntRange("m_Paused", 0, 1),
 		
-		NetIntRange("score_limit", 0, 'max_int'),
-		NetIntRange("time_limit", 0, 'max_int'),
+		NetIntRange("m_ScoreLimit", 0, 'max_int'),
+		NetIntRange("m_TimeLimit", 0, 'max_int'),
 		
-		NetIntRange("warmup", 0, 'max_int'),
+		NetIntRange("m_Warmup", 0, 'max_int'),
 		
-		NetIntRange("round_num", 0, 'max_int'),
-		NetIntRange("round_current", 0, 'max_int'),
+		NetIntRange("m_RoundNum", 0, 'max_int'),
+		NetIntRange("m_RoundCurrent", 0, 'max_int'),
 
-		NetIntAny("teamscore_red"),
-		NetIntAny("teamscore_blue"),
+		NetIntAny("m_TeamscoreRed"),
+		NetIntAny("m_TeamscoreBlue"),
 	]),
 
-	NetObject("Character_Core", [
-		NetIntAny("tick"),
-		NetIntAny("x"),
-		NetIntAny("y"),
-		NetIntAny("vx"),
-		NetIntAny("vy"),
+	NetObject("CharacterCore", [
+		NetIntAny("m_Tick"),
+		NetIntAny("m_X"),
+		NetIntAny("m_Y"),
+		NetIntAny("m_VelX"),
+		NetIntAny("m_VelY"),
 
-		NetIntAny("angle"),
-		NetIntRange("direction", -1, 1),
+		NetIntAny("m_Angle"),
+		NetIntRange("m_Direction", -1, 1),
 		
-		NetIntRange("jumped", 0, 3),
-		NetIntRange("hooked_player", 0, 'MAX_CLIENTS-1'),
-		NetIntRange("hook_state", -1, 5),
-		NetTick("hook_tick"),
-
-		NetIntAny("hook_x"),
-		NetIntAny("hook_y"),
-		NetIntAny("hook_dx"),
-		NetIntAny("hook_dy"),
-	]),
-
-	NetObject("Character:Character_Core", [
-		NetIntRange("player_state", 0, 'NUM_PLAYERSTATES-1'),
-		NetIntRange("health", 0, 10),
-		NetIntRange("armor", 0, 10),
-		NetIntRange("ammocount", 0, 10),
-		NetIntRange("weapon", 0, 'NUM_WEAPONS-1'),
-		NetIntRange("emote", 0, len(Emotes)),
-		NetIntRange("attacktick", 0, 'max_int'),
+		NetIntRange("m_Jumped", 0, 3),
+		NetIntRange("m_HookedPlayer", 0, 'MAX_CLIENTS-1'),
+		NetIntRange("m_HookState", -1, 5),
+		NetTick("m_HookTick"),
+
+		NetIntAny("m_HookX"),
+		NetIntAny("m_HookY"),
+		NetIntAny("m_HookDx"),
+		NetIntAny("m_HookDy"),
+	]),
+
+	NetObject("Character:CharacterCore", [
+		NetIntRange("m_PlayerState", 0, 'NUM_PLAYERSTATES-1'),
+		NetIntRange("m_Health", 0, 10),
+		NetIntRange("m_Armor", 0, 10),
+		NetIntRange("m_AmmoCount", 0, 10),
+		NetIntRange("m_Weapon", 0, 'NUM_WEAPONS-1'),
+		NetIntRange("m_Emote", 0, len(Emotes)),
+		NetIntRange("m_AttackTick", 0, 'max_int'),
 	]),
 	
-	NetObject("Player_Info", [
-		NetIntRange("local", 0, 1),
-		NetIntRange("cid", 0, 'MAX_CLIENTS-1'),
-		NetIntRange("team", -1, 1),
+	NetObject("PlayerInfo", [
+		NetIntRange("m_Local", 0, 1),
+		NetIntRange("m_ClientId", 0, 'MAX_CLIENTS-1'),
+		NetIntRange("m_Team", -1, 1),
 
-		NetIntAny("score"),
-		NetIntAny("latency"),
-		NetIntAny("latency_flux"),
+		NetIntAny("m_Score"),
+		NetIntAny("m_Latency"),
+		NetIntAny("m_LatencyFlux"),
 	]),
 
-	NetObject("Client_Info", [
+	NetObject("ClientInfo", [
 		# 4*6 = 24 charachters
-		NetIntAny("name0"), NetIntAny("name1"), NetIntAny("name2"),
-		NetIntAny("name3"), NetIntAny("name4"), NetIntAny("name5"),
+		NetIntAny("m_Name0"), NetIntAny("m_Name1"), NetIntAny("m_Name2"),
+		NetIntAny("m_Name3"), NetIntAny("m_Name4"), NetIntAny("m_Name5"),
 
 		# 4*6 = 24 charachters
-		NetIntAny("skin0"), NetIntAny("skin1"), NetIntAny("skin2"),
-		NetIntAny("skin3"), NetIntAny("skin4"), NetIntAny("skin5"),
+		NetIntAny("m_Skin0"), NetIntAny("m_Skin1"), NetIntAny("m_Skin2"),
+		NetIntAny("m_Skin3"), NetIntAny("m_Skin4"), NetIntAny("m_Skin5"),
 
-		NetIntRange("use_custom_color", 0, 1),
+		NetIntRange("m_UseCustomColor", 0, 1),
 		
-		NetIntAny("color_body"),
-		NetIntAny("color_feet"),
+		NetIntAny("m_ColorBody"),
+		NetIntAny("m_ColorFeet"),
 	]),
 	
 	## Events
 	
 	NetEvent("Common", [
-		NetIntAny("x"),
-		NetIntAny("y"),
+		NetIntAny("m_X"),
+		NetIntAny("m_Y"),
 	]),
 	
 
@@ -173,121 +176,121 @@ Objects = [
 	NetEvent("HammerHit:Common", []),
 	
 	NetEvent("Death:Common", [
-		NetIntRange("cid", 0, 'MAX_CLIENTS-1'),
+		NetIntRange("m_ClientId", 0, 'MAX_CLIENTS-1'),
 	]),
 	
 	NetEvent("SoundGlobal:Common", [
-		NetIntRange("soundid", 0, 'NUM_SOUNDS-1'),
+		NetIntRange("m_SoundId", 0, 'NUM_SOUNDS-1'),
 	]),
 
 	NetEvent("SoundWorld:Common", [
-		NetIntRange("soundid", 0, 'NUM_SOUNDS-1'),
+		NetIntRange("m_SoundId", 0, 'NUM_SOUNDS-1'),
 	]),
 
 	NetEvent("DamageInd:Common", [
-		NetIntAny("angle"),
+		NetIntAny("m_Angle"),
 	]),
 ]
 
 Messages = [
 
 	### Server messages
-	NetMessage("sv_motd", [
-		NetString("message"),
+	NetMessage("Sv_Motd", [
+		NetString("m_pMessage"),
 	]),
 
-	NetMessage("sv_broadcast", [
-		NetString("message"),
+	NetMessage("Sv_Broadcast", [
+		NetString("m_pMessage"),
 	]),
 
-	NetMessage("sv_chat", [
-		NetIntRange("team", -1, 1),
-		NetIntRange("cid", -1, 'MAX_CLIENTS-1'),
-		NetString("message"),
+	NetMessage("Sv_Chat", [
+		NetIntRange("m_Team", -1, 1),
+		NetIntRange("m_Cid", -1, 'MAX_CLIENTS-1'),
+		NetString("m_pMessage"),
 	]),
 	
-	NetMessage("sv_killmsg", [
-		NetIntRange("killer", 0, 'MAX_CLIENTS-1'),
-		NetIntRange("victim", 0, 'MAX_CLIENTS-1'),
-		NetIntRange("weapon", -3, 'NUM_WEAPONS-1'),
-		NetIntAny("mode_special"),
+	NetMessage("Sv_KillMsg", [
+		NetIntRange("m_Killer", 0, 'MAX_CLIENTS-1'),
+		NetIntRange("m_Victim", 0, 'MAX_CLIENTS-1'),
+		NetIntRange("m_Weapon", -3, 'NUM_WEAPONS-1'),
+		NetIntAny("m_ModeSpecial"),
 	]),
 
-	NetMessage("sv_soundglobal", [
-		NetIntRange("soundid", 0, 'NUM_SOUNDS-1'),
+	NetMessage("Sv_SoundGlobal", [
+		NetIntRange("m_Soundid", 0, 'NUM_SOUNDS-1'),
 	]),
 	
-	NetMessage("sv_tuneparams", []),
-	NetMessage("sv_extraprojectile", []),
-	NetMessage("sv_readytoenter", []),
+	NetMessage("Sv_TuneParams", []),
+	NetMessage("Sv_ExtraProjectile", []),
+	NetMessage("Sv_ReadyToEnter", []),
 
-	NetMessage("sv_weaponpickup", [
-		NetIntRange("weapon", 0, 'NUM_WEAPONS-1'),
+	NetMessage("Sv_WeaponPickup", [
+		NetIntRange("m_Weapon", 0, 'NUM_WEAPONS-1'),
 	]),
 
-	NetMessage("sv_emoticon", [
-		NetIntRange("cid", 0, 'MAX_CLIENTS-1'),
-		NetIntRange("emoticon", 0, 'NUM_EMOTICONS-1'),
+	NetMessage("Sv_Emoticon", [
+		NetIntRange("m_Cid", 0, 'MAX_CLIENTS-1'),
+		NetIntRange("m_Emoticon", 0, 'NUM_EMOTICONS-1'),
 	]),
 
-	NetMessage("sv_vote_clearoptions", [
+	NetMessage("Sv_VoteClearOptions", [
 	]),
 	
-	NetMessage("sv_vote_option", [
-		NetString("command"),
+	NetMessage("Sv_VoteOption", [
+		NetString("m_pCommand"),
 	]),
 
-	NetMessage("sv_vote_set", [
-		NetIntRange("timeout", 0, 60),
-		NetString("description"),
-		NetString("command"),
+	NetMessage("Sv_VoteSet", [
+		NetIntRange("m_Timeout", 0, 60),
+		NetString("m_pDescription"),
+		NetString("m_pCommand"),
 	]),
 
-	NetMessage("sv_vote_status", [
-		NetIntRange("yes", 0, 'MAX_CLIENTS'),
-		NetIntRange("no", 0, 'MAX_CLIENTS'),
-		NetIntRange("pass", 0, 'MAX_CLIENTS'),
-		NetIntRange("total", 0, 'MAX_CLIENTS'),
+	NetMessage("Sv_VoteStatus", [
+		NetIntRange("m_Yes", 0, 'MAX_CLIENTS'),
+		NetIntRange("m_No", 0, 'MAX_CLIENTS'),
+		NetIntRange("m_Pass", 0, 'MAX_CLIENTS'),
+		NetIntRange("m_Total", 0, 'MAX_CLIENTS'),
 	]),
 		
 	### Client messages
-	NetMessage("cl_say", [
-		NetBool("team"),
-		NetString("message"),
+	NetMessage("Cl_Say", [
+		NetBool("m_Team"),
+		NetString("m_pMessage"),
 	]),
 
-	NetMessage("cl_setteam", [
-		NetIntRange("team", -1, 1),
+	NetMessage("Cl_SetTeam", [
+		NetIntRange("m_Team", -1, 1),
 	]),
 	
-	NetMessage("cl_startinfo", [
-		NetString("name"),
-		NetString("skin"),
-		NetBool("use_custom_color"),
-		NetIntAny("color_body"),
-		NetIntAny("color_feet"),
+	NetMessage("Cl_StartInfo", [
+		NetString("m_pName"),
+		NetString("m_pSkin"),
+		NetBool("m_UseCustomColor"),
+		NetIntAny("m_ColorBody"),
+		NetIntAny("m_ColorFeet"),
 	]),	
 
-	NetMessage("cl_changeinfo", [
-		NetString("name"),
-		NetString("skin"),
-		NetBool("use_custom_color"),
-		NetIntAny("color_body"),
-		NetIntAny("color_feet"),
+	NetMessage("Cl_ChangeInfo", [
+		NetString("m_pName"),
+		NetString("m_pSkin"),
+		NetBool("m_UseCustomColor"),
+		NetIntAny("m_ColorBody"),
+		NetIntAny("m_ColorFeet"),
 	]),
 
-	NetMessage("cl_kill", []),
+	NetMessage("Cl_Kill", []),
 
-	NetMessage("cl_emoticon", [
-		NetIntRange("emoticon", 0, 'NUM_EMOTICONS-1'),
+	NetMessage("Cl_Emoticon", [
+		NetIntRange("m_Emoticon", 0, 'NUM_EMOTICONS-1'),
 	]),
 
-	NetMessage("cl_vote", [
-		NetIntRange("vote", -1, 1),
+	NetMessage("Cl_Vote", [
+		NetIntRange("m_Vote", -1, 1),
 	]),
 	
-	NetMessage("cl_callvote", [
-		NetString("type"),
-		NetString("value"),
+	NetMessage("Cl_CallVote", [
+		NetString("m_Type"),
+		NetString("m_Value"),
 	]),
 ]