about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--datasrc/client.dts83
-rw-r--r--datasrc/compile.py287
-rw-r--r--datasrc/content.py808
-rw-r--r--datasrc/data.ds699
-rw-r--r--datasrc/datatypes.py205
-rw-r--r--datasrc/network.dts2
-rw-r--r--datasrc/network.py61
-rw-r--r--datasrc/server.dts25
-rw-r--r--datasrc/teewars.dsd24
-rw-r--r--default.bam196
-rw-r--r--scripts/tw_api.py12
-rw-r--r--src/engine/client/ec_client.c2
-rw-r--r--src/engine/e_network.c37
-rw-r--r--src/engine/server/es_server.c3
-rw-r--r--src/game/client/gc_anim.h20
-rw-r--r--src/game/client/gc_client.cpp60
-rw-r--r--src/game/client/gc_client.h42
-rw-r--r--src/game/client/gc_effects.cpp18
-rw-r--r--src/game/client/gc_hooks.cpp36
-rw-r--r--src/game/client/gc_menu.cpp14
-rw-r--r--src/game/client/gc_particles.cpp4
-rw-r--r--src/game/client/gc_render.cpp10
-rw-r--r--src/game/client/gc_render.h12
-rw-r--r--src/game/client/gc_render_obj.cpp78
-rw-r--r--src/game/editor/ed_editor.cpp12
-rw-r--r--src/game/editor/ed_editor.hpp8
-rw-r--r--src/game/editor/ed_io.cpp8
-rw-r--r--src/game/g_game.cpp28
-rw-r--r--src/game/g_game.h18
-rw-r--r--src/game/server/gs_common.h90
-rw-r--r--src/game/server/gs_game.cpp44
-rw-r--r--src/game/server/gs_game_ctf.cpp36
-rw-r--r--src/game/server/gs_game_ctf.h16
-rw-r--r--src/game/server/gs_game_dm.cpp4
-rw-r--r--src/game/server/gs_game_dm.h2
-rw-r--r--src/game/server/gs_game_tdm.cpp10
-rw-r--r--src/game/server/gs_game_tdm.h6
-rw-r--r--src/game/server/gs_server.cpp358
38 files changed, 1412 insertions, 1966 deletions
diff --git a/datasrc/client.dts b/datasrc/client.dts
deleted file mode 100644
index 93786646..00000000
--- a/datasrc/client.dts
+++ /dev/null
@@ -1,83 +0,0 @@
-struct image {
-	int id = 0
-	string filename = filename@1
-}
-
-struct spriteset {
-	ptr:image img = @1
-	int gridx = @2
-	int gridy = @3
-}
-
-struct sprite {
-	ptr:spriteset set = parent
-	int x = @1
-	int y = @2
-	int w = @3
-	int h = @4
-}
-
-struct sound {
-	int id = 0
-	string filename = @0
-}
-
-struct soundset {
-	int last = 0
-	array:sound sounds = *
-}
-
-struct spriteptr {
-	ptr:sprite psprite = @0
-}
-
-struct weapon {
-	ptr:sprite sprite_body = sprite_body@1
-	ptr:sprite sprite_cursor = sprite_cursor@1
-	ptr:sprite sprite_proj = sprite_proj@1
-	array:spriteptr sprite_muzzle = sprite_muzzles.*
-	
-	int nummuzzlesprites = nummuzzlesprites@1
-	int recoil = recoil@1
-	int visual_size = visual_size@1
-	int muzzleduration = muzzleduration@1
-	float offsetx = offsetx@1
-	float offsety = offsety@1
-	float muzzleoffsetx = muzzleoffsetx@1
-	float muzzleoffsety = muzzleoffsety@1
-}
-
-struct keyframe {
-	float time =  @0
-	float x = @1
-	float y = @2
-	float angle = @3
-}
-
-struct sequence {
-	array:keyframe frames = *
-}
-
-struct animation {
-	instance:sequence body = body
-	instance:sequence back_foot = back_foot
-	instance:sequence front_foot = front_foot
-	instance:sequence attach = attach
-}
-
-struct data_container {
-	array:image images = images.*
-	array:spriteset spritesets = sprites.*
-	array:sprite sprites = sprites.*.*
-	array:weapon weapons = weapons.*
-
-	array:soundset sounds = sounds.*
-	array:animation animations = animations.*
-}
-
-const array:int weapon = weapons.*
-const array:int sound = sounds.*
-const array:int image = images.*
-const array:int sprite = sprites.*.*
-const array:int anim = animations.*
-const array:int powerup = powerups.*
diff --git a/datasrc/compile.py b/datasrc/compile.py
index 5df84c23..38457e91 100644
--- a/datasrc/compile.py
+++ b/datasrc/compile.py
@@ -1,9 +1,8 @@
 import os, imp, sys
-import datatypes
+from datatypes import *
 import content
 import network
 
-	
 def create_enum_table(names, num):
 	lines = []
 	lines += ["enum", "{"]
@@ -13,180 +12,114 @@ def create_enum_table(names, num):
 	lines += ["\t%s" % num, "};"]
 	return lines
 	
-gen_content_header = False
-gen_content_source = True
-
-
-# collect sprites
-sprites = []
-for set in content.Sprites:
-	sprites += set.sprites
-
-
-if gen_content_header:
-	
-	print """
-struct SOUND
-{
-	int id;
-	const char *filename;
-};
-
-struct SOUNDSET
-{
-	int num_sounds;
-	SOUND *sound;
-};
-
-struct IMAGE
-{
-	int id;
-	const char *filename;
-};
-
-struct SPRITESET
-{
-	IMAGE *image;
-	int gridx;
-	int gridy;
-};
-
-struct SPRITE
-{
-	SPRITESET *set;
-	int x, y, w, h;
-};
-
-"""
-
-	def generate_struct(this, name, parent_name):
-		print "struct %s" % name
-
-		print "{"
-		if parent_name:
-			print "\t%s base;" % parent_name
-		for var in this.fields[this.baselen:]:
-			for l in var.emit_declaration(): print "\t"+l
-		print "};"
-
-	generate_struct(content.WeaponBase, "WEAPONSPEC", None)
-	for weapon in content.Weapons:
-		generate_struct(weapon, "WEAPONSPEC_%s"%weapon.name.upper(), "WEAPONSPEC")
-
-	# generate enums
-	for l in create_enum_table(["SOUND_"+o.name.upper() for o in content.Sounds], "NUM_SOUNDS"): print l
-	for l in create_enum_table(["IMAGE_"+o.name.upper() for o in content.Images], "NUM_IMAGES"): print l
-	for l in create_enum_table(["SPRITE_"+o.name.upper() for o in sprites], "NUM_SPRITES"): print l
-
-	for l in create_enum_table(["WEAPONTYPE_"+o.name.upper() for o in content.Weapons], "NUM_WEAPONTYPES"): print l
-
-if gen_content_source:
-	# generate data
-	for s in content.Sounds:
-		print "static SOUND sounds_%s[%d] = {" % (s.name, len(s.files))
-		for filename in s.files:
-			print '\t{%d, "%s"},' % (-1, filename)
-		print "};"
-		
-	print "static SOUNDSET soundsets[%d] = {" % len(content.Sounds)
-	for s in content.Sounds:
-		print "\t{%d, sounds_%s}," % (len(s.files), s.name)
-		#for filename in s.files:
-		#	print "\t{%d, '%s'}," % (-1, filename)
-	print "};"
-
-	print "static IMAGE images[%d] = {" % len(content.Images)
-	for i in content.Images:
-		print '\t{%d, "%s"},' % (-1, i.filename)
-	print "};"
-
-	print "static SPRITESET spritesets[%d] = {" % len(content.Sprites)
-	for set in content.Sprites:
-		if set.image:
-			print '\t{&images[IMAGE_%s], %d, %d},' % (set.image.upper(), set.grid[0], set.grid[1])
-		else:
-			print '\t{0, %d, %d},' % (set.grid[0], set.grid[1])
-	print "};"
-
-	print "static SPRITE sprites[%d] = {" % len(sprites)
-	spritesetid = 0
-	for set in content.Sprites:
-		for sprite in set.sprites:
-			print '\t{&spritesets[%d], %d, %d, %d, %d},' % (spritesetid, sprite.pos[0], sprite.pos[1], sprite.pos[2], sprite.pos[3])
-		spritesetid += 1
-	print "};"
-
-	for weapon in content.Weapons:
-		print "static WEAPONSPEC_%s weapon_%s = {" % (weapon.name.upper(), weapon.name)
-		for var in weapon.fields:
-			for l in var.emit_definition(): print "\t"+l,
-			print ","
-		print "};"
-
-	print "struct WEAPONS"
+def EmitEnum(names, num):
+	print "enum"
 	print "{"
-	print "\tWEAPONSPEC *id[%d];" % len(content.Weapons)
-	for w in content.Weapons:
-		print "\tWEAPONSPEC_%s &weapon_%s;" % (w.name.upper(), w.name)
-	print ""
-	print "};"
-
-	print "static WEAPONS weapons = {{%s}," % (",".join(["&weapon_%s.base"%w.name for w in content.Weapons]))
-	for w in content.Weapons:
-		print "\tweapon_%s," % w.name
+	print "\t%s=0,"%names[0]
+	for name in names[1:]:
+		print "\t%s,"%name
+	print "\t%s" % num
 	print "};"
+		
 
-
-	
-	print """
-struct DATACONTAINER
-{
-	int num_sounds;
-	SOUNDSET *sounds;
-
-	int num_images;
-	IMAGE *images;
+gen_network_header = False
+gen_network_source = False
+gen_client_content_header = False
+gen_client_content_source = False
+gen_server_content_header = False
+gen_server_content_source = False
+
+if "network_header" in sys.argv: gen_network_header = True
+if "network_source" in sys.argv: gen_network_source = True
+if "client_content_header" in sys.argv: gen_client_content_header = True
+if "client_content_source" in sys.argv: gen_client_content_source = True
+if "server_content_header" in sys.argv: gen_server_content_header = True
+if "server_content_source" in sys.argv: gen_server_content_source = True
+
+if gen_client_content_header or gen_server_content_header:
+	# emit the type declarations
+	contentlines = file("datasrc/content.py").readlines()
+	order = []
+	for line in contentlines:
+		line = line.strip()
+		if line[:6] == "class " and '(Struct)' in line:
+			order += [line.split()[1].split("(")[0]]
+	for name in order:
+		EmitTypeDeclaration(content.__dict__[name])
+		
+	# the container pointer
+	print 'extern DATACONTAINER *data;';
 	
-	int num_sprites;
-	SPRITE *sprites;
+	# enums
+	EmitEnum(["IMAGE_%s"%i.name.value.upper() for i in content.container.images.items], "NUM_IMAGES")
+	EmitEnum(["ANIM_%s"%i.name.value.upper() for i in content.container.animations.items], "NUM_ANIMS")
+	EmitEnum(["SPRITE_%s"%i.name.value.upper() for i in content.container.sprites.items], "NUM_SPRITES")
+
+if gen_client_content_source or gen_server_content_source:
+	if gen_client_content_source:
+		print '#include "gc_data.h"'
+	if gen_server_content_source:
+		print '#include "gs_data.h"'
+	EmitDefinition(content.container, "datacontainer")
+	print 'DATACONTAINER *data = &datacontainer;';
 
-	WEAPONS &weapons;
-};"""
-
-	print "DATACONTAINER data = {"
-	print "\t%d, soundsets," % len(content.Sounds)
-	print "\t%d, images," % len(content.Images)
-	print "\t%d, sprites," % len(content.Sprites)
-	print "\tweapons,"
-	print "};"
+# NETWORK
+if gen_network_header:
 	
+	print network.RawHeader
 	
-# NETWORK
-if 0:
-
-
 	for e in network.Enums:
 		for l in create_enum_table(["%s_%s"%(e.name, v) for v in e.values], "NUM_%sS"%e.name): print l
 		print ""
 		
-	for l in create_enum_table([o.enum_name for o in network.Objects], "NUM_NETOBJTYPES"): print l
+	for l in create_enum_table(["NETOBJ_INVALID"]+[o.enum_name for o in network.Objects], "NUM_NETOBJTYPES"): print l
 	print ""
-	for l in create_enum_table([o.enum_name for o in network.Messages], "NUM_NETMSGTYPES"): print l
+	for l in create_enum_table(["NETMSG_INVALID"]+[o.enum_name for o in network.Messages], "NUM_NETMSGTYPES"): print l
 	print ""
 		
 	for item in network.Objects + network.Messages:
 		for line in item.emit_declaration():
 			print line
 		print ""
+		
+	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 "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();"
+	
 
-
-if 0:		
+if gen_network_source:
 	# create names
 	lines = []
