]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/constants.qh
Merge branch 'martin-t/damagetext' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / constants.qh
1 #pragma once
2
3 REGISTER_NET_TEMP(TE_CSQC_PICTURE)
4 REGISTER_NET_TEMP(TE_CSQC_RACE)
5 REGISTER_NET_TEMP(TE_CSQC_TEAMNAGGER)
6 REGISTER_NET_TEMP(TE_CSQC_PINGPLREPORT)
7 REGISTER_NET_TEMP(TE_CSQC_WEAPONCOMPLAIN)
8 REGISTER_NET_TEMP(TE_CSQC_VEHICLESETUP)
9
10 const int RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
11 const int RACE_NET_CHECKPOINT_CLEAR = 1;
12 const int RACE_NET_CHECKPOINT_NEXT_QUALIFYING = 2; // byte nextcheckpoint, short recordtime, string recordholder
13 const int RACE_NET_CHECKPOINT_HIT_RACE = 3; // byte checkpoint, short delta, byte lapsdelta, string opponent
14 const int RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT = 4; // byte checkpoint, short delta, byte lapsdelta, string opponent
15 const int RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING = 5; // byte nextcheckpoint, float laptime, short recordtime, string recordholder
16 const int RACE_NET_PENALTY_RACE = 6; // byte penaltytime, string reason
17 const int RACE_NET_PENALTY_QUALIFYING = 7; // byte penaltytime, string reason
18 const int RACE_NET_SERVER_RECORD = 8; // server record, sent to client
19 const int RACE_NET_SPEED_AWARD = 9; // speed award, sent to client
20 const int RACE_NET_SPEED_AWARD_BEST = 10; // all time best speed award, sent to client
21 const int RACE_NET_SERVER_RANKINGS = 11;
22 const int RACE_NET_SERVER_STATUS = 12;
23 const int RANKINGS_CNT = 15;
24
25 REGISTER_NET_LINKED(_ENT_CLIENT_INIT)
26 #ifdef CSQC
27 NET_HANDLE(_ENT_CLIENT_INIT, bool isnew) { make_pure(this); return true; }
28 #endif
29 /** Sent as a temp entity from a persistent linked entity */
30 REGISTER_NET_TEMP(ENT_CLIENT_INIT)
31
32 REGISTER_NET_LINKED(ENT_CLIENT_SCORES_INFO)
33 REGISTER_NET_LINKED(ENT_CLIENT_SCORES)
34 REGISTER_NET_LINKED(ENT_CLIENT_TEAMSCORES)
35 REGISTER_NET_LINKED(ENT_CLIENT_NAGGER) // flags [votecalledvote]
36 REGISTER_NET_LINKED(ENT_CLIENT_RADARLINK) // flags [startorigin] [endorigin] [startcolor+16*endcolor]
37 REGISTER_NET_LINKED(ENT_CLIENT_PROJECTILE)
38 REGISTER_NET_LINKED(ENT_CLIENT_MAPVOTE)
39 REGISTER_NET_LINKED(ENT_CLIENT_CLIENTDATA)
40 REGISTER_NET_LINKED(ENT_CLIENT_RANDOMSEED)
41 REGISTER_NET_LINKED(ENT_CLIENT_ACCURACY)
42 REGISTER_NET_LINKED(ENT_CLIENT_ELIMINATEDPLAYERS)
43
44 REGISTER_NET_LINKED(ENT_CLIENT_MODEL)
45
46 REGISTER_NET_LINKED(ENT_CLIENT_WARPZONE)
47 REGISTER_NET_LINKED(ENT_CLIENT_WARPZONE_CAMERA)
48 REGISTER_NET_LINKED(ENT_CLIENT_WARPZONE_TELEPORTED)
49
50 REGISTER_NET_LINKED(ENT_CLIENT_ARC_BEAM)
51 REGISTER_NET_LINKED(ENT_CLIENT_HOOK)
52 REGISTER_NET_LINKED(ENT_CLIENT_TUBANOTE)
53
54 REGISTER_NET_LINKED(ENT_CLIENT_SPAWNPOINT)
55 REGISTER_NET_LINKED(ENT_CLIENT_SPAWNEVENT)
56 REGISTER_NET_LINKED(ENT_CLIENT_WALL)
57
58 const int SPRITERULE_DEFAULT = 0;
59 const int SPRITERULE_TEAMPLAY = 1;
60 const int SPRITERULE_SPECTATOR = 2;
61
62 ///////////////////////////
63 // keys pressed
64 const int KEY_FORWARD = BIT(0);
65 const int KEY_BACKWARD = BIT(1);
66 const int KEY_LEFT = BIT(2);
67 const int KEY_RIGHT = BIT(3);
68 const int KEY_JUMP = BIT(4);
69 const int KEY_CROUCH = BIT(5);
70 const int KEY_ATCK = BIT(6);
71 const int KEY_ATCK2 = BIT(7);
72
73 ///////////////////////////
74 // cvar constants
75
76 const int CVAR_SAVE = 1;
77 const int CVAR_NOTIFY = 2;
78 const int CVAR_READONLY = 4;
79
80 ///////////////////////////
81 // csqc communication stuff
82
83 const int HUD_NORMAL = 0;
84 const int HUD_BUMBLEBEE_GUN = 25;
85
86 // moved that here so the client knows the max.
87 // # of maps, I'll use arrays for them :P
88 const int MAPVOTE_COUNT = 30;
89
90 /**
91  * Lower scores are better (e.g. suicides)
92  */
93 const int SFL_LOWER_IS_BETTER = BIT(0);
94
95 /**
96  * Don't show zero values as scores
97  */
98 const int SFL_HIDE_ZERO = BIT(1);
99
100 /**
101  * Allow a column to be hidden (do not automatically add it even if it is a sorting key)
102  */
103 const int SFL_ALLOW_HIDE = BIT(4);
104
105 /**
106  * Display as a rank (with st, nd, rd, th suffix)
107  */
108 const int SFL_RANK = BIT(5);
109
110 /**
111  * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!)
112  */
113 const int SFL_TIME = BIT(6);
114
115 // not an extra constant yet
116 #define SFL_ZERO_IS_WORST SFL_TIME
117
118 /**
119  * Scoring priority (NOTE: PRIMARY is used for fraglimit)
120  */
121 const int SFL_SORT_PRIO_SECONDARY = 4;
122 const int SFL_SORT_PRIO_PRIMARY = 8;
123 const int SFL_SORT_PRIO_MASK = 12;
124
125 /*
126  * Score indices
127  */
128
129 #ifdef GAMEQC
130
131 #define IS_INCREASING(x) ( (x) & SFL_LOWER_IS_BETTER )
132 #define IS_DECREASING(x) ( !((x) & SFL_LOWER_IS_BETTER) )
133
134
135 #define MAX_SCORE 64
136
137 #define REGISTER_SP(id) REGISTER(Scores, SP, id, m_id, new_pure(PlayerScoreField))
138 REGISTRY(Scores, MAX_SCORE);
139 #define Scores_from(i) _Scores_from(i, NULL)
140 REGISTER_REGISTRY(Scores)
141 REGISTRY_SORT(Scores);
142 REGISTRY_CHECK(Scores);
143 STATIC_INIT(Scores_renumber) { FOREACH(Scores, true, it.m_id = i); }
144
145 USING(PlayerScoreField, entity);
146 .int _scores[MAX_SCORE];
147 .string m_name;
148 .int m_flags;
149
150 #define scores(this) _scores[(this).m_id]
151 #define scores_label(this) ((this).m_name)
152 #define scores_flags(this) ((this).m_flags)
153
154 REGISTER_SP(END);
155
156 REGISTER_SP(PING);
157 REGISTER_SP(PL);
158 REGISTER_SP(NAME);
159 REGISTER_SP(KDRATIO);
160 REGISTER_SP(SUM);
161
162 REGISTER_SP(SEPARATOR);
163
164 REGISTER_SP(SCORE);
165
166 REGISTER_SP(DMG);
167 REGISTER_SP(DMGTAKEN);
168
169 REGISTER_SP(KILLS);
170 REGISTER_SP(DEATHS);
171 REGISTER_SP(SUICIDES);
172 REGISTER_SP(FRAGS);
173
174 REGISTER_SP(ELO);
175
176 // TODO: move to common mutators
177
178 REGISTER_SP(RACE_TIME);
179 REGISTER_SP(RACE_LAPS);
180 REGISTER_SP(RACE_FASTEST);
181
182 //REGISTER_SP(CTS_TIME);
183 //REGISTER_SP(CTS_LAPS);
184 //REGISTER_SP(CTS_FASTEST);
185
186 REGISTER_SP(ASSAULT_OBJECTIVES);
187
188 REGISTER_SP(CTF_PICKUPS);
189 REGISTER_SP(CTF_FCKILLS);
190 REGISTER_SP(CTF_RETURNS);
191 REGISTER_SP(CTF_CAPS);
192 REGISTER_SP(CTF_CAPTIME);
193 REGISTER_SP(CTF_DROPS);
194
195 REGISTER_SP(DOM_TAKES);
196 REGISTER_SP(DOM_TICKS);
197
198 REGISTER_SP(FREEZETAG_REVIVALS);
199
200 REGISTER_SP(KEEPAWAY_PICKUPS);
201 REGISTER_SP(KEEPAWAY_BCTIME);
202 REGISTER_SP(KEEPAWAY_CARRIERKILLS);
203
204 REGISTER_SP(KH_PICKUPS);
205 REGISTER_SP(KH_CAPS);
206 REGISTER_SP(KH_KCKILLS);
207 REGISTER_SP(KH_PUSHES);
208 REGISTER_SP(KH_DESTROYS);
209 REGISTER_SP(KH_LOSSES);
210
211 REGISTER_SP(LMS_RANK);
212 REGISTER_SP(LMS_LIVES);
213
214 REGISTER_SP(NEXBALL_GOALS);
215 REGISTER_SP(NEXBALL_FAULTS);
216
217 REGISTER_SP(ONS_TAKES);
218 REGISTER_SP(ONS_CAPS);
219
220 #define MAX_TEAMSCORE 2
221 USING(ScoreTeam, string);
222 .int _teamscores[MAX_TEAMSCORE];
223 #define teamscores(i) _teamscores[i]
224 string _teamscores_label[MAX_TEAMSCORE];
225 #define teamscores_label(i) _teamscores_label[i]
226 int _teamscores_flags[MAX_TEAMSCORE];
227 #define teamscores_flags(i) _teamscores_flags[i]
228
229 #endif
230
231 const int ST_SCORE = 0;
232
233 // game mode specific indices are not in common/, but in server/scores_rules.qc!
234
235 // WEAPONTODO: move this into separate/new projectile handling code // this sets sounds and other properties of the projectiles in csqc
236 const int PROJECTILE_ELECTRO = 1;
237 const int PROJECTILE_ROCKET = 2;
238 const int PROJECTILE_TAG = 3;
239 const int PROJECTILE_CRYLINK = 5;
240 const int PROJECTILE_ELECTRO_BEAM = 6;
241 const int PROJECTILE_GRENADE = 7;
242 const int PROJECTILE_GRENADE_BOUNCING = 8;
243 const int PROJECTILE_MINE = 9;
244 const int PROJECTILE_BLASTER = 10;
245 const int PROJECTILE_HLAC = 11;
246 const int PROJECTILE_SEEKER = 12;
247 const int PROJECTILE_FLAC = 13;
248 const int PROJECTILE_PORTO_RED = 14;
249 const int PROJECTILE_PORTO_BLUE = 15;
250 const int PROJECTILE_HOOKBOMB = 16;
251 const int PROJECTILE_HAGAR = 17;
252 const int PROJECTILE_HAGAR_BOUNCING = 18;
253 const int PROJECTILE_CRYLINK_BOUNCING = 20;
254 const int PROJECTILE_FIREBALL = 21;
255 const int PROJECTILE_FIREMINE = 22;
256
257 const int PROJECTILE_RAPTORCANNON = 24;
258 const int PROJECTILE_RAPTORBOMB = 25;
259 const int PROJECTILE_RAPTORBOMBLET = 26;
260 const int PROJECTILE_SPIDERROCKET = 27;
261 const int PROJECTILE_WAKIROCKET = 28;
262 const int PROJECTILE_WAKICANNON = 29;
263
264 const int PROJECTILE_BUMBLE_GUN = 30;
265 const int PROJECTILE_BUMBLE_BEAM = 31;
266
267 const int PROJECTILE_MAGE_SPIKE = 32;
268 const int PROJECTILE_SHAMBLER_LIGHTNING = 33;
269
270 const int PROJECTILE_ROCKETMINSTA_LASER = 34;
271
272 const int PROJECTILE_ARC_BOLT = 35;
273
274 // projectile IDs 40-50 reserved
275
276 const int PROJECTILE_RPC = 60;
277
278 const int SPECIES_HUMAN = 0;
279 const int SPECIES_ROBOT_SOLID = 1;
280 const int SPECIES_ALIEN = 2;
281 const int SPECIES_ANIMAL = 3;
282 const int SPECIES_ROBOT_RUSTY = 4;
283 const int SPECIES_ROBOT_SHINY = 5;
284 const int SPECIES_RESERVED = 15;
285
286 const int FRAGS_PLAYER = 0;
287 const int FRAGS_SPECTATOR = -666;
288 const int FRAGS_LMS_LOSER = -616;
289 const int FRAGS_PLAYER_NONSOLID = -616;
290 // we can use this frags value for both
291
292 // water levels
293 const int WATERLEVEL_NONE = 0;
294 const int WATERLEVEL_WETFEET = 1;
295 const int WATERLEVEL_SWIMMING = 2;
296 const int WATERLEVEL_SUBMERGED = 3;
297
298 // server flags
299 const int SERVERFLAG_ALLOW_FULLBRIGHT = 1;
300 const int SERVERFLAG_TEAMPLAY = 2;
301 const int SERVERFLAG_PLAYERSTATS = 4;
302
303 // FIXME/EXPLAINME: why? Mario: because
304 vector autocvar_sv_player_maxs = '16 16 45';
305 vector autocvar_sv_player_mins = '-16 -16 -24';
306 vector autocvar_sv_player_viewoffset = '0 0 20';
307 vector autocvar_sv_player_crouch_maxs = '16 16 25';
308 vector autocvar_sv_player_crouch_mins = '-16 -16 -24';
309 vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
310 vector autocvar_sv_player_headsize = '24 24 12';
311
312
313 // a bit more constant
314 const vector PL_MAX_CONST = '16 16 45';
315 const vector PL_MIN_CONST = '-16 -16 -24';
316
317 // spawnpoint prios
318 const int SPAWN_PRIO_NEAR_TEAMMATE_FOUND = 200;
319 const int SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM = 100;
320 const int SPAWN_PRIO_RACE_PREVIOUS_SPAWN = 50;
321 const int SPAWN_PRIO_GOOD_DISTANCE = 10;
322
323 // gametype vote flags
324 const int GTV_FORBIDDEN = 0; // Cannot be voted
325 const int GTV_AVAILABLE = 1; // Can be voted
326 const int GTV_CUSTOM    = 2; // Custom entry