]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/constants.qh
bc18b4dc7ada43a12d8bb9741756f7ea784346cf
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / constants.qh
1 #ifndef CONSTANTS_H
2 #define CONSTANTS_H
3
4 // COMMIT-TODO: Update if necessary before committing
5 // Revision 1: additional statistics sent (flag caps, returns, deaths)
6 // Revision 2: Mapvote preview pictures
7 // Revision 3: optimized map vote protocol
8 // Revision 4: CSQC config var system
9 // Revision 5: mapvote time fix
10 // Revision 6: more robust against packet loss/delays, also show not yet connected clients
11 // Revision 7: packet loss column
12 // Revision 8: race
13 // Revision 9: race delta
14 // Revision 10: scoreboard force
15 // Revision 11: scoreboard unforce; spectator support beginning
16 // Revision 12: smaller scores updates (SERVER: requires new engine)
17 // Revision 13: pointparticles
18 // Revision 14: laser
19 // Revision 15: zoom
20 // Revision 16: multi-weapons
21 // Revision 17: multi-weaponimpulses
22 // Revision 18: warmup
23 // Revision 19: fog
24 // Revision 20: naggers
25 // Revision 21: entcs for players optimized (position data down from 12 to 7 bytes); waypointsprites in csqc for team radar
26 // Revision 22: hook shot origin
27 #define CSQC_REVISION 22
28
29 const int AS_STRING = 1;
30 const int AS_INT = 2;
31 const int AS_FLOAT_TRUNCATED = 2;
32 const int AS_FLOAT = 8;
33
34 const int TE_CSQC_MUTATOR = 99;
35 #define MUTATOR_HASH(s) crc16(true, s)
36 #define WriteMutator(to, s) do { \
37     WriteByte(to, TE_CSQC_MUTATOR); \
38     WriteLong(to, MUTATOR_HASH(#s)); \
39 } while (0)
40 #define ReadMutator() ReadLong()
41 #define ReadMutatorEquals(read, s) (read == MUTATOR_HASH(#s))
42 const int TE_CSQC_PICTURE = 100;
43 const int TE_CSQC_RACE = 101;
44 const int TE_CSQC_VORTEXBEAMPARTICLE = 103;
45 const int TE_CSQC_ARC = 104;
46 const int TE_CSQC_TEAMNAGGER = 105;
47 const int TE_CSQC_PINGPLREPORT = 106;
48 const int TE_CSQC_TARGET_MUSIC = 107;
49 const int TE_CSQC_WEAPONCOMPLAIN = 108;
50 const int TE_CSQC_VORTEX_SCOPE = 109;
51 const int TE_CSQC_MINELAYER_MAXMINES = 110;
52 const int TE_CSQC_HAGAR_MAXROCKETS = 111;
53 const int TE_CSQC_VEHICLESETUP = 112;
54 const int TE_CSQC_SVNOTICE = 113;
55 const int TE_CSQC_SHOCKWAVEPARTICLE = 114;
56
57 const int RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
58 const int RACE_NET_CHECKPOINT_CLEAR = 1;
59 const int RACE_NET_CHECKPOINT_NEXT_QUALIFYING = 2; // byte nextcheckpoint, short recordtime, string recordholder
60 const int RACE_NET_CHECKPOINT_HIT_RACE = 3; // byte checkpoint, short delta, byte lapsdelta, string opponent
61 const int RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT = 4; // byte checkpoint, short delta, byte lapsdelta, string opponent
62 const int RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING = 5; // byte nextcheckpoint, float laptime, short recordtime, string recordholder
63 const int RACE_NET_PENALTY_RACE = 6; // byte penaltytime, string reason
64 const int RACE_NET_PENALTY_QUALIFYING = 7; // byte penaltytime, string reason
65 const int RACE_NET_SERVER_RECORD = 8; // server record, sent to client
66 const int RACE_NET_SPEED_AWARD = 9; // speed award, sent to client
67 const int RACE_NET_SPEED_AWARD_BEST = 10; // all time best speed award, sent to client
68 const int RACE_NET_SERVER_RANKINGS = 11;
69 const int RACE_NET_SERVER_STATUS = 12;
70 const int RANKINGS_CNT = 15;
71
72 const int ENT_CLIENT = 0;
73 const int ENT_CLIENT_DEAD = 1;
74 const int ENT_CLIENT_ENTCS = 2;
75 const int ENT_CLIENT_SCORES_INFO = 3;
76 const int ENT_CLIENT_SCORES = 4;
77 const int ENT_CLIENT_TEAMSCORES = 5;
78 const int ENT_CLIENT_POINTPARTICLES = 6;
79 const int ENT_CLIENT_RAINSNOW = 7;
80 const int ENT_CLIENT_LASER = 8;
81 const int ENT_CLIENT_NAGGER = 9; // flags [votecalledvote]
82 const int ENT_CLIENT_RADARLINK = 11; // flags [startorigin] [endorigin] [startcolor+16*endcolor]
83 const int ENT_CLIENT_PROJECTILE = 12;
84 const int ENT_CLIENT_GIBSPLASH = 13;
85 const int ENT_CLIENT_DAMAGEINFO = 14;
86 const int ENT_CLIENT_CASING = 15;
87 const int ENT_CLIENT_INIT = 16;
88 const int ENT_CLIENT_MAPVOTE = 17;
89 const int ENT_CLIENT_CLIENTDATA = 18;
90 const int ENT_CLIENT_RANDOMSEED = 19;
91 const int ENT_CLIENT_WALL = 20;
92 const int ENT_CLIENT_SPIDERBOT = 21;
93 const int ENT_CLIENT_MODELEFFECT = 22;
94 const int ENT_CLIENT_TUBANOTE = 23;
95 const int ENT_CLIENT_WARPZONE = 24;
96 const int ENT_CLIENT_WARPZONE_CAMERA = 25;
97 const int ENT_CLIENT_TRIGGER_MUSIC = 26;
98 const int ENT_CLIENT_HOOK = 27;
99 const int ENT_CLIENT_INVENTORY = 28;
100 const int ENT_CLIENT_ARC_BEAM = 29; // WEAPONTODO: fix numbers
101 const int ENT_CLIENT_ACCURACY = 30;
102 const int ENT_CLIENT_SHOWNAMES = 31;
103 const int ENT_CLIENT_WARPZONE_TELEPORTED = 32;
104 const int ENT_CLIENT_MODEL = 33;
105 const int ENT_CLIENT_ITEM = 34;
106 const int ENT_CLIENT_BUMBLE_RAYGUN = 35;
107 const int ENT_CLIENT_SPAWNPOINT = 36;
108 const int ENT_CLIENT_SPAWNEVENT = 37;
109 const int ENT_CLIENT_NOTIFICATION = 38;
110 const int ENT_CLIENT_ELIMINATEDPLAYERS = 39;
111 const int ENT_CLIENT_TURRET = 40;
112 const int ENT_CLIENT_AUXILIARYXHAIR = 50;
113 const int ENT_CLIENT_VEHICLE = 60;
114 const int ENT_CLIENT_LADDER = 61;
115 const int ENT_CLIENT_TRIGGER_PUSH = 62;
116 const int ENT_CLIENT_TARGET_PUSH = 63;
117 const int ENT_CLIENT_CONVEYOR = 64;
118 const int ENT_CLIENT_DOOR = 65;
119 const int ENT_CLIENT_TRAIN = 66;
120 const int ENT_CLIENT_PLAT = 67;
121 const int ENT_CLIENT_TRIGGER_IMPULSE = 68;
122 const int ENT_CLIENT_SWAMP = 69;
123 const int ENT_CLIENT_CORNER = 70;
124 const int ENT_CLIENT_KEYLOCK = 71;
125 const int ENT_CLIENT_GENERATOR = 72;
126 const int ENT_CLIENT_CONTROLPOINT_ICON = 73;
127 const int ENT_CLIENT_EFFECT = 74;
128 const int ENT_CLIENT_MINIGAME = 75;
129 const int ENT_CLIENT_VIEWLOC = 78;
130 const int ENT_CLIENT_VIEWLOC_TRIGGER = 79;
131 const int ENT_CLIENT_HEALING_ORB = 80;
132
133 const int ENT_CLIENT_MUTATOR = TE_CSQC_MUTATOR; // 99
134
135 const int SPRITERULE_DEFAULT = 0;
136 const int SPRITERULE_TEAMPLAY = 1;
137 const int SPRITERULE_SPECTATOR = 2;
138
139 const int RADARICON_NONE = 0;
140 const int RADARICON_FLAG = 1;
141 const int RADARICON_FLAGCARRIER = 1;
142 const int RADARICON_HERE = 1; // TODO make these 3 and 4, and make images for them
143 const int RADARICON_DANGER = 1;
144 const int RADARICON_WAYPOINT = 1;
145 const int RADARICON_HELPME = 1;
146 const int RADARICON_CONTROLPOINT = 1;
147 const int RADARICON_GENERATOR = 1;
148 const int RADARICON_OBJECTIVE = 1;
149 const int RADARICON_DOMPOINT = 1;
150 const int RADARICON_POWERUP = 1;
151 const int RADARICON_TAGGED = 1;
152
153 ///////////////////////////
154 // keys pressed
155 const int KEY_FORWARD = 1;
156 const int KEY_BACKWARD = 2;
157 const int KEY_LEFT = 4;
158 const int KEY_RIGHT = 8;
159 const int KEY_JUMP = 16;
160 const int KEY_CROUCH = 32;
161 const int KEY_ATCK = 64;
162 const int KEY_ATCK2 = 128;
163
164 ///////////////////////////
165 // cvar constants
166
167 const int CVAR_SAVE = 1;
168 const int CVAR_NOTIFY = 2;
169 const int CVAR_READONLY = 4;
170
171 ///////////////////////////
172 // csqc communication stuff
173
174 const int CTF_STATE_ATTACK = 1;
175 const int CTF_STATE_DEFEND = 2;
176 const int CTF_STATE_COMMANDER = 3;
177
178 const int HUD_NORMAL = 0;
179 const int HUD_BUMBLEBEE_GUN = 25;
180
181 const vector eX = '1 0 0';
182 const vector eY = '0 1 0';
183 const vector eZ = '0 0 1';
184
185 // moved that here so the client knows the max.
186 // # of maps, I'll use arrays for them :P
187 const int MAPVOTE_COUNT = 30;
188
189 /**
190  * Lower scores are better (e.g. suicides)
191  */
192 const int SFL_LOWER_IS_BETTER = 1;
193
194 /**
195  * Don't show zero values as scores
196  */
197 const int SFL_HIDE_ZERO = 2;
198
199 /**
200  * Allow a column to be hidden (do not automatically add it even if it is a sorting key)
201  */
202 const int SFL_ALLOW_HIDE = 16;
203
204 /**
205  * Display as a rank (with st, nd, rd, th suffix)
206  */
207 const int SFL_RANK = 32;
208
209 /**
210  * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!)
211  */
212 const int SFL_TIME = 64;
213
214 // not an extra constant yet
215 #define SFL_ZERO_IS_WORST SFL_TIME
216
217 /**
218  * Scoring priority (NOTE: PRIMARY is used for fraglimit)
219  */
220 const int SFL_SORT_PRIO_SECONDARY = 4;
221 const int SFL_SORT_PRIO_PRIMARY = 8;
222 const int SFL_SORT_PRIO_MASK = 12;
223
224 /**
225  * Score indices
226  */
227 #define MAX_SCORE 10
228 #define MAX_TEAMSCORE 2
229
230 const int ST_SCORE = 0;
231 const int SP_KILLS = 0;
232 const int SP_DEATHS = 1;
233 const int SP_SUICIDES = 2;
234 const int SP_SCORE = 3;
235 // game mode specific indices are not in common/, but in server/scores_rules.qc!
236
237 const int CH_INFO = 0;
238 const int CH_TRIGGER = -3;
239 const int CH_WEAPON_A = -1;
240 const int CH_WEAPON_SINGLE = 1;
241 const int CH_VOICE = -2;
242 const int CH_BGM_SINGLE = 8;
243 const int CH_AMBIENT = -9;
244 const int CH_TRIGGER_SINGLE = 3;
245 const int CH_SHOTS = -4;
246 const int CH_SHOTS_SINGLE = 4;
247 const int CH_WEAPON_B = -1;
248 const int CH_PAIN = -6;
249 const int CH_PAIN_SINGLE = 6;
250 const int CH_PLAYER = -7;
251 const int CH_PLAYER_SINGLE = 7;
252 const int CH_TUBA_SINGLE = 5;
253
254 const float ATTEN_NONE = 0;
255 const float ATTEN_MIN = 0.015625;
256 const float ATTEN_NORM = 0.5;
257 const float ATTEN_LARGE = 1;
258 const float ATTEN_IDLE = 2;
259 const float ATTEN_STATIC = 3;
260 const float ATTEN_MAX = 3.984375;
261
262 const float VOL_BASE = 0.7;
263 const float VOL_BASEVOICE = 1.0;
264
265 // WEAPONTODO: move this into separate/new projectile handling code // this sets sounds and other properties of the projectiles in csqc
266 const int PROJECTILE_ELECTRO = 1;
267 const int PROJECTILE_ROCKET = 2;
268 const int PROJECTILE_TAG = 3;
269 const int PROJECTILE_CRYLINK = 5;
270 const int PROJECTILE_ELECTRO_BEAM = 6;
271 const int PROJECTILE_GRENADE = 7;
272 const int PROJECTILE_GRENADE_BOUNCING = 8;
273 const int PROJECTILE_MINE = 9;
274 const int PROJECTILE_BLASTER = 10;
275 const int PROJECTILE_HLAC = 11;
276 const int PROJECTILE_SEEKER = 12;
277 const int PROJECTILE_FLAC = 13;
278 const int PROJECTILE_PORTO_RED = 14;
279 const int PROJECTILE_PORTO_BLUE = 15;
280 const int PROJECTILE_HOOKBOMB = 16;
281 const int PROJECTILE_HAGAR = 17;
282 const int PROJECTILE_HAGAR_BOUNCING = 18;
283 const int PROJECTILE_CRYLINK_BOUNCING = 20;
284 const int PROJECTILE_FIREBALL = 21;
285 const int PROJECTILE_FIREMINE = 22;
286
287 const int PROJECTILE_RAPTORCANNON = 24;
288 const int PROJECTILE_RAPTORBOMB = 25;
289 const int PROJECTILE_RAPTORBOMBLET = 26;
290 const int PROJECTILE_SPIDERROCKET = 27;
291 const int PROJECTILE_WAKIROCKET = 28;
292 const int PROJECTILE_WAKICANNON = 29;
293
294 const int PROJECTILE_BUMBLE_GUN = 30;
295 const int PROJECTILE_BUMBLE_BEAM = 31;
296
297 const int PROJECTILE_MAGE_SPIKE = 32;
298 const int PROJECTILE_SHAMBLER_LIGHTNING = 33;
299
300 // projectile IDs 40-50 reserved
301
302 const int PROJECTILE_RPC = 60;
303
304 const int SPECIES_HUMAN = 0;
305 const int SPECIES_ROBOT_SOLID = 1;
306 const int SPECIES_ALIEN = 2;
307 const int SPECIES_ANIMAL = 3;
308 const int SPECIES_ROBOT_RUSTY = 4;
309 const int SPECIES_ROBOT_SHINY = 5;
310 const int SPECIES_RESERVED = 15;
311
312 const int FRAGS_PLAYER = 0;
313 const int FRAGS_SPECTATOR = -666;
314 const int FRAGS_LMS_LOSER = -616;
315 const int FRAGS_PLAYER_NONSOLID = -616;
316 // we can use this frags value for both
317
318 // water levels
319 const int WATERLEVEL_NONE = 0;
320 const int WATERLEVEL_WETFEET = 1;
321 const int WATERLEVEL_SWIMMING = 2;
322 const int WATERLEVEL_SUBMERGED = 3;
323 const int SERVERFLAG_ALLOW_FULLBRIGHT = 1;
324 const int SERVERFLAG_TEAMPLAY = 2;
325 const int SERVERFLAG_PLAYERSTATS = 4;
326
327 // FIXME/EXPLAINME: why? Mario: because
328 vector autocvar_sv_player_maxs = '16 16 45';
329 vector autocvar_sv_player_mins = '-16 -16 -24';
330 vector autocvar_sv_player_viewoffset = '0 0 20';
331 vector autocvar_sv_player_crouch_maxs = '16 16 25';
332 vector autocvar_sv_player_crouch_mins = '-16 -16 -24';
333 vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
334 vector autocvar_sv_player_headsize = '24 24 12';
335
336
337 // not so constant
338 #ifdef SVQC
339 #define PL_VIEW_OFS autocvar_sv_player_viewoffset
340 #define PL_MIN autocvar_sv_player_mins
341 #define PL_MAX autocvar_sv_player_maxs
342 #define PL_CROUCH_VIEW_OFS autocvar_sv_player_crouch_viewoffset
343 #define PL_CROUCH_MIN autocvar_sv_player_crouch_mins
344 #define PL_CROUCH_MAX autocvar_sv_player_crouch_maxs
345 #define PL_HEAD autocvar_sv_player_headsize
346 #elif defined(CSQC)
347 #define PL_VIEW_OFS vec3(getstatf(STAT_PL_VIEW_OFS1), getstatf(STAT_PL_VIEW_OFS2), getstatf(STAT_PL_VIEW_OFS3))
348 #define PL_MIN vec3(getstatf(STAT_PL_MIN1), getstatf(STAT_PL_MIN2), getstatf(STAT_PL_MIN3))
349 #define PL_MAX vec3(getstatf(STAT_PL_MAX1), getstatf(STAT_PL_MAX2), getstatf(STAT_PL_MAX3))
350 #define PL_CROUCH_VIEW_OFS vec3(getstatf(STAT_PL_CROUCH_VIEW_OFS1), getstatf(STAT_PL_CROUCH_VIEW_OFS2), getstatf(STAT_PL_CROUCH_VIEW_OFS3))
351 #define PL_CROUCH_MIN vec3(getstatf(STAT_PL_CROUCH_MIN1), getstatf(STAT_PL_CROUCH_MIN2), getstatf(STAT_PL_CROUCH_MIN3))
352 #define PL_CROUCH_MAX vec3(getstatf(STAT_PL_CROUCH_MAX1), getstatf(STAT_PL_CROUCH_MAX2), getstatf(STAT_PL_CROUCH_MAX3))
353 #endif
354
355 // a bit more constant
356 const vector PL_MAX_CONST = '16 16 45';
357 const vector PL_MIN_CONST = '-16 -16 -24';
358
359 // spawnpoint prios
360 const int SPAWN_PRIO_NEAR_TEAMMATE_FOUND = 200;
361 const int SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM = 100;
362 const int SPAWN_PRIO_RACE_PREVIOUS_SPAWN = 50;
363 const int SPAWN_PRIO_GOOD_DISTANCE = 10;
364
365 // URI handles
366 const int URI_GET_DISCARD = 0;
367 const int URI_GET_IPBAN = 1;
368 const int URI_GET_IPBAN_END = 16;
369 const int URI_GET_CURL = 17;
370 const int URI_GET_CURL_END = 32;
371 const int URI_GET_UPDATENOTIFICATION = 33;
372 const int URI_GET_URLLIB = 128;
373 const int URI_GET_URLLIB_END = 191;
374
375 // gametype vote flags
376 const int GTV_FORBIDDEN = 0; // Cannot be voted
377 const int GTV_AVAILABLE = 1; // Can be voted
378 const int GTV_CUSTOM    = 2; // Custom entry
379 #endif