+	
+	lines += ['#include <engine/e_common_interface.h>']
+	lines += ['#include "g_protocol.h"']
+
+	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 int netobj_clamp_int(const char *error_msg, int v, 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 += ['}']
+
 	lines += ["static const char *netobj_names[] = {"]
 	lines += ['\t"%s",' % o.name for o in network.Objects]
 	lines += ['\t""', "};", ""]
-	
+
 	for l in lines:
 		print l
 
@@ -197,8 +130,10 @@ if 0:
 
 	# 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", "};", ""]
 
@@ -208,6 +143,54 @@ if 0:
 	lines += ["\treturn validate_funcs[type](data, size);"]
 	lines += ["};", ""]
 	
+	lines += ['const char *netobj_get_name(int type)']
+	lines += ['{']
+	lines += ['\tif(type < 0 || type >= NUM_NETOBJTYPES) return "(out of range)";']
+	lines += ['\treturn netobj_names[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 += ['{']
+	lines += ['\tvoid *msg;']
+	lines += ['\tmsg_failed_on = "";']
+	lines += ['\tif(type < 0 || type >= NUM_NETMSGTYPES) return 0;']
+	lines += ['\tmsg = secure_unpack_funcs[type]();']
+	lines += ['\tif(msg_unpack_error()) return 0;']
+	lines += ['\treturn msg;']
+	lines += ['};']
+	lines += ['']
+
+	lines += ['static const char *message_names[] = {']
+	lines += ['\t"invalid",']
+	for msg in network.Messages:
+		lines += ['\t"%s",' % msg.name]
+	lines += ['\t""']
+	lines += ['};']
+	lines += ['']
+
+	lines += ['const char *netmsg_get_name(int type)']
+	lines += ['{']
+	lines += ['\tif(type < 0 || type >= NUM_NETMSGTYPES) return "(out of range)";']
+	lines += ['\treturn message_names[type];']
+	lines += ['};']
+	lines += ['']
+
 	for l in lines:
 		print l
 	
diff --git a/datasrc/content.py b/datasrc/content.py
index 6eb671a6..3a2bfe35 100644
--- a/datasrc/content.py
+++ b/datasrc/content.py
@@ -1,350 +1,476 @@
 import copy
-
-class SoundSet:
-	def __init__(self, name, files):
-		self.name = name
-		self.files = files
-
-class Image:
-	def __init__(self, name, filename):
-		self.name = name
-		self.filename = filename
-		
-class Pickup:
-	def __init__(self, name, respawntime=15, spawndelay=0):
-		self.name = name
-		self.respawntime = respawntime
-		self.spawndelay = spawndelay
-
-class Variable:
-	def __init__(self, name, value):
-		self.name = name
-		self.value = value
-
-class Int(Variable):
-	def emit_declaration(self):
-		return ["int %s;"%self.name]
-	def emit_definition(self):
-		return ["%d"%self.value]
-		
-class Float(Variable):
-	def emit_declaration(self):
-		return ["float %s;"%self.name]
-	def emit_definition(self):
-		return ["%ff"%self.value]
+from datatypes import *
+
+class Sound(Struct):
+	def __init__(self, filename=""):
+		Struct.__init__(self, "SOUND")
+		self.id = Int(0)
+		self.filename = String(filename)
+
+class SoundSet(Struct):
+	def __init__(self, name="", files=[]):
+		Struct.__init__(self, "SOUNDSET")
+		self.name = String(name)
+		self.sounds = Array(Sound())
+		self.last = Int(-1)
+		for name in files:
+			self.sounds.Add(Sound(name))
+
+class Image(Struct):
+	def __init__(self, name="", filename=""):
+		Struct.__init__(self, "IMAGE")
+		self.name = String(name)
+		self.filename = String(filename)
+		self.id = Int(-1)
 	
-class String(Variable):
-	def emit_declaration(self):
-		return ["const char *%s;"%self.name]
-	def emit_definition(self):
-		return ['"%s"'%self.value]
-		
-class SpriteRef(Variable):
-	def emit_declaration(self):
-		return ["SPRITE *%s;"%self.name]
-	def emit_definition(self):
-		return ['&sprites[SPRITE_%s]'%self.value.upper()]
-
-class SpriteSet:
-	def __init__(self, image, grid, sprites):
-		self.image = image
-		self.grid = grid
-		self.sprites = sprites
+class SpriteSet(Struct):
+	def __init__(self, name="", image=None, gridx=0, gridy=0):
+		Struct.__init__(self, "SPRITESET")
+		self.image = Pointer(Image, image) # TODO
+		self.gridx = Int(gridx)
+		self.gridy = Int(gridy)
+
+class Sprite(Struct):
+	def __init__(self, name="", Set=None, x=0, y=0, w=0, h=0):
+		Struct.__init__(self, "SPRITE")
+		self.name = String(name)
+		self.set = Pointer(SpriteSet, Set) # TODO
+		self.x = Int(x)
+		self.y = Int(y)
+		self.w = Int(w)
+		self.h = Int(h)
+
+class Pickup(Struct):
+	def __init__(self, name="", respawntime=20, spawndelay=0):
+		Struct.__init__(self, "PICKUPSPEC")
+		self.name = String(name)
+		self.respawntime = Int(respawntime)
+		self.spawndelay = Int(spawndelay)
+
+class AnimKeyframe(Struct):
+	def __init__(self, time=0, x=0, y=0, angle=0):
+		Struct.__init__(self, "ANIM_KEYFRAME")
+		self.time = Float(time)
+		self.x = Float(x)
+		self.y = Float(y)
+		self.angle = Float(angle)
+
+class AnimSequence(Struct):
+	def __init__(self):
+		Struct.__init__(self, "ANIM_SEQUENCE")
+		self.frames = Array(AnimKeyframe())
+
+class Animation(Struct):
+	def __init__(self, name=""):
+		Struct.__init__(self, "ANIMATION")
+		self.name = String(name)
+		self.body = AnimSequence()
+		self.back_foot = AnimSequence()
+		self.front_foot = AnimSequence()
+		self.attach = AnimSequence()
+
+class WeaponSpec(Struct):
+	def __init__(self, container=None, name=""):
+		Struct.__init__(self, "WEAPONSPEC")
+		self.name = String(name)
+		self.sprite_body = Pointer(Sprite, Sprite())
+		self.sprite_cursor = Pointer(Sprite, Sprite())
+		self.sprite_proj = Pointer(Sprite, Sprite())
+		self.sprite_muzzles = Array(Pointer(Sprite, Sprite()))
+		self.visual_size = Int(96)
 		
-class Sprite:
-	def __init__(self, name, pos):
-		self.name = name
-		self.pos = pos
-
-# TODO: rename this
-class FieldStorage:
-	def __init__(self, name, base, fields):
-		self.name = name
-		self.fields = []
-		if base:
-			self.fields = copy.deepcopy(base.fields)
-		self.base = base
-		self.baselen = len(self.fields)
+		self.firedelay = Int(500)
+		self.maxammo = Int(10)
+		self.ammoregentime = Int(0)
+		self.damage = Int(1)
+
+		self.offsetx = Float(0)
+		self.offsety = Float(0)
+		self.muzzleoffsetx = Float(0)
+		self.muzzleoffsety = Float(0)
+		self.muzzleduration = Float(5)
+
+		# dig out sprites if we have a container
+		if container:
+			for sprite in container.sprites.items:
+				if sprite.name.value == "weapon_"+name+"_body": self.sprite_body.Set(sprite)
+				elif sprite.name.value == "weapon_"+name+"_cursor": self.sprite_cursor.Set(sprite)
+				elif sprite.name.value == "weapon_"+name+"_proj": self.sprite_proj.Set(sprite)
+				elif "weapon_"+name+"_muzzle" in sprite.name.value:
+					self.sprite_muzzles.Add(Pointer(Sprite, sprite))
+
+class Weapon_Hammer(Struct):
+	def __init__(self):
+		Struct.__init__(self, "WEAPONSPEC_HAMMER")
+		self.base = Pointer(WeaponSpec, WeaponSpec())
+
+class Weapon_Gun(Struct):
+	def __init__(self):
+		Struct.__init__(self, "WEAPONSPEC_GUN")
+		self.base = Pointer(WeaponSpec, WeaponSpec())
+		self.curvature = Float(1.25)
+		self.speed = Float(2200)
+		self.lifetime = Float(2.0)
 		
-		self.autoupdate()
+class Weapon_Shotgun(Struct):
+	def __init__(self):
+		Struct.__init__(self, "WEAPONSPEC_SHOTGUN")
+		self.base = Pointer(WeaponSpec, WeaponSpec())
+		self.curvature = Float(1.25)
+		self.speed = Float(2200)
+		self.speeddiff = Float(0.8)
+		self.lifetime = Float(0.25)		
+
+class Weapon_Grenade(Struct):
+	def __init__(self):
+		Struct.__init__(self, "WEAPONSPEC_GRENADE")
+		self.base = Pointer(WeaponSpec, WeaponSpec())
+		self.curvature = Float(7.0)
+		self.speed = Float(1000)
+		self.lifetime = Float(2.0)
+
+class Weapon_Rifle(Struct):
+	def __init__(self):
+		Struct.__init__(self, "WEAPONSPEC_RIFLE")
+		self.base = Pointer(WeaponSpec, WeaponSpec())
+		self.reach = Float(800.0)
+		self.bounce_delay = Int(150)
+		self.bounce_num = Int(1)
+		self.bounce_cost = Float(0)
 		
-		self.update_all(fields)
-	
-	def update_all(self, fields):
-		for v in fields:
-			if not self.update(v):
-				self.fields += [v]
-	
-	def update(self, value):
-		for i in xrange(0, len(self.fields)):
-			if self.fields[i].name == value.name:
-				self.fields[i] = value
-				return True
-		return False
-	
-	def autoupdate(self):
-		pass
+class Weapon_Ninja(Struct):
+	def __init__(self):
+		Struct.__init__(self, "WEAPONSPEC_NINJA")
+		self.base = Pointer(WeaponSpec, WeaponSpec())
+		self.duration = Int(15000)
+		self.movetime = Int(200)
+		self.velocity = Int(50)
+
+class Weapons(Struct):
+	def __init__(self):
+		Struct.__init__(self, "WEAPONSPECS")
+		self.hammer = Weapon_Hammer()
+		self.gun = Weapon_Hammer()
+		self.shotgun = Weapon_Shotgun()
+		self.grenade = Weapon_Grenade()
+		self.rifle = Weapon_Rifle()
+		self.ninja = Weapon_Ninja()
+		self.id = Array(WeaponSpec())
+
+class DataContainer(Struct):
+	def __init__(self):
+		Struct.__init__(self, "DATACONTAINER")
+		self.sounds = Array(SoundSet())
+		self.images = Array(Image())
+		self.pickups = Array(Pickup())
+		self.spritesets = Array(SpriteSet())
+		self.sprites = Array(Sprite())
+		self.animations = Array(Animation())
+		self.weapons = Weapons()
 
 def FileList(format, num):
-	return [format%x for x in xrange(1,num)]
+	return [format%(x+1) for x in xrange(0,num)]
+
+container = DataContainer()
+container.sounds.Add(SoundSet("gun_fire", FileList("data/audio/wp_gun_fire-%02d.wv", 3)))
+container.sounds.Add(SoundSet("shotgun_fire", FileList("data/audio/wp_shotty_fire-%02d.wv", 3)))
+
+container.sounds.Add(SoundSet("grenade_fire", FileList("data/audio/wp_flump_launch-%02d.wv", 3)))
+container.sounds.Add(SoundSet("hammer_fire", FileList("data/audio/wp_hammer_swing-%02d.wv", 3)))
+container.sounds.Add(SoundSet("hammer_hit", FileList("data/audio/wp_hammer_hit-%02d.wv", 3)))
+container.sounds.Add(SoundSet("ninja_fire", FileList("data/audio/wp_ninja_attack-%02d.wv", 3)))
+container.sounds.Add(SoundSet("grenade_explode", FileList("data/audio/wp_flump_explo-%02d.wv", 3)))
+container.sounds.Add(SoundSet("ninja_hit", FileList("data/audio/wp_ninja_hit-%02d.wv", 3)))
+container.sounds.Add(SoundSet("rifle_fire", FileList("data/audio/wp_rifle_fire-%02d.wv", 3)))
+container.sounds.Add(SoundSet("rifle_bounce", FileList("data/audio/wp_rifle_bnce-%02d.wv", 3)))
+container.sounds.Add(SoundSet("weapon_switch", FileList("data/audio/wp_switch-%02d.wv", 3)))
+
+container.sounds.Add(SoundSet("player_pain_short", FileList("data/audio/vo_teefault_pain_short-%02d.wv", 12)))
+container.sounds.Add(SoundSet("player_pain_long", FileList("data/audio/vo_teefault_pain_long-%02d.wv", 2)))
+
+container.sounds.Add(SoundSet("body_land", FileList("data/audio/foley_land-%02d.wv", 4)))
+container.sounds.Add(SoundSet("player_airjump", FileList("data/audio/foley_dbljump-%02d.wv", 3)))
+container.sounds.Add(SoundSet("player_jump", FileList("data/audio/foley_foot_left-%02d.wv", 4) +  FileList("data/audio/foley_foot_right-%02d.wv", 4)))
+container.sounds.Add(SoundSet("player_die", FileList("data/audio/foley_body_splat-%02d.wv", 3)))
+container.sounds.Add(SoundSet("player_spawn", FileList("data/audio/vo_teefault_spawn-%02d.wv", 7)))
+container.sounds.Add(SoundSet("player_skid", FileList("data/audio/sfx_skid-%02d.wv", 4)))
+container.sounds.Add(SoundSet("tee_cry", FileList("data/audio/vo_teefault_cry-%02d.wv", 2)))
+
+container.sounds.Add(SoundSet("hook_loop", FileList("data/audio/hook_loop-%02d.wv", 2)))
+
+container.sounds.Add(SoundSet("hook_attach_ground", FileList("data/audio/hook_attach-%02d.wv", 3)))
+container.sounds.Add(SoundSet("hook_attach_player", FileList("data/audio/foley_body_impact-%02d.wv", 3)))
+container.sounds.Add(SoundSet("pickup_health", FileList("data/audio/sfx_pickup_hrt-%02d.wv", 2)))
+container.sounds.Add(SoundSet("pickup_armor", FileList("data/audio/sfx_pickup_arm-%02d.wv", 4)))
+
+container.sounds.Add(SoundSet("pickup_grenade", FileList("data/audio/sfx_pickup_arm-%02d.wv", 1)))
+container.sounds.Add(SoundSet("pickup_shotgun", FileList("data/audio/sfx_pickup_arm-%02d.wv", 1)))
+container.sounds.Add(SoundSet("pickup_ninja", FileList("data/audio/sfx_pickup_arm-%02d.wv", 1)))
+container.sounds.Add(SoundSet("weapon_spawn", FileList("data/audio/sfx_spawn_wpn-%02d.wv", 3)))
+container.sounds.Add(SoundSet("weapon_noammo", FileList("data/audio/wp_noammo-%02d.wv", 5)))
+
+container.sounds.Add(SoundSet("hit", FileList("data/audio/sfx_hit_weak-%02d.wv", 2)))
+
+container.sounds.Add(SoundSet("chat_server", ["data/audio/sfx_msg-server.wv"]))
+container.sounds.Add(SoundSet("chat_client", ["data/audio/sfx_msg-client.wv"]))
+container.sounds.Add(SoundSet("ctf_drop", ["data/audio/sfx_ctf_drop.wv"]))
+container.sounds.Add(SoundSet("ctf_return", ["data/audio/sfx_ctf_rtn.wv"]))
+container.sounds.Add(SoundSet("ctf_grab_pl", ["data/audio/sfx_ctf_grab_pl.wv"]))
+container.sounds.Add(SoundSet("ctf_grab_en", ["data/audio/sfx_ctf_grab_en.wv"]))
+container.sounds.Add(SoundSet("ctf_capture", ["data/audio/sfx_ctf_cap_pl.wv"]))
+
+image_null = Image("null", "")
+image_particles = Image("particles", "data/particles.png")
+image_game = Image("game", "data/game.png")
+image_browseicons = Image("browseicons", "data/browse_icons.png")
+image_emoticons = Image("emoticons", "data/emoticons.png")
+
+container.images.Add(image_null)
+container.images.Add(image_game)
+container.images.Add(image_particles)
+container.images.Add(Image("cursor", "data/gui_cursor.png"))
+container.images.Add(Image("banner", "data/gui_logo.png"))
+container.images.Add(image_emoticons)
+container.images.Add(image_browseicons)
+container.images.Add(Image("console_bg", "data/console.png"))
+container.images.Add(Image("console_bar", "data/console_bar.png"))
+
+container.pickups.Add(Pickup("health"))
+container.pickups.Add(Pickup("armor"))
+container.pickups.Add(Pickup("weapon"))
+container.pickups.Add(Pickup("ninja", 90, 90))
+
+set_particles = SpriteSet("particles", image_particles, 8, 8)
+set_game = SpriteSet("game", image_game, 32, 16)
+set_tee = SpriteSet("tee", image_null, 8, 4)
+set_browseicons = SpriteSet("browseicons", image_browseicons, 4, 1)
+set_emoticons = SpriteSet("emoticons", image_emoticons, 4, 4)
+
+container.spritesets.Add(set_particles)
+container.spritesets.Add(set_game)
+container.spritesets.Add(set_tee)
+container.spritesets.Add(set_browseicons)
+container.spritesets.Add(set_emoticons)
+
+container.sprites.Add(Sprite("part_slice", set_particles, 0,0,1,1))
+container.sprites.Add(Sprite("part_ball", set_particles, 1,0,1,1))
+container.sprites.Add(Sprite("part_splat01", set_particles, 2,0,1,1))
+container.sprites.Add(Sprite("part_splat02", set_particles, 3,0,1,1))
+container.sprites.Add(Sprite("part_splat03", set_particles, 4,0,1,1))
+
+container.sprites.Add(Sprite("part_smoke", set_particles, 0,1,1,1))
+container.sprites.Add(Sprite("part_shell", set_particles, 0,2,2,2))
+container.sprites.Add(Sprite("part_expl01", set_particles, 0,4,4,4))
+container.sprites.Add(Sprite("part_airjump", set_particles, 2,2,2,2))
+
+container.sprites.Add(Sprite("health_full", set_game, 21,0,2,2))
+container.sprites.Add(Sprite("health_empty", set_game, 23,0,2,2))
+container.sprites.Add(Sprite("armor_full", set_game, 21,2,2,2))
+container.sprites.Add(Sprite("armor_empty", set_game, 23,2,2,2))
+
+container.sprites.Add(Sprite("star1", set_game, 15,0,2,2))
+container.sprites.Add(Sprite("star2", set_game, 17,0,2,2))
+container.sprites.Add(Sprite("star3", set_game, 19,0,2,2))
 	
-
-Sounds = [
-	SoundSet("gun_fire", FileList("data/audio/wp_gun_fire-%02d.wv", 3)),
-	SoundSet("shotgun_fire", FileList("data/audio/wp_shotty_fire-%02d.wv", 3)),
-	SoundSet("grenade_fire", FileList("data/audio/wp_flump_launch-%02d.wv", 3)),
-	SoundSet("hammer_fire", FileList("data/audio/wp_hammer_swing-%02d.wv", 3)),
-	SoundSet("hammer_hit", FileList("data/audio/wp_hammer_hit-%02d.wv", 3)),
-	SoundSet("ninja_fire", FileList("data/audio/wp_ninja_attack-%02d.wv", 3)),
-	SoundSet("grenade_explode", FileList("data/audio/wp_flump_explo-%02d.wv", 3)),
-	SoundSet("ninja_hit", FileList("data/audio/wp_ninja_hit-%02d.wv", 3)),
-	SoundSet("rifle_fire", FileList("data/audio/wp_rifle_fire-%02d.wv", 3)),
-	SoundSet("rifle_bounce", FileList("data/audio/wp_rifle_bnce-%02d.wv", 3)),
-	SoundSet("weapon_switch", FileList("data/audio/wp_switch-%02d.wv", 3)),
-
-	SoundSet("player_pain_short", FileList("data/audio/vo_teefault_pain_short-%02d.wv", 12)),
-	SoundSet("player_pain_long", FileList("data/audio/vo_teefault_pain_long-%02d.wv", 2)),
-
-	SoundSet("body_land", FileList("data/audio/foley_land-%02d.wv", 4)),
-	SoundSet("player_airjump", FileList("data/audio/foley_dbljump-%02d.wv", 3)),
-	SoundSet("player_jump", FileList("data/audio/foley_foot_left-%02d.wv", 4) +  FileList("data/audio/foley_foot_right-%02d.wv", 4)),
-	SoundSet("player_die", FileList("data/audio/foley_body_splat-%02d.wv", 3)),
-	SoundSet("player_spawn", FileList("data/audio/vo_teefault_spawn-%02d.wv", 7)),
-	SoundSet("player_skid", FileList("data/audio/sfx_skid-%02d.wv", 4)),
-	SoundSet("tee_cry", FileList("data/audio/vo_teefault_cry-%02d.wv", 2)),
-
-	SoundSet("hook_loop", FileList("data/audio/hook_loop-%02d.wv", 2)),
-
-	SoundSet("hook_attach_ground", FileList("data/audio/hook_attach-%02d.wv", 3)),
-	SoundSet("hook_attach_player", FileList("data/audio/foley_body_impact-%02d.wv", 3)),
-	SoundSet("pickup_health", FileList("data/audio/sfx_pickup_hrt-%02d.wv", 2)),
-	SoundSet("pickup_armor", FileList("data/audio/sfx_pickup_arm-%02d.wv", 4)),
-
-	SoundSet("pickup_grenade", FileList("data/audio/sfx_pickup_arm-%02d.wv", 1)),
-	SoundSet("pickup_shotgun", FileList("data/audio/sfx_pickup_arm-%02d.wv", 1)),
-	SoundSet("pickup_ninja", FileList("data/audio/sfx_pickup_arm-%02d.wv", 1)),
-	SoundSet("weapon_spawn", FileList("data/audio/sfx_spawn_wpn-%02d.wv", 3)),
-	SoundSet("weapon_noammo", FileList("data/audio/wp_noammo-%02d.wv", 5)),
-
-	SoundSet("hit", FileList("data/audio/sfx_hit_weak-%02d.wv", 2)),
-
-	SoundSet("chat_server", ["data/audio/sfx_msg-server.wv"]),
-	SoundSet("chat_client", ["data/audio/sfx_msg-client.wv"]),
-	SoundSet("ctf_drop", ["data/audio/sfx_ctf_drop.wv"]),
-	SoundSet("ctf_return", ["data/audio/sfx_ctf_rtn.wv"]),
-	SoundSet("ctf_grab_pl", ["data/audio/sfx_ctf_grab_pl.wv"]),
-	SoundSet("ctf_grab_en", ["data/audio/sfx_ctf_grab_en.wv"]),
-	SoundSet("ctf_capture", ["data/audio/sfx_ctf_cap_pl.wv"]),
-]
-
-Images = [
-	Image("null", ""),
-	Image("game", "data/game.png"),
-	Image("particles", "data/particles.png"),
-	Image("cursor", "data/gui_cursor.png"),
-	Image("banner", "data/gui_logo.png"),
-	Image("emoticons", "data/emoticons.png"),
-	Image("browseicons", "data/browse_icons.png"),
-	Image("console_bg", "data/console.png"),
-	Image("console_bar", "data/console_bar.png"),
-]
-
-Pickups = [
-	Pickup("health"),
-	Pickup("armor"),
-	Pickup("weapon"),
-	Pickup("ninja", 90, 90),
-]
-
-Sprites = [
-	SpriteSet("particles", (8,8), [
-		Sprite("part_slice", (0,0,1,1)),
-		Sprite("part_ball", (1,0,1,1)),
-		Sprite("part_splat01", (2,0,1,1)),
-		Sprite("part_splat02", (3,0,1,1)),
-		Sprite("part_splat03", (4,0,1,1)),
-
-		Sprite("part_smoke", (0,1,1,1)),
-		Sprite("part_shell", (0,2,2,2)),
-		Sprite("part_expl01", (0,4,4,4)),
-		Sprite("part_airjump", (2,2,2,2)),
-	]),
-
-	SpriteSet("game", (8,8), [
-		Sprite("health_full", (21,0,2,2)),
-		Sprite("health_empty", (23,0,2,2)),
-		Sprite("armor_full", (21,2,2,2)),
-		Sprite("armor_empty", (23,2,2,2)),
-		
-		Sprite("star1", (15,0,2,2)),
-		Sprite("star2", (17,0,2,2)),
-		Sprite("star3", (19,0,2,2)),
+container.sprites.Add(Sprite("part1", set_game, 6,0,1,1))
+container.sprites.Add(Sprite("part2", set_game, 6,1,1,1))
+container.sprites.Add(Sprite("part3", set_game, 7,0,1,1))
+container.sprites.Add(Sprite("part4", set_game, 7,1,1,1))
+container.sprites.Add(Sprite("part5", set_game, 8,0,1,1))
+container.sprites.Add(Sprite("part6", set_game, 8,1,1,1))
+container.sprites.Add(Sprite("part7", set_game, 9,0,2,2))
+container.sprites.Add(Sprite("part8", set_game, 11,0,2,2))
+container.sprites.Add(Sprite("part9", set_game, 13,0,2,2))
+
+container.sprites.Add(Sprite("weapon_gun_body", set_game, 2,4,4,2))
+container.sprites.Add(Sprite("weapon_gun_cursor", set_game, 0,4,2,2))
+container.sprites.Add(Sprite("weapon_gun_proj", set_game, 6,4,2,2))
+container.sprites.Add(Sprite("weapon_gun_muzzle1", set_game, 8,4,3,2))
+container.sprites.Add(Sprite("weapon_gun_muzzle2", set_game, 12,4,3,2))
+container.sprites.Add(Sprite("weapon_gun_muzzle3", set_game, 16,4,3,2))
+
+container.sprites.Add(Sprite("weapon_shotgun_body", set_game, 2,6,8,2))
+container.sprites.Add(Sprite("weapon_shotgun_cursor", set_game, 0,6,2,2))
+container.sprites.Add(Sprite("weapon_shotgun_proj", set_game, 10,6,2,2))
+container.sprites.Add(Sprite("weapon_shotgun_muzzle1", set_game, 12,6,3,2))
+container.sprites.Add(Sprite("weapon_shotgun_muzzle2", set_game, 16,6,3,2))
+container.sprites.Add(Sprite("weapon_shotgun_muzzle3", set_game, 20,6,3,2))
+
+container.sprites.Add(Sprite("weapon_grenade_body", set_game, 2,8,7,2))
+container.sprites.Add(Sprite("weapon_grenade_cursor", set_game, 0,8,2,2))
+container.sprites.Add(Sprite("weapon_grenade_proj", set_game, 10,8,2,2))
+
+container.sprites.Add(Sprite("weapon_hammer_body", set_game, 2,1,4,3))
+container.sprites.Add(Sprite("weapon_hammer_cursor", set_game, 0,0,2,2))
+container.sprites.Add(Sprite("weapon_hammer_proj", set_game, 0,0,0,0))
+
+container.sprites.Add(Sprite("weapon_ninja_body", set_game, 2,10,7,2))
+container.sprites.Add(Sprite("weapon_ninja_cursor", set_game, 0,10,2,2))
+container.sprites.Add(Sprite("weapon_ninja_proj", set_game, 0,0,0,0))
+
+container.sprites.Add(Sprite("weapon_rifle_body", set_game, 2,12,7,3))
+container.sprites.Add(Sprite("weapon_rifle_cursor", set_game, 0,12,2,2))
+container.sprites.Add(Sprite("weapon_rifle_proj", set_game, 10,12,2,2))
+
+container.sprites.Add(Sprite("hook_chain", set_game, 2,0,1,1))
+container.sprites.Add(Sprite("hook_head", set_game, 3,0,2,1))
+
+container.sprites.Add(Sprite("hadoken1", set_game, 25,0,7,4))
+container.sprites.Add(Sprite("hadoken2", set_game, 25,4,7,4))
+container.sprites.Add(Sprite("hadoken3", set_game, 25,8,7,4))
+
+container.sprites.Add(Sprite("pickup_health", set_game, 10,2,2,2))
+container.sprites.Add(Sprite("pickup_armor", set_game, 12,2,2,2))
+container.sprites.Add(Sprite("pickup_weapon", set_game, 3,0,6,2))
+container.sprites.Add(Sprite("pickup_ninja", set_game, 3,10,7,2))
+
+container.sprites.Add(Sprite("flag_blue", set_game, 12,8,4,8))
+container.sprites.Add(Sprite("flag_red", set_game, 16,8,4,8))
+
+container.sprites.Add(Sprite("tee_body", set_tee, 0,0,3,3))
+container.sprites.Add(Sprite("tee_body_outline", set_tee, 3,0,3,3))
+container.sprites.Add(Sprite("tee_foot", set_tee, 6,1,2,1))
+container.sprites.Add(Sprite("tee_foot_outline", set_tee, 6,2,2,1))
+container.sprites.Add(Sprite("tee_hand", set_tee, 6,0,1,1))
+container.sprites.Add(Sprite("tee_hand_outline", set_tee, 7,0,1,1))
+container.sprites.Add(Sprite("tee_eye_normal", set_tee, 2,3,1,1))
+container.sprites.Add(Sprite("tee_eye_angry", set_tee, 3,3,1,1))
+container.sprites.Add(Sprite("tee_eye_pain", set_tee, 4,3,1,1))
+container.sprites.Add(Sprite("tee_eye_happy", set_tee, 5,3,1,1))
+container.sprites.Add(Sprite("tee_eye_dead", set_tee, 6,3,1,1))
+container.sprites.Add(Sprite("tee_eye_surprise", set_tee, 7,3,1,1))
+
+container.sprites.Add(Sprite("oop", set_emoticons, 0, 0, 1, 1))
+container.sprites.Add(Sprite("exclamation", set_emoticons, 1, 0, 1, 1))
+container.sprites.Add(Sprite("hearts", set_emoticons, 2, 0, 1, 1))
+container.sprites.Add(Sprite("drop", set_emoticons, 3, 0, 1, 1))
+container.sprites.Add(Sprite("dotdot", set_emoticons, 0, 1, 1, 1))
+container.sprites.Add(Sprite("music1", set_emoticons, 1, 1, 1, 1))
+container.sprites.Add(Sprite("music2", set_emoticons, 2, 1, 1, 1))
+container.sprites.Add(Sprite("ghost", set_emoticons, 3, 1, 1, 1))
+container.sprites.Add(Sprite("sushi", set_emoticons, 0, 2, 1, 1))
+container.sprites.Add(Sprite("splattee", set_emoticons, 1, 2, 1, 1))
+container.sprites.Add(Sprite("deviltee", set_emoticons, 2, 2, 1, 1))
+container.sprites.Add(Sprite("zomg", set_emoticons, 3, 2, 1, 1))
+container.sprites.Add(Sprite("zzz", set_emoticons, 0, 3, 1, 1))
+container.sprites.Add(Sprite("blank1", set_emoticons, 1, 3, 1, 1))
+container.sprites.Add(Sprite("deadtee", set_emoticons, 2, 3, 1, 1))
+container.sprites.Add(Sprite("blank2", set_emoticons, 3, 3, 1, 1))
+
+
+container.sprites.Add(Sprite("browse_lock", set_browseicons, 0,0,1,1))
+container.sprites.Add(Sprite("browse_progress1", set_browseicons, 1,0,1,1))
+container.sprites.Add(Sprite("browse_progress2", set_browseicons, 2,0,1,1))
+container.sprites.Add(Sprite("browse_progress3", set_browseicons, 3,0,1,1))
+
+anim = Animation("base")
+anim.body.frames.Add(AnimKeyframe(0, 0, -4, 0))
+anim.back_foot.frames.Add(AnimKeyframe(0, 0, 10, 0))
+anim.front_foot.frames.Add(AnimKeyframe(0, 0, 10, 0))
+container.animations.Add(anim)
+
+anim = Animation("idle")
+anim.back_foot.frames.Add(AnimKeyframe(0, -7, 0, 0))
+anim.front_foot.frames.Add(AnimKeyframe(0, 7, 0, 0))
+container.animations.Add(anim)
+
+anim = Animation("inair")
+anim.back_foot.frames.Add(AnimKeyframe(0, -3, 0, -0.1))
+anim.front_foot.frames.Add(AnimKeyframe(0, 3, 0, -0.1))
+container.animations.Add(anim)
+
+anim = Animation("walk")
+anim.body.frames.Add(AnimKeyframe(0.0, 0, 0, 0))
+anim.body.frames.Add(AnimKeyframe(0.2, 0,-1, 0))
+anim.body.frames.Add(AnimKeyframe(0.4, 0, 0, 0))
+anim.body.frames.Add(AnimKeyframe(0.6, 0, 0, 0))
+anim.body.frames.Add(AnimKeyframe(0.8, 0,-1, 0))
+anim.body.frames.Add(AnimKeyframe(1.0, 0, 0, 0))
+
+anim.back_foot.frames.Add(AnimKeyframe(0.0,  8, 0, 0))
+anim.back_foot.frames.Add(AnimKeyframe(0.2, -8, 0, 0))
+anim.back_foot.frames.Add(AnimKeyframe(0.4,-10,-4, 0.2))
+anim.back_foot.frames.Add(AnimKeyframe(0.6, -8,-8, 0.3))
+anim.back_foot.frames.Add(AnimKeyframe(0.8,  4,-4,-0.2))
+anim.back_foot.frames.Add(AnimKeyframe(1.0,  8, 0, 0))
+
+anim.front_foot.frames.Add(AnimKeyframe(0.0,-10,-4, 0.2))
+anim.front_foot.frames.Add(AnimKeyframe(0.2, -8,-8, 0.3))
+anim.front_foot.frames.Add(AnimKeyframe(0.4,  4,-4,-0.2))
+anim.front_foot.frames.Add(AnimKeyframe(0.6,  8, 0, 0))
+anim.front_foot.frames.Add(AnimKeyframe(0.8,  8, 0, 0))
+anim.front_foot.frames.Add(AnimKeyframe(1.0,-10, 0, 0.2))
+container.animations.Add(anim)
+
+anim = Animation("hammer_swing")
+anim.attach.frames.Add(AnimKeyframe(0.0, 0, 0, -0.10))
+anim.attach.frames.Add(AnimKeyframe(0.3, 0, 0,  0.25))
+anim.attach.frames.Add(AnimKeyframe(0.4, 0, 0,  0.30))
+anim.attach.frames.Add(AnimKeyframe(0.5, 0, 0,  0.25))
+anim.attach.frames.Add(AnimKeyframe(1.0, 0, 0, -0.10))
+container.animations.Add(anim)
 			
-		Sprite("part1", (6,0,1,1)),
-		Sprite("part2", (6,1,1,1)),
-		Sprite("part3", (7,0,1,1)),
-		Sprite("part4", (7,1,1,1)),
-		Sprite("part5", (8,0,1,1)),
-		Sprite("part6", (8,1,1,1)),
-		Sprite("part7", (9,0,2,2)),
-		Sprite("part8", (11,0,2,2)),
-		Sprite("part9", (13,0,2,2)),
-	
-		Sprite("weapon_gun_body", (2,4,4,2)),
-		Sprite("weapon_gun_cursor", (0,4,2,2)),
-		Sprite("weapon_gun_proj", (6,4,2,2)),
-		Sprite("weapon_gun_muzzle1", (8,4,3,2)),
-		Sprite("weapon_gun_muzzle2", (12,4,3,2)),
-		Sprite("weapon_gun_muzzle3", (16,4,3,2)),
-		
-		Sprite("weapon_shotgun_body", (2,6,8,2)),
-		Sprite("weapon_shotgun_cursor", (0,6,2,2)),
-		Sprite("weapon_shotgun_proj", (10,6,2,2)),
-		Sprite("weapon_shotgun_muzzle1", (12,6,3,2)),
-		Sprite("weapon_shotgun_muzzle2", (16,6,3,2)),
-		Sprite("weapon_shotgun_muzzle3", (20,6,3,2)),
-		
-		Sprite("weapon_grenade_body", (2,8,7,2)),
-		Sprite("weapon_grenade_cursor", (0,8,2,2)),
-		Sprite("weapon_grenade_proj", (10,8,2,2)),
-
-		Sprite("weapon_hammer_body", (2,1,4,3)),
-		Sprite("weapon_hammer_cursor", (0,0,2,2)),
-		Sprite("weapon_hammer_proj", (0,0,0,0)),
-		
-		Sprite("weapon_ninja_body", (2,10,7,2)),
-		Sprite("weapon_ninja_cursor", (0,10,2,2)),
-		Sprite("weapon_ninja_proj", (0,0,0,0)),
-
-		Sprite("weapon_rifle_body", (2,12,7,3)),
-		Sprite("weapon_rifle_cursor", (0,12,2,2)),
-		Sprite("weapon_rifle_proj", (10,12,2,2)),
-		
-		Sprite("hook_chain", (2,0,1,1)),
-		Sprite("hook_head", (3,0,2,1)),
-		
-		Sprite("hadoken1", (25,0,7,4)),
-		Sprite("hadoken2", (25,4,7,4)),
-		Sprite("hadoken3", (25,8,7,4)),
-		
-		Sprite("pickup_health", (10,2,2,2)),
-		Sprite("pickup_armor", (12,2,2,2)),
-		Sprite("pickup_weapon", (3,0,6,2)),
-		Sprite("pickup_ninja", (3,10,7,2)),
-
-		Sprite("flag_blue", (12,8,4,8)),
-		Sprite("flag_red", (16,8,4,8)),
-	]),
-	
-	SpriteSet(None, (8,4), [
-		Sprite("tee_body", (0,0,3,3)),
-		Sprite("tee_body_outline", (3,0,3,3)),
-		Sprite("tee_foot", (6,1,2,1)),
-		Sprite("tee_foot_outline", (6,2,2,1)),
-		Sprite("tee_hand", (6,0,1,1)),
-		Sprite("tee_hand_outline", (7,0,1,1)),
-		
-		Sprite("tee_eye_normal", (2,3,1,1)),
-		Sprite("tee_eye_angry", (3,3,1,1)),
-		Sprite("tee_eye_pain", (4,3,1,1)),
-		Sprite("tee_eye_happy", (5,3,1,1)),
-		Sprite("tee_eye_dead", (6,3,1,1)),
-		Sprite("tee_eye_surprise", (7,3,1,1)),
-	]),
-
-	SpriteSet("browseicons", (4,1), [
-		Sprite("browse_lock", (0,0,1,1)),
-		Sprite("browse_progress1", (1,0,1,1)),
-		Sprite("browse_progress2", (2,0,1,1)),
-		Sprite("browse_progress3", (3,0,1,1)),
-	]),
-]
-
-class Weapon(FieldStorage):
-	def autoupdate(self):
-		self.update(String("name", self.name))
-		self.update(SpriteRef("sprite_body", "weapon_%s_body"%self.name))
-		self.update(SpriteRef("sprite_cursor", "weapon_%s_cursor"%self.name))
-		self.update(SpriteRef("sprite_proj", "weapon_%s_proj"%self.name))
-
-WeaponBase = Weapon("weapon", None, [
-	String("name", "base"),
-	SpriteRef("sprite_body", None),
-	SpriteRef("sprite_cursor", None),
-	SpriteRef("sprite_proj", None),
-	Int("damage", 1),
-	Int("firedelay", 500),
-	Int("visual_size", 96),
-])
-
-Weapons = [
-	Weapon("hammer", WeaponBase, [
-		Int("firedelay", 100),
-		Int("damage", 3),
-	]),
-
-	Weapon("gun", WeaponBase, [
-		Int("firedelay", 100),
-		Int("damage", 1),
-
-		Float("curvature", 1.25),
-		Float("speed", 2200.0),
-		Float("lifetime", 2.0),
-	]),
-
-	Weapon("shotgun", WeaponBase, [
-		Int("firedelay", 500),
-		Int("damage", 1),
-
-		Float("curvature", 1.25),
-		Float("speed", 2200.0),
-		Float("speeddiff", 0.8),
-		Float("lifetime", 0.25),
-	]),
-
-	Weapon("grenade", WeaponBase, [
-		Int("firedelay", 100),
-		Int("damage", 6),
-
-		Float("curvature", 7.0),
-		Float("speed", 1000.0),
-		Float("lifetime", 2.0),
-	]),
-
-	Weapon("rifle", WeaponBase, [
-		Int("firedelay", 800),
-		Int("visual_size", 92),
-		Int("damage", 5),
-		
-		Float("reach", 800.0),
-		Float("bounce_delay", 150),
-		Float("bounce_num", 1),
-		Float("bounce_cost", 0),
-	]),
-	
-	Weapon("ninja", WeaponBase, [
-		Int("firedelay", 800),
-		Int("damage", 9),
-	]),	
-]
-
-ticks_per_second = 50.0
-Physics = FieldStorage("physics", None, [
-	Float("ground_control_speed", 10.0),
-	Float("ground_control_accel", 100.0 / ticks_per_second),
-	Float("ground_friction", 0.5),
-	Float("ground_jump_impulse", 12.6),
-	Float("air_jump_impulse", 11.5),
-	Float("air_control_speed", 250.0 / ticks_per_second),
-	Float("air_control_accel", 1.5),
-	Float("air_friction", 0.95),
-	Float("hook_length", 380.0),
-	Float("hook_fire_speed", 80.0),
-	Float("hook_drag_accel", 3.0),
-	Float("hook_drag_speed", 15.0),
-	Float("gravity", 0.5),
-
-	Float("velramp_start", 550),
-	Float("velramp_range", 2000),
-	Float("velramp_curvature", 1.4),
-])
+anim = Animation("ninja_swing")
+anim.attach.frames.Add(AnimKeyframe(0.00, 0, 0, -0.25))
+anim.attach.frames.Add(AnimKeyframe(0.10, 0, 0, -0.05))
+anim.attach.frames.Add(AnimKeyframe(0.15, 0, 0,  0.35))
+anim.attach.frames.Add(AnimKeyframe(0.42, 0, 0,  0.40))
+anim.attach.frames.Add(AnimKeyframe(0.50, 0, 0,  0.35))
+anim.attach.frames.Add(AnimKeyframe(1.00, 0, 0, -0.25))
+container.animations.Add(anim)
+
+weapon = WeaponSpec(container, "hammer")
+weapon.firedelay.Set(100)
+weapon.damage.Set(3)
+weapon.visual_size.Set(96)
+weapon.offsetx.Set(4)
+weapon.offsety.Set(-20)
+container.weapons.hammer.base.Set(weapon)
+container.weapons.id.Add(weapon)
+
+weapon = WeaponSpec(container, "gun")
+weapon.firedelay.Set(100)
+weapon.ammoregentime.Set(500)
+weapon.visual_size.Set(64)
+weapon.offsetx.Set(32)
+weapon.offsety.Set(-4)
+weapon.muzzleoffsetx.Set(50)
+weapon.muzzleoffsety.Set(6)
+container.weapons.gun.base.Set(weapon)
+container.weapons.id.Add(weapon)
+
+weapon = WeaponSpec(container, "shotgun")
+weapon.firedelay.Set(500)
+weapon.visual_size.Set(96)
+weapon.offsetx.Set(24)
+weapon.offsety.Set(-2)
+weapon.muzzleoffsetx.Set(70)
+weapon.muzzleoffsety.Set(6)
+container.weapons.shotgun.base.Set(weapon)
+container.weapons.id.Add(weapon)
+
+weapon = WeaponSpec(container, "grenade")
+weapon.firedelay.Set(500) # TODO: fix this
+weapon.visual_size.Set(96)
+weapon.offsetx.Set(24)
+weapon.offsety.Set(-2)
+container.weapons.grenade.base.Set(weapon)
+container.weapons.id.Add(weapon)
+
+weapon = WeaponSpec(container, "rifle")
+weapon.firedelay.Set(800)
+weapon.visual_size.Set(92)
+weapon.damage.Set(5)
+weapon.offsetx.Set(24)
+weapon.offsety.Set(-2)
+container.weapons.rifle.base.Set(weapon)
+container.weapons.id.Add(weapon)
+
+weapon = WeaponSpec(container, "ninja")
+weapon.firedelay.Set(800)
+weapon.damage.Set(9)
+weapon.visual_size.Set(96)
+weapon.offsetx.Set(0)
+weapon.offsety.Set(0)
+container.weapons.ninja.base.Set(weapon)
+container.weapons.id.Add(weapon)
diff --git a/datasrc/data.ds b/datasrc/data.ds
deleted file mode 100644
index 897a440e..00000000
--- a/datasrc/data.ds
+++ /dev/null
@@ -1,699 +0,0 @@
-sounds {
-	gun_fire {
-		"data/audio/wp_gun_fire-01.wv"
-		"data/audio/wp_gun_fire-02.wv"
-		"data/audio/wp_gun_fire-03.wv"
-	}
-
-	shotgun_fire {
-		"data/audio/wp_shotty_fire-01.wv"
-		"data/audio/wp_shotty_fire-02.wv"
-		"data/audio/wp_shotty_fire-03.wv"
-	}
-	
-	grenade_fire {
-		"data/audio/wp_flump_launch-01.wv"
-		"data/audio/wp_flump_launch-02.wv"
-		"data/audio/wp_flump_launch-03.wv"
-	}
-	
-	hammer_fire {
-		"data/audio/wp_hammer_swing-01.wv"
-		"data/audio/wp_hammer_swing-02.wv"
-		"data/audio/wp_hammer_swing-03.wv"
-	}
-
-	hammer_hit {
-		"data/audio/wp_hammer_hit-01.wv"
-		"data/audio/wp_hammer_hit-02.wv"
-		"data/audio/wp_hammer_hit-03.wv"
-	}
-	
-	ninja_fire { 
-		"data/audio/wp_ninja_attack-01.wv"
-		"data/audio/wp_ninja_attack-02.wv"
-		"data/audio/wp_ninja_attack-03.wv"
-	}
-
-	grenade_explode {
-		"data/audio/wp_flump_explo-01.wv"
-		"data/audio/wp_flump_explo-02.wv"
-		"data/audio/wp_flump_explo-03.wv"
-	}
-	
-	ninja_hit {
-		"data/audio/wp_ninja_hit-01.wv"
-		"data/audio/wp_ninja_hit-02.wv"
-		"data/audio/wp_ninja_hit-03.wv"
-	}
-	
-	rifle_fire {
-		"data/audio/wp_rifle_fire-01.wv"
-		"data/audio/wp_rifle_fire-02.wv"
-		"data/audio/wp_rifle_fire-03.wv"
-	}
-
-	rifle_bounce {
-		"data/audio/wp_rifle_bnce-01.wv"
-		"data/audio/wp_rifle_bnce-02.wv"
-		"data/audio/wp_rifle_bnce-03.wv"
-	}
-
-	weapon_switch { 
-		"data/audio/wp_switch-01.wv"
-		"data/audio/wp_switch-02.wv"
-		"data/audio/wp_switch-03.wv"
-	}
-
-	player_pain_short {
-		"data/audio/vo_teefault_pain_short-01.wv"
-		"data/audio/vo_teefault_pain_short-02.wv"
-		"data/audio/vo_teefault_pain_short-03.wv"
-		"data/audio/vo_teefault_pain_short-04.wv"
-		"data/audio/vo_teefault_pain_short-05.wv"
-		"data/audio/vo_teefault_pain_short-06.wv"
-		"data/audio/vo_teefault_pain_short-07.wv"
-		"data/audio/vo_teefault_pain_short-08.wv"
-		"data/audio/vo_teefault_pain_short-09.wv"
-		"data/audio/vo_teefault_pain_short-10.wv"
-		"data/audio/vo_teefault_pain_short-11.wv"
-		"data/audio/vo_teefault_pain_short-12.wv"
-	}
-
-	player_pain_long {
-		"data/audio/vo_teefault_pain_long-01.wv"
-		"data/audio/vo_teefault_pain_long-02.wv"
-	}
-
-	body_land {
-		"data/audio/foley_land-01.wv"
-		"data/audio/foley_land-02.wv"
-		"data/audio/foley_land-03.wv"
-		"data/audio/foley_land-04.wv"
-	}
-	
-	player_airjump {
-		"data/audio/foley_dbljump-01.wv"
-		"data/audio/foley_dbljump-02.wv"
-		"data/audio/foley_dbljump-03.wv"
-	}
-
-	player_jump {
-		"data/audio/foley_foot_left-01.wv"
-		"data/audio/foley_foot_left-02.wv"
-		"data/audio/foley_foot_left-03.wv"
-		"data/audio/foley_foot_left-04.wv"
-		"data/audio/foley_foot_right-01.wv"
-		"data/audio/foley_foot_right-02.wv"
-		"data/audio/foley_foot_right-03.wv"
-		"data/audio/foley_foot_right-04.wv"
-	}
-
-	player_die {
-		"data/audio/foley_body_splat-02.wv"
-		"data/audio/foley_body_splat-03.wv"
-		"data/audio/foley_body_splat-04.wv"
-	}
-	
-	player_spawn {
-		"data/audio/vo_teefault_spawn-01.wv"
-		"data/audio/vo_teefault_spawn-02.wv"
-		"data/audio/vo_teefault_spawn-03.wv"
-		"data/audio/vo_teefault_spawn-04.wv"
-		"data/audio/vo_teefault_spawn-05.wv"
-		"data/audio/vo_teefault_spawn-06.wv"
-		"data/audio/vo_teefault_spawn-07.wv"
-	}
-	
-	player_skid {
-		"data/audio/sfx_skid-01.wv"
-		"data/audio/sfx_skid-02.wv"
-		"data/audio/sfx_skid-03.wv"
-		"data/audio/sfx_skid-04.wv"
-	}
-
-	tee_cry {
-		"data/audio/vo_teefault_cry-01.wv"
-		"data/audio/vo_teefault_cry-02.wv"
-	}
-
-	hook_loop { 
-		"data/audio/hook_loop-01.wv"
-		"data/audio/hook_loop-02.wv"
-	}
-	
-	hook_attach_ground {
-		"data/audio/hook_attach-01.wv"
-		"data/audio/hook_attach-02.wv"
-		"data/audio/hook_attach-03.wv"
-	}
-	
-	hook_attach_player {
-		"data/audio/foley_body_impact-01.wv"
-		"data/audio/foley_body_impact-02.wv"
-		"data/audio/foley_body_impact-03.wv"
-	}
-		
-	pickup_health {
-		"data/audio/sfx_pickup_hrt-01.wv"
-		"data/audio/sfx_pickup_hrt-02.wv"
-	}
-	
-	pickup_armor {
-		"data/audio/sfx_pickup_arm-01.wv"
-		"data/audio/sfx_pickup_arm-02.wv"
-		"data/audio/sfx_pickup_arm-03.wv"
-		"data/audio/sfx_pickup_arm-04.wv"
-	}
-	
-	pickup_grenade {
-		"data/audio/sfx_pickup_launcher.wv"
-	}
-	
-	pickup_shotgun {
-		"data/audio/sfx_pickup_sg.wv"
-	}
-	
-	pickup_ninja {
-		"data/audio/sfx_pickup_ninja.wv"
-	}
-		
-	weapon_spawn {
-		"data/audio/sfx_spawn_wpn-01.wv"
-		"data/audio/sfx_spawn_wpn-02.wv"
-		"data/audio/sfx_spawn_wpn-03.wv"
-	}
-
-	weapon_noammo {
-		"data/audio/wp_noammo-01.wv"
-		"data/audio/wp_noammo-02.wv"
-		"data/audio/wp_noammo-03.wv"
-		"data/audio/wp_noammo-04.wv"
-		"data/audio/wp_noammo-05.wv"
-	}
-
-	hit {
-		"data/audio/sfx_hit_weak-01.wv"
-		"data/audio/sfx_hit_weak-02.wv"
-	}
-
-	chat_server {
-		"data/audio/sfx_msg-server.wv"
-	}
-	
-	chat_client {
-		"data/audio/sfx_msg-client.wv"
-	}
-
-	ctf_drop {
-		"data/audio/sfx_ctf_drop.wv"
-	}
-
-	ctf_return {
-		"data/audio/sfx_ctf_rtn.wv"
-	}
-	
-	ctf_grab_pl {
-		"data/audio/sfx_ctf_grab_pl.wv"
-	}
-
-	ctf_grab_en {
-		"data/audio/sfx_ctf_grab_en.wv"
-	}
-
-	ctf_capture {
-		"data/audio/sfx_ctf_cap_pl.wv"
-	}
-}
-
-
-images {
-	null {
-		filename ""
-	}
-
-	game {
-		filename "data/game.png"
-	}
-
-	particles {
-		filename "data/particles.png"
-	}
-
-	cursor {
-		filename "data/gui_cursor.png"
-	}
-
-	banner {
-		filename "data/gui_logo.png"
-	}
-
-	emoticons {
-		filename "data/emoticons.png"
-	}
-	
-	browseicons {
-		filename "data/browse_icons.png"
-	}
-
-	console_bg {
-		filename "data/console.png"
-	}
-	console_bar {
-		filename "data/console_bar.png"
-	}
-}
-
-powerups {
-	health {
-		amount 1
-		respawntime 15
-		startspawntime 0
-	}
-	armor {
-		amount 1
-		respawntime 15
-		startspawntime 0
-	}
-	weapon {
-		amount 10
-		respawntime 15
-		startspawntime 0
-	}
-	ninja {
-		amount 1
-		respawntime 90
-		startspawntime 90
-	}
-}
-
-weapons {
-	hammer {
-		sprite_body sprites.game.weapon_hammer_body
-		sprite_cursor sprites.game.weapon_hammer_cursor
-		sprite_proj sprites.game.weapon_hammer_proj
-		sprite_muzzles {
-		}
-		
-		nummuzzlesprites 0
-		muzzleoffsetx 0.0
-		muzzleoffsety 0.0
-		maxammo 10
-		recoil 10
-		firedelay 150
-		muzzleduration 0
-		visual_size 96
-		offsetx 4.0
-		offsety -20.0
-		meleedamage 4
-		meleereach 40
-		ammoregentime 0
-		duration -1
-		movetime 0
-		velocity 0
-	}
-	
-	gun {
-		sprite_body sprites.game.weapon_gun_body
-		sprite_cursor sprites.game.weapon_gun_cursor
-		sprite_proj sprites.game.weapon_gun_proj
-		sprite_muzzles {
-			sprites.game.weapon_gun_muzzle1
-			sprites.game.weapon_gun_muzzle2
-			sprites.game.weapon_gun_muzzle3
-		}
-
-		nummuzzlesprites 3
-		muzzleoffsetx 50.0
-		muzzleoffsety 6.0
-		maxammo 10
-		recoil 10
-		firedelay 100
-		muzzleduration 5
-		visual_size 64
-		offsetx 32.0
-		offsety 4.0
-		meleedamage 0
-		meleereach 0
-		ammoregentime 500
-		duration -1
-		movetime 0
-		velocity 0
-	}
-	
-	shotgun {
-		sprite_body sprites.game.weapon_shotgun_body
-		sprite_cursor sprites.game.weapon_shotgun_cursor
-		sprite_proj sprites.game.weapon_shotgun_proj
-		sprite_muzzles {
-			sprites.game.weapon_shotgun_muzzle1
-			sprites.game.weapon_shotgun_muzzle2
-			sprites.game.weapon_shotgun_muzzle3
-		}
-		
-		nummuzzlesprites 3
-		muzzleoffsetx 70.0
-		muzzleoffsety 6.0
-		maxammo 10
-		recoil 10
-		firedelay 500
-		muzzleduration 5
-		visual_size 96
-		offsetx 24.0
-		offsety -2.0
-		meleedamage 0
-		meleereach 0
-		ammoregentime 0
-		duration -1
-		movetime 0
-		velocity 0
-	}
-
-	grenade {
-		sprite_body sprites.game.weapon_grenade_body
-		sprite_cursor sprites.game.weapon_grenade_cursor
-		sprite_proj sprites.game.weapon_grenade_proj
-		sprite_muzzles {
-		}
-		
-		nummuzzlesprites 0
-		muzzleoffsetx 0.0
-		muzzleoffsety 0.0
-		maxammo 10
-		recoil 10
-		firedelay 600
-		muzzleduration 0
-		visual_size 96
-		offsetx 24.0
-		offsety -2.0
-		meleedamage 0
-		meleereach 0
-		ammoregentime 0
-		duration -1
-		movetime 0
-		velocity 0
-	}
-		
-	rifle {
-		sprite_body sprites.game.weapon_rifle_body
-		sprite_cursor sprites.game.weapon_rifle_cursor
-		sprite_proj sprites.game.weapon_rifle_proj
-		sprite_muzzles {
-		}
-		
-		nummuzzlesprites 3
-		muzzleoffsetx 0.0
-		muzzleoffsety 0.0
-		maxammo 10
-		recoil 10
-		firedelay 800
-		muzzleduration 0
-		visual_size 92
-		offsetx 24.0
-		offsety -2.0
-		meleedamage 0
-		meleereach 0
-		ammoregentime 0
-		duration -1
-		movetime 0
-		velocity 0
-	}
-
-	ninja {
-		sprite_body sprites.game.weapon_ninja_body
-		sprite_cursor sprites.game.weapon_ninja_cursor
-		sprite_proj sprites.game.weapon_ninja_proj
-		sprite_muzzles {
-			sprites.game.hadoken1
-			sprites.game.hadoken2
-			sprites.game.hadoken3
-		}
-		
-		nummuzzlesprites 3
-		muzzleoffsetx 40.0
-		muzzleoffsety -4.0
-		maxammo 0
-		recoil 0
-		firedelay 800
-		muzzleduration 0
-		visual_size 96
-		offsetx 0.0
-		offsety 0.0
-		meleedamage 9
-		meleereach 0
-		ammoregentime 0
-		duration 15000
-		movetime 200
-		velocity 50
-	}
-		
-}
-	
-sprites {
-
-	particles images.particles 8 8 {
-		part_slice 0 0 1 1
-		part_ball 1 0 1 1
-		part_splat01 2 0 1 1
-		part_splat02 3 0 1 1
-		part_splat03 4 0 1 1
-
-		part_smoke 0 1 1 1
-		part_shell 0 2 2 2
-		part_expl01 0 4 4 4
-		part_airjump 2 2 2 2
-	}
-
-	game images.game 32 16 {
-	
-		health_full 21 0 2 2
-		health_empty 23 0 2 2
-		armor_full 21 2 2 2
-		armor_empty 23 2 2 2
-		
-		star1 15 0 2 2
-		star2 17 0 2 2
-		star3 19 0 2 2
-			
-		part1 6 0 1 1
-		part2 6 1 1 1
-		part3 7 0 1 1
-		part4 7 1 1 1
-		part5 8 0 1 1
-		part6 8 1 1 1
-		part7 9 0 2 2
-		part8 11 0 2 2
-		part9 13 0 2 2
-	
-		weapon_gun_body 2 4 4 2
-		weapon_gun_cursor 0 4 2 2
-		weapon_gun_proj 6 4 2 2
-		weapon_gun_muzzle1 8 4 3 2
-		weapon_gun_muzzle2 12 4 3 2
-		weapon_gun_muzzle3 16 4 3 2
-		
-		weapon_shotgun_body 2 6 8 2
-		weapon_shotgun_cursor 0 6 2 2
-		weapon_shotgun_proj 10 6 2 2
-		weapon_shotgun_muzzle1 12 6 3 2
-		weapon_shotgun_muzzle2 16 6 3 2
-		weapon_shotgun_muzzle3 20 6 3 2
-		
-		weapon_grenade_body 2 8 7 2
-		weapon_grenade_cursor 0 8 2 2
-		weapon_grenade_proj 10 8 2 2
-
-		weapon_hammer_body 2 1 4 3
-		weapon_hammer_cursor 0 0 2 2
-		weapon_hammer_proj 0 0 0 0
-		
-		weapon_ninja_body 2 10 7 2
-		weapon_ninja_cursor 0 10 2 2
-		weapon_ninja_proj 0 0 0 0
-
-		weapon_rifle_body 2 12 7 3
-		weapon_rifle_cursor 0 12 2 2
-		weapon_rifle_proj 10 12 2 2
-		
-		hook_chain 2 0 1 1
-		hook_head 3 0 2 1
-		
-		hadoken1 25 0 7 4
-		hadoken2 25 4 7 4
-		hadoken3 25 8 7 4
-		
-		powerup_health 10 2 2 2
-		powerup_armor 12 2 2 2
-		powerup_weapon 3 0 6 2
-		powerup_ninja 3 10 7 2
-		powerup_timefield 3 0 6 2
-
-		flag_blue 12 8 4 8
-		flag_red 16 8 4 8
-
-	}
-	
-	tees images.null 8 4 {
-		tee_body 0 0 3 3
-		tee_body_outline 3 0 3 3
-		tee_foot 6 1 2 1
-		tee_foot_outline 6 2 2 1
-		tee_hand 6 0 1 1
-		tee_hand_outline 7 0 1 1
-		
-		tee_eye_normal 2 3 1 1
-		tee_eye_angry 3 3 1 1
-		tee_eye_pain 4 3 1 1
-		tee_eye_happy 5 3 1 1
-		tee_eye_dead 6 3 1 1
-		tee_eye_surprise 7 3 1 1
-	}
-
-	emoticons images.emoticons 4 4 {
-		oop 0 0 1 1
-		exclamation 1 0 1 1
-		hearts 2 0 1 1
-		drop 3 0 1 1
-		dotdot 0 1 1 1
-		music1 1 1 1 1
-		music2 2 1 1 1
-		ghost 3 1 1 1
-		sushi 0 2 1 1
-		splattee 1 2 1 1
-		deviltee 2 2 1 1
-		zomg 3 2 1 1
-		zzz 0 3 1 1
-		blank1 1 3 1 1
-		deadtee 2 3 1 1
-		blank2 3 3 1 1
-	}
-	
-	browseicons images.browseicons 4 1 {
-		browse_lock 0 0 1 1
-		browse_progress1 1 0 1 1
-		browse_progress2 2 0 1 1
-		browse_progress3 3 0 1 1
-	}
-}
-
-animations {
-	base {
-		body {
-			0.0 0 -4 0
-		}
-		
-		back_foot {
-			0.0 0 10 0
-		}
-		
-		front_foot {
-			0.0 0 10 0
-		}
-		
-		attach {
-		}
-	}
-
-	idle {
-		body {
-		}
-		
-		back_foot {
-			0.0 -7 0 0
-		}
-		
-		front_foot {
-			0.0  7 0 0
-		}
-		
-		attach {
-			0.0  0 0 0
-		}
-	}
-	
-	inair {
-		body {
-		}
-		
-		back_foot {
-			0.0 -3 0 -0.1
-		}
-		
-		front_foot {
-			0.0 3 0 -0.1
-		}
-		
-		attach {
-		}	
-	}
-
-	walk {
-		body {
-			0.0   0  0 0
-			0.2   0 -1 0
-			0.4   0  0 0
-			0.6   0  0 0
-			0.8   0 -1 0
-			1.0   0  0 0
-		}
-		
-		front_foot {
-			0.0   8  0 0
-			0.2  -8  0 0
-			0.4 -10 -4 0.2
-			0.6  -8 -8 0.3
-			0.8   4 -4 -0.2
-			1.0   8  0 0
-		}
-	
-		back_foot {
-			0.0 -10 -4 0.2
-			0.2  -8 -8 0.3
-			0.4  -4 -4 -0.2
-			0.6   0  0 0
-			0.8  -8  0 0
-			1.0 -10 -4 0.2
-		}
-		
-		attach {
-		}
-	}
-	
-	hammer_swing {
-		body {
-		}
-		
-		front_foot {
-		}
-	
-		back_foot {
-		}
-		
-		attach {
-			0.0 0 0 -0.10
-			0.3 0 0 0.25
-			0.4 0 0 0.30
-			0.5 0 0 0.25
-			1.0 0 0 -0.10
-		}
-	}	
-	ninja_swing {
-		body {
-		}
-		
-		front_foot {
-		}
-	
-		back_foot {
-		}
-		
-		attach {
-			0.0 0 0 -0.25
-			0.1 0 0 -0.05
-			0.15 0 0 0.35
-			0.42 0 0 0.4
-			0.5 0 0 0.35
-			1.0 0 0 -0.25
-		}
-	}	
-}
diff --git a/datasrc/datatypes.py b/datasrc/datatypes.py
index 9050b451..88678646 100644
--- a/datasrc/datatypes.py
+++ b/datasrc/datatypes.py
@@ -1,4 +1,164 @@
 
+	
+GlobalIdCounter = 0
+def GetID():
+	global GlobalIdCounter
+	GlobalIdCounter += 1
+	return GlobalIdCounter
+def GetUID():
+	return "x%d"%GetID()
+
+class BaseType:
+	def __init__(self, type_name):
+		self._type_name = type_name
+		self._target_name = "INVALID"
+		self._id = GetID() # this is used to remeber what order the members have in structures etc
+	
+	def Identifyer(self): return "x"+str(self._id)
+	def TargetName(self): return self._target_name
+	def TypeName(self): return self._type_name
+	def ID(self): return self._id;
+	
+	def EmitDeclaration(self, name):
+		return ["%s %s;"%(self.TypeName(), name)]
+	def EmitPreDefinition(self, target_name):
+		self._target_name = target_name
+		return []
+	def EmitDefinition(self, name):
+		return []
+
+class MemberType:
+	def __init__(self, name, var):
+		self.name = name
+		self.var = var
+		
+class Struct(BaseType):
+	def __init__(self, type_name):
+		BaseType.__init__(self, type_name)
+	def Members(self):
+		def sorter(a,b):
+			return a.var.ID()-b.var.ID()
+		m = []
+		for name in self.__dict__:
+			if name[0] == "_":
+				continue
+			m += [MemberType(name, self.__dict__[name])]
+		try:
+			m.sort(sorter)
+		except:
+			for v in m:
+				print v.name, v.var
+			sys.exit(-1)
+		return m
+		
+	def EmitTypeDeclaration(self, name):
+		lines = []
+		lines += ["struct " + self.TypeName()]
+		lines += ["{"]
+		for member in self.Members():
+			lines += ["\t"+l for l in member.var.EmitDeclaration(member.name)]
+		lines += ["};"]
+		return lines
+
+	def EmitPreDefinition(self, target_name):
+		BaseType.EmitPreDefinition(self, target_name)
+		lines = []
+		for member in self.Members():
+			lines += member.var.EmitPreDefinition(target_name+"."+member.name)
+		return lines
+	def EmitDefinition(self, name):
+		lines = ["/* %s */ {" % self.TargetName()]
+		for member in self.Members():
+			lines += ["\t" + " ".join(member.var.EmitDefinition("")) + ","]
+		lines += ["}"]
+		return lines
+		
+class Array(BaseType):
+	def __init__(self, type):
+		BaseType.__init__(self, type.TypeName())
+		self.type = type
+		self.items = []
+	def Add(self, instance):
+		if instance.TypeName() != self.type.TypeName():
+			error("bah")
+		self.items += [instance]
+	def EmitDeclaration(self, name):
+		return ["int num_%s;"%(name),
+			"%s *%s;"%(self.TypeName(), name)]
+	def EmitPreDefinition(self, target_name):
+		BaseType.EmitPreDefinition(self, target_name)
+
+		lines = []
+		i = 0
+		for item in self.items:
+			lines += item.EmitPreDefinition("%s[%d]"%(self.Identifyer(), i))
+			i += 1
+			
+		lines += ["static %s %s[] = {"%(self.TypeName(), self.Identifyer())]
+		for item in self.items:
+			itemlines = item.EmitDefinition("")
+			lines += ["\t" + " ".join(itemlines).replace("\t", " ") + ","]
+		lines += ["};"]
+		return lines
+	def EmitDefinition(self, name):
+		return [str(len(self.items))+","+self.Identifyer()]
+
+# Basic Types
+
+class Int(BaseType):
+	def __init__(self, value):
+		BaseType.__init__(self, "int")
+		self.value = value
+	def Set(self, value):
+		self.value = value
+	def EmitDefinition(self, name):
+		return ["%d"%self.value]
+		#return ["%d /* %s */"%(self.value, self._target_name)]
+		
+class Float(BaseType):
+	def __init__(self, value):
+		BaseType.__init__(self, "float")
+		self.value = value
+	def Set(self, value):
+		self.value = value
+	def EmitDefinition(self, name):
+		return ["%f"%self.value]
+		#return ["%d /* %s */"%(self.value, self._target_name)]
+		
+class String(BaseType):
+	def __init__(self, value):
+		BaseType.__init__(self, "const char*")
+		self.value = value
+	def Set(self, value):
+		self.value = value
+	def EmitDefinition(self, name):
+		return ['"'+self.value+'"']
+		
+class Pointer(BaseType):
+	def __init__(self, type, target):
+		BaseType.__init__(self, "%s*"%type().TypeName())
+		self.target = target
+	def Set(self, target):
+		self.target = target
+	def EmitDefinition(self, name):
+		return ["&"+self.target.TargetName()]
+
+# helper functions
+
+def EmitTypeDeclaration(root):
+	for l in root().EmitTypeDeclaration(""):
+		print l
+
+def EmitDefinition(root, name):
+	for l in root.EmitPreDefinition(name):
+		print l
+	print "%s %s = " % (root.TypeName(), name)
+	for l in root.EmitDefinition(name):
+		print l
+	print ";"
+
+# Network stuff after this
+
 class Object:
 	pass
 
@@ -52,6 +212,33 @@ class NetMessage(NetObject):
 		self.base_struct_name = "NETMSG_%s" % self.base.upper()
 		self.struct_name = "NETMSG_%s" % self.name.upper()
 		self.enum_name = "NETMSGTYPE_%s" % self.name.upper()
+	def emit_unpack(self):
+		lines = []
+		lines += ["static void *secure_unpack_%s()" % self.name]
+		lines += ["{"]
+		lines += ["\tstatic %s msg;" % self.struct_name]
+		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 += ["}"]
+		return lines
+	def emit_declaration(self):
+		extra = []
+		extra += ["\tvoid pack(int flags)"]
+		extra += ["\t{"]
+		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}"]
+		
+		
+		lines = NetObject.emit_declaration(self)
+		lines = lines[:-1] + extra + lines[-1:]
+		return lines
+		
 
 class NetVariable:
 	def __init__(self, name):
@@ -60,14 +247,28 @@ class NetVariable:
 		return []
 	def emit_validate(self):
 		return []
+	def emit_pack(self):
+		return []
+	def emit_unpack(self):
+		return []
+	def emit_unpack_check(self):
+		return []
 
 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]
+	def emit_pack(self):
+		return ["msg_pack_string(%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]
+	def emit_pack(self):
+		return ["msg_pack_int(%s);" % self.name]
 
 class NetIntRange(NetIntAny):
 	def __init__(self, name, min, max):
@@ -75,7 +276,9 @@ class NetIntRange(NetIntAny):
 		self.min = str(min)
 		self.max = str(max)
 	def emit_validate(self):
-		return ["netobj_clamp_int(obj->%s, %s %s)"%(self.name, self.min, self.max)]
+		return ["netobj_clamp_int(\"%s\", obj->%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)]
 
 class NetBool(NetIntRange):
 	def __init__(self, name):
diff --git a/datasrc/network.dts b/datasrc/network.dts
deleted file mode 100644
index ffa6dea4..00000000
--- a/datasrc/network.dts
+++ /dev/null
@@ -1,2 +0,0 @@
-const array:int sound = sounds.*
-const array:int weapon = weapons.*
diff --git a/datasrc/network.py b/datasrc/network.py
index 5029cbc1..6f03adb9 100644
--- a/datasrc/network.py
+++ b/datasrc/network.py
@@ -4,11 +4,33 @@ Emotes = ["NORMAL", "PAIN", "HAPPY", "SURPRISE", "ANGRY", "BLINK"]
 PlayerStates = ["UNKNOWN", "PLAYING", "IN_MENU", "CHATTING"]
 GameTypes = ["DM", "TDM", "CTF"]
 
-Enums = [Enum("GAMETYPE", GameTypes), Enum("PLAYERSTATE", PlayerStates), Enum("EMOTE", Emotes)]
+Emoticons = [str(x) for x in xrange(1,16)]
+
+Powerups = ["ARMOR", "HEALTH", "WEAPON", "NINJA"]
+
+RawHeader = '''
+enum
+{
+	INPUT_STATE_MASK=0x2f,
+};
+'''
+
+RawSource = '''
+#include <engine/e_common_interface.h>
+#include "g_protocol.h"
+'''
+
+Enums = [
+	Enum("GAMETYPE", GameTypes),
+	Enum("PLAYERSTATE", PlayerStates),
+	Enum("EMOTE", Emotes),
+	Enum("POWERUP", Powerups),
+	Enum("EMOTICON", Emoticons)
+]
 
 Objects = [
 
-	NetObject("PlayerInput", [
+	NetObject("Player_Input", [
 		NetIntAny("direction"),
 		NetIntAny("target_x"),
 		NetIntAny("target_y"),
@@ -77,7 +99,7 @@ Objects = [
 		NetIntAny("teamscore_blue"),
 	]),
 
-	NetObject("PlayerCore", [
+	NetObject("Player_Core", [
 		NetIntAny("x"),
 		NetIntAny("y"),
 		NetIntAny("vx"),
@@ -96,7 +118,18 @@ Objects = [
 		NetIntAny("hook_dy"),
 	]),
 
-	NetObject("PlayerCharacter:PlayerCore", [
+	NetObject("Player_Character:Player_Core", [
+		NetIntRange("player_state", 0, 'NUM_PLAYERSTATES-1'),
+		NetIntRange("wanted_direction", -1, 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'),
+	]),
+	
+	NetObject("Player_Info", [
 		NetIntRange("local", 0, 1),
 		NetIntRange("cid", 0, 'MAX_CLIENTS-1'),
 		NetIntRange("team", -1, 1),
@@ -108,26 +141,30 @@ Objects = [
 	
 	## Events
 	
-	NetEvent("CommonEvent", [
+	NetEvent("Common", [
 		NetIntAny("x"),
 		NetIntAny("y"),
 	]),
 	
 
-	NetEvent("Explosion:CommonEvent", []),
-	NetEvent("Spawn:CommonEvent", []),
-	NetEvent("Death:CommonEvent", []),
-	NetEvent("AirJump:CommonEvent", []),
+	NetEvent("Explosion:Common", []),
+	NetEvent("Spawn:Common", []),
+	
+	NetEvent("Death:Common", [
+		NetIntRange("cid", 0, 'MAX_CLIENTS-1'),
+	]),
+	
+	NetEvent("AirJump:Common", []),
 
-	NetEvent("SoundGlobal:CommonEvent", [
+	NetEvent("SoundGlobal:Common", [
 		NetIntRange("soundid", 0, 'NUM_SOUNDS-1'),
 	]),
 
-	NetEvent("SoundWorld:CommonEvent", [
+	NetEvent("SoundWorld:Common", [
 		NetIntRange("soundid", 0, 'NUM_SOUNDS-1'),
 	]),
 
-	NetEvent("DamageInd:CommonEvent", [
+	NetEvent("DamageInd:Common", [
 		NetIntAny("angle"),
 	]),
 ]
diff --git a/datasrc/server.dts b/datasrc/server.dts
deleted file mode 100644
index aa3e12fd..00000000
--- a/datasrc/server.dts
+++ /dev/null
@@ -1,25 +0,0 @@
-const array:int sound = sounds.*
-const array:int weapon = weapons.*
-const array:int powerup = powerups.*
-
-struct weapon {
-	int firedelay = firedelay@1
-	int meleedamage = meleedamage@1
-	int meleereach = meleereach@1
-	int ammoregentime = ammoregentime@1
-	int maxammo = maxammo@1
-	int duration = duration@1
-	int movetime = movetime@1
-	int velocity = velocity@1
-}
-
-struct powerupinf {
-	int amount = amount@1
-	int respawntime = respawntime@1
-	int startspawntime = startspawntime@1
-}
-
-struct data_container {
-	array:weapon weapons = weapons.*
-	array:powerupinf powerupinfo = powerups.*
-}
diff --git a/datasrc/teewars.dsd b/datasrc/teewars.dsd
deleted file mode 100644
index a95b960c..00000000
--- a/datasrc/teewars.dsd
+++ /dev/null
@@ -1,24 +0,0 @@
-tag:images {
-	ident:name * {
-		tag:filename string:filename
-	}
-}
-
-tag:sounds {
-	ident:name * {
-		tag:filename string:path
-	}
-}
-
-tag:weapons {
-	ident:name * {
-		tag:sprite_gun ptr:sprite
-		tag:sprite_cursor ptr:sprite
-	}
-}
-
-tag:sprites {
-	ident:name ptr:image int:gridx int:gridy * {
-		ident:name int:x int:y int:w int:h *
-	}
-}
diff --git a/default.bam b/default.bam
index 1bf44415..672f77c4 100644
--- a/default.bam
+++ b/default.bam
@@ -22,90 +22,18 @@ if not config:load("config.bam") then
 end
 
 -- data compiler
-dc_compiler = "python scripts/compiler.py"
-if family == "windows" then
-	dc_compiler = "scripts\\compiler.py"
-end
-
-netobj_compiler = "python scripts/netobj.py"
-if family == "windows" then
-	netobj_compiler = "scripts\\netobj.py"
-end
-
-dat2c_compiler = "python scripts/dat2c.py"
-if family == "windows" then
-	dat2c_compiler = "scripts\\dat2c.py"
-end
-
-cmd5_tool = "python scripts/cmd5.py"
-if family == "windows" then
-	cmd5_tool = "scripts\\cmd5.py"
-end
-
-function rc(output, input)
-	print("rc " .. PathFilename(input))
-	return os.execute("rc /fo " .. output .. " " .. input)
-end
-
-function cmd5(output, inputs)
-	cmd = cmd5_tool .. " "
-	for i,v in inputs do
-		cmd = cmd .. v .. " " 
+function Script(name)
+	if family == "windows" then
+		return str_replace(name, "/", "\\")
 	end
-	cmd = cmd .. " > " .. output
-	return {"cmd5 " .. PathFilename(output), cmd}
-end
-
-function dat2c(output, data, name)
-	return {
-		"dat2c " .. PathFilename(output) .. " = " .. PathFilename(data),
-		dat2c_compiler .. " " .. data .. " " .. name .. " > " .. output,
-	}
-end
-
-function dc_header(output, data, script)
-	return {
-		"dc_header " .. PathFilename(output) .. " = " .. PathFilename(data) .. " ~ " .. PathFilename(script),
-		dc_compiler .. " " .. data .. " " .. script .. " -h " .. output
-	}
-end
-
-function dc_source(output, data, script, headerfile)
-	cmd = dc_compiler .. " " .. data .. " " .. script .. " -s " .. output .. " " .. headerfile
-	return {
-		"dc_source " .. PathFilename(output) .. "+" .. PathFilename(headerfile) .. " = " .. PathFilename(data) .. " ~ " .. PathFilename(script),
-		cmd
-	}
-end
-
-function dc_data(output, data, script)
-	return {
-		"dc_data " .. PathFilename(output) .. " = " .. PathFilename(data) .. " ~ " .. PathFilename(script),
-		dc_compiler .. " " .. data .. " " .. script .. " -d " .. output
-	}
-end
-
-function dc_cdata(output, data, script)
-	return {
-		"dc_cdata " .. PathFilename(output) .. " = " .. PathFilename(data) .. " ~ " .. PathFilename(script),
-		dc_compiler .. " " .. data .. " " .. script .. " -c " .. output
-	}
-end
-
-function netobj_source(output, proto)
-	return {
-		"netobj source " .. PathFilename(output) .. " = " .. PathFilename(proto),
-		netobj_compiler .. " source " .. proto .. " " .. output
-	}
-end
-
-function netobj_header(output, proto)
-	return {
-		"netobj header " .. PathFilename(output) .. " = " .. PathFilename(proto),
-		netobj_compiler .. " header " .. proto .. " " .. output
-	}
+	return "python " .. name
 end
 
+--dc_compiler = Script("scripts/compiler.py")
+--netobj_compiler = Script("scripts/netobj.py")
+dat2c_compiler = Script("scripts/dat2c.py")
+cmd5_tool = Script("scripts/cmd5.py")
+content_compiler = Script("datasrc/compile.py")
 
 function CHash(output, ...)
 	local inputs = {}
@@ -114,11 +42,14 @@ function CHash(output, ...)
 	output = Path(output)
 	
 	-- compile all the files
+	local cmd = cmd5_tool .. " "
 	for index, inname in ih do
-		table.insert(inputs, Path(inname))
+		cmd = cmd .. Path(inname) .. " " 
 	end
 	
-	bam_add_job("cmd5", output, inputs)
+	cmd = cmd .. " > " .. output
+	
+	bam_add_job(output, "cmd5 " .. output, cmd)
 	for index, inname in inputs do
 		bam_add_dependency(output, inname)
 	end
@@ -128,7 +59,7 @@ end
 function ResCompile(scriptfile)
 	scriptfile = Path(scriptfile)
 	output = PathBase(scriptfile) .. ".res"
-	bam_add_job("rc", output, scriptfile)
+	bam_add_job(output, "rc " .. scriptfile, "rc /fo " .. output .. " " .. scriptfile)
 	bam_add_dependency(output, scriptfile)
 	return output
 end
@@ -136,81 +67,48 @@ end
 function Dat2c(datafile, sourcefile, arrayname)
 	datafile = Path(datafile)
 	sourcefile = Path(sourcefile)
-	bam_add_job("dat2c", sourcefile, datafile, arrayname)
+
+	bam_add_job(
+		sourcefile,
+		"dat2c " .. PathFilename(sourcefile) .. " = " .. PathFilename(datafile),
+		dat2c_compiler .. " " .. datafile .. " " .. arrayname .. " > " .. sourcefile
+	)
 	bam_add_dependency(sourcefile, datafile)
 	return sourcefile
 end
 
-function NetObjCompile(protofile, sourcefile, headerfile)
-	protofile = Path(protofile)
-	sourcefile = Path(sourcefile)
-	headerfile = Path(headerfile)
-	bam_add_job("netobj_source", sourcefile, protofile)
-	bam_add_job("netobj_header", headerfile, protofile)
-	bam_add_dependency(sourcefile, protofile)
-	bam_add_dependency(headerfile, protofile)
-	bam_dependency_cpp(sourcefile, {"src"})
-	return {source = sourcefile, header=headerfile}
+function ContentCompile(action, output)
+	output = Path(output)
+	bam_add_job(
+		output,
+		action .. " > " .. output,
+		Script("datasrc/compile.py") .. " " .. action .. " > " .. Path(output)
+	)
+	bam_add_dependency(output, Path("datasrc/content.py")) -- do this more proper
+	bam_add_dependency(output, Path("datasrc/network.py"))
+	bam_add_dependency(output, Path("datasrc/compile.py"))
+	bam_add_dependency(output, Path("datasrc/datatypes.py"))
+	return output
 end
 
-function DataCompile(datafile, scriptfile, headerfile, sourcefile, outputdatafile)
-	datafile = Path(datafile)
-	scriptfile = Path(scriptfile)
-	headerfile = Path(headerfile)
-
-	bam_add_job("dc_header", headerfile, datafile, scriptfile)
-	bam_add_dependency(headerfile, datafile)
-	bam_add_dependency(headerfile, scriptfile)
-	
-	if sourcefile then
-		sourcefile = Path(sourcefile)
-		bam_add_job("dc_source", sourcefile, datafile, scriptfile, headerfile)
-		bam_add_dependency(sourcefile, datafile)
-		bam_add_dependency(sourcefile, scriptfile)
-		bam_add_dependency(sourcefile, headerfile)
-	end
-		
-	if outputdatafile then
-		outputdatafile = Path(outputdatafile)
-		bam_add_job("dc_cdata", outputdatafile, datafile, scriptfile)
-		bam_add_dependency(outputdatafile, datafile)
-		bam_add_dependency(outputdatafile, scriptfile)
-	end
-		
-	return {cdata = outputdatafile, header=headerfile, source=sourcefile}
-end
+-- Content Compile
+network_source = ContentCompile("network_source", "src/game/generated/g_protocol.cpp")
+network_header = ContentCompile("network_header", "src/game/generated/g_protocol.h")
+client_content_source = ContentCompile("client_content_source", "src/game/generated/gc_data.cpp")
+client_content_header = ContentCompile("client_content_header", "src/game/generated/gc_data.h")
+server_content_source = ContentCompile("server_content_source", "src/game/generated/gs_data.cpp")
+server_content_header = ContentCompile("server_content_header", "src/game/generated/gs_data.h")
 
-serverdata = DataCompile(
-		"datasrc/data.ds", 
-		"datasrc/server.dts", 
-		"src/game/generated/gs_data.h",
-		"src/game/generated/gs_data.cpp",
-		"src/game/generated/gs_internaldata.cpp")
-
-clientdata = DataCompile(
-		"datasrc/data.ds", 
-		"datasrc/client.dts", 
-		"src/game/generated/gc_data.h",
-		"src/game/generated/gc_data.cpp",
-		"src/game/generated/gc_internaldata.cpp")
-
-networkdata = DataCompile(
-		"datasrc/data.ds", 
-		"datasrc/network.dts", 
-		"src/game/generated/g_protocol_ids.h",
-		"src/game/generated/g_protocol_ids.cpp")
-		
-netobj = NetObjCompile(
-		"src/game/g_protocol.def",
-		"src/game/generated/g_protocol.cpp",
-		"src/game/generated/g_protocol.h")
+bam_add_dependency(network_source, network_header)
+bam_add_dependency(client_content_source, client_content_header)
+bam_add_dependency(server_content_source, server_content_header)
 
 nethash = CHash(
 	"src/game/generated/nethash.c",
 	"src/engine/e_protocol.h",
 	"src/game/generated/g_protocol.h",
 	"src/game/g_tuning.h",
-	"src/game/g_game.cpp", networkdata.header)
+	"src/game/g_game.cpp", network_header)
 
 client_link_other = {}
 if config.compiler.value == "cl" then
@@ -402,9 +300,9 @@ function build(settings)
 	server = Compile(server_settings, Collect("src/engine/server/*.c"))
 	
 	masterserver = Compile(settings, Collect("src/mastersrv/*.cpp"))
-	game_shared = Compile(settings, Collect("src/game/*.cpp"), nethash, netobj.source)
-	game_client = Compile(settings, Collect("src/game/client/*.cpp"), clientdata.source, clientdata.cdata)
-	game_server = Compile(settings, Collect("src/game/server/*.cpp"), serverdata.source, serverdata.cdata)
+	game_shared = Compile(settings, Collect("src/game/*.cpp"), nethash, network_source)
+	game_client = Compile(settings, Collect("src/game/client/*.cpp"), client_content_source)
+	game_server = Compile(settings, Collect("src/game/server/*.cpp"), server_content_source)
 	game_editor = Compile(settings, Collect("src/game/editor/*.cpp"))
 
 	-- build tools (TODO: fix this so we don't get double _d_d stuff)
diff --git a/scripts/tw_api.py b/scripts/tw_api.py
index 9081063b..6ef0cc6a 100644
--- a/scripts/tw_api.py
+++ b/scripts/tw_api.py
@@ -84,15 +84,17 @@ def get_all_servers():
 		addr = "master%d.teeworlds.com"%i
 		list = get_servers(addr)
 		if list:
+			print addr, "had", len(list), "servers"
 			servers += list
 	return servers
 
 servers = get_all_servers()
 total_players = 0
-for server in servers:
-	print "checking server", server[0], server[1]
-	info = get_server_info(server[0], server[1])
-	if info:
-		total_players += len(info["players"])
+if 1:
+	for server in servers:
+		print "checking server", server[0], server[1]
+		info = get_server_info(server[0], server[1])
+		if info:
+			total_players += len(info["players"])
 
 print total_players, "on", len(servers), 'servers'
diff --git a/src/engine/client/ec_client.c b/src/engine/client/ec_client.c
index 6d3a400b..8872d5f4 100644
--- a/src/engine/client/ec_client.c
+++ b/src/engine/client/ec_client.c
@@ -770,7 +770,7 @@ static void client_process_packet(NETCHUNK *packet)
 	{
 		int sys;
 		int msg = msg_unpack_start(packet->data, packet->data_size, &sys);
-
+		
 		if(sys)
 		{
 			/* system message */
diff --git a/src/engine/e_network.c b/src/engine/e_network.c
index 9ebeba61..51fcbd75 100644
--- a/src/engine/e_network.c
+++ b/src/engine/e_network.c
@@ -19,7 +19,6 @@ CURRENT:
 		unsigned char flags_size; // 2bit flags, 6 bit size
 		unsigned char size_seq; // 4bit size, 4bit seq
 		(unsigned char seq;) // 8bit seq, if vital flag is set
-		
 */
 
 enum
@@ -216,6 +215,25 @@ struct NETCLIENT_t
 static IOHANDLE datalog = 0;
 static HUFFSTATE huffmanstate;
 
+#define COMPRESSION 0
+
+typedef struct pcap_hdr_s {
+        unsigned magic_number;   /* magic number */
+        short version_major;  /* major version number */
+        short version_minor;  /* minor version number */
+        int  thiszone;       /* GMT to local correction */
+        unsigned sigfigs;        /* accuracy of timestamps */
+        unsigned snaplen;        /* max length of captured packets, in octets */
+        unsigned network;        /* data link type */
+} pcap_hdr_t;
+
+typedef struct pcaprec_hdr_s {
+        unsigned ts_sec;         /* timestamp seconds */
+        unsigned ts_usec;        /* timestamp microseconds */
+        unsigned incl_len;       /* number of octets of packet saved in file */
+        unsigned orig_len;       /* actual length of packet */
+} pcaprec_hdr_t;
+
 /* packs the data tight and sends it */
 static void send_packet(NETSOCKET socket, NETADDR4 *addr, NETPACKETCONSTRUCT *packet)
 {
@@ -229,14 +247,14 @@ static void send_packet(NETSOCKET socket, NETADDR4 *addr, NETPACKETCONSTRUCT *pa
 		io_write(datalog, &packet->chunk_data, packet->data_size);
 	}
 	
-	if(1)
+	if(COMPRESSION)
 	{
 		int compressed_size = (huffman_compress(&huffmanstate, packet->chunk_data, packet->data_size, &buffer[4], NET_MAX_PACKETSIZE-4)+7)/8;
 		net_udp4_send(socket, addr, buffer, NET_PACKETHEADERSIZE+compressed_size);
 	}
 	else
 	{
-		mem_copy(&buffer[4], packet->chunk_data, packet->data_size);
+		mem_copy(&buffer[3], packet->chunk_data, packet->data_size);
 		net_udp4_send(socket, addr, buffer, NET_PACKETHEADERSIZE+packet->data_size);
 	}
 }
@@ -246,7 +264,10 @@ static int unpack_packet(unsigned char *buffer, int size, NETPACKETCONSTRUCT *pa
 {
 	/* check the size */
 	if(size < NET_PACKETHEADERSIZE || size > NET_MAX_PACKETSIZE)
+	{
+		dbg_msg("", "packet too small");
 		return -1;
+	}
 	
 	/* read the packet */
 	packet->flags = buffer[0]>>4;
@@ -254,12 +275,12 @@ static int unpack_packet(unsigned char *buffer, int size, NETPACKETCONSTRUCT *pa
 	packet->num_chunks = buffer[2];
 	packet->data_size = size - NET_PACKETHEADERSIZE;
 	
-	if(1)
+	if(COMPRESSION)
 	{
-		huffman_decompress(&huffmanstate, &buffer[4], packet->data_size, packet->chunk_data, sizeof(packet->chunk_data));
+		huffman_decompress(&huffmanstate, &buffer[3], packet->data_size, packet->chunk_data, sizeof(packet->chunk_data));
 	}
 	else
-		mem_copy(packet->chunk_data, &buffer[4], packet->data_size);
+		mem_copy(packet->chunk_data, &buffer[3], packet->data_size);
 	
 	/* return success */
 	return 0;
@@ -435,6 +456,7 @@ static void conn_send_control(NETCONNECTION *conn, int controlmsg, const void *e
 
 static void conn_resend(NETCONNECTION *conn)
 {
+	int resend_count = 0;
 	int max = 10;
 	RINGBUFFER_ITEM *item = conn->buffer.first;
 	while(item)
@@ -443,9 +465,12 @@ static void conn_resend(NETCONNECTION *conn)
 		conn_queue_chunk(conn, resend->flags|NET_CHUNKFLAG_RESEND, resend->data_size, resend->data);
 		item = item->next;
 		max--;
+		resend_count++;
 		if(!max)
 			break;
 	}
+	
+	dbg_msg("conn", "resent %d packets", resend_count);
 }
 
 static int conn_connect(NETCONNECTION *conn, NETADDR4 *addr)
diff --git a/src/engine/server/es_server.c b/src/engine/server/es_server.c
index 0d2200c3..ac1a79a1 100644
--- a/src/engine/server/es_server.c
+++ b/src/engine/server/es_server.c
@@ -226,6 +226,9 @@ void server_setclientname(int client_id, const char *name)
 	if(client_id < 0 || client_id > MAX_CLIENTS || clients[client_id].state < SRVCLIENT_STATE_READY)
 		return;
 		
+	if(!name)
+		return;
+		
 	str_copy(nametry, name, MAX_NAME_LENGTH);
 	if(server_try_setclientname(client_id, nametry))
 	{
diff --git a/src/game/client/gc_anim.h b/src/game/client/gc_anim.h
index 115f7353..f6e9aac3 100644
--- a/src/game/client/gc_anim.h
+++ b/src/game/client/gc_anim.h
@@ -1,14 +1,14 @@
 
-struct animstate
+struct ANIM_STATE
 {
-	keyframe body;
-	keyframe back_foot;
-	keyframe front_foot;
-	keyframe attach;
+	ANIM_KEYFRAME body;
+	ANIM_KEYFRAME back_foot;
+	ANIM_KEYFRAME front_foot;
+	ANIM_KEYFRAME attach;
 };
 
-void anim_seq_eval(sequence *seq, float time, keyframe *frame);
-void anim_eval(animation *anim, float time, animstate *state);
-void anim_add_keyframe(keyframe *seq, keyframe *added, float amount);
-void anim_add(animstate *state, animstate *added, float amount);
-void anim_eval_add(animstate *state, animation *anim, float time, float amount);
+void anim_seq_eval(ANIM_SEQUENCE *seq, float time, ANIM_KEYFRAME *frame);
+void anim_eval(ANIMATION *anim, float time, ANIM_STATE *state);
+void anim_add_keyframe(ANIM_KEYFRAME *seq, ANIM_KEYFRAME *added, float amount);
+void anim_add(ANIM_STATE *state, ANIM_STATE *added, float amount);
+void anim_eval_add(ANIM_STATE *state, ANIMATION *anim, float time, float amount);
diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp
index ae22a479..89c7ffcd 100644
--- a/src/game/client/gc_client.cpp
+++ b/src/game/client/gc_client.cpp
@@ -24,7 +24,7 @@ extern "C" {
 #include "gc_anim.h"
 #include "gc_console.h"
 
-struct data_container *data = 0;
+//struct data_container *data = 0;
 int64 debug_firedelay = 0;
 
 NETOBJ_PLAYER_INPUT input_data = {0};
@@ -39,7 +39,7 @@ int emoticon_selector_active = 0;
 int scoreboard_active = 0;
 static int emoticon_selected_emote = -1;
 
-tuning_params tuning;
+TUNING_PARAMS tuning;
 
 vec2 mouse_pos;
 vec2 local_character_pos;
@@ -53,12 +53,12 @@ const NETOBJ_FLAG *flags[2] = {0,0};
 const NETOBJ_GAME *gameobj = 0;
 */
 
-snapstate netobjects;
+SNAPSTATE netobjects;
 
 int picked_up_weapon = -1;
 
-client_data client_datas[MAX_CLIENTS];
-void client_data::update_render_info()
+CLIENT_DATA client_datas[MAX_CLIENTS];
+void CLIENT_DATA::update_render_info()
 {
 	render_info = skin_info;
 
@@ -82,7 +82,7 @@ int64 broadcast_time = 0;
 
 void snd_play_random(int chn, int setid, float vol, vec2 pos)
 {
-	soundset *set = &data->sounds[setid];
+	SOUNDSET *set = &data->sounds[setid];
 
 	if(!set->num_sounds)
 		return;
@@ -280,7 +280,7 @@ void chat_add_line(int client_id, int team, const char *line)
 }
 
 
-killmsg killmsgs[killmsg_max];
+KILLMSG killmsgs[killmsg_max];
 int killmsg_current = 0;
 
 //bool add_trail = false;
@@ -347,18 +347,18 @@ void line_input::process_input(INPUT_EVENT e)
 	}
 }
 
-input_stack_handler::input_stack_handler()
+INPUT_STACK_HANDLER::INPUT_STACK_HANDLER()
 {
 	num_handlers = 0;
 }
 
-void input_stack_handler::add_handler(callback cb, void *user)
+void INPUT_STACK_HANDLER::add_handler(CALLBACK cb, void *user)
 {
 	user_data[num_handlers] = user;
 	handlers[num_handlers++] = cb;
 }
 
-void input_stack_handler::dispatch_input()
+void INPUT_STACK_HANDLER::dispatch_input()
 {
 	for(int i = 0; i < inp_num_events(); i++)
 	{
@@ -378,7 +378,7 @@ void input_stack_handler::dispatch_input()
 }
 
 
-input_stack_handler input_stack;
+INPUT_STACK_HANDLER input_stack;
 
 extern int render_popup(const char *caption, const char *text, const char *button_text);
 
@@ -395,7 +395,7 @@ void process_events(int snaptype)
 			NETEVENT_DAMAGEIND *ev = (NETEVENT_DAMAGEIND *)data;
 			effect_damage_indicator(vec2(ev->x, ev->y), get_direction(ev->angle));
 		}
-		else if(item.type == NETEVENTTYPE_AIR_JUMP)
+		else if(item.type == NETEVENTTYPE_AIRJUMP)
 		{
 			NETEVENT_COMMON *ev = (NETEVENT_COMMON *)data;
 			effect_air_jump(vec2(ev->x, ev->y));
@@ -420,9 +420,9 @@ void process_events(int snaptype)
 			NETEVENT_DEATH *ev = (NETEVENT_DEATH *)data;
 			effect_playerdeath(vec2(ev->x, ev->y), ev->cid);
 		}
-		else if(item.type == NETEVENTTYPE_SOUND_WORLD)
+		else if(item.type == NETEVENTTYPE_SOUNDWORLD)
 		{
-			NETEVENT_SOUND_WORLD *ev = (NETEVENT_SOUND_WORLD *)data;
+			NETEVENT_SOUNDWORLD *ev = (NETEVENT_SOUNDWORLD *)data;
 			snd_play_random(CHN_WORLD, ev->soundid, 1.0f, vec2(ev->x, ev->y));
 		}
 	}
@@ -474,7 +474,7 @@ void send_kill(int client_id)
 	client_send_msg();
 }
 
-void anim_seq_eval(sequence *seq, float time, keyframe *frame)
+void anim_seq_eval(ANIM_SEQUENCE *seq, float time, ANIM_KEYFRAME *frame)
 {
 	if(seq->num_frames == 0)
 	{
@@ -490,8 +490,8 @@ void anim_seq_eval(sequence *seq, float time, keyframe *frame)
 	else
 	{
 		//time = max(0.0f, min(1.0f, time / duration)); // TODO: use clamp
-		keyframe *frame1 = 0;
-		keyframe *frame2 = 0;
+		ANIM_KEYFRAME *frame1 = 0;
+		ANIM_KEYFRAME *frame2 = 0;
 		float blend = 0.0f;
 
 		// TODO: make this smarter.. binary search
@@ -516,7 +516,7 @@ void anim_seq_eval(sequence *seq, float time, keyframe *frame)
 	}
 }
 
-void anim_eval(animation *anim, float time, animstate *state)
+void anim_eval(ANIMATION *anim, float time, ANIM_STATE *state)
 {
 	anim_seq_eval(&anim->body, time, &state->body);
 	anim_seq_eval(&anim->back_foot, time, &state->back_foot);
@@ -524,14 +524,14 @@ void anim_eval(animation *anim, float time, animstate *state)
 	anim_seq_eval(&anim->attach, time, &state->attach);
 }
 
-void anim_add_keyframe(keyframe *seq, keyframe *added, float amount)
+void anim_add_keyframe(ANIM_KEYFRAME *seq, ANIM_KEYFRAME *added, float amount)
 {
 	seq->x += added->x*amount;
 	seq->y += added->y*amount;
 	seq->angle += added->angle*amount;
 }
 
-void anim_add(animstate *state, animstate *added, float amount)
+void anim_add(ANIM_STATE *state, ANIM_STATE *added, float amount)
 {
 	anim_add_keyframe(&state->body, &added->body, amount);
 	anim_add_keyframe(&state->back_foot, &added->back_foot, amount);
@@ -539,9 +539,9 @@ void anim_add(animstate *state, animstate *added, float amount)
 	anim_add_keyframe(&state->attach, &added->attach, amount);
 }
 
-void anim_eval_add(animstate *state, animation *anim, float time, float amount)
+void anim_eval_add(ANIM_STATE *state, ANIMATION *anim, float time, float amount)
 {
-	animstate add;
+	ANIM_STATE add;
 	anim_eval(anim, time, &add);
 	anim_add(state, &add, amount);
 }
@@ -694,7 +694,7 @@ void render_spectators(float x, float y, float w)
 
 void render_scoreboard(float x, float y, float w, int team, const char *title)
 {
-	animstate idlestate;
+	ANIM_STATE idlestate;
 	anim_eval(&data->animations[ANIM_BASE], 0, &idlestate);
 	anim_eval_add(&idlestate, &data->animations[ANIM_IDLE], 0, 1.0f);
 
@@ -892,7 +892,7 @@ void render_game()
 	if(netobjects.local_info && netobjects.local_info->team == -1)
 		spectate = true;
 
-	animstate idlestate;
+	ANIM_STATE idlestate;
 	anim_eval(&data->animations[ANIM_BASE], 0, &idlestate);
 	anim_eval_add(&idlestate, &data->animations[ANIM_IDLE], 0, 1.0f);
 
@@ -1117,7 +1117,7 @@ void render_game()
 		// render cursor
 		if (!menu_active && !emoticon_selector_active)
 		{
-			select_sprite(data->weapons[netobjects.local_character->weapon%data->num_weapons].sprite_cursor);
+			select_sprite(data->weapons.id[netobjects.local_character->weapon%NUM_WEAPONS].sprite_cursor);
 			float cursorsize = 64;
 			draw_sprite(local_target_pos.x, local_target_pos.y, cursorsize);
 		}
@@ -1132,7 +1132,7 @@ void render_game()
 		gfx_mapscreen(0,0,300*gfx_screenaspect(),300);
 		
 		// if weaponstage is active, put a "glow" around the stage ammo
-		select_sprite(data->weapons[netobjects.local_character->weapon%data->num_weapons].sprite_proj);
+		select_sprite(data->weapons.id[netobjects.local_character->weapon%NUM_WEAPONS].sprite_proj);
 		for (int i = 0; i < min(netobjects.local_character->ammocount, 10); i++)
 			gfx_quads_drawTL(x+i*12,y+24,10,10);
 
@@ -1215,7 +1215,7 @@ void render_game()
 			{
 				gfx_texture_set(data->images[IMAGE_GAME].id);
 				gfx_quads_begin();
-				select_sprite(data->weapons[killmsgs[r].weapon].sprite_body);
+				select_sprite(data->weapons.id[killmsgs[r].weapon].sprite_body);
 				draw_sprite(x, y+28, 96);
 				gfx_quads_end();
 			}
@@ -1410,7 +1410,7 @@ void render_game()
 							const char *name = client_datas[id].name;
 							float w = gfx_text_width(0, 10, name, -1);
 							gfx_text(0, whole-40-5-w, 300-40-15+t*20+2, 10, name, -1);
-							tee_render_info info = client_datas[id].render_info;
+							TEE_RENDER_INFO info = client_datas[id].render_info;
 							info.size = 18.0f;
 							
 							render_tee(&idlestate, &info, EMOTE_NORMAL, vec2(1,0),
@@ -1588,11 +1588,11 @@ void render_game()
 			gfx_text(0, 150*gfx_screenaspect()-w/2, 35, 14, broadcast_text, -1);
 		}
 		
-		tuning_params standard_tuning;
+		TUNING_PARAMS standard_tuning;
 
 		// render warning about non standard tuning
 		bool flash = time_get()/(time_freq()/2)%2 == 0;
-		if(config.cl_warning_tuning && memcmp(&standard_tuning, &tuning, sizeof(tuning_params)) != 0)
+		if(config.cl_warning_tuning && memcmp(&standard_tuning, &tuning, sizeof(TUNING_PARAMS)) != 0)
 		{
 			const char *text = "Warning! Server is running non-standard tuning.";
 			if(flash)
diff --git a/src/game/client/gc_client.h b/src/game/client/gc_client.h
index 15df5dc2..bb8a69cf 100644
--- a/src/game/client/gc_client.h
+++ b/src/game/client/gc_client.h
@@ -13,14 +13,14 @@ enum
 	CHN_GLOBAL,
 };
 
-extern struct data_container *data;
+//extern struct data_container *data;
 
 extern vec2 mouse_pos;
 extern vec2 local_character_pos;
 extern vec2 local_target_pos;
 
 // snap pointers
-struct snapstate
+struct SNAPSTATE
 {
 	const NETOBJ_PLAYER_CHARACTER *local_character;
 	const NETOBJ_PLAYER_CHARACTER *local_prev_character;
@@ -33,7 +33,7 @@ struct snapstate
 	int num_players;
 };
 
-extern snapstate netobjects;
+extern SNAPSTATE netobjects;
 
 /*
 extern const NETOBJ_PLAYER_CHARACTER *local_character;
@@ -43,11 +43,11 @@ extern const NETOBJ_FLAG *flags[2];
 extern const NETOBJ_GAME *gameobj;
 * */
 
-extern tuning_params tuning;
+extern TUNING_PARAMS tuning;
 
 // predicted players
-extern player_core predicted_prev_player;
-extern player_core predicted_player;
+extern PLAYER_CORE predicted_prev_player;
+extern PLAYER_CORE predicted_player;
 
 // input
 extern NETOBJ_PLAYER_INPUT input_data;
@@ -112,13 +112,13 @@ public:
 	unsigned cursor_offset() const { return cursor_pos; }
 };
 
-class input_stack_handler
+class INPUT_STACK_HANDLER
 {
 public:
-	typedef bool (*callback)(INPUT_EVENT e, void *user);
+	typedef bool (*CALLBACK)(INPUT_EVENT e, void *user);
 	
-	input_stack_handler();
-	void add_handler(callback cb, void *user_data);
+	INPUT_STACK_HANDLER();
+	void add_handler(CALLBACK cb, void *user_data);
 	void dispatch_input();
 	
 private:
@@ -127,19 +127,19 @@ private:
 		MAX_HANDLERS=16
 	};
 	
-	callback handlers[MAX_HANDLERS];
+	CALLBACK handlers[MAX_HANDLERS];
 	void *user_data[MAX_HANDLERS];
 	int num_handlers;
 };
 
-extern input_stack_handler input_stack;
+extern INPUT_STACK_HANDLER input_stack;
 
 
 extern int emoticon_selector_active; // TODO: ugly
 extern int scoreboard_active; // TODO: ugly
 
 // client data
-struct client_data
+struct CLIENT_DATA
 {
 	char name[64];
 	char skin_name[64];
@@ -148,20 +148,20 @@ struct client_data
 	int team;
 	int emoticon;
 	int emoticon_start;
-	player_core predicted;
+	PLAYER_CORE predicted;
 	
-	tee_render_info skin_info; // this is what the server reports
-	tee_render_info render_info; // this is what we use
+	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();
 };
 
-extern client_data client_datas[MAX_CLIENTS];
+extern CLIENT_DATA client_datas[MAX_CLIENTS];
 
 // kill messages
-struct killmsg
+struct KILLMSG
 {
 	int weapon;
 	int victim;
@@ -171,7 +171,7 @@ struct killmsg
 };
 
 const int killmsg_max = 5;
-extern killmsg killmsgs[killmsg_max];
+extern KILLMSG killmsgs[killmsg_max];
 extern int killmsg_current;
 
 //
@@ -205,7 +205,7 @@ void effect_playerdeath(vec2 pos, int cid);
 void effect_powerupshine(vec2 pos, vec2 size);
 
 // particles
-struct particle
+struct PARTICLE
 {
 	void set_default()
 	{
@@ -255,7 +255,7 @@ enum
 	NUM_PARTGROUPS
 };
 
-void particle_add(int group, particle *part);
+void particle_add(int group, PARTICLE *part);
 void particle_render(int group);
 void particle_update(float time_passed);
 void particle_reset();
diff --git a/src/game/client/gc_effects.cpp b/src/game/client/gc_effects.cpp
index 79bac29e..5a9ebfc6 100644
--- a/src/game/client/gc_effects.cpp
+++ b/src/game/client/gc_effects.cpp
@@ -8,7 +8,7 @@ static bool add_100hz = false;
 
 void effect_air_jump(vec2 pos)
 {
-	particle p;
+	PARTICLE p;
 	p.set_default();
 	p.spr = SPRITE_PART_AIRJUMP;
 	p.pos = pos + vec2(-6.0f, 16.0f);
@@ -32,7 +32,7 @@ void effect_powerupshine(vec2 pos, vec2 size)
 	if(!add_50hz)
 		return;
 		
-	particle p;
+	PARTICLE p;
 	p.set_default();
 	p.spr = SPRITE_PART_SLICE;
 	p.pos = pos + vec2((frandom()-0.5f)*size.x, (frandom()-0.5f)*size.y);
@@ -53,7 +53,7 @@ void effect_smoketrail(vec2 pos, vec2 vel)
 	if(!add_50hz)
 		return;
 		
-	particle p;
+	PARTICLE p;
 	p.set_default();
 	p.spr = SPRITE_PART_SMOKE;
 	p.pos = pos;
@@ -72,7 +72,7 @@ void effect_skidtrail(vec2 pos, vec2 vel)
 	if(!add_100hz)
 		return;
 	
-	particle p;
+	PARTICLE p;
 	p.set_default();
 	p.spr = SPRITE_PART_SMOKE;
 	p.pos = pos;
@@ -91,7 +91,7 @@ void effect_bullettrail(vec2 pos)
 	if(!add_100hz)
 		return;
 		
-	particle p;
+	PARTICLE p;
 	p.set_default();
 	p.spr = SPRITE_PART_BALL;
 	p.pos = pos;
@@ -106,7 +106,7 @@ void effect_playerspawn(vec2 pos)
 {
 	for(int i = 0; i < 32; i++)
 	{
-		particle p;
+		PARTICLE p;
 		p.set_default();
 		p.spr = SPRITE_PART_SHELL;
 		p.pos = pos;
@@ -137,7 +137,7 @@ void effect_playerdeath(vec2 pos, int cid)
 	
 	for(int i = 0; i < 64; i++)
 	{
-		particle p;
+		PARTICLE p;
 		p.set_default();
 		p.spr = SPRITE_PART_SPLAT01 + (rand()%3);
 		p.pos = pos;
@@ -170,7 +170,7 @@ void effect_explosion(vec2 pos)
 		}
 		
 	// add the explosion
-	particle p;
+	PARTICLE p;
 	p.set_default();
 	p.spr = SPRITE_PART_EXPL01;
 	p.pos = pos;
@@ -183,7 +183,7 @@ void effect_explosion(vec2 pos)
 	// add the smoke
 	for(int i = 0; i < 24; i++)
 	{
-		particle p;
+		PARTICLE p;
 		p.set_default();
 		p.spr = SPRITE_PART_SMOKE;
 		p.pos = pos;
diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp
index 36e166d4..61e5f2e8 100644
--- a/src/game/client/gc_hooks.cpp
+++ b/src/game/client/gc_hooks.cpp
@@ -83,7 +83,7 @@ extern "C" void modc_init()
 	snd_set_channel(CHN_GLOBAL, 1.0f, 0.0f);
 
 	// load the data container
-	data = load_data_from_memory(internal_data);
+	//data = load_data_from_memory(internal_data);
 
 	// TODO: should be removed
 	snd_set_listener_pos(0.0f, 0.0f);
@@ -128,18 +128,18 @@ extern "C" void modc_shutdown()
 }
 
 
-player_core predicted_prev_player;
-player_core predicted_player;
+PLAYER_CORE predicted_prev_player;
+PLAYER_CORE predicted_player;
 static int predicted_tick = 0;
 static int last_new_predicted_tick = -1;
 
 extern "C" void modc_predict()
 {
-	player_core before_prev_player = predicted_prev_player;
-	player_core before_player = predicted_player;
+	PLAYER_CORE before_prev_player = predicted_prev_player;
+	PLAYER_CORE before_player = predicted_player;
 
 	// repredict player
-	world_core world;
+	WORLD_CORE world;
 	world.tuning = tuning;
 	int local_cid = -1;
 
@@ -271,10 +271,10 @@ extern "C" void modc_newsnapshot()
 		{
 			SNAP_ITEM item;
 			void *data = snap_get_item(SNAP_CURRENT, index, &item);
-			if(netobj_secure(item.type, data, item.datasize) != 0)
+			if(netobj_validate(item.type, data, item.datasize) != 0)
 			{
 				if(config.debug)
-					dbg_msg("game", "invalidated %d %d (%s) %d", index, item.type, netobj_get_name(item.type), item.id);
+					dbg_msg("game", "invalidated index=%d type=%d (%s) size=%d id=%d", index, item.type, netobj_get_name(item.type), item.datasize, item.id);
 				snap_invalidate_item(SNAP_CURRENT, index);
 			}
 		}
@@ -477,7 +477,7 @@ int64 server_motd_time = 0;
 extern "C" void modc_message(int msgtype)
 {
 	// special messages
-	if(msgtype == NETMSGTYPE_SV_EXTRA_PROJECTILE)
+	if(msgtype == NETMSGTYPE_SV_EXTRAPROJECTILE)
 	{
 		int num = msg_unpack_int();
 		
@@ -499,12 +499,12 @@ extern "C" void modc_message(int msgtype)
 		
 		return;
 	}
-	else if(msgtype == NETMSGTYPE_SV_TUNE_PARAMS)
+	else if(msgtype == NETMSGTYPE_SV_TUNEPARAMS)
 	{
 		// unpack the new tuning
-		tuning_params new_tuning;
+		TUNING_PARAMS new_tuning;
 		int *params = (int *)&new_tuning;
-		for(unsigned i = 0; i < sizeof(tuning_params)/sizeof(int); i++)
+		for(unsigned i = 0; i < sizeof(TUNING_PARAMS)/sizeof(int); i++)
 			params[i] = msg_unpack_int();
 
 		// check for unpacking errors
@@ -595,13 +595,13 @@ extern "C" void modc_message(int msgtype)
 
 		client_datas[msg->cid].update_render_info();
 	}
-    else if(msgtype == NETMSGTYPE_SV_WEAPON_PICKUP)
+    else if(msgtype == NETMSGTYPE_SV_WEAPONPICKUP)
     {
-    	NETMSG_SV_WEAPON_PICKUP *msg = (NETMSG_SV_WEAPON_PICKUP *)rawmsg;
+    	NETMSG_SV_WEAPONPICKUP *msg = (NETMSG_SV_WEAPONPICKUP *)rawmsg;
         if(config.cl_autoswitch_weapons)
         	input_data.wanted_weapon = msg->weapon+1;
     }
-	else if(msgtype == NETMSGTYPE_SV_READY_TO_ENTER)
+	else if(msgtype == NETMSGTYPE_SV_READYTOENTER)
 	{
 		client_entergame();
 	}
@@ -610,7 +610,7 @@ extern "C" void modc_message(int msgtype)
 		NETMSG_SV_KILLMSG *msg = (NETMSG_SV_KILLMSG *)rawmsg;
 		
 		// unpack messages
-		killmsg kill;
+		KILLMSG kill;
 		kill.killer = msg->killer;
 		kill.victim = msg->victim;
 		kill.weapon = msg->weapon;
@@ -629,9 +629,9 @@ extern "C" void modc_message(int msgtype)
 		client_datas[msg->cid].emoticon = msg->emoticon;
 		client_datas[msg->cid].emoticon_start = client_tick();
 	}
-	else if(msgtype == NETMSGTYPE_SV_SOUND_GLOBAL)
+	else if(msgtype == NETMSGTYPE_SV_SOUNDGLOBAL)
 	{
-		NETMSG_SV_SOUND_GLOBAL *msg = (NETMSG_SV_SOUND_GLOBAL *)rawmsg;
+		NETMSG_SV_SOUNDGLOBAL *msg = (NETMSG_SV_SOUNDGLOBAL *)rawmsg;
 		snd_play_random(CHN_GLOBAL, msg->soundid, 1.0f, vec2(0,0));
 	}
 }
diff --git a/src/game/client/gc_menu.cpp b/src/game/client/gc_menu.cpp
index 10319f0b..3a41aee4 100644
--- a/src/game/client/gc_menu.cpp
+++ b/src/game/client/gc_menu.cpp
@@ -25,7 +25,7 @@ extern "C" {
 #include "gc_client.h"
 #include <mastersrv/mastersrv.h>
 
-extern data_container *data;
+//extern data_container *data;
 
 extern bool menu_active;
 //extern bool menu_game_active;
@@ -959,7 +959,7 @@ static void menu2_render_serverbrowser(RECT main_view)
 	if (selected_server)
 	{
 		RECT row;
-		static char *labels[] = { "Version:", "Game Type:", "Progression:", "Ping:" };
+		static const char *labels[] = { "Version:", "Game Type:", "Progression:", "Ping:" };
 
 		RECT left_column;
 		RECT right_column;
@@ -977,7 +977,7 @@ static void menu2_render_serverbrowser(RECT main_view)
 		ui_do_label(&row, selected_server->version, font_size, -1);
 
 		ui_hsplit_t(&right_column, 15.0f, &row, &right_column);
-		static char *game_types[] = { "DM", "TDM", "CTF" };
+		static const char *game_types[] = { "DM", "TDM", "CTF" };
 		if (selected_server->game_type >= 0 && selected_server->game_type < (int)(sizeof(game_types)/sizeof(*game_types)))
 			ui_do_label(&row, game_types[selected_server->game_type], font_size, -1);
 
@@ -1285,7 +1285,7 @@ static void menu2_render_settings_player(RECT main_view)
 	if(start < 0)
 		start = 0;
 		
-	animstate state;
+	ANIM_STATE state;
 	anim_eval(&data->animations[ANIM_BASE], 0, &state);
 	anim_eval_add(&state, &data->animations[ANIM_IDLE], 0, 1.0f);
 	//anim_eval_add(&state, &data->animations[ANIM_WALK], fmod(client_localtime(), 1.0f), 1.0f);
@@ -1307,7 +1307,7 @@ static void menu2_render_settings_player(RECT main_view)
 		if(strcmp(s->name, config.player_skin) == 0)
 			selected = 1;
 		
-		tee_render_info info;
+		TEE_RENDER_INFO info;
 		info.texture = s->org_texture;
 		info.color_body = vec4(1,1,1,1);
 		info.color_feet = vec4(1,1,1,1);
@@ -1831,7 +1831,7 @@ int menu2_render()
 		gfx_mapscreen(0,0,10*4/3.0f,10);
 		gfx_clear(gui_color.r, gui_color.g, gui_color.b);
 		
-		animstate state;
+		ANIM_STATE state;
 		anim_eval(&data->animations[ANIM_BASE], 0, &state);
 		anim_eval_add(&state, &data->animations[ANIM_IDLE], 0, 1.0f);
 		//anim_eval_add(&state, &data->animations[ANIM_WALK], fmod(client_localtime(), 1.0f), 1.0f);
@@ -1846,7 +1846,7 @@ int menu2_render()
 				//int colors[2] = {65432, 9895832}; // NEW
 				int colors[2] = {65387, 10223467}; // NEW
 				
-				tee_render_info info;
+				TEE_RENDER_INFO info;
 				info.texture = skin_get(i)->color_texture;
 				info.color_feet = info.color_body = skin_get_color(colors[c]);
 				//info.color_feet = info.color_body = vec4(1,1,1,1);
diff --git a/src/game/client/gc_particles.cpp b/src/game/client/gc_particles.cpp
index a0b1ff92..2c3ef36c 100644
--- a/src/game/client/gc_particles.cpp
+++ b/src/game/client/gc_particles.cpp
@@ -9,7 +9,7 @@ enum
 	MAX_PARTICLES=1024*8,
 };
 
-static particle particles[MAX_PARTICLES];
+static PARTICLE particles[MAX_PARTICLES];
 static int first_free = -1;
 static int first_part[NUM_PARTGROUPS] = {-1};
 
@@ -31,7 +31,7 @@ void particle_reset()
 }
 
 
-void particle_add(int group, particle *part)
+void particle_add(int group, PARTICLE *part)
 {
 	if (first_free == -1)
 		return;
diff --git a/src/game/client/gc_render.cpp b/src/game/client/gc_render.cpp
index 91986b6f..364b33eb 100644
--- a/src/game/client/gc_render.cpp
+++ b/src/game/client/gc_render.cpp
@@ -14,7 +14,7 @@
 static float sprite_w_scale;
 static float sprite_h_scale;
 
-void select_sprite(sprite *spr, int flags, int sx, int sy)
+void select_sprite(SPRITE *spr, int flags, int sx, int sy)
 {
 	int x = spr->x+sx;
 	int y = spr->y+sy;
@@ -134,7 +134,7 @@ void ui_draw_rect(const RECT *r, vec4 color, int corners, float rounding)
 	gfx_quads_end();
 }
 
-void render_tee(animstate *anim, tee_render_info *info, int emote, vec2 dir, vec2 pos)
+void render_tee(ANIM_STATE *anim, TEE_RENDER_INFO *info, int emote, vec2 dir, vec2 pos)
 {
 	vec2 direction = dir;
 	vec2 position = pos;
@@ -196,7 +196,7 @@ void render_tee(animstate *anim, tee_render_info *info, int emote, vec2 dir, vec
 			}
 
 			// draw feet
-			keyframe *foot = f ? &anim->front_foot : &anim->back_foot;
+			ANIM_KEYFRAME *foot = f ? &anim->front_foot : &anim->back_foot;
 
 			float w = basesize;
 			float h = basesize/2;
@@ -433,11 +433,11 @@ static void render_items()
 		{
 			render_projectile((const NETOBJ_PROJECTILE *)data, item.id);
 		}
-		else if(item.type == NETOBJTYPE_POWERUP)
+		else if(item.type == NETOBJTYPE_PICKUP)
 		{
 			const void *prev = snap_find_item(SNAP_PREV, item.type, item.id);
 			if(prev)
-				render_powerup((const NETOBJ_POWERUP *)prev, (const NETOBJ_POWERUP *)data);
+				render_pickup((const NETOBJ_PICKUP *)prev, (const NETOBJ_PICKUP *)data);
 		}
 		else if(item.type == NETOBJTYPE_LASER)
 		{
diff --git a/src/game/client/gc_render.h b/src/game/client/gc_render.h
index b3439e93..508ab195 100644
--- a/src/game/client/gc_render.h
+++ b/src/game/client/gc_render.h
@@ -6,9 +6,9 @@
 #include "../g_mapitems.h"
 #include "gc_ui.h"
 
-struct tee_render_info
+struct TEE_RENDER_INFO
 {
-	tee_render_info()
+	TEE_RENDER_INFO()
 	{
 		texture = -1;
 		color_body = vec4(1,1,1,1);
@@ -36,9 +36,9 @@ enum
 	TILERENDERFLAG_EXTEND=4,
 };
 
-typedef struct sprite;
+typedef struct SPRITE;
 
-void select_sprite(sprite *spr, int flags=0, int sx=0, int sy=0);
+void select_sprite(SPRITE *spr, int flags=0, int sx=0, int sy=0);
 void select_sprite(int id, int flags=0, int sx=0, int sy=0);
 
 void draw_sprite(float x, float y, float size);
@@ -60,9 +60,9 @@ void render_particles();
 void render_tilemap_generate_skip();
 
 // object render methods (gc_render_obj.cpp)
-void render_tee(class animstate *anim, tee_render_info *info, int emote, vec2 dir, vec2 pos);
+void render_tee(class ANIM_STATE *anim, TEE_RENDER_INFO *info, int emote, vec2 dir, vec2 pos);
 void render_flag(const struct NETOBJ_FLAG *prev, const struct NETOBJ_FLAG *current);
-void render_powerup(const struct NETOBJ_POWERUP *prev, const struct NETOBJ_POWERUP *current);
+void render_pickup(const struct NETOBJ_PICKUP *prev, const struct NETOBJ_PICKUP *current);
 void render_projectile(const struct NETOBJ_PROJECTILE *current, int itemid);
 void render_laser(const struct NETOBJ_LASER *current);
 void render_player(
diff --git a/src/game/client/gc_render_obj.cpp b/src/game/client/gc_render_obj.cpp
index 580ca259..a6cd2b69 100644
--- a/src/game/client/gc_render_obj.cpp
+++ b/src/game/client/gc_render_obj.cpp
@@ -49,7 +49,7 @@ void render_projectile(const NETOBJ_PROJECTILE *current, int itemid)
 	vec2 pos = calc_pos(startpos, startvel, curvature, speed, ct);
 	vec2 prevpos = calc_pos(startpos, startvel, curvature, speed, ct-0.001f);
 
-	select_sprite(data->weapons[clamp(current->type, 0, NUM_WEAPONS-1)].sprite_proj);
+	select_sprite(data->weapons.id[clamp(current->type, 0, NUM_WEAPONS-1)].sprite_proj);
 	vec2 vel = pos-prevpos;
 	//vec2 pos = mix(vec2(prev->x, prev->y), vec2(current->x, current->y), client_intratick());
 	
@@ -78,7 +78,7 @@ void render_projectile(const NETOBJ_PROJECTILE *current, int itemid)
 	gfx_quads_end();
 }
 
-void render_powerup(const NETOBJ_POWERUP *prev, const NETOBJ_POWERUP *current)
+void render_pickup(const NETOBJ_PICKUP *prev, const NETOBJ_PICKUP *current)
 {
 	gfx_texture_set(data->images[IMAGE_GAME].id);
 	gfx_quads_begin();
@@ -88,21 +88,20 @@ void render_powerup(const NETOBJ_POWERUP *prev, const NETOBJ_POWERUP *current)
 	if (current->type == POWERUP_WEAPON)
 	{
 		angle = 0; //-pi/6;//-0.25f * pi * 2.0f;
-		select_sprite(data->weapons[clamp(current->subtype, 0, NUM_WEAPONS-1)].sprite_body);
-		size = data->weapons[clamp(current->subtype, 0, NUM_WEAPONS-1)].visual_size;
+		select_sprite(data->weapons.id[clamp(current->subtype, 0, NUM_WEAPONS-1)].sprite_body);
+		size = data->weapons.id[clamp(current->subtype, 0, NUM_WEAPONS-1)].visual_size;
 	}
 	else
 	{
 		const int c[] = {
-			SPRITE_POWERUP_HEALTH,
-			SPRITE_POWERUP_ARMOR,
-			SPRITE_POWERUP_WEAPON,
-			SPRITE_POWERUP_NINJA,
-			SPRITE_POWERUP_TIMEFIELD
+			SPRITE_PICKUP_HEALTH,
+			SPRITE_PICKUP_ARMOR,
+			SPRITE_PICKUP_WEAPON,
+			SPRITE_PICKUP_NINJA
 			};
 		select_sprite(c[current->type]);
 
-		if(c[current->type] == SPRITE_POWERUP_NINJA)
+		if(c[current->type] == SPRITE_PICKUP_NINJA)
 		{
 			effect_powerupshine(pos, vec2(96,18));
 			size *= 2.0f;
@@ -157,7 +156,7 @@ void render_laser(const struct NETOBJ_LASER *current)
 	vec2 from = vec2(current->from_x, current->from_y);
 	vec2 dir = normalize(pos-from);
 
-	float ticks = client_tick() + client_intratick() - current->eval_tick;
+	float ticks = client_tick() + client_intratick() - current->start_tick;
 	float ms = (ticks/50.0f) * 1000.0f;
 	float a =  ms / tuning.laser_bounce_delay;
 	a = clamp(a, 0.0f, 1.0f);
@@ -222,7 +221,7 @@ void render_laser(const struct NETOBJ_LASER *current)
 
 
 
-static void render_hand(tee_render_info *info, vec2 center_pos, vec2 dir, float angle_offset, vec2 post_rot_offset)
+static void render_hand(TEE_RENDER_INFO *info, vec2 center_pos, vec2 dir, float angle_offset, vec2 post_rot_offset)
 {
 	// for drawing hand
 	//const skin *s = skin_get(skin_id);
@@ -278,7 +277,7 @@ void render_player(
 	player = *player_char;
 
 	NETOBJ_PLAYER_INFO info = *player_info;
-	tee_render_info render_info = client_datas[info.cid].render_info;
+	TEE_RENDER_INFO render_info = client_datas[info.cid].render_info;
 
 	// check for teamplay modes
 	bool is_teamplay = false;
@@ -353,7 +352,7 @@ void render_player(
 
 	// evaluate animation
 	float walk_time = fmod(position.x, 100.0f)/100.0f;
-	animstate state;
+	ANIM_STATE state;
 	anim_eval(&data->animations[ANIM_BASE], 0, &state);
 
 	if(inair)
@@ -445,7 +444,7 @@ void render_player(
 
 		// normal weapons
 		int iw = clamp(player.weapon, 0, NUM_WEAPONS-1);
-		select_sprite(data->weapons[iw].sprite_body, direction.x < 0 ? SPRITE_FLAG_FLIP_Y : 0);
+		select_sprite(data->weapons.id[iw].sprite_body, direction.x < 0 ? SPRITE_FLAG_FLIP_Y : 0);
 
 		vec2 dir = direction;
 		float recoil = 0.0f;
@@ -454,28 +453,28 @@ void render_player(
 		{
 			// Static position for hammer
 			p = position + vec2(state.attach.x, state.attach.y);
-			p.y += data->weapons[iw].offsety;
+			p.y += data->weapons.id[iw].offsety;
 			// if attack is under way, bash stuffs
 			if(direction.x < 0)
 			{
 				gfx_quads_setrotation(-pi/2-state.attach.angle*pi*2);
-				p.x -= data->weapons[iw].offsetx;
+				p.x -= data->weapons.id[iw].offsetx;
 			}
 			else
 			{
 				gfx_quads_setrotation(-pi/2+state.attach.angle*pi*2);
 			}
-			draw_sprite(p.x, p.y, data->weapons[iw].visual_size);
+			draw_sprite(p.x, p.y, data->weapons.id[iw].visual_size);
 		}
 		else if (player.weapon == WEAPON_NINJA)
 		{
 			p = position;
-			p.y += data->weapons[iw].offsety;
+			p.y += data->weapons.id[iw].offsety;
 
 			if(direction.x < 0)
 			{
 				gfx_quads_setrotation(-pi/2-state.attach.angle*pi*2);
-				p.x -= data->weapons[iw].offsetx;
+				p.x -= data->weapons.id[iw].offsetx;
 				effect_powerupshine(p+vec2(32,0), vec2(32,12));
 			}
 			else
@@ -483,24 +482,24 @@ void render_player(
 				gfx_quads_setrotation(-pi/2+state.attach.angle*pi*2);
 				effect_powerupshine(p-vec2(32,0), vec2(32,12));
 			}
-			draw_sprite(p.x, p.y, data->weapons[iw].visual_size);
+			draw_sprite(p.x, p.y, data->weapons.id[iw].visual_size);
 
 			// HADOKEN
-			if ((client_tick()-player.attacktick) <= (SERVER_TICK_SPEED / 6) && data->weapons[iw].nummuzzlesprites)
+			if ((client_tick()-player.attacktick) <= (SERVER_TICK_SPEED / 6) && data->weapons.id[iw].num_sprite_muzzles)
 			{
-				int itex = rand() % data->weapons[iw].nummuzzlesprites;
+				int itex = rand() % data->weapons.id[iw].num_sprite_muzzles;
 				float alpha = 1.0f;
-				if (alpha > 0.0f && data->weapons[iw].sprite_muzzle[itex].psprite)
+				if (alpha > 0.0f && data->weapons.id[iw].sprite_muzzles[itex])
 				{
 					vec2 dir = vec2(player_char->x,player_char->y) - vec2(prev_char->x, prev_char->y);
 					dir = normalize(dir);
 					float hadokenangle = get_angle(dir);
 					gfx_quads_setrotation(hadokenangle);
 					//float offsety = -data->weapons[iw].muzzleoffsety;
-					select_sprite(data->weapons[iw].sprite_muzzle[itex].psprite, 0);
+					select_sprite(data->weapons.id[iw].sprite_muzzles[itex], 0);
 					vec2 diry(-dir.y,dir.x);
 					p = position;
-					float offsetx = data->weapons[iw].muzzleoffsetx;
+					float offsetx = data->weapons.id[iw].muzzleoffsetx;
 					p -= dir * offsetx;
 					draw_sprite(p.x, p.y, 160.0f);
 				}
@@ -513,36 +512,37 @@ void render_player(
 			float a = (client_tick()-player.attacktick+intratick)/5.0f;
 			if(a < 1)
 				recoil = sinf(a*pi);
-			p = position + dir * data->weapons[iw].offsetx - dir*recoil*10.0f;
-			p.y += data->weapons[iw].offsety;
-			draw_sprite(p.x, p.y, data->weapons[iw].visual_size);
+			p = position + dir * data->weapons.id[iw].offsetx - dir*recoil*10.0f;
+			p.y += data->weapons.id[iw].offsety;
+			draw_sprite(p.x, p.y, data->weapons.id[iw].visual_size);
 		}
 
 		if (player.weapon == WEAPON_GUN || player.weapon == WEAPON_SHOTGUN)
 		{
 			// check if we're firing stuff
-			if (true)//prev.attackticks)
+			if(data->weapons.id[iw].num_sprite_muzzles)//prev.attackticks)
 			{
 				float alpha = 0.0f;
 				int phase1tick = (client_tick() - player.attacktick);
-				if (phase1tick < (data->weapons[iw].muzzleduration + 3))
+				if (phase1tick < (data->weapons.id[iw].muzzleduration + 3))
 				{
-					float t = ((((float)phase1tick) + intratick)/(float)data->weapons[iw].muzzleduration);
+					float t = ((((float)phase1tick) + intratick)/(float)data->weapons.id[iw].muzzleduration);
 					alpha = LERP(2.0, 0.0f, min(1.0f,max(0.0f,t)));
 				}
 
-				int itex = rand() % data->weapons[iw].nummuzzlesprites;
-				if (alpha > 0.0f && data->weapons[iw].sprite_muzzle[itex].psprite)
+				int itex = rand() % data->weapons.id[iw].num_sprite_muzzles;
+				if (alpha > 0.0f && data->weapons.id[iw].sprite_muzzles[itex])
 				{
-					float offsety = -data->weapons[iw].muzzleoffsety;
-					select_sprite(data->weapons[iw].sprite_muzzle[itex].psprite, direction.x < 0 ? SPRITE_FLAG_FLIP_Y : 0);
+					float offsety = -data->weapons.id[iw].muzzleoffsety;
+					select_sprite(data->weapons.id[iw].sprite_muzzles[itex], direction.x < 0 ? SPRITE_FLAG_FLIP_Y : 0);
 					if(direction.x < 0)
 						offsety = -offsety;
 
 					vec2 diry(-dir.y,dir.x);
-					vec2 muzzlepos = p + dir * data->weapons[iw].muzzleoffsetx + diry * offsety;
+					vec2 muzzlepos = p + dir * data->weapons.id[iw].muzzleoffsetx + diry * offsety;
 
-					draw_sprite(muzzlepos.x, muzzlepos.y, data->weapons[iw].visual_size);
+					dbg_msg("", "%d", data->weapons.id[iw].num_sprite_muzzles);
+					draw_sprite(muzzlepos.x, muzzlepos.y, data->weapons.id[iw].visual_size);
 				}
 			}
 		}
@@ -561,7 +561,7 @@ void render_player(
 	if(info.local && config.debug)
 	{
 		vec2 ghost_position = mix(vec2(prev_char->x, prev_char->y), vec2(player_char->x, player_char->y), client_intratick());
-		tee_render_info ghost = render_info;
+		TEE_RENDER_INFO ghost = render_info;
 		ghost.color_body.a = 0.5f;
 		ghost.color_feet.a = 0.5f;
 		render_tee(&state, &ghost, player.emote, direction, ghost_position); // render ghost
diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp
index 8b514c88..3632a034 100644
--- a/src/game/editor/ed_editor.cpp
+++ b/src/game/editor/ed_editor.cpp
@@ -139,7 +139,7 @@ int LAYERGROUP::swap_layers(int index0, int index1)
 	return index1;
 }
 
-void IMAGE::analyse_tileflags()
+void EDITOR_IMAGE::analyse_tileflags()
 {
 	mem_zero(tileflags, sizeof(tileflags));
 	
@@ -1470,11 +1470,11 @@ static void extract_name(const char *filename, char *name)
 
 static void replace_image(const char *filename)
 {
-	IMAGE imginfo;
+	EDITOR_IMAGE imginfo;
 	if(!gfx_load_png(&imginfo, filename))
 		return;
 	
-	IMAGE *img = editor.map.images[editor.selected_image];
+	EDITOR_IMAGE *img = editor.map.images[editor.selected_image];
 	gfx_unload_texture(img->tex_id);
 	*img = imginfo;
 	extract_name(filename, img->name);
@@ -1483,11 +1483,11 @@ static void replace_image(const char *filename)
 
 static void add_image(const char *filename)
 {
-	IMAGE imginfo;
+	EDITOR_IMAGE imginfo;
 	if(!gfx_load_png(&imginfo, filename))
 		return;
 
-	IMAGE *img = new IMAGE;
+	EDITOR_IMAGE *img = new EDITOR_IMAGE;
 	*img = imginfo;
 	img->tex_id = gfx_load_texture_raw(imginfo.width, imginfo.height, imginfo.format, imginfo.data, IMG_AUTO, 0);
 	img->external = 1; // external by default
@@ -1513,7 +1513,7 @@ static int popup_image(RECT view)
 	RECT slot;
 	ui_hsplit_t(&view, 2.0f, &slot, &view);
 	ui_hsplit_t(&view, 12.0f, &slot, &view);
-	IMAGE *img = editor.map.images[editor.selected_image];
+	EDITOR_IMAGE *img = editor.map.images[editor.selected_image];
 	
 	static int external_button = 0;
 	if(img->external)
diff --git a/src/game/editor/ed_editor.hpp b/src/game/editor/ed_editor.hpp
index 23dbd382..62f8871a 100644
--- a/src/game/editor/ed_editor.hpp
+++ b/src/game/editor/ed_editor.hpp
@@ -217,10 +217,10 @@ public:
 	}
 };
 
-class IMAGE : public IMAGE_INFO
+class EDITOR_IMAGE : public IMAGE_INFO
 {
 public:
-	IMAGE()
+	EDITOR_IMAGE()
 	{
 		tex_id = -1;
 		name[0] = 0;
@@ -231,7 +231,7 @@ public:
 		format = 0;
 	}
 	
-	~IMAGE()
+	~EDITOR_IMAGE()
 	{
 		gfx_unload_texture(tex_id);
 	}
@@ -255,7 +255,7 @@ public:
 	}
 
 	array<LAYERGROUP*> groups;
-	array<IMAGE*> images;
+	array<EDITOR_IMAGE*> images;
 	array<ENVELOPE*> envelopes;
 	
 	class LAYER_GAME *game_layer;
diff --git a/src/game/editor/ed_io.cpp b/src/game/editor/ed_io.cpp
index 9e0cd4a3..b27dd25e 100644
--- a/src/game/editor/ed_io.cpp
+++ b/src/game/editor/ed_io.cpp
@@ -133,7 +133,7 @@ void editor_load_old(DATAFILE *df, MAP *map)
 			mapres_image *imgres = (mapres_image *)datafile_get_item(df, start+i, 0, 0);
 			void *data = datafile_get_data(df, imgres->image_data);
 
-			IMAGE *img = new IMAGE;
+			EDITOR_IMAGE *img = new EDITOR_IMAGE;
 			img->width = imgres->width;
 			img->height = imgres->height;
 			img->format = IMG_RGBA;
@@ -213,7 +213,7 @@ int MAP::save(const char *filename)
 	// save images
 	for(int i = 0; i < images.len(); i++)
 	{
-		IMAGE *img = images[i];
+		EDITOR_IMAGE *img = images[i];
 		
 		// analyse the image for when saving (should be done when we load the image)
 		// TODO!
@@ -392,7 +392,7 @@ int MAP::load(const char *filename)
 				char *name = (char *)datafile_get_data(df, item->image_name);
 
 				// copy base info				
-				IMAGE *img = new IMAGE;
+				EDITOR_IMAGE *img = new EDITOR_IMAGE;
 				img->external = item->external;
 
 				if(item->external)
@@ -401,7 +401,7 @@ int MAP::load(const char *filename)
 					sprintf(buf, "data/mapres/%s.png", name);
 					
 					// load external
-					IMAGE imginfo;
+					EDITOR_IMAGE imginfo;
 					if(gfx_load_png(&imginfo, buf))
 					{
 						*img = imginfo;
diff --git a/src/game/g_game.cpp b/src/game/g_game.cpp
index 71ddc1a2..b5b37918 100644
--- a/src/game/g_game.cpp
+++ b/src/game/g_game.cpp
@@ -2,7 +2,7 @@
 #include <string.h>
 #include "g_game.h"
 
-const char *tuning_params::names[] =
+const char *TUNING_PARAMS::names[] =
 {
 	#define MACRO_TUNING_PARAM(name,value) #name,
 	#include "g_tuning.h"
@@ -10,7 +10,7 @@ const char *tuning_params::names[] =
 };
 
 
-bool tuning_params::set(int index, float value)
+bool TUNING_PARAMS::set(int index, float value)
 {
 	if(index < 0 || index >= num())
 		return false;
@@ -18,7 +18,7 @@ bool tuning_params::set(int index, float value)
 	return true;
 }
 
-bool tuning_params::get(int index, float *value)
+bool TUNING_PARAMS::get(int index, float *value)
 {
 	if(index < 0 || index >= num())
 		return false;
@@ -26,7 +26,7 @@ bool tuning_params::get(int index, float *value)
 	return true;
 }
 
-bool tuning_params::set(const char *name, float value)
+bool TUNING_PARAMS::set(const char *name, float value)
 {
 	for(int i = 0; i < num(); i++)
 		if(strcmp(name, names[i]) == 0)
@@ -34,7 +34,7 @@ bool tuning_params::set(const char *name, float value)
 	return false;
 }
 
-bool tuning_params::get(const char *name, float *value)
+bool TUNING_PARAMS::get(const char *name, float *value)
 {
 	for(int i = 0; i < num(); i++)
 		if(strcmp(name, names[i]) == 0)
@@ -166,7 +166,7 @@ float velocity_ramp(float value, float start, float range, float curvature)
 	return 1.0f/pow(curvature, (value-start)/range);
 }
 
-void player_core::reset()
+void PLAYER_CORE::reset()
 {
 	pos = vec2(0,0);
 	vel = vec2(0,0);
@@ -179,7 +179,7 @@ void player_core::reset()
 	triggered_events = 0;
 }
 
-void player_core::tick()
+void PLAYER_CORE::tick()
 {
 	float phys_size = 28.0f;
 	triggered_events = 0;
@@ -273,7 +273,7 @@ void player_core::tick()
 			// Check against other players first
 			for(int i = 0; i < MAX_CLIENTS; i++)
 			{
-				player_core *p = world->players[i];
+				PLAYER_CORE *p = world->players[i];
 				if(!p || p == this)
 					continue;
 
@@ -312,7 +312,7 @@ void player_core::tick()
 	{
 		if(hooked_player != -1)
 		{
-			player_core *p = world->players[hooked_player];
+			PLAYER_CORE *p = world->players[hooked_player];
 			if(p)
 				hook_pos = p->pos;
 			else
@@ -366,7 +366,7 @@ void player_core::tick()
 	{
 		for(int i = 0; i < MAX_CLIENTS; i++)
 		{
-			player_core *p = world->players[i];
+			PLAYER_CORE *p = world->players[i];
 			if(!p)
 				continue;
 			
@@ -414,7 +414,7 @@ void player_core::tick()
 		vel = normalize(vel) * 6000;
 }
 
-void player_core::move()
+void PLAYER_CORE::move()
 {
 	float rampvalue = velocity_ramp(length(vel)*50, world->tuning.velramp_start, world->tuning.velramp_range, world->tuning.velramp_curvature);
 	
@@ -423,7 +423,7 @@ void player_core::move()
 	vel.x = vel.x*(1.0f/rampvalue);
 }
 
-void player_core::write(NETOBJ_PLAYER_CORE *obj_core)
+void PLAYER_CORE::write(NETOBJ_PLAYER_CORE *obj_core)
 {
 	obj_core->x = (int)pos.x;
 	obj_core->y = (int)pos.y;
@@ -450,7 +450,7 @@ void player_core::write(NETOBJ_PLAYER_CORE *obj_core)
 	obj_core->angle = (int)(a*256.0f);
 }
 
-void player_core::read(const NETOBJ_PLAYER_CORE *obj_core)
+void PLAYER_CORE::read(const NETOBJ_PLAYER_CORE *obj_core)
 {
 	pos.x = obj_core->x;
 	pos.y = obj_core->y;
@@ -466,7 +466,7 @@ void player_core::read(const NETOBJ_PLAYER_CORE *obj_core)
 	jumped = obj_core->jumped;
 }
 
-void player_core::quantize()
+void PLAYER_CORE::quantize()
 {
 	NETOBJ_PLAYER_CORE c;
 	write(&c);
diff --git a/src/game/g_game.h b/src/game/g_game.h
index 9803d6a2..414dfdbf 100644
--- a/src/game/g_game.h
+++ b/src/game/g_game.h
@@ -9,9 +9,9 @@
 #include "g_collision.h"
 #include "g_protocol.h"
 
-struct tuning_params
+struct TUNING_PARAMS
 {
-	tuning_params()
+	TUNING_PARAMS()
 	{
 		const float ticks_per_second = 50.0f;
 		#define MACRO_TUNING_PARAM(name,value) name.set((int)(value*100.0f));
@@ -25,7 +25,7 @@ struct tuning_params
 	#include "g_tuning.h"
 	#undef MACRO_TUNING_PARAM
 	
-	static int num() { return sizeof(tuning_params)/sizeof(int); }
+	static int num() { return sizeof(TUNING_PARAMS)/sizeof(int); }
 	bool set(int index, float value);
 	bool set(const char *name, float value);
 	bool get(int index, float *value);
@@ -109,22 +109,22 @@ enum
 	COREEVENT_HOOK_RETRACT=0x20,
 };
 
-class world_core
+class WORLD_CORE
 {
 public:
-	world_core()
+	WORLD_CORE()
 	{
 		mem_zero(players, sizeof(players));
 	}
 	
-	tuning_params tuning;
-	class player_core *players[MAX_CLIENTS];
+	TUNING_PARAMS tuning;
+	class PLAYER_CORE *players[MAX_CLIENTS];
 };
 
-class player_core
+class PLAYER_CORE
 {
 public:
-	world_core *world;
+	WORLD_CORE *world;
 	
 	vec2 pos;
 	vec2 vel;
diff --git a/src/game/server/gs_common.h b/src/game/server/gs_common.h
index efebe384..6b307cdf 100644
--- a/src/game/server/gs_common.h
+++ b/src/game/server/gs_common.h
@@ -3,7 +3,7 @@
 #include "../generated/gs_data.h"
 
 
-extern tuning_params tuning;
+extern TUNING_PARAMS tuning;
 
 void create_sound_global(int sound, int target=-1);
 
@@ -13,7 +13,7 @@ inline int cmask_all_except_one(int cid) { return 0x7fffffff^cmask_one(cid); }
 inline bool cmask_is_set(int mask, int cid) { return (mask&cmask_one(cid)) != 0; }
 
 //
-class event_handler
+class EVENT_HANDLER
 {
 	static const int MAX_EVENTS = 128;
 	static const int MAX_DATASIZE = 128*64;
@@ -27,25 +27,25 @@ class event_handler
 	int current_offset;
 	int num_events;
 public:
-	event_handler();
+	EVENT_HANDLER();
 	void *create(int type, int size, int mask = -1);
 	void clear();
 	void snap(int snapping_client);
 };
 
-extern event_handler events;
+extern EVENT_HANDLER events;
 
 // a basic entity
-class entity
+class ENTITY
 {
 private:
-	friend class game_world;
-	friend class player;
-	entity *prev_entity;
-	entity *next_entity;
+	friend class GAMEWORLD; // thy these?
+	friend class PLAYER;
+	ENTITY *prev_entity;
+	ENTITY *next_entity;
 
-	entity *prev_type_entity;
-	entity *next_type_entity;
+	ENTITY *prev_type_entity;
+	ENTITY *next_type_entity;
 protected:
 	int id;
 public:
@@ -60,8 +60,8 @@ public:
 		FLAG_PHYSICS=0x00000002,
 	};
 	
-	entity(int objtype);
-	virtual ~entity();
+	ENTITY(int objtype);
+	virtual ~ENTITY();
 	
 	virtual void reset() {}
 	virtual void post_reset() {}
@@ -79,7 +79,7 @@ public:
 };
 
 
-class game_world
+class GAMEWORLD
 {
 	void reset();
 	void remove_entities();
@@ -90,32 +90,32 @@ public:
 	};
 
 	// TODO: two lists seams kinda not good, shouldn't be needed
-	entity *first_entity;
-	entity *first_entity_types[NUM_ENT_TYPES];
+	ENTITY *first_entity;
+	ENTITY *first_entity_types[NUM_ENT_TYPES];
 	bool paused;
 	bool reset_requested;
 	
-	world_core core;
+	WORLD_CORE core;
 	
-	game_world();
-	~game_world();
-	int find_entities(vec2 pos, float radius, entity **ents, int max);
-	int find_entities(vec2 pos, float radius, entity **ents, int max, const int* types, int maxtypes);
+	GAMEWORLD();
+	~GAMEWORLD();
+	int find_entities(vec2 pos, float radius, ENTITY **ents, int max);
+	int find_entities(vec2 pos, float radius, ENTITY **ents, int max, const int* types, int maxtypes);
 
-	void insert_entity(entity *ent);
-	void destroy_entity(entity *ent);
-	void remove_entity(entity *ent);
+	void insert_entity(ENTITY *ent);
+	void destroy_entity(ENTITY *ent);
+	void remove_entity(ENTITY *ent);
 	
 	//
 	void snap(int snapping_client);
 	void tick();
 };
 
-extern game_world *world;
+extern GAMEWORLD *world;
 
 // game object
 // TODO: should change name of this one
-class gameobject : public entity
+class GAMECONTROLLER : public ENTITY
 {
 protected:
 	void cyclemap();
@@ -134,7 +134,7 @@ protected:
 	
 public:
 	int gametype;
-	gameobject();
+	GAMECONTROLLER();
 
 	void do_team_score_wincheck();
 	void do_player_score_wincheck();
@@ -151,10 +151,10 @@ public:
 	virtual void post_reset();
 	virtual void tick();
 	
-	virtual void on_player_spawn(class player *p) {}
-	virtual int on_player_death(class player *victim, class player *killer, int weapon);
+	virtual void on_player_spawn(class PLAYER *p) {}
+	virtual int on_player_death(class PLAYER *victim, class PLAYER *killer, int weapon);
 	
-	virtual void on_player_info_change(class player *p);
+	virtual void on_player_info_change(class PLAYER *p);
 	
 	virtual void snap(int snapping_client);
 	virtual int get_auto_team(int notthisid);
@@ -162,11 +162,11 @@ public:
 	int clampteam(int team);
 };
 
-extern gameobject *gameobj;
+extern GAMECONTROLLER *gamecontroller;
 
 
 // TODO: move to seperate file
-class powerup : public entity
+class PICKUP : public ENTITY
 {
 public:
 	static const int phys_size = 14;
@@ -174,7 +174,7 @@ public:
 	int type;
 	int subtype; // weapon type for instance?
 	int spawntick;
-	powerup(int _type, int _subtype = 0);
+	PICKUP(int _type, int _subtype = 0);
 	
 	virtual void reset();
 	virtual void tick();
@@ -182,7 +182,7 @@ public:
 };
 
 // projectile entity
-class projectile : public entity
+class PROJECTILE : public ENTITY
 {
 public:
 	enum
@@ -191,7 +191,7 @@ public:
 	};
 	
 	vec2 direction;
-	entity *powner; // this is nasty, could be removed when client quits
+	ENTITY *powner; // this is nasty, could be removed when client quits
 	int lifespan;
 	int owner;
 	int type;
@@ -203,7 +203,7 @@ public:
 	float force;
 	int start_tick;
 	
-	projectile(int type, int owner, vec2 pos, vec2 vel, int span, entity* powner,
+	PROJECTILE(int type, int owner, vec2 pos, vec2 vel, int span, ENTITY* powner,
 		int damage, int flags, float force, int sound_impact, int weapon);
 
 	vec2 get_pos(float time);
@@ -214,21 +214,21 @@ public:
 	virtual void snap(int snapping_client);
 };
 
-class laser : public entity
+class LASER : public ENTITY
 {
 	vec2 from;
 	vec2 dir;
 	float energy;
 	int bounces;
 	int eval_tick;
-	player *owner;
+	PLAYER *owner;
 	
 	bool hit_player(vec2 from, vec2 to);
 	void do_bounce();
 	
 public:
 	
-	laser(vec2 pos, vec2 direction, float start_energy, player *owner);
+	LASER(vec2 pos, vec2 direction, float start_energy, PLAYER *owner);
 	
 	virtual void reset();
 	virtual void tick();
@@ -236,15 +236,15 @@ public:
 };
 
 // player entity
-class player : public entity
+class PLAYER : public ENTITY
 {
 public:
 	static const int phys_size = 28;
 
 	// weapon info
-	entity *hitobjects[10];
+	ENTITY *hitobjects[10];
 	int numobjectshit;
-	struct weaponstat
+	struct WEAPONSTAT
 	{
 		int ammoregenstart;
 		int ammo;
@@ -316,13 +316,13 @@ public:
 	int latency_max;
 
 	// the player core for the physics	
-	player_core core;
+	PLAYER_CORE core;
 	
 	//
 	int64 last_chat;
 
 	//
-	player();
+	PLAYER();
 	void init();
 	virtual void reset();
 	virtual void destroy();
@@ -354,4 +354,4 @@ public:
 	virtual void snap(int snaping_client);
 };
 
-extern player *players;
+extern PLAYER *players;
diff --git a/src/game/server/gs_game.cpp b/src/game/server/gs_game.cpp
index 1f5456c3..4a8aa9bd 100644
--- a/src/game/server/gs_game.cpp
+++ b/src/game/server/gs_game.cpp
@@ -5,8 +5,8 @@
 #include <game/g_mapitems.h>
 #include "gs_common.h"
 
-gameobject::gameobject()
-: entity(NETOBJTYPE_GAME)
+GAMECONTROLLER::GAMECONTROLLER()
+: ENTITY(NETOBJTYPE_GAME)
 {
 	// select gametype
 	if(strcmp(config.sv_gametype, "ctf") == 0)
@@ -40,7 +40,7 @@ gameobject::gameobject()
 extern vec2 spawn_points[3][64];
 extern int num_spawn_points[3];
 
-bool gameobject::on_entity(int index, vec2 pos)
+bool GAMECONTROLLER::on_entity(int index, vec2 pos)
 {
 	int type = -1;
 	int subtype = 0;
@@ -78,15 +78,15 @@ bool gameobject::on_entity(int index, vec2 pos)
 	
 	if(type != -1)
 	{
-		powerup *ppower = new powerup(type, subtype);
-		ppower->pos = pos;
+		PICKUP *pickup = new PICKUP(type, subtype);
+		pickup->pos = pos;
 		return true;
 	}
 
 	return false;
 }
 
-void gameobject::endround()
+void GAMECONTROLLER::endround()
 {
 	if(warmup) // game can't end when we are running warmup
 		return;
@@ -96,14 +96,14 @@ void gameobject::endround()
 	sudden_death = 0;
 }
 
-void gameobject::resetgame()
+void GAMECONTROLLER::resetgame()
 {
 	world->reset_requested = true;
 }
 
 static bool is_separator(char c) { return c == ';' || c == ' ' || c == ',' || c == '\t'; }
 
-void gameobject::startround()
+void GAMECONTROLLER::startround()
 {
 	resetgame();
 	
@@ -116,7 +116,7 @@ void gameobject::startround()
 	round_count++;
 }
 
-void gameobject::cyclemap()
+void GAMECONTROLLER::cyclemap()
 {
 	if(!strlen(config.sv_maprotation))
 		return;
@@ -174,7 +174,7 @@ void gameobject::cyclemap()
 	str_copy(config.sv_map, &buf[i], sizeof(config.sv_map));
 }
 
-void gameobject::post_reset()
+void GAMECONTROLLER::post_reset()
 {
 	for(int i = 0; i < MAX_CLIENTS; i++)
 	{
@@ -183,7 +183,7 @@ void gameobject::post_reset()
 	}
 }
 	
-void gameobject::on_player_info_change(class player *p)
+void GAMECONTROLLER::on_player_info_change(class PLAYER *p)
 {
 	const int team_colors[2] = {65387, 10223467};
 	if(is_teamplay)
@@ -198,7 +198,7 @@ void gameobject::on_player_info_change(class player *p)
 }
 
 
-int gameobject::on_player_death(class player *victim, class player *killer, int weapon)
+int GAMECONTROLLER::on_player_death(class PLAYER *victim, class PLAYER *killer, int weapon)
 {
 	// do scoreing
 	if(!killer)
@@ -215,12 +215,12 @@ int gameobject::on_player_death(class player *victim, class player *killer, int
 	return 0;
 }
 
-void gameobject::do_warmup(int seconds)
+void GAMECONTROLLER::do_warmup(int seconds)
 {
 	warmup = seconds*server_tickspeed();
 }
 
-bool gameobject::is_friendly_fire(int cid1, int cid2)
+bool GAMECONTROLLER::is_friendly_fire(int cid1, int cid2)
 {
 	if(cid1 == cid2)
 		return false;
@@ -234,7 +234,7 @@ bool gameobject::is_friendly_fire(int cid1, int cid2)
 	return false;
 }
 
-void gameobject::tick()
+void GAMECONTROLLER::tick()
 {
 	// do warmup
 	if(warmup)
@@ -283,7 +283,7 @@ void gameobject::tick()
 	server_setbrowseinfo(gametype, prog);
 }
 
-void gameobject::snap(int snapping_client)
+void GAMECONTROLLER::snap(int snapping_client)
 {
 	NETOBJ_GAME *game = (NETOBJ_GAME *)snap_new_item(NETOBJTYPE_GAME, 0, sizeof(NETOBJ_GAME));
 	game->paused = world->paused;
@@ -301,7 +301,7 @@ void gameobject::snap(int snapping_client)
 	game->teamscore_blue = teamscore[1];
 }
 
-int gameobject::get_auto_team(int notthisid)
+int GAMECONTROLLER::get_auto_team(int notthisid)
 {
 	int numplayers[2] = {0,0};
 	for(int i = 0; i < MAX_CLIENTS; i++)
@@ -322,7 +322,7 @@ int gameobject::get_auto_team(int notthisid)
 	return -1;
 }
 
-bool gameobject::can_join_team(int team, int notthisid)
+bool GAMECONTROLLER::can_join_team(int team, int notthisid)
 {
 	(void)team;
 	int numplayers[2] = {0,0};
@@ -338,7 +338,7 @@ bool gameobject::can_join_team(int team, int notthisid)
 	return (numplayers[0] + numplayers[1]) < config.sv_max_clients-config.sv_spectator_slots;
 }
 
-void gameobject::do_player_score_wincheck()
+void GAMECONTROLLER::do_player_score_wincheck()
 {
 	if(game_over_tick == -1  && !warmup)
 	{
@@ -371,7 +371,7 @@ void gameobject::do_player_score_wincheck()
 	}
 }
 
-void gameobject::do_team_score_wincheck()
+void GAMECONTROLLER::do_team_score_wincheck()
 {
 	if(game_over_tick == -1 && !warmup)
 	{
@@ -387,7 +387,7 @@ void gameobject::do_team_score_wincheck()
 	}
 }
 
-int gameobject::clampteam(int team)
+int GAMECONTROLLER::clampteam(int team)
 {
 	if(team < 0) // spectator
 		return -1;
@@ -396,4 +396,4 @@ int gameobject::clampteam(int team)
 	return  0;
 }
 
-gameobject *gameobj = 0;
+GAMECONTROLLER *gamecontroller = 0;
diff --git a/src/game/server/gs_game_ctf.cpp b/src/game/server/gs_game_ctf.cpp
index 5c9545fb..59ec3981 100644
--- a/src/game/server/gs_game_ctf.cpp
+++ b/src/game/server/gs_game_ctf.cpp
@@ -4,16 +4,16 @@
 #include "gs_common.h"
 #include "gs_game_ctf.h"
 
-gameobject_ctf::gameobject_ctf()
+GAMECONTROLLER_CTF::GAMECONTROLLER_CTF()
 {
 	flags[0] = 0;
 	flags[1] = 0;
 	is_teamplay = true;
 }
 
-bool gameobject_ctf::on_entity(int index, vec2 pos)
+bool GAMECONTROLLER_CTF::on_entity(int index, vec2 pos)
 {
-	if(gameobject::on_entity(index, pos))
+	if(GAMECONTROLLER::on_entity(index, pos))
 		return true;
 	
 	int team = -1;
@@ -22,26 +22,26 @@ bool gameobject_ctf::on_entity(int index, vec2 pos)
 	if(team == -1)
 		return false;
 		
-	flag *f = new flag(team);
+	FLAG *f = new FLAG(team);
 	f->stand_pos = pos;
 	f->pos = pos;
 	flags[team] = f;
 	return true;
 }
 
-void gameobject_ctf::on_player_spawn(class player *p)
+void GAMECONTROLLER_CTF::on_player_spawn(class PLAYER *p)
 {
 }
 
-int gameobject_ctf::on_player_death(class player *victim, class player *killer, int weaponid)
+int GAMECONTROLLER_CTF::on_player_death(class PLAYER *victim, class PLAYER *killer, int weaponid)
 {
-	gameobject::on_player_death(victim, killer, weaponid);
+	GAMECONTROLLER::on_player_death(victim, killer, weaponid);
 	int had_flag = 0;
 	
 	// drop flags
 	for(int fi = 0; fi < 2; fi++)
 	{
-		flag *f = flags[fi];
+		FLAG *f = flags[fi];
 		if(f && f->carrying_player == killer)
 			had_flag |= 2;
 		if(f && f->carrying_player == victim)
@@ -61,15 +61,15 @@ int gameobject_ctf::on_player_death(class player *victim, class player *killer,
 	return had_flag;
 }
 
-void gameobject_ctf::tick()
+void GAMECONTROLLER_CTF::tick()
 {
-	gameobject::tick();
+	GAMECONTROLLER::tick();
 
 	do_team_score_wincheck();
 	
 	for(int fi = 0; fi < 2; fi++)
 	{
-		flag *f = flags[fi];
+		FLAG *f = flags[fi];
 		
 		if(!f)
 			continue;
@@ -99,9 +99,9 @@ void gameobject_ctf::tick()
 		}
 		else
 		{
-			player *close_players[MAX_CLIENTS];
+			PLAYER *close_players[MAX_CLIENTS];
 			int types[] = {NETOBJTYPE_PLAYER_CHARACTER};
-			int num = world->find_entities(f->pos, 32.0f, (entity**)close_players, MAX_CLIENTS, types, 1);
+			int num = world->find_entities(f->pos, 32.0f, (ENTITY**)close_players, MAX_CLIENTS, types, 1);
 			for(int i = 0; i < num; i++)
 			{
 				if(close_players[i]->team == f->team)
@@ -109,7 +109,7 @@ void gameobject_ctf::tick()
 					// return the flag
 					if(!f->at_stand)
 					{
-						player *p = close_players[i];
+						PLAYER *p = close_players[i];
 						p->score += 1;
 
 						dbg_msg("game", "flag_return player='%d:%s'", p->client_id, server_clientname(p->client_id));
@@ -161,8 +161,8 @@ void gameobject_ctf::tick()
 }
 
 // Flag
-flag::flag(int _team)
-: entity(NETOBJTYPE_FLAG)
+FLAG::FLAG(int _team)
+: ENTITY(NETOBJTYPE_FLAG)
 {
 	team = _team;
 	proximity_radius = phys_size;
@@ -174,7 +174,7 @@ flag::flag(int _team)
 	world->insert_entity(this);
 }
 
-void flag::reset()
+void FLAG::reset()
 {
 	carrying_player = 0;
 	at_stand = 1;
@@ -182,7 +182,7 @@ void flag::reset()
 	vel = vec2(0,0);
 }
 
-void flag::snap(int snapping_client)
+void FLAG::snap(int snapping_client)
 {
 	NETOBJ_FLAG *flag = (NETOBJ_FLAG *)snap_new_item(NETOBJTYPE_FLAG, team, sizeof(NETOBJ_FLAG));
 	flag->x = (int)pos.x;
diff --git a/src/game/server/gs_game_ctf.h b/src/game/server/gs_game_ctf.h
index 107c000d..6d512815 100644
--- a/src/game/server/gs_game_ctf.h
+++ b/src/game/server/gs_game_ctf.h
@@ -1,26 +1,26 @@
 /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
 
 // game object
-class gameobject_ctf : public gameobject
+class GAMECONTROLLER_CTF : public GAMECONTROLLER
 {
 public:
-	class flag *flags[2];
+	class FLAG *flags[2];
 	
-	gameobject_ctf();
+	GAMECONTROLLER_CTF();
 	virtual void tick();
 	
 	virtual bool on_entity(int index, vec2 pos);
 	
-	virtual void on_player_spawn(class player *p);
-	virtual int on_player_death(class player *victim, class player *killer, int weapon);
+	virtual void on_player_spawn(class PLAYER *p);
+	virtual int on_player_death(class PLAYER *victim, class PLAYER *killer, int weapon);
 };
 
 // TODO: move to seperate file
-class flag : public entity
+class FLAG : public ENTITY
 {
 public:
 	static const int phys_size = 14;
-	player *carrying_player;
+	PLAYER *carrying_player;
 	vec2 vel;
 	vec2 stand_pos;
 	
@@ -28,7 +28,7 @@ public:
 	int at_stand;
 	int drop_tick;
 	
-	flag(int _team);
+	FLAG(int _team);
 
 	virtual void reset();
 	virtual void snap(int snapping_client);
diff --git a/src/game/server/gs_game_dm.cpp b/src/game/server/gs_game_dm.cpp
index 49de6b56..1d565372 100644
--- a/src/game/server/gs_game_dm.cpp
+++ b/src/game/server/gs_game_dm.cpp
@@ -3,8 +3,8 @@
 #include "gs_common.h"
 #include "gs_game_dm.h"
 
-void gameobject_dm::tick()
+void GAMECONTROLLER_DM::tick()
 {
 	do_player_score_wincheck();
-	gameobject::tick();
+	GAMECONTROLLER::tick();
 }
diff --git a/src/game/server/gs_game_dm.h b/src/game/server/gs_game_dm.h
index 96bff3ae..99ceaec1 100644
--- a/src/game/server/gs_game_dm.h
+++ b/src/game/server/gs_game_dm.h
@@ -1,6 +1,6 @@
 /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
 // game object
-class gameobject_dm : public gameobject
+class GAMECONTROLLER_DM : public GAMECONTROLLER
 {
 public:
 	virtual void tick();
diff --git a/src/game/server/gs_game_tdm.cpp b/src/game/server/gs_game_tdm.cpp
index fb2f569b..10c5a7dc 100644
--- a/src/game/server/gs_game_tdm.cpp
+++ b/src/game/server/gs_game_tdm.cpp
@@ -3,14 +3,14 @@
 #include "gs_common.h"
 #include "gs_game_tdm.h"
 
-gameobject_tdm::gameobject_tdm()
+GAMECONTROLLER_TDM::GAMECONTROLLER_TDM()
 {
 	is_teamplay = true;
 }
 
-int gameobject_tdm::on_player_death(class player *victim, class player *killer, int weapon)
+int GAMECONTROLLER_TDM::on_player_death(class PLAYER *victim, class PLAYER *killer, int weapon)
 {
-	gameobject::on_player_death(victim, killer, weapon);
+	GAMECONTROLLER::on_player_death(victim, killer, weapon);
 	
 	if(weapon >= 0)
 	{
@@ -23,8 +23,8 @@ int gameobject_tdm::on_player_death(class player *victim, class player *killer,
 	return 0;
 }
 
-void gameobject_tdm::tick()
+void GAMECONTROLLER_TDM::tick()
 {
 	do_team_score_wincheck();
-	gameobject::tick();
+	GAMECONTROLLER::tick();
 }
diff --git a/src/game/server/gs_game_tdm.h b/src/game/server/gs_game_tdm.h
index 70b4646e..516b581c 100644
--- a/src/game/server/gs_game_tdm.h
+++ b/src/game/server/gs_game_tdm.h
@@ -1,10 +1,10 @@
 /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
 // game object
-class gameobject_tdm : public gameobject
+class GAMECONTROLLER_TDM : public GAMECONTROLLER
 {
 public:
-	gameobject_tdm();
+	GAMECONTROLLER_TDM();
 	
-	int on_player_death(class player *victim, class player *killer, int weapon);
+	int on_player_death(class PLAYER *victim, class PLAYER *killer, int weapon);
 	virtual void tick();
 };
diff --git a/src/game/server/gs_server.cpp b/src/game/server/gs_server.cpp
index 5550f1a6..86d7fe32 100644
--- a/src/game/server/gs_server.cpp
+++ b/src/game/server/gs_server.cpp
@@ -13,21 +13,20 @@
 #include "gs_game_tdm.h"
 #include "gs_game_dm.h"
 
-data_container *data = 0x0;
+TUNING_PARAMS tuning;
 
-tuning_params tuning;
-
-class player* get_player(int index);
 void create_damageind(vec2 p, float angle_mod, int amount);
 void create_explosion(vec2 p, int owner, int weapon, bool bnodamage);
 void create_smoke(vec2 p);
 void create_playerspawn(vec2 p);
 void create_death(vec2 p, int who);
 void create_sound(vec2 pos, int sound, int mask=-1);
-class player *intersect_player(vec2 pos0, vec2 pos1, float radius, vec2 &new_pos, class entity *notthis = 0);
-class player *closest_player(vec2 pos, float radius, entity *notthis);
 
-game_world *world;
+PLAYER *get_player(int index);
+class PLAYER *intersect_player(vec2 pos0, vec2 pos1, float radius, vec2 &new_pos, class ENTITY *notthis = 0);
+class PLAYER *closest_player(vec2 pos, float radius, ENTITY *notthis);
+
+GAMEWORLD *world;
 
 enum
 {
@@ -95,7 +94,7 @@ void send_emoticon(int cid, int emoticon)
 
 void send_weapon_pickup(int cid, int weapon)
 {
-	NETMSG_SV_WEAPON_PICKUP msg;
+	NETMSG_SV_WEAPONPICKUP msg;
 	msg.weapon = weapon;
 	msg.pack(MSGFLAG_VITAL);
 	server_send_msg(cid);
@@ -112,23 +111,25 @@ void send_broadcast(const char *text, int cid)
 
 void send_tuning_params(int cid)
 {
+	/*
 	msg_pack_start(NETMSGTYPE_SV_TUNE_PARAMS, MSGFLAG_VITAL);
 	int *params = (int *)&tuning;
 	for(unsigned i = 0; i < sizeof(tuning_params)/sizeof(int); i++)
 		msg_pack_int(params[i]);
 	msg_pack_end();
 	server_send_msg(cid);
+	*/
 }
 
 //////////////////////////////////////////////////
 // Event handler
 //////////////////////////////////////////////////
-event_handler::event_handler()
+EVENT_HANDLER::EVENT_HANDLER()
 {
 	clear();
 }
 
-void *event_handler::create(int type, int size, int mask)
+void *EVENT_HANDLER::create(int type, int size, int mask)
 {
 	if(num_events == MAX_EVENTS)
 		return 0;
@@ -145,13 +146,13 @@ void *event_handler::create(int type, int size, int mask)
 	return p;
 }
 
-void event_handler::clear()
+void EVENT_HANDLER::clear()
 {
 	num_events = 0;
 	current_offset = 0;
 }
 
-void event_handler::snap(int snapping_client)
+void EVENT_HANDLER::snap(int snapping_client)
 {
 	for(int i = 0; i < num_events; i++)
 	{
@@ -167,12 +168,12 @@ void event_handler::snap(int snapping_client)
 	}
 }
 
-event_handler events;
+EVENT_HANDLER events;
 
 //////////////////////////////////////////////////
 // Entity
 //////////////////////////////////////////////////
-entity::entity(int objtype)
+ENTITY::ENTITY(int objtype)
 {
 	this->objtype = objtype;
 	pos = vec2(0,0);
@@ -187,7 +188,7 @@ entity::entity(int objtype)
 	next_type_entity = 0;
 }
 
-entity::~entity()
+ENTITY::~ENTITY()
 {
 	world->remove_entity(this);
 	snap_free_id(id);
@@ -196,7 +197,7 @@ entity::~entity()
 //////////////////////////////////////////////////
 // game world
 //////////////////////////////////////////////////
-game_world::game_world()
+GAMEWORLD::GAMEWORLD()
 {
 	paused = false;
 	reset_requested = false;
@@ -205,19 +206,19 @@ game_world::game_world()
 		first_entity_types[i] = 0;
 }
 
-game_world::~game_world()
+GAMEWORLD::~GAMEWORLD()
 {
 	// delete all entities
 	while(first_entity)
 		delete first_entity;
 }
 
-int game_world::find_entities(vec2 pos, float radius, entity **ents, int max)
+int GAMEWORLD::find_entities(vec2 pos, float radius, ENTITY **ents, int max)
 {
 	int num = 0;
-	for(entity *ent = first_entity; ent; ent = ent->next_entity)
+	for(ENTITY *ent = first_entity; ent; ent = ent->next_entity)
 	{
-		if(!(ent->flags&entity::FLAG_PHYSICS))
+		if(!(ent->flags&ENTITY::FLAG_PHYSICS))
 			continue;
 
 		if(distance(ent->pos, pos) < radius+ent->proximity_radius)
@@ -232,14 +233,14 @@ int game_world::find_entities(vec2 pos, float radius, entity **ents, int max)
 	return num;
 }
 
-int game_world::find_entities(vec2 pos, float radius, entity **ents, int max, const int* types, int maxtypes)
+int GAMEWORLD::find_entities(vec2 pos, float radius, ENTITY **ents, int max, const int* types, int maxtypes)
 {
 	int num = 0;
 	for(int t = 0; t < maxtypes; t++)
 	{
-		for(entity *ent = first_entity_types[types[t]]; ent; ent = ent->next_type_entity)
+		for(ENTITY *ent = first_entity_types[types[t]]; ent; ent = ent->next_type_entity)
 		{
-			if(!(ent->flags&entity::FLAG_PHYSICS))
+			if(!(ent->flags&ENTITY::FLAG_PHYSICS))
 				continue;
 
 			if(distance(ent->pos, pos) < radius+ent->proximity_radius)
@@ -255,9 +256,9 @@ int game_world::find_entities(vec2 pos, float radius, entity **ents, int max, co
 	return num;
 }
 
-void game_world::insert_entity(entity *ent)
+void GAMEWORLD::insert_entity(ENTITY *ent)
 {
-	entity *cur = first_entity;
+	ENTITY *cur = first_entity;
 	while(cur)
 	{
 		dbg_assert(cur != ent, "err");
@@ -279,12 +280,12 @@ void game_world::insert_entity(entity *ent)
 	first_entity_types[ent->objtype] = ent;
 }
 
-void game_world::destroy_entity(entity *ent)
+void GAMEWORLD::destroy_entity(ENTITY *ent)
 {
-	ent->set_flag(entity::FLAG_DESTROY);
+	ent->set_flag(ENTITY::FLAG_DESTROY);
 }
 
-void game_world::remove_entity(entity *ent)
+void GAMEWORLD::remove_entity(ENTITY *ent)
 {
 	// not in the list
 	if(!ent->next_entity && !ent->prev_entity && first_entity != ent)
@@ -312,34 +313,34 @@ void game_world::remove_entity(entity *ent)
 }
 
 //
-void game_world::snap(int snapping_client)
+void GAMEWORLD::snap(int snapping_client)
 {
-	for(entity *ent = first_entity; ent; ent = ent->next_entity)
+	for(ENTITY *ent = first_entity; ent; ent = ent->next_entity)
 		ent->snap(snapping_client);
 }
 
-void game_world::reset()
+void GAMEWORLD::reset()
 {
 	// reset all entities
-	for(entity *ent = first_entity; ent; ent = ent->next_entity)
+	for(ENTITY *ent = first_entity; ent; ent = ent->next_entity)
 		ent->reset();
 	remove_entities();
 
-	for(entity *ent = first_entity; ent; ent = ent->next_entity)
+	for(ENTITY *ent = first_entity; ent; ent = ent->next_entity)
 		ent->post_reset();
 	remove_entities();
 
 	reset_requested = false;
 }
 
-void game_world::remove_entities()
+void GAMEWORLD::remove_entities()
 {
 	// destroy objects marked for destruction
-	entity *ent = first_entity;
+	ENTITY *ent = first_entity;
 	while(ent)
 	{
-		entity *next = ent->next_entity;
-		if(ent->flags&entity::FLAG_DESTROY)
+		ENTITY *next = ent->next_entity;
+		if(ent->flags&ENTITY::FLAG_DESTROY)
 		{
 			remove_entity(ent);
 			ent->destroy();
@@ -348,7 +349,7 @@ void game_world::remove_entities()
 	}
 }
 
-void game_world::tick()
+void GAMEWORLD::tick()
 {
 	if(reset_requested)
 		reset();
@@ -382,7 +383,7 @@ void game_world::tick()
 		perf_start(&tick_scope);*/
 		
 		// update all objects
-		for(entity *ent = first_entity; ent; ent = ent->next_entity)
+		for(ENTITY *ent = first_entity; ent; ent = ent->next_entity)
 		{
 			/*if(ent->objtype >= 0 && ent->objtype < OBJTYPE_FLAG)
 				perf_start(&scopes[ent->objtype]);*/
@@ -396,7 +397,7 @@ void game_world::tick()
 
 		static PERFORMACE_INFO deftick_scope = {"tick_defered", 0};
 		perf_start(&deftick_scope);*/
-		for(entity *ent = first_entity; ent; ent = ent->next_entity)
+		for(ENTITY *ent = first_entity; ent; ent = ent->next_entity)
 		{
 			/*if(ent->objtype >= 0 && ent->objtype < OBJTYPE_FLAG)
 				perf_start(&scopes_def[ent->objtype]);*/
@@ -410,15 +411,15 @@ void game_world::tick()
 	remove_entities();
 }
 
-struct input_count
+struct INPUT_COUNT
 {
 	int presses;
 	int releases;
 };
 
-static input_count count_input(int prev, int cur)
+static INPUT_COUNT count_input(int prev, int cur)
 {
-	input_count c = {0,0};
+	INPUT_COUNT c = {0,0};
 	prev &= INPUT_STATE_MASK;
 	cur &= INPUT_STATE_MASK;
 	int i = prev;
@@ -438,9 +439,9 @@ static input_count count_input(int prev, int cur)
 //////////////////////////////////////////////////
 // projectile
 //////////////////////////////////////////////////
-projectile::projectile(int type, int owner, vec2 pos, vec2 dir, int span, entity* powner,
+PROJECTILE::PROJECTILE(int type, int owner, vec2 pos, vec2 dir, int span, ENTITY* powner,
 	int damage, int flags, float force, int sound_impact, int weapon)
-: entity(NETOBJTYPE_PROJECTILE)
+: ENTITY(NETOBJTYPE_PROJECTILE)
 {
 	this->type = type;
 	this->pos = pos;
@@ -458,12 +459,12 @@ projectile::projectile(int type, int owner, vec2 pos, vec2 dir, int span, entity
 	world->insert_entity(this);
 }
 
-void projectile::reset()
+void PROJECTILE::reset()
 {
 	world->destroy_entity(this);
 }
 
-vec2 projectile::get_pos(float time)
+vec2 PROJECTILE::get_pos(float time)
 {
 	float curvature = 0;
 	float speed = 0;
@@ -487,7 +488,7 @@ vec2 projectile::get_pos(float time)
 }
 
 
-void projectile::tick()
+void PROJECTILE::tick()
 {
 	
 	float pt = (server_tick()-start_tick-1)/(float)server_tickspeed();
@@ -500,7 +501,7 @@ void projectile::tick()
 	int collide = col_intersect_line(prevpos, curpos, &curpos);
 	//int collide = col_check_point((int)curpos.x, (int)curpos.y);
 	
-	entity *targetplayer = (entity*)intersect_player(prevpos, curpos, 6.0f, curpos, powner);
+	ENTITY *targetplayer = (ENTITY*)intersect_player(prevpos, curpos, 6.0f, curpos, powner);
 	if(targetplayer || collide || lifespan < 0)
 	{
 		if (lifespan >= 0 || weapon == WEAPON_GRENADE)
@@ -517,7 +518,7 @@ void projectile::tick()
 	}
 }
 
-void projectile::fill_info(NETOBJ_PROJECTILE *proj)
+void PROJECTILE::fill_info(NETOBJ_PROJECTILE *proj)
 {
 	proj->x = (int)pos.x;
 	proj->y = (int)pos.y;
@@ -527,7 +528,7 @@ void projectile::fill_info(NETOBJ_PROJECTILE *proj)
 	proj->type = type;
 }
 
-void projectile::snap(int snapping_client)
+void PROJECTILE::snap(int snapping_client)
 {
 	float ct = (server_tick()-start_tick)/(float)server_tickspeed();
 	
@@ -542,8 +543,8 @@ void projectile::snap(int snapping_client)
 //////////////////////////////////////////////////
 // laser
 //////////////////////////////////////////////////
-laser::laser(vec2 pos, vec2 direction, float start_energy, player *owner)
-: entity(NETOBJTYPE_LASER)
+LASER::LASER(vec2 pos, vec2 direction, float start_energy, PLAYER *owner)
+: ENTITY(NETOBJTYPE_LASER)
 {
 	this->pos = pos;
 	this->owner = owner;
@@ -556,10 +557,10 @@ laser::laser(vec2 pos, vec2 direction, float start_energy, player *owner)
 }
 
 
-bool laser::hit_player(vec2 from, vec2 to)
+bool LASER::hit_player(vec2 from, vec2 to)
 {
 	vec2 at;
-	player *hit = intersect_player(pos, to, 0.0f, at, owner);
+	PLAYER *hit = intersect_player(pos, to, 0.0f, at, owner);
 	if(!hit)
 		return false;
 
@@ -570,7 +571,7 @@ bool laser::hit_player(vec2 from, vec2 to)
 	return true;
 }
 
-void laser::do_bounce()
+void LASER::do_bounce()
 {
 	eval_tick = server_tick();
 	
@@ -619,12 +620,12 @@ void laser::do_bounce()
 	//dbg_msg("laser", "%d done %f %f %f %f", server_tick(), from.x, from.y, pos.x, pos.y);
 }
 	
-void laser::reset()
+void LASER::reset()
 {
 	world->destroy_entity(this);
 }
 
-void laser::tick()
+void LASER::tick()
 {
 	if(server_tick() > eval_tick+(server_tickspeed()*tuning.laser_bounce_delay)/1000.0f)
 	{
@@ -633,7 +634,7 @@ void laser::tick()
 
 }
 
-void laser::snap(int snapping_client)
+void LASER::snap(int snapping_client)
 {
 	if(distance(players[snapping_client].pos, pos) > 1000.0f)
 		return;
@@ -643,7 +644,7 @@ void laser::snap(int snapping_client)
 	obj->y = (int)pos.y;
 	obj->from_x = (int)from.x;
 	obj->from_y = (int)from.y;
-	obj->eval_tick = eval_tick;
+	obj->start_tick = eval_tick;
 }
 
 
@@ -651,13 +652,13 @@ void laser::snap(int snapping_client)
 // player
 //////////////////////////////////////////////////
 // TODO: move to separate file
-player::player()
-: entity(NETOBJTYPE_PLAYER_CHARACTER)
+PLAYER::PLAYER()
+: ENTITY(NETOBJTYPE_PLAYER_CHARACTER)
 {
 	init();
 }
 
-void player::init()
+void PLAYER::init()
 {
 	proximity_radius = phys_size;
 	client_id = -1;
@@ -673,7 +674,7 @@ void player::init()
 	reset();
 }
 
-void player::reset()
+void PLAYER::reset()
 {
 	pos = vec2(0.0f, 0.0f);
 	core.reset();
@@ -684,7 +685,7 @@ void player::reset()
 	//direction = vec2(0.0f, 1.0f);
 	score = 0;
 	dead = true;
-	clear_flag(entity::FLAG_PHYSICS);
+	clear_flag(ENTITY::FLAG_PHYSICS);
 	spawning = false;
 	die_tick = 0;
 	die_pos = vec2(0,0);
@@ -709,9 +710,9 @@ void player::reset()
 	queued_weapon = -1;
 }
 
-void player::destroy() {  }
+void PLAYER::destroy() {  }
 
-void player::set_weapon(int w)
+void PLAYER::set_weapon(int w)
 {
 	if(w == active_weapon)
 		return;
@@ -725,14 +726,14 @@ void player::set_weapon(int w)
 	create_sound(pos, SOUND_WEAPON_SWITCH);
 }
 
-void player::respawn()
+void PLAYER::respawn()
 {
 	spawning = true;
 }
 
 const char *get_team_name(int team)
 {
-	if(gameobj->gametype == GAMETYPE_DM)
+	if(gamecontroller->gametype == GAMETYPE_DM)
 	{
 		if(team == 0)
 			return "game";
@@ -748,10 +749,10 @@ const char *get_team_name(int team)
 	return "spectators";
 }
 
-void player::set_team(int new_team)
+void PLAYER::set_team(int new_team)
 {
 	// clamp the team
-	new_team = gameobj->clampteam(new_team);
+	new_team = gamecontroller->clampteam(new_team);
 	if(team == new_team)
 		return;
 		
@@ -764,7 +765,7 @@ void player::set_team(int new_team)
 	score = 0;
 	dbg_msg("game", "team_join player='%d:%s' team=%d", client_id, server_clientname(client_id), team);
 	
-	gameobj->on_player_info_change(&players[client_id]);
+	gamecontroller->on_player_info_change(&players[client_id]);
 
 	// send all info to this client
 	for(int i = 0; i < MAX_CLIENTS; i++)
@@ -777,9 +778,9 @@ void player::set_team(int new_team)
 vec2 spawn_points[3][64];
 int num_spawn_points[3] = {0};
 
-struct spawneval
+struct SPAWNEVAL
 {
-	spawneval()
+	SPAWNEVAL()
 	{
 		got = false;
 		friendly_team = -1;
@@ -794,7 +795,7 @@ struct spawneval
 	vec2 die_pos;
 };
 
-static float evaluate_spawn(spawneval *eval, vec2 pos)
+static float evaluate_spawn(SPAWNEVAL *eval, vec2 pos)
 {
 	float score = 0.0f;
 	
@@ -804,7 +805,7 @@ static float evaluate_spawn(spawneval *eval, vec2 pos)
 			continue;
 			
 		// don't count dead people
-		if(!(players[c].flags&entity::FLAG_PHYSICS))
+		if(!(players[c].flags&ENTITY::FLAG_PHYSICS))
 			continue;
 		
 		// team mates are not as dangerous as enemies
@@ -829,7 +830,7 @@ static float evaluate_spawn(spawneval *eval, vec2 pos)
 	return score;
 }
 
-static void evaluate_spawn_type(spawneval *eval, int t)
+static void evaluate_spawn_type(SPAWNEVAL *eval, int t)
 {
 	// get spawn point
 	/*
@@ -853,17 +854,17 @@ static void evaluate_spawn_type(spawneval *eval, int t)
 	}
 }
 
-void player::try_respawn()
+void PLAYER::try_respawn()
 {
 	vec2 spawnpos = vec2(100.0f, -60.0f);
 	
 	// get spawn point
-	spawneval eval;
+	SPAWNEVAL eval;
 	eval.die_pos = die_pos;
 	
 	eval.pos = vec2(100, 100);
 	
-	if(gameobj->gametype == GAMETYPE_CTF)
+	if(gamecontroller->gametype == GAMETYPE_CTF)
 	{
 		eval.friendly_team = team;
 		
@@ -878,7 +879,7 @@ void player::try_respawn()
 	}
 	else
 	{
-		if(gameobj->gametype == GAMETYPE_TDM)
+		if(gamecontroller->gametype == GAMETYPE_TDM)
 			eval.friendly_team = team;
 			
 		evaluate_spawn_type(&eval, 0);
@@ -889,7 +890,7 @@ void player::try_respawn()
 	spawnpos = eval.pos;
 
 	// check if the position is occupado
-	entity *ents[2] = {0};
+	ENTITY *ents[2] = {0};
 	int types[] = {NETOBJTYPE_PLAYER_CHARACTER};
 	int num_ents = world->find_entities(spawnpos, 64, ents, 2, types, 1);
 	for(int i = 0; i < num_ents; i++)
@@ -912,7 +913,7 @@ void player::try_respawn()
 	mem_zero(&ninja, sizeof(ninja));
 	
 	dead = false;
-	set_flag(entity::FLAG_PHYSICS);
+	set_flag(ENTITY::FLAG_PHYSICS);
 	player_state = PLAYERSTATE_PLAYING;
 
 	core.hook_state = HOOK_IDLE;
@@ -924,7 +925,7 @@ void player::try_respawn()
 	weapons[WEAPON_HAMMER].got = true;
 	weapons[WEAPON_HAMMER].ammo = -1;
 	weapons[WEAPON_GUN].got = true;
-	weapons[WEAPON_GUN].ammo = data->weapons[WEAPON_GUN].maxammo;
+	weapons[WEAPON_GUN].ammo = 10;
 
 	/*weapons[WEAPON_RIFLE].got = true;
 	weapons[WEAPON_RIFLE].ammo = -1;*/
@@ -939,10 +940,10 @@ void player::try_respawn()
 	create_sound(pos, SOUND_PLAYER_SPAWN);
 	create_playerspawn(pos);
 
-	gameobj->on_player_spawn(this);
+	gamecontroller->on_player_spawn(this);
 }
 
-bool player::is_grounded()
+bool PLAYER::is_grounded()
 {
 	if(col_check_point((int)(pos.x+phys_size/2), (int)(pos.y+phys_size/2+5)))
 		return true;
@@ -952,11 +953,11 @@ bool player::is_grounded()
 }
 
 
-int player::handle_ninja()
+int PLAYER::handle_ninja()
 {
 	vec2 direction = normalize(vec2(latest_input.target_x, latest_input.target_y));
 
-	if ((server_tick() - ninja.activationtick) > (data->weapons[WEAPON_NINJA].duration * server_tickspeed() / 1000))
+	if ((server_tick() - ninja.activationtick) > (data->weapons.ninja.duration * server_tickspeed() / 1000))
 	{
 		// time's up, return
 		weapons[WEAPON_NINJA].got = false;
@@ -976,8 +977,8 @@ int player::handle_ninja()
 		// ok then, activate ninja
 		attack_tick = server_tick();
 		ninja.activationdir = direction;
-		ninja.currentmovetime = data->weapons[WEAPON_NINJA].movetime * server_tickspeed() / 1000;
-		ninja.currentcooldown = data->weapons[WEAPON_NINJA].firedelay * server_tickspeed() / 1000 + server_tick();
+		ninja.currentmovetime = data->weapons.ninja.movetime * server_tickspeed() / 1000;
+		ninja.currentcooldown = data->weapons.ninja.base->firedelay * server_tickspeed() / 1000 + server_tick();
 		
 		// reset hit objects
 		numobjectshit = 0;
@@ -1001,7 +1002,7 @@ int player::handle_ninja()
 	if (ninja.currentmovetime > 0)
 	{
 		// Set player velocity
-		core.vel = ninja.activationdir * data->weapons[WEAPON_NINJA].velocity;
+		core.vel = ninja.activationdir * data->weapons.ninja.velocity;
 		vec2 oldpos = pos;
 		move_box(&core.pos, &core.vel, vec2(phys_size, phys_size), 0.0f);
 		// reset velocity so the client doesn't predict stuff
@@ -1014,7 +1015,7 @@ int player::handle_ninja()
 		// check if we hit anything along the way
 		{
 			int type = NETOBJTYPE_PLAYER_CHARACTER;
-			entity *ents[64];
+			ENTITY *ents[64];
 			vec2 dir = pos - oldpos;
 			float radius = phys_size * 2.0f; //length(dir * 0.5f);
 			vec2 center = oldpos + dir * 0.5f;
@@ -1044,7 +1045,7 @@ int player::handle_ninja()
 				// set his velocity to fast upward (for now)
 				if(numobjectshit < 10)
 					hitobjects[numobjectshit++] = ents[i];
-				ents[i]->take_damage(vec2(0,10.0f), data->weapons[WEAPON_NINJA].meleedamage, client_id,WEAPON_NINJA);
+				ents[i]->take_damage(vec2(0,10.0f), data->weapons.ninja.base->damage, client_id,WEAPON_NINJA);
 			}
 		}
 		return 0;
@@ -1054,7 +1055,7 @@ int player::handle_ninja()
 }
 
 
-void player::do_weaponswitch()
+void PLAYER::do_weaponswitch()
 {
 	if(reload_timer != 0) // make sure we have reloaded
 		return;
@@ -1069,7 +1070,7 @@ void player::do_weaponswitch()
 	set_weapon(queued_weapon);
 }
 
-void player::handle_weaponswitch()
+void PLAYER::handle_weaponswitch()
 {
 	int wanted_weapon = active_weapon;
 	if(queued_weapon != -1)
@@ -1110,7 +1111,7 @@ void player::handle_weaponswitch()
 	do_weaponswitch();
 }
 
-void player::fire_weapon()
+void PLAYER::fire_weapon()
 {
 	if(reload_timer != 0 || active_weapon == WEAPON_NINJA)
 		return;
@@ -1149,12 +1150,12 @@ void player::fire_weapon()
 			create_sound(pos, SOUND_HAMMER_FIRE);
 			
 			int type = NETOBJTYPE_PLAYER_CHARACTER;
-			entity *ents[64];
+			ENTITY *ents[64];
 			int num = world->find_entities(pos+direction*phys_size*0.75f, phys_size*0.5f, ents, 64, &type, 1);			
 
 			for (int i = 0; i < num; i++)
 			{
-				player *target = (player*)ents[i];
+				PLAYER *target = (PLAYER*)ents[i];
 				if (target == this)
 					continue;
 					
@@ -1163,7 +1164,7 @@ void player::fire_weapon()
 
 				// set his velocity to fast upward (for now)
 				create_sound(pos, SOUND_HAMMER_HIT);
-				ents[i]->take_damage(vec2(0,-1.0f), data->weapons[active_weapon].meleedamage, client_id, active_weapon);
+				ents[i]->take_damage(vec2(0,-1.0f), data->weapons.hammer.base->damage, client_id, active_weapon);
 				vec2 dir;
 				if (length(target->pos - pos) > 0.0f)
 					dir = normalize(target->pos - pos);
@@ -1177,7 +1178,7 @@ void player::fire_weapon()
 
 		case WEAPON_GUN:
 		{
-			projectile *proj = new projectile(WEAPON_GUN,
+			PROJECTILE *proj = new PROJECTILE(WEAPON_GUN,
 				client_id,
 				projectile_startpos,
 				direction,
@@ -1189,7 +1190,7 @@ void player::fire_weapon()
 			NETOBJ_PROJECTILE p;
 			proj->fill_info(&p);
 			
-			msg_pack_start(NETMSGTYPE_SV_EXTRA_PROJECTILE, 0);
+			msg_pack_start(NETMSGTYPE_SV_EXTRAPROJECTILE, 0);
 			msg_pack_int(1);
 			for(unsigned i = 0; i < sizeof(NETOBJ_PROJECTILE)/sizeof(int); i++)
 				msg_pack_int(((int *)&p)[i]);
@@ -1203,7 +1204,7 @@ void player::fire_weapon()
 		{
 			int shotspread = 2;
 
-			msg_pack_start(NETMSGTYPE_SV_EXTRA_PROJECTILE, 0);
+			msg_pack_start(NETMSGTYPE_SV_EXTRAPROJECTILE, 0);
 			msg_pack_int(shotspread*2+1);
 			
 			for(int i = -shotspread; i <= shotspread; i++)
@@ -1213,7 +1214,7 @@ void player::fire_weapon()
 				a += spreading[i+2];
 				float v = 1-(abs(i)/(float)shotspread);
 				float speed = mix((float)tuning.shotgun_speeddiff, 1.0f, v);
-				projectile *proj = new projectile(WEAPON_SHOTGUN,
+				PROJECTILE *proj = new PROJECTILE(WEAPON_SHOTGUN,
 					client_id,
 					projectile_startpos,
 					vec2(cosf(a), sinf(a))*speed,
@@ -1237,19 +1238,19 @@ void player::fire_weapon()
 
 		case WEAPON_GRENADE:
 		{
-			projectile *proj = new projectile(WEAPON_GRENADE,
+			PROJECTILE *proj = new PROJECTILE(WEAPON_GRENADE,
 				client_id,
 				projectile_startpos,
 				direction,
 				(int)(server_tickspeed()*tuning.grenade_lifetime),
 				this,
-				1, projectile::PROJECTILE_FLAGS_EXPLODE, 0, SOUND_GRENADE_EXPLODE, WEAPON_GRENADE);
+				1, PROJECTILE::PROJECTILE_FLAGS_EXPLODE, 0, SOUND_GRENADE_EXPLODE, WEAPON_GRENADE);
 
 			// pack the projectile and send it to the client directly
 			NETOBJ_PROJECTILE p;
 			proj->fill_info(&p);
 			
-			msg_pack_start(NETMSGTYPE_SV_EXTRA_PROJECTILE, 0);
+			msg_pack_start(NETMSGTYPE_SV_EXTRAPROJECTILE, 0);
 			msg_pack_int(1);
 			for(unsigned i = 0; i < sizeof(NETOBJ_PROJECTILE)/sizeof(int); i++)
 				msg_pack_int(((int *)&p)[i]);
@@ -1261,7 +1262,7 @@ void player::fire_weapon()
 		
 		case WEAPON_RIFLE:
 		{
-			new laser(pos, direction, tuning.laser_reach, this);
+			new LASER(pos, direction, tuning.laser_reach, this);
 			create_sound(pos, SOUND_RIFLE_FIRE);
 		} break;
 		
@@ -1270,10 +1271,10 @@ void player::fire_weapon()
 	if(weapons[active_weapon].ammo > 0) // -1 == unlimited
 		weapons[active_weapon].ammo--;
 	attack_tick = server_tick();
-	reload_timer = data->weapons[active_weapon].firedelay * server_tickspeed() / 1000;
+	reload_timer = data->weapons.id[active_weapon].firedelay * server_tickspeed() / 1000;
 }
 
-int player::handle_weapons()
+int PLAYER::handle_weapons()
 {
 	vec2 direction = normalize(vec2(latest_input.target_x, latest_input.target_y));
 
@@ -1306,7 +1307,8 @@ int player::handle_weapons()
 	fire_weapon();
 
 	// ammo regen
-	if (data->weapons[active_weapon].ammoregentime)
+	int ammoregentime = data->weapons.id[active_weapon].ammoregentime;
+	if(ammoregentime)
 	{
 		// If equipped and not active, regen ammo?
 		if (reload_timer <= 0)
@@ -1314,10 +1316,10 @@ int player::handle_weapons()
 			if (weapons[active_weapon].ammoregenstart < 0)
 				weapons[active_weapon].ammoregenstart = server_tick();
 
-			if ((server_tick() - weapons[active_weapon].ammoregenstart) >= data->weapons[active_weapon].ammoregentime * server_tickspeed() / 1000)
+			if ((server_tick() - weapons[active_weapon].ammoregenstart) >= ammoregentime * server_tickspeed() / 1000)
 			{
 				// Add some ammo
-				weapons[active_weapon].ammo = min(weapons[active_weapon].ammo + 1, data->weapons[active_weapon].maxammo);
+				weapons[active_weapon].ammo = min(weapons[active_weapon].ammo + 1, 10);
 				weapons[active_weapon].ammoregenstart = -1;
 			}
 		}
@@ -1330,7 +1332,7 @@ int player::handle_weapons()
 	return 0;
 }
 
-void player::on_direct_input(NETOBJ_PLAYER_INPUT *new_input)
+void PLAYER::on_direct_input(NETOBJ_PLAYER_INPUT *new_input)
 {
 	mem_copy(&latest_previnput, &latest_input, sizeof(latest_input));
 	mem_copy(&latest_input, new_input, sizeof(latest_input));
@@ -1341,7 +1343,7 @@ void player::on_direct_input(NETOBJ_PLAYER_INPUT *new_input)
 	}
 }
 
-void player::tick()
+void PLAYER::tick()
 {
 	server_setclientscore(client_id, score);
 
@@ -1433,7 +1435,7 @@ void player::tick()
 	return;
 }
 
-void player::tick_defered()
+void PLAYER::tick_defered()
 {
 	if(!dead)
 	{
@@ -1466,7 +1468,7 @@ void player::tick_defered()
 		if(events&COREEVENT_AIR_JUMP)
 		{
 			create_sound(pos, SOUND_PLAYER_AIRJUMP, mask);
-			NETEVENT_COMMON *c = (NETEVENT_COMMON *)::events.create(NETEVENTTYPE_AIR_JUMP, sizeof(NETEVENT_COMMON), mask);
+			NETEVENT_COMMON *c = (NETEVENT_COMMON *)::events.create(NETEVENTTYPE_AIRJUMP, sizeof(NETEVENT_COMMON), mask);
 			if(c)
 			{
 				c->x = (int)pos.x;
@@ -1488,12 +1490,12 @@ void player::tick_defered()
 	}
 }
 
-void player::die(int killer, int weapon)
+void PLAYER::die(int killer, int weapon)
 {
 	if (dead || team == -1)
 		return;
 
-	int mode_special = gameobj->on_player_death(this, get_player(killer), weapon);
+	int mode_special = gamecontroller->on_player_death(this, get_player(killer), weapon);
 
 	dbg_msg("game", "kill killer='%d:%s' victim='%d:%s' weapon=%d special=%d",
 		killer, server_clientname(killer),
@@ -1519,11 +1521,11 @@ void player::die(int killer, int weapon)
 	create_death(pos, client_id);
 }
 
-bool player::take_damage(vec2 force, int dmg, int from, int weapon)
+bool PLAYER::take_damage(vec2 force, int dmg, int from, int weapon)
 {
 	core.vel += force;
 	
-	if(gameobj->is_friendly_fire(client_id, from) && !config.sv_teamdamage)
+	if(gamecontroller->is_friendly_fire(client_id, from) && !config.sv_teamdamage)
 		return false;
 
 	// player only inflicts half damage on self
@@ -1587,7 +1589,7 @@ bool player::take_damage(vec2 force, int dmg, int from, int weapon)
 		// set attacker's face to happy (taunt!)
 		if (from >= 0 && from != client_id)
 		{
-			player *p = get_player(from);
+			PLAYER *p = get_player(from);
 
 			p->emote_type = EMOTE_HAPPY;
 			p->emote_stop = server_tick() + server_tickspeed();
@@ -1608,7 +1610,7 @@ bool player::take_damage(vec2 force, int dmg, int from, int weapon)
 	return true;
 }
 
-void player::snap(int snaping_client)
+void PLAYER::snap(int snaping_client)
 {
 	if(1)
 	{
@@ -1679,13 +1681,13 @@ void player::snap(int snaping_client)
 	}
 }
 
-player *players;
+PLAYER *players;
 
 //////////////////////////////////////////////////
 // powerup
 //////////////////////////////////////////////////
-powerup::powerup(int _type, int _subtype)
-: entity(NETOBJTYPE_POWERUP)
+PICKUP::PICKUP(int _type, int _subtype)
+: ENTITY(NETOBJTYPE_PICKUP)
 {
 	type = _type;
 	subtype = _subtype;
@@ -1697,10 +1699,10 @@ powerup::powerup(int _type, int _subtype)
 	world->insert_entity(this);
 }
 
-void powerup::reset()
+void PICKUP::reset()
 {
-	if (data->powerupinfo[type].startspawntime > 0)
-		spawntick = server_tick() + server_tickspeed() * data->powerupinfo[type].startspawntime;
+	if (data->pickups[type].spawndelay > 0)
+		spawntick = server_tick() + server_tickspeed() * data->pickups[type].spawndelay;
 	else
 		spawntick = -1;
 }
@@ -1708,7 +1710,7 @@ void powerup::reset()
 
 void send_weapon_pickup(int cid, int weapon);
 
-void powerup::tick()
+void PICKUP::tick()
 {
 	// wait for respawn
 	if(spawntick > 0)
@@ -1725,7 +1727,7 @@ void powerup::tick()
 			return;
 	}
 	// Check if a player intersected us
-	player* pplayer = closest_player(pos, 20.0f, 0);
+	PLAYER* pplayer = closest_player(pos, 20.0f, 0);
 	if (pplayer)
 	{
 		// player picked us up, is someone was hooking us, let them go
@@ -1736,27 +1738,27 @@ void powerup::tick()
 			if(pplayer->health < 10)
 			{
 				create_sound(pos, SOUND_PICKUP_HEALTH);
-				pplayer->health = min(10, pplayer->health + data->powerupinfo[type].amount);
-				respawntime = data->powerupinfo[type].respawntime;
+				pplayer->health = min(10, pplayer->health + 1);
+				respawntime = data->pickups[type].respawntime;
 			}
 			break;
 		case POWERUP_ARMOR:
 			if(pplayer->armor < 10)
 			{
 				create_sound(pos, SOUND_PICKUP_ARMOR);
-				pplayer->armor = min(10, pplayer->armor + data->powerupinfo[type].amount);
-				respawntime = data->powerupinfo[type].respawntime;
+				pplayer->armor = min(10, pplayer->armor + 1);
+				respawntime = data->pickups[type].respawntime;
 			}
 			break;
 
 		case POWERUP_WEAPON:
 			if(subtype >= 0 && subtype < NUM_WEAPONS)
 			{
-				if(pplayer->weapons[subtype].ammo < data->weapons[subtype].maxammo || !pplayer->weapons[subtype].got)
+				if(pplayer->weapons[subtype].ammo < data->weapons.id[subtype].maxammo || !pplayer->weapons[subtype].got)
 				{
 					pplayer->weapons[subtype].got = true;
-					pplayer->weapons[subtype].ammo = min(data->weapons[subtype].maxammo, pplayer->weapons[subtype].ammo + data->powerupinfo[type].amount);
-					respawntime = data->powerupinfo[type].respawntime;
+					pplayer->weapons[subtype].ammo = min(data->weapons.id[subtype].maxammo, pplayer->weapons[subtype].ammo + 10);
+					respawntime = data->pickups[type].respawntime;
 
 					// TODO: data compiler should take care of stuff like this
 					if(subtype == WEAPON_GRENADE)
@@ -1777,16 +1779,16 @@ void powerup::tick()
 				pplayer->weapons[WEAPON_NINJA].got = true;
 				pplayer->last_weapon = pplayer->active_weapon;
 				pplayer->active_weapon = WEAPON_NINJA;
-				respawntime = data->powerupinfo[type].respawntime;
+				respawntime = data->pickups[type].respawntime;
 				create_sound(pos, SOUND_PICKUP_NINJA);
 
 				// loop through all players, setting their emotes
-				entity *ents[64];
+				ENTITY *ents[64];
 				const int types[] = {NETOBJTYPE_PLAYER_CHARACTER};
 				int num = world->find_entities(vec2(0, 0), 1000000, ents, 64, types, 1);
 				for (int i = 0; i < num; i++)
 				{
-					player *p = (player *)ents[i];
+					PLAYER *p = (PLAYER *)ents[i];
 					if (p != pplayer)
 					{
 						p->emote_type = EMOTE_SURPRISE;
@@ -1812,12 +1814,12 @@ void powerup::tick()
 	}
 }
 
-void powerup::snap(int snapping_client)
+void PICKUP::snap(int snapping_client)
 {
 	if(spawntick != -1)
 		return;
 
-	NETOBJ_POWERUP *up = (NETOBJ_POWERUP *)snap_new_item(NETOBJTYPE_POWERUP, id, sizeof(NETOBJ_POWERUP));
+	NETOBJ_PICKUP *up = (NETOBJ_PICKUP *)snap_new_item(NETOBJTYPE_PICKUP, id, sizeof(NETOBJ_PICKUP));
 	up->x = (int)pos.x;
 	up->y = (int)pos.y;
 	up->type = type; // TODO: two diffrent types? what gives?
@@ -1826,7 +1828,7 @@ void powerup::snap(int snapping_client)
 
 // POWERUP END ///////////////////////
 
-player *get_player(int index)
+PLAYER *get_player(int index)
 {
 	return &players[index];
 }
@@ -1863,7 +1865,7 @@ void create_explosion(vec2 p, int owner, int weapon, bool bnodamage)
 	if (!bnodamage)
 	{
 		// deal damage
-		entity *ents[64];
+		ENTITY *ents[64];
 		float radius = 128.0f;
 		float innerradius = 42.0f;
 
@@ -1924,7 +1926,7 @@ void create_sound(vec2 pos, int sound, int mask)
 		return;
 
 	// create a sound
-	NETEVENT_SOUND_WORLD *ev = (NETEVENT_SOUND_WORLD *)events.create(NETEVENTTYPE_SOUND_WORLD, sizeof(NETEVENT_SOUND_WORLD), mask);
+	NETEVENT_SOUNDWORLD *ev = (NETEVENT_SOUNDWORLD *)events.create(NETEVENTTYPE_SOUNDWORLD, sizeof(NETEVENT_SOUNDWORLD), mask);
 	if(ev)
 	{
 		ev->x = (int)pos.x;
@@ -1938,31 +1940,31 @@ void create_sound_global(int sound, int target)
 	if (sound < 0)
 		return;
 
-	NETMSG_SV_SOUND_GLOBAL msg;
+	NETMSG_SV_SOUNDGLOBAL msg;
 	msg.soundid = sound;
 	msg.pack(MSGFLAG_VITAL);
 	server_send_msg(target);
 }
 
 // TODO: should be more general
-player *intersect_player(vec2 pos0, vec2 pos1, float radius, vec2& new_pos, entity *notthis)
+PLAYER *intersect_player(vec2 pos0, vec2 pos1, float radius, vec2& new_pos, ENTITY *notthis)
 {
 	// Find other players
 	float closest_len = distance(pos0, pos1) * 100.0f;
 	vec2 line_dir = normalize(pos1-pos0);
-	player *closest = 0;
+	PLAYER *closest = 0;
 		
 	for(int i = 0; i < MAX_CLIENTS; i++)
 	{
-		if(players[i].client_id < 0 || (entity *)&players[i] == notthis)
+		if(players[i].client_id < 0 || (ENTITY *)&players[i] == notthis)
 			continue;
 			
-		if(!(players[i].flags&entity::FLAG_PHYSICS))
+		if(!(players[i].flags&ENTITY::FLAG_PHYSICS))
 			continue;
 
 		vec2 intersect_pos = closest_point_on_line(pos0, pos1, players[i].pos);
 		float len = distance(players[i].pos, intersect_pos);
-		if(len < player::phys_size+radius)
+		if(len < PLAYER::phys_size+radius)
 		{
 			if(len < closest_len)
 			{
@@ -1977,22 +1979,22 @@ player *intersect_player(vec2 pos0, vec2 pos1, float radius, vec2& new_pos, enti
 }
 
 
-player *closest_player(vec2 pos, float radius, entity *notthis)
+PLAYER *closest_player(vec2 pos, float radius, ENTITY *notthis)
 {
 	// Find other players
 	float closest_range = radius*2;
-	player *closest = 0;
+	PLAYER *closest = 0;
 		
 	for(int i = 0; i < MAX_CLIENTS; i++)
 	{
-		if(players[i].client_id < 0 || (entity *)&players[i] == notthis)
+		if(players[i].client_id < 0 || (ENTITY *)&players[i] == notthis)
 			continue;
 			
-		if(!(players[i].flags&entity::FLAG_PHYSICS))
+		if(!(players[i].flags&ENTITY::FLAG_PHYSICS))
 			continue;
 
 		float len = distance(pos, players[i].pos);
-		if(len < player::phys_size+radius)
+		if(len < PLAYER::phys_size+radius)
 		{
 			if(len < closest_range)
 			{
@@ -2012,7 +2014,7 @@ void mods_tick()
 	world->tick();
 
 	if(world->paused) // make sure that the game object always updates
-		gameobj->tick();
+		gamecontroller->tick();
 }
 
 void mods_snap(int client_id)
@@ -2075,7 +2077,7 @@ void mods_connected(int client_id)
 	if(config.sv_tournament_mode)
 		players[client_id].team = -1;
 	else
-		players[client_id].team = gameobj->get_auto_team(client_id);
+		players[client_id].team = gamecontroller->get_auto_team(client_id);
 
 	// send motd
 	NETMSG_SV_MOTD msg;
@@ -2092,7 +2094,7 @@ void mods_client_drop(int client_id)
 
 	dbg_msg("game", "leave player='%d:%s'", client_id, server_clientname(client_id));
 
-	gameobj->on_player_death(&players[client_id], 0, -1);
+	gamecontroller->on_player_death(&players[client_id], 0, -1);
 	world->remove_entity(&players[client_id]);
 	world->core.players[client_id] = 0x0;
 	players[client_id].client_id = -1;
@@ -2131,7 +2133,7 @@ void mods_message(int msgtype, int client_id)
 		NETMSG_CL_SETTEAM *msg = (NETMSG_CL_SETTEAM *)rawmsg;
 
 		// Switch team on given client and kill/respawn him
-		if(gameobj->can_join_team(msg->team, client_id))
+		if(gamecontroller->can_join_team(msg->team, client_id))
 			players[client_id].set_team(msg->team);
 		else
 		{
@@ -2172,7 +2174,7 @@ void mods_message(int msgtype, int client_id)
 		// set skin
 		str_copy(players[client_id].skin_name, msg->skin, sizeof(players[client_id].skin_name));
 		
-		gameobj->on_player_info_change(&players[client_id]);
+		gamecontroller->on_player_info_change(&players[client_id]);
 		
 		if(msgtype == NETMSGTYPE_CL_STARTINFO)
 		{
@@ -2189,7 +2191,7 @@ void mods_message(int msgtype, int client_id)
 			send_tuning_params(client_id);
 			
 			//
-			NETMSG_SV_READY_TO_ENTER m;
+			NETMSG_SV_READYTOENTER m;
 			m.pack(MSGFLAG_VITAL|MSGFLAG_FLUSH);
 			server_send_msg(client_id);			
 		}
@@ -2203,7 +2205,7 @@ void mods_message(int msgtype, int client_id)
 	}
 	else if (msgtype == NETMSGTYPE_CL_KILL)
 	{
-		player *pplayer = get_player(client_id);
+		PLAYER *pplayer = get_player(client_id);
 		pplayer->die(client_id, -1);
 	}
 }
@@ -2227,7 +2229,7 @@ static void con_tune_param(void *result, void *user_data)
 
 static void con_tune_reset(void *result, void *user_data)
 {
-	tuning_params p;
+	TUNING_PARAMS p;
 	tuning = p;
 	send_tuning_params(-1);
 	console_print("tuning reset");
@@ -2247,9 +2249,9 @@ static void con_tune_dump(void *result, void *user_data)
 static void con_restart(void *result, void *user_data)
 {
 	if(console_arg_num(result))
-		gameobj->do_warmup(console_arg_int(result, 0));
+		gamecontroller->do_warmup(console_arg_int(result, 0));
 	else
-		gameobj->startround();
+		gamecontroller->startround();
 }
 
 static void con_broadcast(void *result, void *user_data)
@@ -2289,22 +2291,22 @@ void mods_console_init()
 
 void mods_init()
 {
-	if(!data) /* only load once */
-		data = load_data_from_memory(internal_data);
+	//if(!data) /* only load once */
+		//data = load_data_from_memory(internal_data);
 
 	layers_init();
 	col_init();
 
-	world = new game_world;
-	players = new player[MAX_CLIENTS];
+	world = new GAMEWORLD;
+	players = new PLAYER[MAX_CLIENTS];
 
 	// select gametype
 	if(strcmp(config.sv_gametype, "ctf") == 0)
-		gameobj = new gameobject_ctf;
+		gamecontroller = new GAMECONTROLLER_CTF;
 	else if(strcmp(config.sv_gametype, "tdm") == 0)
-		gameobj = new gameobject_tdm;
+		gamecontroller = new GAMECONTROLLER_TDM;
 	else
-		gameobj = new gameobject_dm;
+		gamecontroller = new GAMECONTROLLER_DM;
 
 	// setup core world
 	for(int i = 0; i < MAX_CLIENTS; i++)
@@ -2324,11 +2326,11 @@ void mods_init()
 		{
 			int index = tiles[y*tmap->width+x].index - ENTITY_OFFSET;
 			vec2 pos(x*32.0f+16.0f, y*32.0f+16.0f);
-			gameobj->on_entity(index, pos);
+			gamecontroller->on_entity(index, pos);
 		}
 	}
 
-	world->insert_entity(gameobj);
+	world->insert_entity(gamecontroller);
 
 	if(config.dbg_dummies)
 	{
@@ -2336,7 +2338,7 @@ void mods_init()
 		{
 			mods_connected(MAX_CLIENTS-i-1);
 			mods_client_enter(MAX_CLIENTS-i-1);
-			if(gameobj->gametype != GAMETYPE_DM)
+			if(gamecontroller->gametype != GAMETYPE_DM)
 				players[MAX_CLIENTS-i-1].team = i&1;
 		}
 	}
@@ -2345,9 +2347,9 @@ void mods_init()
 void mods_shutdown()
 {
 	delete [] players;
-	delete gameobj;
+	delete gamecontroller;
 	delete world;
-	gameobj = 0;
+	gamecontroller = 0;
 	players = 0;
 	world = 0;
 }