Merged master.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / stats.qh
1 #pragma once
2
3 #ifdef SVQC
4 #include <server/client.qh>
5 #endif
6
7 // Full list of all stat constants, included in a single location for easy reference
8 // 255 is the current limit (MAX_CL_STATS - 1), engine will need to be modified if you wish to add more stats
9
10 const int MAX_CL_STATS = 256;
11
12 // const int STAT_HEALTH = 0;
13 // const int STAT_ARMOR = 4;
14 // const int STAT_SHELLS = 6;
15 // const int STAT_NAILS = 7;
16 // const int STAT_ROCKETS = 8;
17 // const int STAT_CELLS = 9;
18 // const int STAT_ACTIVEWEAPON = 10;
19 // const int STAT_ITEMS = 15; // .items | .items2 << 23 | serverflags << 28
20 // const int STAT_VIEWHEIGHT = 16;
21
22 #if defined(CSQC)
23     #define g_stat_HEALTH getstati(STAT_HEALTH)
24     #define g_stat_ARMOR getstat_int(STAT_ARMOR)
25     #define g_stat_SHELLS getstat_int(STAT_SHELLS)
26     #define g_stat_NAILS getstat_int(STAT_NAILS)
27     #define g_stat_ROCKETS getstat_int(STAT_ROCKETS)
28     #define g_stat_CELLS getstat_int(STAT_CELLS)
29     #define g_stat_ACTIVEWEAPON getstat_int(STAT_ACTIVEWEAPON)
30     #define g_stat_ITEMS getstat_int(STAT_ITEMS)
31     #define g_stat_VIEWHEIGHT getstati(STAT_VIEWHEIGHT)
32 #elif defined(SVQC)
33     #define stat_HEALTH health
34     #define stat_ARMOR armorvalue
35     #define stat_SHELLS ammo_shells
36     #define stat_NAILS ammo_nails
37     #define stat_ROCKETS ammo_rockets
38     #define stat_CELLS ammo_cells
39     #define stat_ACTIVEWEAPON weapon
40     #define stat_ITEMS items
41     #define stat_VIEWHEIGHT view_ofs_z
42 #endif
43
44 #ifdef SVQC
45 vector weaponsInMap;
46 #endif
47 REGISTER_STAT(WEAPONS, vectori)
48 REGISTER_STAT(WEAPONSINMAP, vectori, weaponsInMap)
49
50 REGISTER_STAT(PL_VIEW_OFS, vector)
51 REGISTER_STAT(PL_CROUCH_VIEW_OFS, vector)
52
53 REGISTER_STAT(PL_MIN, vector)
54 REGISTER_STAT(PL_CROUCH_MIN, vector)
55
56 REGISTER_STAT(PL_MAX, vector)
57 REGISTER_STAT(PL_CROUCH_MAX, vector)
58
59 REGISTER_STAT(KH_KEYS, int)
60
61 #ifdef SVQC
62 float W_WeaponRateFactor(entity this);
63 float game_stopped;
64 float game_starttime;
65 float round_starttime;
66 bool autocvar_g_allow_oldvortexbeam;
67 int autocvar_leadlimit;
68 #endif
69 REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor(this))
70 REGISTER_STAT(GAME_STOPPED, int, game_stopped)
71 REGISTER_STAT(GAMESTARTTIME, float, game_starttime)
72 REGISTER_STAT(STRENGTH_FINISHED, float)
73 REGISTER_STAT(INVINCIBLE_FINISHED, float)
74 /** arc heat in [0,1] */
75 REGISTER_STAT(ARC_HEAT, float)
76 REGISTER_STAT(PRESSED_KEYS, int)
77 /** this stat could later contain some other bits of info, like, more server-side particle config */
78 REGISTER_STAT(ALLOW_OLDVORTEXBEAM, bool, autocvar_g_allow_oldvortexbeam)
79 REGISTER_STAT(FUEL, int)
80 REGISTER_STAT(NB_METERSTART, float)
81 /** compressShotOrigin */
82 REGISTER_STAT(SHOTORG, int)
83 REGISTER_STAT(LEADLIMIT, float, autocvar_leadlimit)
84 REGISTER_STAT(WEAPON_CLIPLOAD, int)
85 REGISTER_STAT(WEAPON_CLIPSIZE, int)
86
87 REGISTER_STAT(VORTEX_CHARGE, float)
88 REGISTER_STAT(OVERKILL_VORTEX_CHARGE, float)
89 REGISTER_STAT(LAST_PICKUP, float)
90 REGISTER_STAT(HUD, int)
91 REGISTER_STAT(VORTEX_CHARGEPOOL, float)
92 REGISTER_STAT(OVERKILL_VORTEX_CHARGEPOOL, float)
93 REGISTER_STAT(HIT_TIME, float)
94 REGISTER_STAT(DAMAGE_DEALT_TOTAL, int)
95 REGISTER_STAT(TYPEHIT_TIME, float)
96 REGISTER_STAT(LAYED_MINES, int)
97 REGISTER_STAT(HAGAR_LOAD, int)
98 REGISTER_STAT(SUPERWEAPONS_FINISHED, float)
99 REGISTER_STAT(VEHICLESTAT_HEALTH, int)
100 REGISTER_STAT(VEHICLESTAT_SHIELD, int)
101 REGISTER_STAT(VEHICLESTAT_ENERGY, int)
102 REGISTER_STAT(VEHICLESTAT_AMMO1, int)
103 REGISTER_STAT(VEHICLESTAT_RELOAD1, int)
104 REGISTER_STAT(VEHICLESTAT_AMMO2, int)
105 REGISTER_STAT(VEHICLESTAT_RELOAD2, int)
106 REGISTER_STAT(VEHICLESTAT_W2MODE, int)
107 REGISTER_STAT(NADE_TIMER, float)
108 REGISTER_STAT(SECRETS_TOTAL, float)
109 REGISTER_STAT(SECRETS_FOUND, float)
110 REGISTER_STAT(RESPAWN_TIME, float)
111 REGISTER_STAT(ROUNDSTARTTIME, float, round_starttime)
112 REGISTER_STAT(MONSTERS_TOTAL, int)
113 REGISTER_STAT(MONSTERS_KILLED, int)
114 REGISTER_STAT(BUFFS, int)
115 REGISTER_STAT(NADE_BONUS, float)
116 REGISTER_STAT(NADE_BONUS_TYPE, int)
117 REGISTER_STAT(NADE_BONUS_SCORE, float)
118 REGISTER_STAT(HEALING_ORB, float)
119 REGISTER_STAT(HEALING_ORB_ALPHA, float)
120 REGISTER_STAT(PLASMA, int)
121 REGISTER_STAT(FROZEN, int)
122 REGISTER_STAT(REVIVE_PROGRESS, float)
123 REGISTER_STAT(ROUNDLOST, int)
124 REGISTER_STAT(BUFF_TIME, float)
125 REGISTER_STAT(CTF_FLAGSTATUS, int)
126 REGISTER_STAT(CAPTURE_PROGRESS, float)
127 REGISTER_STAT(ENTRAP_ORB, float)
128 REGISTER_STAT(ENTRAP_ORB_ALPHA, float)
129 REGISTER_STAT(ITEMSTIME, int, autocvar_sv_itemstime)
130 REGISTER_STAT(KILL_TIME, float)
131
132 #ifdef SVQC
133 bool autocvar_g_ctf_leaderboard;
134 #endif
135 REGISTER_STAT(CTF_SHOWLEADERBOARD, bool, autocvar_g_ctf_leaderboard)
136
137 #ifdef SVQC
138 int autocvar_g_multijump;
139 float autocvar_g_multijump_add;
140 float autocvar_g_multijump_speed;
141 float autocvar_g_multijump_maxspeed;
142 float autocvar_g_multijump_dodging = 1;
143 #endif
144 REGISTER_STAT(MULTIJUMP_DODGING, int, autocvar_g_multijump_dodging)
145 REGISTER_STAT(MULTIJUMP_MAXSPEED, float, autocvar_g_multijump_maxspeed)
146 REGISTER_STAT(MULTIJUMP_ADD, int, autocvar_g_multijump_add)
147 REGISTER_STAT(MULTIJUMP_SPEED, float, autocvar_g_multijump_speed)
148 .int multijump_count;
149 REGISTER_STAT(MULTIJUMP_COUNT, int, this.multijump_count)
150 REGISTER_STAT(MULTIJUMP, int, autocvar_g_multijump)
151 REGISTER_STAT(DOUBLEJUMP, int, autocvar_sv_doublejump)
152
153 #ifdef SVQC
154 bool g_bugrigs;
155 bool g_bugrigs_planar_movement;
156 bool g_bugrigs_planar_movement_car_jumping;
157 float g_bugrigs_reverse_spinning;
158 float g_bugrigs_reverse_speeding;
159 float g_bugrigs_reverse_stopping;
160 float g_bugrigs_air_steering;
161 float g_bugrigs_angle_smoothing;
162 float g_bugrigs_friction_floor;
163 float g_bugrigs_friction_brake;
164 float g_bugrigs_friction_air;
165 float g_bugrigs_accel;
166 float g_bugrigs_speed_ref;
167 float g_bugrigs_speed_pow;
168 float g_bugrigs_steer;
169 #endif
170 REGISTER_STAT(BUGRIGS, int, g_bugrigs)
171 REGISTER_STAT(BUGRIGS_ACCEL, float, g_bugrigs_accel)
172 REGISTER_STAT(BUGRIGS_AIR_STEERING, int, g_bugrigs_air_steering)
173 REGISTER_STAT(BUGRIGS_ANGLE_SMOOTHING, int, g_bugrigs_angle_smoothing)
174 REGISTER_STAT(BUGRIGS_CAR_JUMPING, int, g_bugrigs_planar_movement_car_jumping)
175 REGISTER_STAT(BUGRIGS_FRICTION_AIR, float, g_bugrigs_friction_air)
176 REGISTER_STAT(BUGRIGS_FRICTION_BRAKE, float, g_bugrigs_friction_brake)
177 REGISTER_STAT(BUGRIGS_FRICTION_FLOOR, float, g_bugrigs_friction_floor)
178 REGISTER_STAT(BUGRIGS_PLANAR_MOVEMENT, int, g_bugrigs_planar_movement)
179 REGISTER_STAT(BUGRIGS_REVERSE_SPEEDING, int, g_bugrigs_reverse_speeding)
180 REGISTER_STAT(BUGRIGS_REVERSE_SPINNING, int, g_bugrigs_reverse_spinning)
181 REGISTER_STAT(BUGRIGS_REVERSE_STOPPING, int, g_bugrigs_reverse_stopping)
182 REGISTER_STAT(BUGRIGS_SPEED_POW, float, g_bugrigs_speed_pow)
183 REGISTER_STAT(BUGRIGS_SPEED_REF, float, g_bugrigs_speed_ref)
184 REGISTER_STAT(BUGRIGS_STEER, float, g_bugrigs_steer)
185
186 #ifdef SVQC
187 int autocvar_sv_gameplayfix_downtracesupportsongroundflag;
188 int autocvar_sv_gameplayfix_easierwaterjump;
189 int autocvar_sv_gameplayfix_stepdown;
190 int autocvar_sv_gameplayfix_stepmultipletimes;
191 int autocvar_sv_gameplayfix_unstickplayers;
192 int autocvar_sv_gameplayfix_fixedcheckwatertransition;
193 #endif
194 REGISTER_STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, int, autocvar_sv_gameplayfix_downtracesupportsongroundflag)
195 REGISTER_STAT(GAMEPLAYFIX_EASIERWATERJUMP, int, autocvar_sv_gameplayfix_easierwaterjump)
196 REGISTER_STAT(GAMEPLAYFIX_STEPDOWN, int, autocvar_sv_gameplayfix_stepdown)
197 REGISTER_STAT(GAMEPLAYFIX_STEPMULTIPLETIMES, int, autocvar_sv_gameplayfix_stepmultipletimes)
198 REGISTER_STAT(GAMEPLAYFIX_UNSTICKPLAYERS, int, autocvar_sv_gameplayfix_unstickplayers)
199 REGISTER_STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, int, autocvar_sv_gameplayfix_upwardvelocityclearsongroundflag)
200 REGISTER_STAT(GAMEPLAYFIX_WATERTRANSITION, int, autocvar_sv_gameplayfix_fixedcheckwatertransition)
201
202 REGISTER_STAT(MOVEVARS_JUMPSTEP, int, cvar("sv_jumpstep"))
203 REGISTER_STAT(NOSTEP, int, cvar("sv_nostep"))
204
205 REGISTER_STAT(MOVEVARS_FRICTION, float)
206 REGISTER_STAT(MOVEVARS_FRICTION_SLICK, float, autocvar_sv_friction_slick)
207 REGISTER_STAT(MOVEVARS_FRICTION_ONLAND, float, autocvar_sv_friction_on_land)
208
209 REGISTER_STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, int, autocvar_sv_jumpspeedcap_max_disable_on_ramps)
210 REGISTER_STAT(MOVEVARS_TRACK_CANJUMP, int)
211 /** cvar loopback */
212 REGISTER_STAT(MOVEVARS_CL_TRACK_CANJUMP, int)
213
214 #ifdef SVQC
215 int g_dodging;
216 float autocvar_sv_dodging_delay;
217 float autocvar_sv_dodging_wall_distance_threshold;
218 bool autocvar_sv_dodging_frozen;
219 bool autocvar_sv_dodging_frozen_doubletap;
220 float autocvar_sv_dodging_height_threshold;
221 float autocvar_sv_dodging_horiz_speed;
222 float autocvar_sv_dodging_horiz_speed_frozen;
223 float autocvar_sv_dodging_ramp_time;
224 float autocvar_sv_dodging_up_speed;
225 bool autocvar_sv_dodging_wall_dodging;
226 bool autocvar_sv_dodging_air_dodging;
227 float autocvar_sv_dodging_maxspeed = 450;
228 #endif
229
230 #if 0
231 REGISTER_STAT(DODGING, int, g_dodging)
232 REGISTER_STAT(DODGING_DELAY, float, autocvar_sv_dodging_delay)
233 REGISTER_STAT(DODGING_DISTANCE_THRESHOLD, float, autocvar_sv_dodging_wall_distance_threshold)
234 REGISTER_STAT(DODGING_FROZEN_NO_DOUBLETAP, int, autocvar_sv_dodging_frozen_doubletap)
235 REGISTER_STAT(DODGING_HEIGHT_THRESHOLD, float, autocvar_sv_dodging_height_threshold)
236 REGISTER_STAT(DODGING_HORIZ_SPEED, float, autocvar_sv_dodging_horiz_speed)
237 REGISTER_STAT(DODGING_HORIZ_SPEED_FROZEN, float, autocvar_sv_dodging_horiz_speed_frozen)
238 REGISTER_STAT(DODGING_RAMP_TIME, float, autocvar_sv_dodging_ramp_time)
239 REGISTER_STAT(DODGING_UP_SPEED, float, autocvar_sv_dodging_up_speed)
240 REGISTER_STAT(DODGING_WALL, bool, autocvar_sv_dodging_wall_dodging)
241 REGISTER_STAT(DODGING_AIR, bool, autocvar_sv_dodging_air_dodging)
242 REGISTER_STAT(DODGING_MAXSPEED, float, autocvar_sv_dodging_maxspeed)
243 #endif
244 /** cvar loopback */
245 REGISTER_STAT(DODGING_FROZEN, int, autocvar_sv_dodging_frozen)
246 REGISTER_STAT(DODGING_TIMEOUT, float)
247
248 REGISTER_STAT(JETPACK_ACCEL_SIDE, float, autocvar_g_jetpack_acceleration_side)
249 REGISTER_STAT(JETPACK_ACCEL_UP, float, autocvar_g_jetpack_acceleration_up)
250 REGISTER_STAT(JETPACK_ANTIGRAVITY, float, autocvar_g_jetpack_antigravity)
251 REGISTER_STAT(JETPACK_FUEL, float, autocvar_g_jetpack_fuel)
252 REGISTER_STAT(JETPACK_MAXSPEED_SIDE, float, autocvar_g_jetpack_maxspeed_side)
253 REGISTER_STAT(JETPACK_MAXSPEED_UP, float, autocvar_g_jetpack_maxspeed_up)
254 REGISTER_STAT(JETPACK_REVERSE_THRUST, float, autocvar_g_jetpack_reverse_thrust)
255
256 REGISTER_STAT(MOVEVARS_HIGHSPEED, float)
257
258 #ifdef SVQC
259 AUTOCVAR(g_walljump, bool, false, "Enable wall jumping mutator");
260 AUTOCVAR(g_walljump_delay, float, 1, "Minimum delay between wall jumps");
261 AUTOCVAR(g_walljump_force, float, 300, "How far to bounce/jump off the wall");
262 AUTOCVAR(g_walljump_velocity_xy_factor, float, 1.15, "How much to slow down along horizontal axis, higher value = higher deceleration, if factor is < 1, you accelerate by wall jumping");
263 AUTOCVAR(g_walljump_velocity_z_factor, float, 0.5, "Upwards velocity factor, multiplied by normal jump velocity");
264 #endif
265 REGISTER_STAT(WALLJUMP, int, autocvar_g_walljump)
266 REGISTER_STAT(WALLJUMP_VELOCITY_Z_FACTOR, float, autocvar_g_walljump_velocity_z_factor)
267 REGISTER_STAT(WALLJUMP_VELOCITY_XY_FACTOR, float, autocvar_g_walljump_velocity_xy_factor)
268 REGISTER_STAT(WALLJUMP_DELAY, float, autocvar_g_walljump_delay)
269 REGISTER_STAT(WALLJUMP_FORCE, float, autocvar_g_walljump_force)
270 REGISTER_STAT(LASTWJ, float)
271
272 // freeze tag, clan arena
273 REGISTER_STAT(REDALIVE, int)
274 REGISTER_STAT(BLUEALIVE, int)
275 REGISTER_STAT(YELLOWALIVE, int)
276 REGISTER_STAT(PINKALIVE, int)
277
278 // domination
279 REGISTER_STAT(DOM_TOTAL_PPS, float)
280 REGISTER_STAT(DOM_PPS_RED, float)
281 REGISTER_STAT(DOM_PPS_BLUE, float)
282 REGISTER_STAT(DOM_PPS_YELLOW, float)
283 REGISTER_STAT(DOM_PPS_PINK, float)
284
285 REGISTER_STAT(TELEPORT_MAXSPEED, float, autocvar_g_teleport_maxspeed)
286 REGISTER_STAT(TELEPORT_TELEFRAG_AVOID, int, autocvar_g_telefrags_avoid)
287
288 REGISTER_STAT(CAMERA_SPECTATOR, int)
289
290 REGISTER_STAT(SPECTATORSPEED, float)
291
292 #ifdef SVQC
293 bool autocvar_sv_slick_applygravity;
294 #endif
295 REGISTER_STAT(SLICK_APPLYGRAVITY, bool, autocvar_sv_slick_applygravity)
296
297 #ifdef SVQC
298 #include "physics/movetypes/movetypes.qh"
299 #endif
300
301 REGISTER_STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, float)
302 REGISTER_STAT(MOVEVARS_AIRCONTROL_PENALTY, float)
303 REGISTER_STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, float)
304 REGISTER_STAT(MOVEVARS_AIRSTRAFEACCEL_QW, float)
305 REGISTER_STAT(MOVEVARS_AIRCONTROL_POWER, float)
306 REGISTER_STAT(MOVEVARS_AIRCONTROL_BACKWARDS, bool)
307 REGISTER_STAT(MOVEVARS_AIRCONTROL_SIDEWARDS, bool)
308 noref bool autocvar_sv_gameplayfix_nogravityonground;
309 REGISTER_STAT(MOVEFLAGS, int, MOVEFLAG_VALID
310                               | (autocvar_sv_gameplayfix_q2airaccelerate ? MOVEFLAG_Q2AIRACCELERATE : 0)
311                               | (autocvar_sv_gameplayfix_nogravityonground ? MOVEFLAG_NOGRAVITYONGROUND : 0)
312                               | (autocvar_sv_gameplayfix_gravityunaffectedbyticrate ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0))
313
314 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, float)
315 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_ACCEL, float)
316 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_TOPSPEED, float)
317 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_TURNACCEL, float)
318 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, float)
319
320 REGISTER_STAT(MOVEVARS_AIRSTOPACCELERATE, float)
321 REGISTER_STAT(MOVEVARS_AIRSTRAFEACCELERATE, float)
322 REGISTER_STAT(MOVEVARS_MAXAIRSTRAFESPEED, float)
323 REGISTER_STAT(MOVEVARS_AIRCONTROL, float)
324 REGISTER_STAT(FRAGLIMIT, float, autocvar_fraglimit)
325 REGISTER_STAT(TIMELIMIT, float, autocvar_timelimit)
326 REGISTER_STAT(WARMUP_TIMELIMIT, float, warmup_limit)
327 #ifdef SVQC
328 float autocvar_sv_wallfriction;
329 #endif
330 REGISTER_STAT(MOVEVARS_WALLFRICTION, int, autocvar_sv_wallfriction)
331 REGISTER_STAT(MOVEVARS_TICRATE, float, autocvar_sys_ticrate)
332 REGISTER_STAT(MOVEVARS_TIMESCALE, float, autocvar_slowmo)
333 REGISTER_STAT(MOVEVARS_GRAVITY, float, autocvar_sv_gravity)
334 REGISTER_STAT(MOVEVARS_STOPSPEED, float)
335 REGISTER_STAT(MOVEVARS_MAXSPEED, float)
336 REGISTER_STAT(MOVEVARS_ACCELERATE, float)
337 REGISTER_STAT(MOVEVARS_AIRACCELERATE, float)
338 .float gravity;
339 // FIXME: Was 0 on server, 1 on client. Still want that?
340 REGISTER_STAT(MOVEVARS_ENTGRAVITY, float, (this.gravity) ? this.gravity : 1)
341 REGISTER_STAT(MOVEVARS_JUMPVELOCITY, float)
342 REGISTER_STAT(MOVEVARS_MAXAIRSPEED, float)
343 REGISTER_STAT(MOVEVARS_STEPHEIGHT, float, autocvar_sv_stepheight)
344 REGISTER_STAT(MOVEVARS_AIRACCEL_QW, float)
345 REGISTER_STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, float)
346 REGISTER_STAT(MOVEVARS_SPECIALCOMMAND, bool)
347
348
349 #ifdef CSQC
350 noref int autocvar_cl_gunalign;
351 #endif
352 #ifdef SVQC
353 .int cvar_cl_gunalign;
354 REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
355 #endif
356 REGISTER_STAT(GUNALIGN, int, this.cvar_cl_gunalign)
357 #ifdef SVQC
358 SPECTATE_COPYFIELD(_STAT(GUNALIGN))
359 #endif