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