
raw_source
	#include <engine/e_common_interface.h>
	#include "g_protocol.h"
	extern "C" {
		#include "g_protocol_ids.h"
	}
	#define max_int 2147483647
end

raw_header
	enum
	{
		// emotes
		EMOTE_NORMAL=0,
		EMOTE_PAIN,
		EMOTE_HAPPY,
		EMOTE_SURPRISE,
		EMOTE_ANGRY,
		EMOTE_BLINK,
		NUM_EMOTES,
		
		// playerstates
		PLAYERSTATE_UNKNOWN=0,
		PLAYERSTATE_PLAYING,
		PLAYERSTATE_IN_MENU,
		PLAYERSTATE_CHATTING,
		NUM_PLAYERSTATES,

		// game types
		GAMETYPE_DM=0,
		GAMETYPE_TDM,
		GAMETYPE_CTF,
		NUM_GAMETYPES,
		
		// other stuff
		INPUT_STATE_MASK=0x1f,
		NUM_EMOTICONS=16,
	};
	
end



object player_input
	any left
	any right

	any target_x
	any target_y

	any jump
	any fire
	any hook
	any blink

	any player_state

	any wanted_weapon
	any next_weapon
	any prev_weapon
end

object projectile
	any x, y
	any vx, vy
	range(0, NUM_WEAPONS-1) type
	range(0, max_int) start_tick
end

object laser
	any x
	any y
	any from_x
	any from_y
	range(0, max_int) eval_tick
end

object powerup
	any x, y
	range(0, max_int) type
	range(0, max_int) subtype
end

object flag
	any x, y
	range(0, 1) team
	range(-2,MAX_CLIENTS-1) carried_by // -2 == at stand -1 == on the field
end

object game
	range(0, max_int) round_start_tick
	
	range(0, 1) game_over
	range(0, 1) sudden_death
	range(0, 1) paused

	range(0, max_int) score_limit
	range(0, max_int) time_limit
	range(0, NUM_GAMETYPES-1) gametype

	range(0, max_int) warmup

	any teamscore_red
	any teamscore_blue
end

// core object needed for physics
object player_core
	any x, y
	any vx, vy

	any angle
	range(0, 3) jumped

	range(-1,MAX_CLIENTS-1) hooked_player
	range(-1,5) hook_state
	range(0, max_int) hook_tick

	any hook_x
	any hook_y
	any hook_dx
	any hook_dy
end

// info about the player that is only needed when it's on screen
object player_character extends player_core
	range(0, NUM_PLAYERSTATES-1) player_state
	
	range(-1, 1) wanted_direction
	
	range(0, 10) health
	range(0, 10) armor
	range(0, 10) ammocount

	range(0, NUM_WEAPONS-1) weapon
	range(0, NUM_EMOTES-1) emote
	
	range(0, max_int) attacktick
end

// information about the player that is always needed
object player_info
	range(0, 1) local
	range(0,MAX_CLIENTS-1) cid
	range(-1, 1) team
	
	any score
	
	any latency
	any latency_flux
end

event common
	any x, y
end

event explosion
	any x, y
end

event spawn
	any x, y
end

event death
	any x, y
	range(0,MAX_CLIENTS-1) cid
end

event air_jump
	any x, y
end

event sound_global
	any x, y
	range(0, NUM_SOUNDS-1) soundid
end

event sound_world
	any x, y
	range(0, NUM_SOUNDS-1) soundid
end

event damageind
	any x, y
	any angle
end

message sv_motd
	string message
end

message cl_say
	range(0, 1) team
	string message
end

message sv_chat
	range(-1, 1) team
	range(-1,MAX_CLIENTS-1) cid
	string message
end

message sv_broadcast
	string message
end

message sv_setinfo
	range(0,MAX_CLIENTS-1) cid
	string name
	string skin
	range(0,1) use_custom_color
	any color_body
	any color_feet
end

message sv_killmsg
	range(-1,MAX_CLIENTS-1) killer
	range(-1,MAX_CLIENTS-1) victim
	range(-1,NUM_WEAPONS-1) weapon
	any mode_special
end

message cl_setteam
	range(-1,1) team
end

message sv_ready_to_ender
end

message sv_sound_global
	range(0, NUM_SOUNDS-1) soundid
end

message cl_startinfo
	string name
	string skin
	range(0,1) use_custom_color
	any color_body
	any color_feet
end

message cl_changeinfo
	string name
	string skin
	range(0,1) use_custom_color
	any color_body
	any color_feet
end

message sv_weapon_pickup
	range(0,NUM_WEAPONS-1) weapon
end

message sv_emoticon
	range(0,MAX_CLIENTS-1) cid
	range(0,NUM_EMOTICONS-1) emoticon
end

message cl_emoticon
	range(0,NUM_EMOTICONS-1) emoticon
end

message cl_kill
end

message sv_tune_params
end

message sv_extra_projectile
end

message sv_ready_to_enter
end
