diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-06-12 10:51:48 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-06-12 10:51:48 +0000 |
| commit | f6c67c29cd10d41b877ee1319801edc01b625e72 (patch) | |
| tree | 6ca26c44ac0218a57d078a6f72034f2924b44104 /datasrc/network.py | |
| parent | 0d3b988c1aed8f6b91879a801253db81a251a532 (diff) | |
| download | zcatch-f6c67c29cd10d41b877ee1319801edc01b625e72.tar.gz zcatch-f6c67c29cd10d41b877ee1319801edc01b625e72.zip | |
large commit with loads of clean up. more is comming
Diffstat (limited to 'datasrc/network.py')
| -rw-r--r-- | datasrc/network.py | 61 |
1 files changed, 49 insertions, 12 deletions
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"), ]), ] |