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