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