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