2008-04-27 05:59:38 +00:00
|
|
|
from datatypes import *
|
|
|
|
|
|
|
|
Emotes = ["NORMAL", "PAIN", "HAPPY", "SURPRISE", "ANGRY", "BLINK"]
|
|
|
|
PlayerStates = ["UNKNOWN", "PLAYING", "IN_MENU", "CHATTING"]
|
2008-08-31 14:37:35 +00:00
|
|
|
GameFlags = ["TEAMS", "FLAGS"]
|
2008-04-27 05:59:38 +00:00
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
Emoticons = [str(x) for x in xrange(1,16)]
|
|
|
|
|
2008-09-04 21:54:21 +00:00
|
|
|
Powerups = ["HEALTH", "ARMOR", "WEAPON", "NINJA"]
|
2008-06-12 10:51:48 +00:00
|
|
|
|
|
|
|
RawHeader = '''
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
INPUT_STATE_MASK=0x2f,
|
|
|
|
};
|
|
|
|
'''
|
|
|
|
|
|
|
|
RawSource = '''
|
|
|
|
#include <engine/e_common_interface.h>
|
2008-06-12 12:09:34 +00:00
|
|
|
#include "g_protocol.hpp"
|
2008-06-12 10:51:48 +00:00
|
|
|
'''
|
|
|
|
|
|
|
|
Enums = [
|
|
|
|
Enum("PLAYERSTATE", PlayerStates),
|
|
|
|
Enum("EMOTE", Emotes),
|
|
|
|
Enum("POWERUP", Powerups),
|
|
|
|
Enum("EMOTICON", Emoticons)
|
|
|
|
]
|
2008-04-27 05:59:38 +00:00
|
|
|
|
2008-08-27 15:51:09 +00:00
|
|
|
Flags = [
|
|
|
|
Flags("GAMEFLAG", GameFlags)
|
|
|
|
]
|
|
|
|
|
2008-04-27 05:59:38 +00:00
|
|
|
Objects = [
|
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
NetObject("Player_Input", [
|
2008-04-27 05:59:38 +00:00
|
|
|
NetIntAny("direction"),
|
|
|
|
NetIntAny("target_x"),
|
|
|
|
NetIntAny("target_y"),
|
|
|
|
|
|
|
|
NetIntAny("jump"),
|
|
|
|
NetIntAny("fire"),
|
|
|
|
NetIntAny("hook"),
|
|
|
|
|
|
|
|
NetIntRange("player_state", 0, len(PlayerStates)),
|
|
|
|
|
|
|
|
NetIntAny("wanted_weapon"),
|
|
|
|
NetIntAny("next_weapon"),
|
|
|
|
NetIntAny("prev_weapon"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetObject("Projectile", [
|
|
|
|
NetIntAny("x"),
|
|
|
|
NetIntAny("y"),
|
|
|
|
NetIntAny("vx"),
|
|
|
|
NetIntAny("vy"),
|
|
|
|
|
|
|
|
NetIntRange("type", 0, 'NUM_WEAPONS-1'),
|
|
|
|
NetTick("start_tick"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetObject("Laser", [
|
|
|
|
NetIntAny("x"),
|
|
|
|
NetIntAny("y"),
|
|
|
|
NetIntAny("from_x"),
|
|
|
|
NetIntAny("from_y"),
|
|
|
|
|
|
|
|
NetTick("start_tick"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetObject("Pickup", [
|
|
|
|
NetIntAny("x"),
|
|
|
|
NetIntAny("y"),
|
|
|
|
|
|
|
|
NetIntRange("type", 0, 'max_int'),
|
|
|
|
NetIntRange("subtype", 0, 'max_int'),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetObject("Flag", [
|
|
|
|
NetIntAny("x"),
|
|
|
|
NetIntAny("y"),
|
|
|
|
|
|
|
|
NetIntRange("team", 0, 1),
|
|
|
|
NetIntRange("carried_by", -2, 'MAX_CLIENTS-1')
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetObject("Game", [
|
2008-08-27 15:51:09 +00:00
|
|
|
NetIntRange("flags", 0, 256),
|
2008-04-27 05:59:38 +00:00
|
|
|
NetTick("round_start_tick"),
|
|
|
|
|
|
|
|
NetIntRange("game_over", 0, 1),
|
|
|
|
NetIntRange("sudden_death", 0, 1),
|
|
|
|
NetIntRange("paused", 0, 1),
|
|
|
|
|
|
|
|
NetIntRange("score_limit", 0, 'max_int'),
|
|
|
|
NetIntRange("time_limit", 0, 'max_int'),
|
|
|
|
|
|
|
|
NetIntRange("warmup", 0, 'max_int'),
|
2008-09-07 15:07:08 +00:00
|
|
|
|
|
|
|
NetIntRange("round_num", 0, 'max_int'),
|
|
|
|
NetIntRange("round_current", 0, 'max_int'),
|
2008-04-27 05:59:38 +00:00
|
|
|
|
|
|
|
NetIntAny("teamscore_red"),
|
|
|
|
NetIntAny("teamscore_blue"),
|
|
|
|
]),
|
|
|
|
|
2008-07-08 09:07:21 +00:00
|
|
|
NetObject("Character_Core", [
|
2008-09-23 07:43:41 +00:00
|
|
|
NetIntAny("tick"),
|
2008-04-27 05:59:38 +00:00
|
|
|
NetIntAny("x"),
|
|
|
|
NetIntAny("y"),
|
|
|
|
NetIntAny("vx"),
|
|
|
|
NetIntAny("vy"),
|
|
|
|
|
|
|
|
NetIntAny("angle"),
|
2008-09-23 07:43:41 +00:00
|
|
|
NetIntRange("direction", -1, 1),
|
2008-04-27 05:59:38 +00:00
|
|
|
|
|
|
|
NetIntRange("jumped", 0, 3),
|
|
|
|
NetIntRange("hooked_player", 0, 'MAX_CLIENTS-1'),
|
|
|
|
NetIntRange("hook_state", -1, 5),
|
|
|
|
NetTick("hook_tick"),
|
|
|
|
|
|
|
|
NetIntAny("hook_x"),
|
|
|
|
NetIntAny("hook_y"),
|
|
|
|
NetIntAny("hook_dx"),
|
|
|
|
NetIntAny("hook_dy"),
|
|
|
|
]),
|
|
|
|
|
2008-07-08 09:07:21 +00:00
|
|
|
NetObject("Character:Character_Core", [
|
2008-06-12 10:51:48 +00:00
|
|
|
NetIntRange("player_state", 0, 'NUM_PLAYERSTATES-1'),
|
|
|
|
NetIntRange("health", 0, 10),
|
|
|
|
NetIntRange("armor", 0, 10),
|
|
|
|
NetIntRange("ammocount", 0, 10),
|
|
|
|
NetIntRange("weapon", 0, 'NUM_WEAPONS-1'),
|
|
|
|
NetIntRange("emote", 0, len(Emotes)),
|
|
|
|
NetIntRange("attacktick", 0, 'max_int'),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetObject("Player_Info", [
|
2008-04-27 05:59:38 +00:00
|
|
|
NetIntRange("local", 0, 1),
|
|
|
|
NetIntRange("cid", 0, 'MAX_CLIENTS-1'),
|
|
|
|
NetIntRange("team", -1, 1),
|
2008-09-23 07:43:41 +00:00
|
|
|
|
2008-04-27 05:59:38 +00:00
|
|
|
NetIntAny("score"),
|
|
|
|
NetIntAny("latency"),
|
|
|
|
NetIntAny("latency_flux"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
## Events
|
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
NetEvent("Common", [
|
2008-04-27 05:59:38 +00:00
|
|
|
NetIntAny("x"),
|
|
|
|
NetIntAny("y"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
NetEvent("Explosion:Common", []),
|
|
|
|
NetEvent("Spawn:Common", []),
|
|
|
|
|
|
|
|
NetEvent("Death:Common", [
|
|
|
|
NetIntRange("cid", 0, 'MAX_CLIENTS-1'),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetEvent("AirJump:Common", []),
|
2008-04-27 05:59:38 +00:00
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
NetEvent("SoundGlobal:Common", [
|
2008-04-27 05:59:38 +00:00
|
|
|
NetIntRange("soundid", 0, 'NUM_SOUNDS-1'),
|
|
|
|
]),
|
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
NetEvent("SoundWorld:Common", [
|
2008-04-27 05:59:38 +00:00
|
|
|
NetIntRange("soundid", 0, 'NUM_SOUNDS-1'),
|
|
|
|
]),
|
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
NetEvent("DamageInd:Common", [
|
2008-04-27 05:59:38 +00:00
|
|
|
NetIntAny("angle"),
|
|
|
|
]),
|
|
|
|
]
|
|
|
|
|
|
|
|
Messages = [
|
|
|
|
|
|
|
|
### Server messages
|
|
|
|
NetMessage("sv_motd", [
|
|
|
|
NetString("message"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetMessage("sv_broadcast", [
|
|
|
|
NetString("message"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetMessage("sv_chat", [
|
|
|
|
NetIntRange("team", -1, 1),
|
|
|
|
NetIntRange("cid", -1, 'MAX_CLIENTS-1'),
|
|
|
|
NetString("message"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetMessage("sv_setinfo", [
|
|
|
|
NetIntRange("cid", 0, 'MAX_CLIENTS-1'),
|
|
|
|
NetString("name"),
|
|
|
|
NetString("skin"),
|
|
|
|
NetBool("use_custom_color"),
|
|
|
|
NetIntAny("color_body"),
|
|
|
|
NetIntAny("color_feet"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetMessage("sv_killmsg", [
|
|
|
|
NetIntRange("killer", 0, 'MAX_CLIENTS-1'),
|
|
|
|
NetIntRange("victim", 0, 'MAX_CLIENTS-1'),
|
|
|
|
NetIntRange("weapon", 0, 'NUM_WEAPONS-1'),
|
|
|
|
NetIntAny("mode_special"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetMessage("sv_soundglobal", [
|
|
|
|
NetIntRange("soundid", 0, 'NUM_SOUNDS-1'),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetMessage("sv_tuneparams", []),
|
|
|
|
NetMessage("sv_extraprojectile", []),
|
|
|
|
NetMessage("sv_readytoenter", []),
|
|
|
|
|
|
|
|
NetMessage("sv_weaponpickup", [
|
|
|
|
NetIntRange("weapon", 0, 'NUM_WEAPONS-1'),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetMessage("sv_emoticon", [
|
|
|
|
NetIntRange("cid", 0, 'MAX_CLIENTS-1'),
|
|
|
|
NetIntRange("emoticon", 0, 'NUM_EMOTICONS-1'),
|
|
|
|
]),
|
2008-09-24 14:47:03 +00:00
|
|
|
|
|
|
|
NetMessage("sv_vote_set", [
|
|
|
|
NetIntRange("timeout", 0, 60),
|
|
|
|
NetString("description"),
|
|
|
|
NetString("command"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetMessage("sv_vote_status", [
|
|
|
|
NetIntRange("yes", 0, 'MAX_CLIENTS'),
|
|
|
|
NetIntRange("no", 0, 'MAX_CLIENTS'),
|
|
|
|
NetIntRange("pass", 0, 'MAX_CLIENTS'),
|
|
|
|
NetIntRange("total", 0, 'MAX_CLIENTS'),
|
|
|
|
]),
|
2008-09-29 11:34:49 +00:00
|
|
|
|
|
|
|
NetMessage("sv_maplist", [
|
|
|
|
NetString("names"),
|
|
|
|
]),
|
|
|
|
|
2008-04-27 05:59:38 +00:00
|
|
|
### Client messages
|
|
|
|
NetMessage("cl_say", [
|
|
|
|
NetBool("team"),
|
|
|
|
NetString("message"),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetMessage("cl_setteam", [
|
|
|
|
NetIntRange("team", -1, 1),
|
|
|
|
]),
|
|
|
|
|
|
|
|
NetMessage("cl_startinfo", [
|
|
|
|
NetString("name"),
|
|
|
|
NetString("skin"),
|
|
|
|
NetBool("use_custom_color"),
|
|
|
|
NetIntAny("color_body"),
|
|
|
|
NetIntAny("color_feet"),
|
|
|
|
]),
|
|
|
|
|
2008-07-08 09:07:21 +00:00
|
|
|
NetMessage("cl_changeinfo", [
|
|
|
|
NetString("name"),
|
|
|
|
NetString("skin"),
|
|
|
|
NetBool("use_custom_color"),
|
|
|
|
NetIntAny("color_body"),
|
|
|
|
NetIntAny("color_feet"),
|
|
|
|
]),
|
2008-09-24 14:47:03 +00:00
|
|
|
|
2008-04-27 05:59:38 +00:00
|
|
|
NetMessage("cl_kill", []),
|
|
|
|
|
|
|
|
NetMessage("cl_emoticon", [
|
|
|
|
NetIntRange("emoticon", 0, 'NUM_EMOTICONS-1'),
|
|
|
|
]),
|
2008-09-24 14:47:03 +00:00
|
|
|
|
|
|
|
NetMessage("cl_vote", [
|
|
|
|
NetIntRange("vote", -1, 1),
|
|
|
|
]),
|
2008-09-25 12:23:44 +00:00
|
|
|
|
|
|
|
NetMessage("cl_callvote", [
|
|
|
|
NetString("type"),
|
|
|
|
NetString("value"),
|
|
|
|
]),
|
2008-04-27 05:59:38 +00:00
|
|
|
]
|