]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/common/constants.qh
Downer + TDM
[divverent/nexuiz.git] / data / qcsrc / common / constants.qh
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
9 // Revision 8: race
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
15 // Revision 14: laser
16 // Revision 15: zoom
17 // Revision 16: multi-weapons
18 // Revision 17: multi-weaponimpulses
19 // Revision 18: warmup
20 // Revision 19: fog
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
25
26 // probably put these in common/
27 // so server/ and client/ can be synced better
28 const float GAME_DEATHMATCH             = 1;
29 const float GAME_TEAM_DEATHMATCH        = 2;
30 const float GAME_DOMINATION             = 3;
31 const float GAME_CTF                    = 4;
32 const float GAME_RUNEMATCH              = 5;
33 const float GAME_LMS                    = 6;
34 const float GAME_ARENA          = 7;
35 const float GAME_KEYHUNT                = 8;
36 const float GAME_ASSAULT                = 9;
37 const float GAME_ONSLAUGHT      = 10;
38 const float GAME_RACE   = 11;
39
40 const float AS_STRING           = 1;
41 const float AS_INT              = 2;
42 const float AS_FLOAT_TRUNCATED  = 2;
43 const float AS_FLOAT            = 8;
44
45 const float TE_CSQC_PICTURE = 100;
46 const float TE_CSQC_RACE = 101;
47 const float TE_CSQC_SPAWN = 102;
48 const float TE_CSQC_ZCURVEPARTICLES = 103;
49 const float TE_CSQC_NEXGUNBEAMPARTICLE = 104;
50
51 const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
52 const float RACE_NET_CHECKPOINT_CLEAR = 1;
53 const float RACE_NET_CHECKPOINT_NEXT_QUALIFYING = 2; // byte nextcheckpoint, short recordtime, string recordholder
54 const float RACE_NET_CHECKPOINT_HIT_RACE = 3; // byte checkpoint, short delta, byte lapsdelta, string opponent
55 const float RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT = 4; // byte checkpoint, short delta, byte lapsdelta, string opponent
56 const float RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING = 5; // byte nextcheckpoint, float laptime, short recordtime, string recordholder
57
58 const float ENT_CLIENT = 0;
59 const float ENT_CLIENT_DEAD = 1;
60 const float ENT_CLIENT_ENTCS = 2;
61 const float ENT_CLIENT_SCORES_INFO = 3;
62 const float ENT_CLIENT_SCORES = 4;
63 const float ENT_CLIENT_TEAMSCORES = 5;
64 const float ENT_CLIENT_POINTPARTICLES = 6;
65 const float ENT_CLIENT_RAINSNOW = 7;
66 const float ENT_CLIENT_LASER = 8;
67 const float ENT_CLIENT_NAGGER = 9; // flags [votecalledvote]
68 const float ENT_CLIENT_WAYPOINT = 10; // flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable]
69 const float ENT_CLIENT_RADARLINK = 11; // flags [startorigin] [endorigin] [startcolor+16*endcolor]
70 const float ENT_CLIENT_PROJECTILE = 12;
71 const float ENT_CLIENT_GIBSPLASH = 13;
72 const float ENT_CLIENT_DAMAGEINFO = 14;
73 const float ENT_CLIENT_CASING = 15;
74 const float ENT_CLIENT_INIT = 16;
75 const float ENT_CLIENT_MAPVOTE = 17;
76 const float ENT_CLIENT_CLIENTDATA = 18;
77 const float ENT_CLIENT_RANDOMSEED = 19;
78
79 const float SPRITERULE_DEFAULT = 0;
80 const float SPRITERULE_TEAMPLAY = 1;
81
82 const float RADARICON_FLAG = 1;
83 const float RADARICON_FLAGCARRIER = 1;
84 const float RADARICON_HERE = 1; // TODO make these 3 and 4, and make images for them
85 const float RADARICON_DANGER = 1;
86 const float RADARICON_WAYPOINT = 1;
87 const float RADARICON_HELPME = 1;
88 const float RADARICON_CONTROLPOINT = 1;
89 const float RADARICON_GENERATOR = 1;
90 const float RADARICON_OBJECTIVE = 1;
91 const float RADARICON_DOMPOINT = 1;
92
93 ///////////////////////////
94 // key constants
95
96 //
97 // these are the key numbers that should be passed to Key_Event
98 //
99 const float K_TAB                       =       9;
100 const float K_ENTER             =       13;
101 const float K_ESCAPE            =       27;
102 const float K_SPACE             =       32;
103
104 // normal keys should be passed as lowercased ascii
105
106 const float K_BACKSPACE =       127;
107 const float K_UPARROW           =       128;
108 const float K_DOWNARROW =       129;
109 const float K_LEFTARROW =       130;
110 const float K_RIGHTARROW        =       131;
111
112 const float K_ALT               =       132;
113 const float K_CTRL      =       133;
114 const float K_SHIFT     =       134;
115 const float K_F1                =       135;
116 const float K_F2                =       136;
117 const float K_F3                =       137;
118 const float K_F4                =       138;
119 const float K_F5                =       139;
120 const float K_F6                =       140;
121 const float K_F7                =       141;
122 const float K_F8                =       142;
123 const float K_F9                =       143;
124 const float K_F10               =       144;
125 const float K_F11               =       145;
126 const float K_F12               =       146;
127 const float K_INS               =       147;
128 const float K_DEL               =       148;
129 const float K_PGDN      =       149;
130 const float K_PGUP      =       150;
131 const float K_HOME      =       151;
132 const float K_END               =       152;
133
134 const float K_KP_HOME                   =       160;
135 const float K_KP_UPARROW                =       161;
136 const float K_KP_PGUP                   =       162;
137 const float K_KP_LEFTARROW      =       163;
138 const float K_KP_5                      =       164;
139 const float K_KP_RIGHTARROW     =       165;
140 const float K_KP_END                    =       166;
141 const float K_KP_DOWNARROW      =       167;
142 const float K_KP_PGDN                   =       168;
143 const float K_KP_ENTER          =       169;
144 const float K_KP_INS            =       170;
145 const float K_KP_DEL                    =       171;
146 const float K_KP_SLASH          =       172;
147 const float K_KP_MINUS          =       173;
148 const float K_KP_PLUS                   =       174;
149
150 const float K_PAUSE             =       255;
151
152 //
153 // joystick buttons
154 //
155 const float K_JOY1              =       768;
156 const float K_JOY2              =       769;
157 const float K_JOY3              =       770;
158 const float K_JOY4              =       771;
159
160 //
161 // aux keys are for multi-buttoned joysticks to generate so they can use
162 // the normal binding process
163 //
164 const float K_AUX1              =       772;
165 const float K_AUX2              =       773;
166 const float K_AUX3              =       774;
167 const float K_AUX4              =       775;
168 const float K_AUX5              =       776;
169 const float K_AUX6              =       777;
170 const float K_AUX7              =       778;
171 const float K_AUX8              =       779;
172 const float K_AUX9              =       780;
173 const float K_AUX10             =       781;
174 const float K_AUX11             =       782;
175 const float K_AUX12             =       783;
176 const float K_AUX13             =       784;
177 const float K_AUX14             =       785;
178 const float K_AUX15             =       786;
179 const float K_AUX16             =       787;
180 const float K_AUX17             =       788;
181 const float K_AUX18             =       789;
182 const float K_AUX19             =       790;
183 const float K_AUX20             =       791;
184 const float K_AUX21             =       792;
185 const float K_AUX22             =       793;
186 const float K_AUX23             =       794;
187 const float K_AUX24             =       795;
188 const float K_AUX25             =       796;
189 const float K_AUX26             =       797;
190 const float K_AUX27             =       798;
191 const float K_AUX28             =       799;
192 const float K_AUX29             =       800;
193 const float K_AUX30             =       801;
194 const float K_AUX31             =       802;
195 const float K_AUX32             =       803;
196
197 //
198 // mouse buttons generate virtual keys
199 //
200 const float K_MOUSE1            =       512;
201 const float K_MOUSE2            =       513;
202 const float K_MOUSE3            =       514;
203 const float K_MWHEELUP  =       515;
204 const float K_MWHEELDOWN        =       516;
205 const float K_MOUSE4            =       517;
206 const float K_MOUSE5            =       518;
207 const float K_MOUSE6            =       519;
208 const float K_MOUSE7            =       520;
209 const float K_MOUSE8            =       521;
210 const float K_MOUSE9            =       522;
211 const float K_MOUSE10           =       523;
212 const float K_MOUSE11           =       524;
213 const float K_MOUSE12           =       525;
214 const float K_MOUSE13           =       526;
215 const float K_MOUSE14           =       527;
216 const float K_MOUSE15           =       528;
217 const float K_MOUSE16           =       529;
218
219 ///////////////////////////
220 // keys pressed
221 const float KEY_FORWARD         =       1;
222 const float KEY_BACKWARD        =       2;
223 const float KEY_LEFT            =       4;
224 const float KEY_RIGHT           =       8;
225 const float KEY_JUMP            =       16;
226 const float KEY_CROUCH          =       32;
227
228 ///////////////////////////
229 // cvar constants
230
231 float CVAR_SAVE         = 1;
232 float CVAR_NOTIFY       = 2;
233 float CVAR_READONLY     = 4;
234
235 ///////////////////////////
236 // csqc communication stuff
237
238 const float STAT_KH_KEYS = 32;
239 const float STAT_CTF_STATE = 33;
240 const float STAT_SYS_TICRATE = 34;
241 const float STAT_WEAPONS = 35;
242 const float STAT_SWITCHWEAPON = 36;
243 const float STAT_GAMESTARTTIME = 37;
244 const float STAT_STRENGTH_FINISHED = 38;
245 const float STAT_INVINCIBLE_FINISHED = 39;
246 const float STAT_PRESSED_KEYS = 42;
247 const float STAT_ALLOW_OLDNEXBEAM = 43; // this stat could later contain some other bits of info, like, more server-side particle config
248 const float CTF_STATE_ATTACK = 1;
249 const float CTF_STATE_DEFEND = 2;
250 const float CTF_STATE_COMMANDER = 3;
251
252 // moved that here so the client knows the max.
253 // # of maps, I'll use arrays for them :P
254 #define MAPVOTE_COUNT 10
255
256 /**
257  * Lower scores are better (e.g. suicides)
258  */
259 #define SFL_LOWER_IS_BETTER     1
260
261 /**
262  * Don't show zero values as scores
263  */
264 #define SFL_HIDE_ZERO           2
265
266 /**
267  * Allow a column to be hidden (do not automatically add it even if it is a sorting key)
268  */
269 #define SFL_ALLOW_HIDE         16
270
271 /**
272  * Display as a rank (with st, nd, rd, th suffix)
273  */
274 #define SFL_RANK               32
275
276 /**
277  * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!)
278  */
279 #define SFL_TIME               64
280
281 // not an extra constant yet
282 #define SFL_ZERO_IS_WORST SFL_TIME
283
284 /**
285  * Scoring priority (NOTE: PRIMARY is used for fraglimit)
286  */
287 #define SFL_SORT_PRIO_SECONDARY 4
288 #define SFL_SORT_PRIO_PRIMARY   8
289 #define SFL_SORT_PRIO_MASK     12
290
291 /**
292  * Score indices
293  */
294 #define MAX_SCORE 10
295 #define MAX_TEAMSCORE 2
296
297 #define ST_SCORE 0
298 #define SP_KILLS 0
299 #define SP_DEATHS 1
300 #define SP_SUICIDES 2
301 #define SP_SCORE 3
302 // game mode specific indices are not in common/, but in server/scores_rules.qc!
303
304 // this assignment must match menu/nexuiz/dialog_settings_misc.c!
305 float   CHAN_AUTO                               = 0;
306         // on world: announcers, ...                     INFO
307         // on players: item pickup                       ITEMS
308         // on entities: UNUSED
309         // on csqc: UNUSED
310 float   CHAN_WEAPON                             = 1; // Weapon fire
311         // on world: UNUSED
312         // on players: weapon firing                     WEAPONS
313         // on entities: turret firing                    WEAPONS
314         // on csqc: UNUSED
315 float   CHAN_VOICE                              = 2; // Voice/Radio
316         // on world: UNUSED
317         // on players: voice                             VOICE
318         // on entities: ambient                          AMBIENT
319         // on csqc: UNUSED
320 float   CHAN_TRIGGER                    = 3; // Triggers/Items
321         // on world: UNUSED
322         // on players: item pickup                       ITEMS
323         // on entities: platforms moving etc.            ITEMS
324         // on csqc: UNUSED
325 float   CHAN_PROJECTILE                 = 4; // Projectiles
326         // on world: UNUSED
327         // on players: projectiles hitting player        SHOTS
328         // on entities: projectiles                      SHOTS
329         // on csqc: projectile sounds                    SHOTS
330 float   CHAN_WEAPON2                    = 5; // Nex fire (separated as it is a very long sound)
331         // on world: UNUSED
332         // on players: weapon firing                     WEAPONS
333         // on entities: turret firing                    WEAPONS
334         // on csqc: UNUSED
335 float   CHAN_PAIN                               = 6; // Pain
336         // on world: UNUSED
337         // on players: pain                              PAIN
338         // on entities: projectiles flying               SHOTS
339         // on csqc: player pain                          PAIN
340 float   CHAN_PLAYER                             = 7; // Player body
341         // on world: UNUSED
342         // on players: player sounds                     PLAYER
343         // on entities: player sounds                    PLAYER
344         // on csqc: UNUSED
345
346 float   ATTN_NONE                               = 0;
347 float   ATTN_MIN                                = 0.015625;
348 float   ATTN_NORM                               = 0.5;
349 float   ATTN_IDLE                               = 2;
350 float   ATTN_STATIC                             = 3;
351 float   ATTN_MAX                                = 3.984375;
352
353 #define VOL_BASE 0.7
354 #define VOL_BASEVOICE 1.0
355
356 // this sets sounds and other properties of the projectiles in csqc
357 float PROJECTILE_ELECTRO = 1;
358 float PROJECTILE_ROCKET = 2;
359 float PROJECTILE_TAG = 3;
360 float PROJECTILE_BULLET = 4;
361 float PROJECTILE_CRYLINK = 5;
362 float PROJECTILE_ELECTRO_BEAM = 6;
363 float PROJECTILE_GRENADE = 7;
364 float PROJECTILE_GRENADE_BOUNCING = 8;
365 float PROJECTILE_LASER = 9;
366 float PROJECTILE_HLAC = 10;
367 float PROJECTILE_SEEKER = 11;
368 float PROJECTILE_FLAC = 12;
369 float PROJECTILE_PORTO_RED = 13;
370 float PROJECTILE_PORTO_BLUE = 14;
371 float PROJECTILE_HOOKBOMB = 15;
372 float PROJECTILE_HAGAR = 16;
373 float PROJECTILE_HAGAR_BOUNCING = 17;
374 float PROJECTILE_BULLET_GLOWING = 18;
375
376 // Deathtypes (weapon deathtypes are the IT_* constants below)
377 // NOTE: when adding death types, please add an explanation to Docs/spamlog.txt too.
378 float DEATH_SPECIAL_START = 10000;
379 float DEATH_FALL = 10000;
380 float DEATH_TELEFRAG = 10001;
381 float DEATH_DROWN = 10002;
382 float DEATH_HURTTRIGGER = 10003;
383 float DEATH_LAVA = 10004;
384 float DEATH_SLIME = 10005;
385 float DEATH_KILL = 10006;
386 float DEATH_NOAMMO = 10007;
387 float DEATH_SWAMP = 10008;
388 float DEATH_TEAMCHANGE = 10009;
389 float DEATH_AUTOTEAMCHANGE = 10010;
390 float DEATH_CAMP = 10011;
391 float DEATH_SHOOTING_STAR = 10012;
392 float DEATH_ROT = 10013;
393 float DEATH_MIRRORDAMAGE = 10014;
394 float DEATH_TOUCHEXPLODE = 10015;
395 float DEATH_CHEAT = 10016;
396 float DEATH_TURRET = 10100;
397
398 float DEATH_WEAPONMASK = 0xFF;
399 float DEATH_HITTYPEMASK = 0x1F00; // which is WAY below 10000 used for normal deaths
400 float HITTYPE_SECONDARY = 0x100;
401 float HITTYPE_SPLASH = 0x200;
402 float HITTYPE_BOUNCE = 0x400;
403 float HITTYPE_HEADSHOT = 0x800;
404 float HITTYPE_RESERVED = 0x1000; // unused yet
405
406 // macros to access these
407 #define DEATH_ISSPECIAL(t)            ((t) >= DEATH_SPECIAL_START)
408 #define DEATH_WEAPONOFWEAPONDEATH(t)  ((t) & DEATH_WEAPONMASK)
409 #define DEATH_ISWEAPON(t,w)           (!DEATH_ISSPECIAL(t) && DEATH_WEAPONOFWEAPONDEATH(t) == (w))
410 #define DEATH_WEAPONOF(t)             (DEATH_ISSPECIAL(t) ? 0 : DEATH_WEAPONOFWEAPONDEATH(t))
411 #define WEP_VALID(w)                  ((w) >= WEP_FIRST && (w) <= WEP_LAST)
412
413 #define FRAGS_PLAYER 0
414 #define FRAGS_SPECTATOR -666
415 #define FRAGS_LMS_LOSER -616
416 #define FRAGS_PLAYER_NONSOLID -616
417 // we can use this frags value for both
418
419 //misc. stuff
420 #define NEWLINES "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
421
422 // water levels
423 float WATERLEVEL_NONE = 0;
424 float WATERLEVEL_WETFEET = 1;
425 float WATERLEVEL_SWIMMING = 2;
426 float WATERLEVEL_SUBMERGED = 3;