1 // COMMIT-TODO: Update if necessary before committing
2 // Revision 1: additional statistics sent (flag caps, returns, deaths)
3 // Revision 2: Mapvote preview pictures
4 // Revision 3: optimized map vote protocol
5 // Revision 4: CSQC config var system
6 // Revision 5: mapvote time fix
7 // Revision 6: more robust against packet loss/delays, also show not yet connected clients
8 // Revision 7: packet loss column
10 // Revision 9: race delta
11 // Revision 10: scoreboard force
12 // Revision 11: scoreboard unforce; spectator support beginning
13 // Revision 12: smaller scores updates (SERVER: requires new engine)
14 // Revision 13: pointparticles
17 // Revision 16: multi-weapons
18 // Revision 17: multi-weaponimpulses
19 // Revision 18: warmup
21 // Revision 20: naggers
22 // Revision 21: entcs for players optimized (position data down from 12 to 7 bytes); waypointsprites in csqc for team radar
23 // Revision 22: hook shot origin
24 #define CSQC_REVISION 22
26 const float AS_STRING = 1;
27 const float AS_INT = 2;
28 const float AS_FLOAT_TRUNCATED = 2;
29 const float AS_FLOAT = 8;
31 const float TE_CSQC_PICTURE = 100;
32 const float TE_CSQC_RACE = 101;
33 const float TE_CSQC_SPAWN = 102;
34 const float TE_CSQC_ZCURVEPARTICLES = 103;
35 const float TE_CSQC_NEXGUNBEAMPARTICLE = 104;
36 const float TE_CSQC_LIGHTNINGARC = 105;
37 const float TE_CSQC_TEAMNAGGER = 106;
38 const float TE_CSQC_PINGPLREPORT = 107;
39 const float TE_CSQC_ANNOUNCE = 108;
40 const float TE_CSQC_TARGET_MUSIC = 109;
41 const float TE_CSQC_WEAPONCOMPLAIN = 110;
42 const float TE_CSQC_NEX_SCOPE = 111;
43 const float TE_CSQC_MINELAYER_MAXMINES = 112;
44 const float TE_CSQC_HAGAR_MAXROCKETS = 113;
45 const float TE_CSQC_VEHICLESETUP = 114;
46 const float TE_CSQC_SVNOTICE = 115;
48 const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
49 const float RACE_NET_CHECKPOINT_CLEAR = 1;
50 const float RACE_NET_CHECKPOINT_NEXT_QUALIFYING = 2; // byte nextcheckpoint, short recordtime, string recordholder
51 const float RACE_NET_CHECKPOINT_HIT_RACE = 3; // byte checkpoint, short delta, byte lapsdelta, string opponent
52 const float RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT = 4; // byte checkpoint, short delta, byte lapsdelta, string opponent
53 const float RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING = 5; // byte nextcheckpoint, float laptime, short recordtime, string recordholder
54 const float RACE_NET_PENALTY_RACE = 6; // byte penaltytime, string reason
55 const float RACE_NET_PENALTY_QUALIFYING = 7; // byte penaltytime, string reason
56 const float RACE_NET_SERVER_RECORD = 8; // server record, sent to client
57 const float RACE_NET_SPEED_AWARD = 9; // speed award, sent to client
58 const float RACE_NET_SPEED_AWARD_BEST = 10; // all time best speed award, sent to client
59 const float RACE_NET_SERVER_RANKINGS = 11;
60 const float RACE_NET_SERVER_STATUS = 12;
61 const float RANKINGS_CNT = 15;
63 const float ENT_CLIENT = 0;
64 const float ENT_CLIENT_DEAD = 1;
65 const float ENT_CLIENT_ENTCS = 2;
66 const float ENT_CLIENT_SCORES_INFO = 3;
67 const float ENT_CLIENT_SCORES = 4;
68 const float ENT_CLIENT_TEAMSCORES = 5;
69 const float ENT_CLIENT_POINTPARTICLES = 6;
70 const float ENT_CLIENT_RAINSNOW = 7;
71 const float ENT_CLIENT_LASER = 8;
72 const float ENT_CLIENT_NAGGER = 9; // flags [votecalledvote]
73 const float ENT_CLIENT_WAYPOINT = 10; // flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable]
74 const float ENT_CLIENT_RADARLINK = 11; // flags [startorigin] [endorigin] [startcolor+16*endcolor]
75 const float ENT_CLIENT_PROJECTILE = 12;
76 const float ENT_CLIENT_GIBSPLASH = 13;
77 const float ENT_CLIENT_DAMAGEINFO = 14;
78 const float ENT_CLIENT_CASING = 15;
79 const float ENT_CLIENT_INIT = 16;
80 const float ENT_CLIENT_MAPVOTE = 17;
81 const float ENT_CLIENT_CLIENTDATA = 18;
82 const float ENT_CLIENT_RANDOMSEED = 19;
83 const float ENT_CLIENT_WALL = 20;
84 const float ENT_CLIENT_SPIDERBOT = 21;
85 const float ENT_CLIENT_MODELEFFECT = 22;
86 const float ENT_CLIENT_TUBANOTE = 23;
87 const float ENT_CLIENT_WARPZONE = 24;
88 const float ENT_CLIENT_WARPZONE_CAMERA = 25;
89 const float ENT_CLIENT_TRIGGER_MUSIC = 26;
90 const float ENT_CLIENT_HOOK = 27;
91 const float ENT_CLIENT_LGBEAM = 28;
92 const float ENT_CLIENT_GAUNTLET = 29;
93 const float ENT_CLIENT_ACCURACY = 30;
94 const float ENT_CLIENT_SHOWNAMES = 31;
95 const float ENT_CLIENT_WARPZONE_TELEPORTED = 32;
96 const float ENT_CLIENT_MODEL = 33;
97 const float ENT_CLIENT_ITEM = 34;
98 const float ENT_CLIENT_BUMBLE_RAYGUN = 35;
99 const float ENT_CLIENT_NOTIFICATION = 36;
101 const float ENT_CLIENT_TURRET = 40;
102 const float ENT_CLIENT_AUXILIARYXHAIR = 50;
103 const float ENT_CLIENT_VEHICLE = 60;
105 const float SPRITERULE_DEFAULT = 0;
106 const float SPRITERULE_TEAMPLAY = 1;
108 const float RADARICON_NONE = 0;
109 const float RADARICON_FLAG = 1;
110 const float RADARICON_FLAGCARRIER = 1;
111 const float RADARICON_HERE = 1; // TODO make these 3 and 4, and make images for them
112 const float RADARICON_DANGER = 1;
113 const float RADARICON_WAYPOINT = 1;
114 const float RADARICON_HELPME = 1;
115 const float RADARICON_CONTROLPOINT = 1;
116 const float RADARICON_GENERATOR = 1;
117 const float RADARICON_OBJECTIVE = 1;
118 const float RADARICON_DOMPOINT = 1;
119 const float RADARICON_POWERUP = 1;
120 const float RADARICON_TAGGED = 1;
122 ///////////////////////////
124 const float KEY_FORWARD = 1;
125 const float KEY_BACKWARD = 2;
126 const float KEY_LEFT = 4;
127 const float KEY_RIGHT = 8;
128 const float KEY_JUMP = 16;
129 const float KEY_CROUCH = 32;
130 const float KEY_ATCK = 64;
131 const float KEY_ATCK2 = 128;
133 ///////////////////////////
137 float CVAR_NOTIFY = 2;
138 float CVAR_READONLY = 4;
140 ///////////////////////////
141 // csqc communication stuff
143 const float STAT_KH_KEYS = 32;
144 const float STAT_CTF_STATE = 33;
145 const float STAT_WEAPONS = 35;
146 const float STAT_SWITCHWEAPON = 36;
147 const float STAT_GAMESTARTTIME = 37;
148 const float STAT_STRENGTH_FINISHED = 38;
149 const float STAT_INVINCIBLE_FINISHED = 39;
150 const float STAT_PRESSED_KEYS = 42;
151 const float STAT_ALLOW_OLDNEXBEAM = 43; // this stat could later contain some other bits of info, like, more server-side particle config
152 const float STAT_FUEL = 44;
153 const float STAT_NB_METERSTART = 45;
154 const float STAT_SHOTORG = 46; // compressShotOrigin
155 const float STAT_LEADLIMIT = 47;
156 const float STAT_WEAPON_CLIPLOAD = 48;
157 const float STAT_WEAPON_CLIPSIZE = 49;
158 const float STAT_NEX_CHARGE = 50;
159 const float STAT_LAST_PICKUP = 51;
160 const float STAT_HUD = 52;
161 const float STAT_NEX_CHARGEPOOL = 53;
162 const float STAT_HIT_TIME = 54;
163 const float STAT_TYPEHIT_TIME = 55;
164 const float STAT_LAYED_MINES = 56;
165 const float STAT_HAGAR_LOAD = 57;
166 const float STAT_SWITCHINGWEAPON = 58;
167 const float STAT_SUPERWEAPONS_FINISHED = 59;
169 const float STAT_VEHICLESTAT_HEALTH = 60;
170 const float STAT_VEHICLESTAT_SHIELD = 61;
171 const float STAT_VEHICLESTAT_ENERGY = 62;
172 const float STAT_VEHICLESTAT_AMMO1 = 63;
173 const float STAT_VEHICLESTAT_RELOAD1 = 64;
174 const float STAT_VEHICLESTAT_AMMO2 = 65;
175 const float STAT_VEHICLESTAT_RELOAD2 = 66;
177 const float STAT_SECRETS_TOTAL = 70;
178 const float STAT_SECRETS_FOUND = 71;
180 const float STAT_RESPAWN_TIME = 72;
182 const float STAT_CURRENT_WAVE = 73;
183 const float STAT_TOTALWAVES = 74;
185 const float STAT_MONSTERS_TOTAL = 75;
186 const float STAT_MONSTERS_KILLED = 76;
189 const float STAT_REDALIVE = 100;
190 const float STAT_BLUEALIVE = 101;
191 const float STAT_YELLOWALIVE = 102;
192 const float STAT_PINKALIVE = 103;
195 const float STAT_FROZEN = 104;
196 const float STAT_REVIVE_PROGRESS = 105;
199 const float STAT_DOM_TOTAL_PPS = 100;
200 const float STAT_DOM_PPS_RED = 101;
201 const float STAT_DOM_PPS_BLUE = 102;
202 const float STAT_DOM_PPS_PINK = 103;
203 const float STAT_DOM_PPS_YELLOW = 104;
205 //const float STAT_SPIDERBOT_AIM 53 // compressShotOrigin
206 //const float STAT_SPIDERBOT_TARGET 54 // compressShotOrigin
208 // see DP source, quakedef.h
209 const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222;
210 const float STAT_MOVEVARS_AIRSTRAFEACCEL_QW = 223;
211 const float STAT_MOVEVARS_MAXSPEED = 244;
212 const float STAT_MOVEVARS_AIRACCEL_QW = 254;
214 const float CTF_STATE_ATTACK = 1;
215 const float CTF_STATE_DEFEND = 2;
216 const float CTF_STATE_COMMANDER = 3;
218 const float HUD_NORMAL = 0;
219 const float HUD_VEHICLE_FIRST = 10;
220 const float HUD_SPIDERBOT = 10;
221 const float HUD_WAKIZASHI = 11;
222 const float HUD_RAPTOR = 12;
223 const float HUD_BUMBLEBEE = 13;
224 const float HUD_BUMBLEBEE_GUN = 14;
225 const float HUD_VEHICLE_LAST = 14;
227 const vector eX = '1 0 0';
228 const vector eY = '0 1 0';
229 const vector eZ = '0 0 1';
231 // moved that here so the client knows the max.
232 // # of maps, I'll use arrays for them :P
233 #define MAPVOTE_COUNT 10
236 * Lower scores are better (e.g. suicides)
238 #define SFL_LOWER_IS_BETTER 1
241 * Don't show zero values as scores
243 #define SFL_HIDE_ZERO 2
246 * Allow a column to be hidden (do not automatically add it even if it is a sorting key)
248 #define SFL_ALLOW_HIDE 16
251 * Display as a rank (with st, nd, rd, th suffix)
256 * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!)
260 // not an extra constant yet
261 #define SFL_ZERO_IS_WORST SFL_TIME
264 * Scoring priority (NOTE: PRIMARY is used for fraglimit)
266 #define SFL_SORT_PRIO_SECONDARY 4
267 #define SFL_SORT_PRIO_PRIMARY 8
268 #define SFL_SORT_PRIO_MASK 12
274 #define MAX_TEAMSCORE 2
279 #define SP_SUICIDES 2
281 // game mode specific indices are not in common/, but in server/scores_rules.qc!
283 #ifdef COMPAT_XON010_CHANNELS
284 float CH_INFO = 0; // only on world and csqc
285 float CH_TRIGGER = 0; // only on players; compat: FALSELY CONTROLLED BY "Info"
286 float CH_WEAPON_A = 1; // only on players and entities
287 float CH_WEAPON_SINGLE = 5; // only on players and entities
288 float CH_VOICE = 2; // only on players
289 float CH_BGM_SINGLE = 2; // only on csqc; compat: FALSELY CONTROLLED BY "Voice"
290 float CH_AMBIENT = 2; // only on csqc; compat: FALSELY CONTROLLED BY "Voice"
291 float CH_TRIGGER_SINGLE = 3; // only on players, entities, csqc
292 float CH_SHOTS = 4; // only on players, entities, csqc
293 float CH_SHOTS_SINGLE = 4; // only on players, entities, csqc
294 float CH_WEAPON_B = 5; // only on players and entities
295 float CH_PAIN = 6; // only on players and csqc
296 float CH_PAIN_SINGLE = 6; // only on players and csqc
297 float CH_PLAYER = 7; // only on players and entities
298 float CH_TUBA = 5; // only on csqc
301 float CH_TRIGGER = -3;
302 float CH_WEAPON_A = -1;
303 float CH_WEAPON_SINGLE = 1;
305 float CH_BGM_SINGLE = 8;
306 float CH_AMBIENT = -9;
307 float CH_TRIGGER_SINGLE = 3;
309 float CH_SHOTS_SINGLE = 4;
310 float CH_WEAPON_B = -1;
312 float CH_PAIN_SINGLE = 6;
313 float CH_PLAYER = -7;
318 float ATTN_MIN = 0.015625;
319 float ATTN_NORM = 0.5;
320 float ATTN_LARGE = 1;
322 float ATTN_STATIC = 3;
323 float ATTN_MAX = 3.984375;
326 #define VOL_BASEVOICE 1.0
328 // this sets sounds and other properties of the projectiles in csqc
329 float PROJECTILE_ELECTRO = 1;
330 float PROJECTILE_ROCKET = 2;
331 float PROJECTILE_TAG = 3;
332 float PROJECTILE_BULLET = 4;
333 float PROJECTILE_CRYLINK = 5;
334 float PROJECTILE_ELECTRO_BEAM = 6;
335 float PROJECTILE_GRENADE = 7;
336 float PROJECTILE_GRENADE_BOUNCING = 8;
337 float PROJECTILE_MINE = 9;
338 float PROJECTILE_LASER = 10;
339 float PROJECTILE_HLAC = 11;
340 float PROJECTILE_SEEKER = 12;
341 float PROJECTILE_FLAC = 13;
342 float PROJECTILE_PORTO_RED = 14;
343 float PROJECTILE_PORTO_BLUE = 15;
344 float PROJECTILE_HOOKBOMB = 16;
345 float PROJECTILE_HAGAR = 17;
346 float PROJECTILE_HAGAR_BOUNCING = 18;
347 float PROJECTILE_BULLET_GLOWING = 19;
348 float PROJECTILE_CRYLINK_BOUNCING = 20;
349 float PROJECTILE_FIREBALL = 21;
350 float PROJECTILE_FIREMINE = 22;
351 float PROJECTILE_BULLET_GLOWING_TRACER = 23;
353 float PROJECTILE_RAPTORCANNON = 24;
354 float PROJECTILE_RAPTORBOMB = 25;
355 float PROJECTILE_RAPTORBOMBLET = 26;
356 float PROJECTILE_SPIDERROCKET = 27;
357 float PROJECTILE_WAKIROCKET = 28;
358 float PROJECTILE_WAKICANNON = 29;
360 float PROJECTILE_BUMBLE_GUN = 30;
361 float PROJECTILE_BUMBLE_BEAM = 31;
363 float PROJECTILE_VORE_SPIKE = 32;
365 float SPECIES_HUMAN = 0;
366 float SPECIES_ROBOT_SOLID = 1;
367 float SPECIES_ALIEN = 2;
368 float SPECIES_ANIMAL = 3;
369 float SPECIES_ROBOT_RUSTY = 4;
370 float SPECIES_ROBOT_SHINY = 5;
371 float SPECIES_RESERVED = 15;
373 #define FRAGS_PLAYER 0
374 #define FRAGS_SPECTATOR -666
375 #define FRAGS_LMS_LOSER -616
376 #define FRAGS_PLAYER_NONSOLID -616
377 // we can use this frags value for both
380 float WATERLEVEL_NONE = 0;
381 float WATERLEVEL_WETFEET = 1;
382 float WATERLEVEL_SWIMMING = 2;
383 float WATERLEVEL_SUBMERGED = 3;
385 float MAX_SHOT_DISTANCE = 32768;
388 float WR_SETUP = 1; // (SVQC) setup weapon data
389 float WR_THINK = 2; // (SVQC) logic to run every frame
390 float WR_CHECKAMMO1 = 3; // (SVQC) checks ammo for weapon
391 float WR_CHECKAMMO2 = 4; // (SVQC) checks ammo for weapon
392 float WR_AIM = 5; // (SVQC) runs bot aiming code for this weapon
393 float WR_PRECACHE = 6; // (CSQC and SVQC) precaches models/sounds used by this weapon
394 float WR_SUICIDEMESSAGE = 7; // (SVQC) notification number for suicide message (may inspect w_deathtype for details)
395 float WR_KILLMESSAGE = 8; // (SVQC) notification number for kill message (may inspect w_deathtype for details)
396 float WR_RELOAD = 9; // (SVQC) does not need to do anything
397 float WR_RESETPLAYER = 10; // (SVQC) does not need to do anything
398 float WR_IMPACTEFFECT = 11; // (CSQC) impact effect
399 float WR_SWITCHABLE = 12; // (CSQC) impact effect
400 float WR_PLAYERDEATH = 13; // (SVQC) does not need to do anything
401 float WR_GONETHINK = 14; // (SVQC) logic to run every frame, also if no longer having the weapon as long as the switch away has not been performed
403 float HUD_PANEL_WEAPONS = 0;
404 float HUD_PANEL_AMMO = 1;
405 float HUD_PANEL_POWERUPS = 2;
406 float HUD_PANEL_HEALTHARMOR = 3;
407 float HUD_PANEL_NOTIFY = 4;
408 float HUD_PANEL_TIMER = 5;
409 float HUD_PANEL_RADAR = 6;
410 float HUD_PANEL_SCORE = 7;
411 float HUD_PANEL_RACETIMER = 8;
412 float HUD_PANEL_VOTE = 9;
413 float HUD_PANEL_MODICONS = 10;
414 float HUD_PANEL_PRESSEDKEYS = 11;
415 float HUD_PANEL_CHAT = 12;
416 float HUD_PANEL_ENGINEINFO = 13;
417 float HUD_PANEL_INFOMESSAGES = 14;
418 float HUD_PANEL_PHYSICS = 15;
419 float HUD_PANEL_CENTERPRINT = 16;
420 float HUD_PANEL_NUM = 17; // always last panel id + 1, please increment when adding a new panel
422 string HUD_PANELNAME_WEAPONS = "weapons";
423 string HUD_PANELNAME_AMMO = "ammo";
424 string HUD_PANELNAME_POWERUPS = "powerups";
425 string HUD_PANELNAME_HEALTHARMOR = "healtharmor";
426 string HUD_PANELNAME_NOTIFY = "notify";
427 string HUD_PANELNAME_TIMER = "timer";
428 string HUD_PANELNAME_RADAR = "radar";
429 string HUD_PANELNAME_SCORE = "score";
430 string HUD_PANELNAME_RACETIMER = "racetimer";
431 string HUD_PANELNAME_VOTE = "vote";
432 string HUD_PANELNAME_MODICONS = "modicons";
433 string HUD_PANELNAME_PRESSEDKEYS = "pressedkeys";
434 string HUD_PANELNAME_CHAT = "chat";
435 string HUD_PANELNAME_ENGINEINFO = "engineinfo";
436 string HUD_PANELNAME_INFOMESSAGES = "infomessages";
437 string HUD_PANELNAME_PHYSICS = "physics";
438 string HUD_PANELNAME_CENTERPRINT = "centerprint";
440 #define SERVERFLAG_ALLOW_FULLBRIGHT 1
441 #define SERVERFLAG_TEAMPLAY 2
442 #define SERVERFLAG_PLAYERSTATS 4
444 // FIXME/EXPLAINME: why?
445 noref var vector autocvar_sv_player_maxs = '16 16 45';
446 noref var vector autocvar_sv_player_mins = '-16 -16 -24';
447 noref var vector autocvar_sv_player_viewoffset = '0 0 20';
448 noref var vector autocvar_sv_player_crouch_maxs = '16 16 25';
449 noref var vector autocvar_sv_player_crouch_mins = '-16 -16 -24';
450 noref var vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
451 noref var vector autocvar_sv_player_headsize = '24 24 12';
453 #define PL_VIEW_OFS autocvar_sv_player_viewoffset
454 #define PL_MIN autocvar_sv_player_mins
455 #define PL_MAX autocvar_sv_player_maxs
456 #define PL_CROUCH_VIEW_OFS autocvar_sv_player_crouch_viewoffset
457 #define PL_CROUCH_MIN autocvar_sv_player_crouch_mins
458 #define PL_CROUCH_MAX autocvar_sv_player_crouch_maxs
459 #define PL_HEAD autocvar_sv_player_headsize
462 #define PL_VIEW_OFS_z autocvar_sv_player_viewoffset_z
463 #define PL_MIN_z autocvar_sv_player_mins_z
464 #define PL_MAX_z autocvar_sv_player_maxs_z
465 #define PL_CROUCH_VIEW_OFS_z autocvar_sv_player_crouch_viewoffset_z
466 #define PL_CROUCH_MIN_z autocvar_sv_player_mins_z
467 #define PL_HEAD_x autocvar_sv_player_headsize_x
468 #define PL_HEAD_y autocvar_sv_player_headsize_y
469 #define PL_HEAD_z autocvar_sv_player_headsize_z
472 #define SPAWN_PRIO_NEAR_TEAMMATE_FOUND 200
473 #define SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM 100
474 #define SPAWN_PRIO_RACE_PREVIOUS_SPAWN 50
475 #define SPAWN_PRIO_GOOD_DISTANCE 10
478 #define URI_GET_DISCARD 0
479 #define URI_GET_IPBAN 1
480 #define URI_GET_IPBAN_END 16
481 #define URI_GET_CURL 17
482 #define URI_GET_CURL_END 32
483 #define URI_GET_UPDATENOTIFICATION 33
484 #define URI_GET_URLLIB 128
485 #define URI_GET_URLLIB_END 191