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