Merge branch 'master' into Mario/wepent_experimental
[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 REGISTER_STAT(WEAPONS, vectori)
45 REGISTER_STAT(WEAPONSINMAP, vectori)
46
47 REGISTER_STAT(PL_VIEW_OFS, vector, autocvar_sv_player_viewoffset)
48 REGISTER_STAT(PL_CROUCH_VIEW_OFS, vector, autocvar_sv_player_crouch_viewoffset)
49
50 REGISTER_STAT(PL_MIN, vector, autocvar_sv_player_mins)
51 REGISTER_STAT(PL_CROUCH_MIN, vector, autocvar_sv_player_crouch_mins)
52
53 REGISTER_STAT(PL_MAX, vector, autocvar_sv_player_maxs)
54 REGISTER_STAT(PL_CROUCH_MAX, vector, autocvar_sv_player_crouch_maxs)
55
56 REGISTER_STAT(KH_KEYS, int)
57
58 #ifdef SVQC
59 float W_WeaponRateFactor(entity this);
60 #endif
61 REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor(this))
62
63 REGISTER_STAT(GAMESTARTTIME, float)
64 REGISTER_STAT(STRENGTH_FINISHED, float)
65 REGISTER_STAT(INVINCIBLE_FINISHED, float)
66 /** arc heat in [0,1] */
67 REGISTER_STAT(ARC_HEAT, float)
68 REGISTER_STAT(PRESSED_KEYS, int)
69 /** this stat could later contain some other bits of info, like, more server-side particle config */
70 REGISTER_STAT(ALLOW_OLDVORTEXBEAM, bool)
71 REGISTER_STAT(FUEL, int)
72 REGISTER_STAT(NB_METERSTART, float)
73 /** compressShotOrigin */
74 REGISTER_STAT(SHOTORG, int)
75 REGISTER_STAT(LEADLIMIT, float)
76 REGISTER_STAT(WEAPON_CLIPLOAD, int)
77 REGISTER_STAT(WEAPON_CLIPSIZE, int)
78
79 REGISTER_STAT(VORTEX_CHARGE, float)
80 REGISTER_STAT(LAST_PICKUP, float)
81 REGISTER_STAT(HUD, int)
82 REGISTER_STAT(VORTEX_CHARGEPOOL, float)
83 REGISTER_STAT(HIT_TIME, float)
84 REGISTER_STAT(DAMAGE_DEALT_TOTAL, int)
85 REGISTER_STAT(TYPEHIT_TIME, float)
86 REGISTER_STAT(LAYED_MINES, int)
87 REGISTER_STAT(HAGAR_LOAD, int)
88 REGISTER_STAT(SUPERWEAPONS_FINISHED, float)
89 REGISTER_STAT(VEHICLESTAT_HEALTH, int)
90 REGISTER_STAT(VEHICLESTAT_SHIELD, int)
91 REGISTER_STAT(VEHICLESTAT_ENERGY, int)
92 REGISTER_STAT(VEHICLESTAT_AMMO1, int)
93 REGISTER_STAT(VEHICLESTAT_RELOAD1, int)
94 REGISTER_STAT(VEHICLESTAT_AMMO2, int)
95 REGISTER_STAT(VEHICLESTAT_RELOAD2, int)
96 REGISTER_STAT(VEHICLESTAT_W2MODE, int)
97 REGISTER_STAT(NADE_TIMER, float)
98 REGISTER_STAT(SECRETS_TOTAL, float)
99 REGISTER_STAT(SECRETS_FOUND, float)
100 REGISTER_STAT(RESPAWN_TIME, float)
101 REGISTER_STAT(ROUNDSTARTTIME, float)
102 REGISTER_STAT(MONSTERS_TOTAL, int)
103 REGISTER_STAT(MONSTERS_KILLED, int)
104 REGISTER_STAT(BUFFS, int)
105 REGISTER_STAT(NADE_BONUS, float)
106 REGISTER_STAT(NADE_BONUS_TYPE, int)
107 REGISTER_STAT(NADE_BONUS_SCORE, float)
108 REGISTER_STAT(HEALING_ORB, float)
109 REGISTER_STAT(HEALING_ORB_ALPHA, float)
110 REGISTER_STAT(PLASMA, int)
111 REGISTER_STAT(FROZEN, int)
112 REGISTER_STAT(REVIVE_PROGRESS, float)
113 REGISTER_STAT(ROUNDLOST, int)
114 REGISTER_STAT(BUFF_TIME, float)
115 REGISTER_STAT(CTF_FLAGSTATUS, int)
116 REGISTER_STAT(CAPTURE_PROGRESS, float)
117 REGISTER_STAT(ENTRAP_ORB, float)
118 REGISTER_STAT(ENTRAP_ORB_ALPHA, float)
119 REGISTER_STAT(ITEMSTIME, int, autocvar_sv_itemstime)
120
121 #ifdef SVQC
122 int autocvar_g_multijump;
123 float autocvar_g_multijump_add;
124 float autocvar_g_multijump_speed;
125 float autocvar_g_multijump_maxspeed;
126 float autocvar_g_multijump_dodging = 1;
127 #endif
128 REGISTER_STAT(MULTIJUMP_DODGING, int, autocvar_g_multijump_dodging)
129 REGISTER_STAT(MULTIJUMP_MAXSPEED, float, autocvar_g_multijump_maxspeed)
130 REGISTER_STAT(MULTIJUMP_ADD, int, autocvar_g_multijump_add)
131 REGISTER_STAT(MULTIJUMP_SPEED, float, autocvar_g_multijump_speed)
132 .int multijump_count;
133 REGISTER_STAT(MULTIJUMP_COUNT, int, this.multijump_count)
134 REGISTER_STAT(MULTIJUMP, int, autocvar_g_multijump)
135 REGISTER_STAT(DOUBLEJUMP, int, autocvar_sv_doublejump)
136
137 #ifdef SVQC
138 bool g_bugrigs;
139 bool g_bugrigs_planar_movement;
140 bool g_bugrigs_planar_movement_car_jumping;
141 float g_bugrigs_reverse_spinning;
142 float g_bugrigs_reverse_speeding;
143 float g_bugrigs_reverse_stopping;
144 float g_bugrigs_air_steering;
145 float g_bugrigs_angle_smoothing;
146 float g_bugrigs_friction_floor;
147 float g_bugrigs_friction_brake;
148 float g_bugrigs_friction_air;
149 float g_bugrigs_accel;
150 float g_bugrigs_speed_ref;
151 float g_bugrigs_speed_pow;
152 float g_bugrigs_steer;
153 #endif
154 REGISTER_STAT(BUGRIGS, int, g_bugrigs)
155 REGISTER_STAT(BUGRIGS_ACCEL, float, g_bugrigs_accel)
156 REGISTER_STAT(BUGRIGS_AIR_STEERING, int, g_bugrigs_air_steering)
157 REGISTER_STAT(BUGRIGS_ANGLE_SMOOTHING, int, g_bugrigs_angle_smoothing)
158 REGISTER_STAT(BUGRIGS_CAR_JUMPING, int, g_bugrigs_planar_movement_car_jumping)
159 REGISTER_STAT(BUGRIGS_FRICTION_AIR, float, g_bugrigs_friction_air)
160 REGISTER_STAT(BUGRIGS_FRICTION_BRAKE, float, g_bugrigs_friction_brake)
161 REGISTER_STAT(BUGRIGS_FRICTION_FLOOR, float, g_bugrigs_friction_floor)
162 REGISTER_STAT(BUGRIGS_PLANAR_MOVEMENT, int, g_bugrigs_planar_movement)
163 REGISTER_STAT(BUGRIGS_REVERSE_SPEEDING, int, g_bugrigs_reverse_speeding)
164 REGISTER_STAT(BUGRIGS_REVERSE_SPINNING, int, g_bugrigs_reverse_spinning)
165 REGISTER_STAT(BUGRIGS_REVERSE_STOPPING, int, g_bugrigs_reverse_stopping)
166 REGISTER_STAT(BUGRIGS_SPEED_POW, float, g_bugrigs_speed_pow)
167 REGISTER_STAT(BUGRIGS_SPEED_REF, float, g_bugrigs_speed_ref)
168 REGISTER_STAT(BUGRIGS_STEER, float, g_bugrigs_steer)
169
170 #ifdef SVQC
171 int autocvar_sv_gameplayfix_downtracesupportsongroundflag;
172 int autocvar_sv_gameplayfix_easierwaterjump;
173 int autocvar_sv_gameplayfix_stepdown;
174 int autocvar_sv_gameplayfix_stepmultipletimes;
175 int autocvar_sv_gameplayfix_unstickplayers;
176 int autocvar_sv_gameplayfix_fixedcheckwatertransition;
177 #endif
178 REGISTER_STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, int, autocvar_sv_gameplayfix_downtracesupportsongroundflag)
179 REGISTER_STAT(GAMEPLAYFIX_EASIERWATERJUMP, int, autocvar_sv_gameplayfix_easierwaterjump)
180 REGISTER_STAT(GAMEPLAYFIX_STEPDOWN, int, autocvar_sv_gameplayfix_stepdown)
181 REGISTER_STAT(GAMEPLAYFIX_STEPMULTIPLETIMES, int, autocvar_sv_gameplayfix_stepmultipletimes)
182 REGISTER_STAT(GAMEPLAYFIX_UNSTICKPLAYERS, int, autocvar_sv_gameplayfix_unstickplayers)
183 REGISTER_STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, int, autocvar_sv_gameplayfix_upwardvelocityclearsongroundflag)
184 REGISTER_STAT(GAMEPLAYFIX_WATERTRANSITION, int, autocvar_sv_gameplayfix_fixedcheckwatertransition)
185
186 REGISTER_STAT(MOVEVARS_JUMPSTEP, int, cvar("sv_jumpstep"))
187 REGISTER_STAT(NOSTEP, int, cvar("sv_nostep"))
188
189 REGISTER_STAT(MOVEVARS_FRICTION, float)
190 REGISTER_STAT(MOVEVARS_FRICTION_SLICK, float, autocvar_sv_friction_slick)
191 REGISTER_STAT(MOVEVARS_FRICTION_ONLAND, float, autocvar_sv_friction_on_land)
192
193 REGISTER_STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, int, autocvar_sv_jumpspeedcap_max_disable_on_ramps)
194 REGISTER_STAT(MOVEVARS_TRACK_CANJUMP, int)
195 /** cvar loopback */
196 REGISTER_STAT(MOVEVARS_CL_TRACK_CANJUMP, int)
197
198 #ifdef SVQC
199 int g_dodging;
200 float autocvar_sv_dodging_delay;
201 float autocvar_sv_dodging_wall_distance_threshold;
202 bool autocvar_sv_dodging_frozen;
203 bool autocvar_sv_dodging_frozen_doubletap;
204 float autocvar_sv_dodging_height_threshold;
205 float autocvar_sv_dodging_horiz_speed;
206 float autocvar_sv_dodging_horiz_speed_frozen;
207 float autocvar_sv_dodging_ramp_time;
208 float autocvar_sv_dodging_up_speed;
209 bool autocvar_sv_dodging_wall_dodging;
210 bool autocvar_sv_dodging_air_dodging;
211 #endif
212
213 REGISTER_STAT(DODGING, int, g_dodging)
214 REGISTER_STAT(DODGING_DELAY, float, autocvar_sv_dodging_delay)
215 REGISTER_STAT(DODGING_DISTANCE_THRESHOLD, float, autocvar_sv_dodging_wall_distance_threshold)
216 REGISTER_STAT(DODGING_FROZEN, int, autocvar_sv_dodging_frozen)
217 REGISTER_STAT(DODGING_FROZEN_NO_DOUBLETAP, int, autocvar_sv_dodging_frozen_doubletap)
218 REGISTER_STAT(DODGING_HEIGHT_THRESHOLD, float, autocvar_sv_dodging_height_threshold)
219 REGISTER_STAT(DODGING_HORIZ_SPEED, float, autocvar_sv_dodging_horiz_speed)
220 REGISTER_STAT(DODGING_HORIZ_SPEED_FROZEN, float, autocvar_sv_dodging_horiz_speed_frozen)
221 REGISTER_STAT(DODGING_RAMP_TIME, float, autocvar_sv_dodging_ramp_time)
222 /** cvar loopback */
223 REGISTER_STAT(DODGING_TIMEOUT, float)
224 REGISTER_STAT(DODGING_UP_SPEED, float, autocvar_sv_dodging_up_speed)
225 REGISTER_STAT(DODGING_WALL, bool, autocvar_sv_dodging_wall_dodging)
226 REGISTER_STAT(DODGING_AIR, bool, autocvar_sv_dodging_air_dodging)
227
228 REGISTER_STAT(JETPACK_ACCEL_SIDE, float, autocvar_g_jetpack_acceleration_side)
229 REGISTER_STAT(JETPACK_ACCEL_UP, float, autocvar_g_jetpack_acceleration_up)
230 REGISTER_STAT(JETPACK_ANTIGRAVITY, float, autocvar_g_jetpack_antigravity)
231 REGISTER_STAT(JETPACK_FUEL, float, autocvar_g_jetpack_fuel)
232 REGISTER_STAT(JETPACK_MAXSPEED_SIDE, float, autocvar_g_jetpack_maxspeed_side)
233 REGISTER_STAT(JETPACK_MAXSPEED_UP, float, autocvar_g_jetpack_maxspeed_up)
234 REGISTER_STAT(JETPACK_REVERSE_THRUST, float, autocvar_g_jetpack_reverse_thrust)
235
236 REGISTER_STAT(MOVEVARS_HIGHSPEED, float, autocvar_g_movement_highspeed)
237
238 // freeze tag, clan arena
239 REGISTER_STAT(REDALIVE, int)
240 REGISTER_STAT(BLUEALIVE, int)
241 REGISTER_STAT(YELLOWALIVE, int)
242 REGISTER_STAT(PINKALIVE, int)
243
244 // domination
245 REGISTER_STAT(DOM_TOTAL_PPS, float)
246 REGISTER_STAT(DOM_PPS_RED, float)
247 REGISTER_STAT(DOM_PPS_BLUE, float)
248 REGISTER_STAT(DOM_PPS_YELLOW, float)
249 REGISTER_STAT(DOM_PPS_PINK, float)
250
251 REGISTER_STAT(TELEPORT_MAXSPEED, float, autocvar_g_teleport_maxspeed)
252 REGISTER_STAT(TELEPORT_TELEFRAG_AVOID, int, autocvar_g_telefrags_avoid)
253
254 REGISTER_STAT(CAMERA_SPECTATOR, int)
255
256 REGISTER_STAT(SPECTATORSPEED, float)
257
258 #ifdef SVQC
259 bool autocvar_sv_slick_applygravity;
260 #endif
261 REGISTER_STAT(SLICK_APPLYGRAVITY, bool, autocvar_sv_slick_applygravity)
262
263 #ifdef SVQC
264 #include "physics/movetypes/movetypes.qh"
265 #endif
266
267 REGISTER_STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, float)
268 REGISTER_STAT(MOVEVARS_AIRCONTROL_PENALTY, float)
269 REGISTER_STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, float)
270 REGISTER_STAT(MOVEVARS_AIRSTRAFEACCEL_QW, float)
271 REGISTER_STAT(MOVEVARS_AIRCONTROL_POWER, float)
272 REGISTER_STAT(MOVEVARS_AIRCONTROL_BACKWARDS, bool)
273 noref bool autocvar_sv_gameplayfix_nogravityonground;
274 REGISTER_STAT(MOVEFLAGS, int, MOVEFLAG_VALID
275                               | (autocvar_sv_gameplayfix_q2airaccelerate ? MOVEFLAG_Q2AIRACCELERATE : 0)
276                               | (autocvar_sv_gameplayfix_nogravityonground ? MOVEFLAG_NOGRAVITYONGROUND : 0)
277                               | (autocvar_sv_gameplayfix_gravityunaffectedbyticrate ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0))
278
279 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, float)
280 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_ACCEL, float)
281 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_TOPSPEED, float)
282 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_TURNACCEL, float)
283 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, float)
284
285 REGISTER_STAT(MOVEVARS_AIRSTOPACCELERATE, float)
286 REGISTER_STAT(MOVEVARS_AIRSTRAFEACCELERATE, float)
287 REGISTER_STAT(MOVEVARS_MAXAIRSTRAFESPEED, float)
288 REGISTER_STAT(MOVEVARS_AIRCONTROL, float)
289 REGISTER_STAT(FRAGLIMIT, float, autocvar_fraglimit)
290 REGISTER_STAT(TIMELIMIT, float, autocvar_timelimit)
291 REGISTER_STAT(WARMUP_TIMELIMIT, float, warmup_limit)
292 #ifdef SVQC
293 float autocvar_sv_wallfriction;
294 #endif
295 REGISTER_STAT(MOVEVARS_WALLFRICTION, int, autocvar_sv_wallfriction)
296 REGISTER_STAT(MOVEVARS_TICRATE, float, autocvar_sys_ticrate)
297 REGISTER_STAT(MOVEVARS_TIMESCALE, float, autocvar_slowmo)
298 REGISTER_STAT(MOVEVARS_GRAVITY, float, autocvar_sv_gravity)
299 REGISTER_STAT(MOVEVARS_STOPSPEED, float)
300 REGISTER_STAT(MOVEVARS_MAXSPEED, float)
301 REGISTER_STAT(MOVEVARS_ACCELERATE, float)
302 REGISTER_STAT(MOVEVARS_AIRACCELERATE, float)
303 .float gravity;
304 // FIXME: Was 0 on server, 1 on client. Still want that?
305 REGISTER_STAT(MOVEVARS_ENTGRAVITY, float, (this.gravity) ? this.gravity : 1)
306 REGISTER_STAT(MOVEVARS_JUMPVELOCITY, float)
307 REGISTER_STAT(MOVEVARS_MAXAIRSPEED, float)
308 REGISTER_STAT(MOVEVARS_STEPHEIGHT, float, autocvar_sv_stepheight)
309 REGISTER_STAT(MOVEVARS_AIRACCEL_QW, float)
310 REGISTER_STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, float)
311
312
313 #ifdef CSQC
314 noref int autocvar_cl_gunalign;
315 #endif
316 #ifdef SVQC
317 .int cvar_cl_gunalign;
318 REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
319 #endif
320 REGISTER_STAT(GUNALIGN, int, this.cvar_cl_gunalign)
321 #ifdef SVQC
322 SPECTATE_COPYFIELD(_STAT(GUNALIGN))
323 #endif