about summary refs log tree commit diff
path: root/src/game/g_protocol.def
blob: 3d411e45e150e4a29d2a42c26b43d8e01fd12c5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213

raw_source
	#include "g_protocol.h"
	extern "C" {
		#include "g_protocol_ids.h"
	}
	#include <engine/e_common_interface.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,
	};
	
	enum
	{
		MSG_NULL=0,
		
		MSG_MOTD, // server -> client, message of the day
		
		MSG_SAY, // client -> server
		MSG_CHAT, // server -> client
		MSG_SETINFO, // server -> client - contains name, skin and color info
		MSG_KILLMSG, // server -> client
		MSG_SETTEAM,
		MSG_JOIN,
		MSG_QUIT,
		MSG_EMOTICON,
		MSG_STARTINFO, // client -> server
		MSG_CHANGEINFO, // client -> server
		MSG_READY_TO_ENTER, // server -> client
		MSG_WEAPON_PICKUP,
		MSG_SOUND_GLOBAL,
		MSG_TUNE_PARAMS,
		MSG_KILL,
		MSG_EXTRA_PROJECTILE, // server -> client
		
	};
	
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) 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
	clientid carried_by
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

	clientid hooked_player
	range(0, 3) 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, 10) weaponstage
	range(0, max_int) attacktick
end

// information about the player that is always needed
object player_info
	range(0, 1) local
	clientid 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
	clientid 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