Add a hook to team change function, will come in handy soon
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / stats.qh
1 #ifndef STATS_H
2 #define STATS_H
3
4 // Full list of all stat constants, included in a single location for easy reference
5 // 255 is the current limit (MAX_CL_STATS - 1), engine will need to be modified if you wish to add more stats
6
7 const int MAX_CL_STATS = 256;
8 #ifndef CSQC
9 const int STAT_HEALTH = 0; // .health
10 const int STAT_ARMOR = 4; // .armorvalue
11 const int STAT_SHELLS = 6; // .ammo_shells
12 const int STAT_NAILS = 7; // .ammo_nails
13 const int STAT_ROCKETS = 8; // .ammo_rockets
14 const int STAT_CELLS = 9; // .ammo_cells
15 const int STAT_ACTIVEWEAPON = 10; // .weapon
16 const int STAT_ITEMS = 15; // .items | .items2 << 23 | serverflags << 28
17 const int STAT_VIEWHEIGHT = 16; // .view_ofs_z
18 #endif
19
20 REGISTER_STAT(WEAPONS, vectori)
21 REGISTER_STAT(WEAPONSINMAP, vectori)
22
23 REGISTER_STAT(PL_VIEW_OFS, vector, autocvar_sv_player_viewoffset)
24 REGISTER_STAT(PL_CROUCH_VIEW_OFS, vector, autocvar_sv_player_crouch_viewoffset)
25
26 REGISTER_STAT(PL_MIN, vector, autocvar_sv_player_mins)
27 REGISTER_STAT(PL_CROUCH_MIN, vector, autocvar_sv_player_crouch_mins)
28
29 REGISTER_STAT(PL_MAX, vector, autocvar_sv_player_maxs)
30 REGISTER_STAT(PL_CROUCH_MAX, vector, autocvar_sv_player_crouch_maxs)
31
32 REGISTER_STAT(KH_KEYS, int)
33 /** weapon requested to switch to; next WANTED weapon (for HUD) */
34 REGISTER_STAT(SWITCHWEAPON, int)
35 REGISTER_STAT(GAMESTARTTIME, float)
36 REGISTER_STAT(STRENGTH_FINISHED, float)
37 REGISTER_STAT(INVINCIBLE_FINISHED, float)
38 /** arc heat in [0,1] */
39 REGISTER_STAT(ARC_HEAT, float)
40 REGISTER_STAT(PRESSED_KEYS, int)
41 /** this stat could later contain some other bits of info, like, more server-side particle config */
42 REGISTER_STAT(ALLOW_OLDVORTEXBEAM, bool)
43 REGISTER_STAT(FUEL, int)
44 REGISTER_STAT(NB_METERSTART, float)
45 /** compressShotOrigin */
46 REGISTER_STAT(SHOTORG, int)
47 REGISTER_STAT(LEADLIMIT, float)
48 REGISTER_STAT(WEAPON_CLIPLOAD, int)
49 REGISTER_STAT(WEAPON_CLIPSIZE, int)
50
51 REGISTER_STAT(VORTEX_CHARGE, float)
52 REGISTER_STAT(LAST_PICKUP, float)
53 REGISTER_STAT(HUD, int)
54 REGISTER_STAT(VORTEX_CHARGEPOOL, float)
55 REGISTER_STAT(HIT_TIME, float)
56 REGISTER_STAT(DAMAGE_DEALT_TOTAL, int)
57 REGISTER_STAT(TYPEHIT_TIME, float)
58 REGISTER_STAT(LAYED_MINES, int)
59 REGISTER_STAT(HAGAR_LOAD, int)
60 REGISTER_STAT(SWITCHINGWEAPON, int)
61 REGISTER_STAT(SUPERWEAPONS_FINISHED, float)
62 REGISTER_STAT(VEHICLESTAT_HEALTH, int)
63 REGISTER_STAT(VEHICLESTAT_SHIELD, int)
64 REGISTER_STAT(VEHICLESTAT_ENERGY, int)
65 REGISTER_STAT(VEHICLESTAT_AMMO1, int)
66 REGISTER_STAT(VEHICLESTAT_RELOAD1, int)
67 REGISTER_STAT(VEHICLESTAT_AMMO2, int)
68 REGISTER_STAT(VEHICLESTAT_RELOAD2, int)
69 REGISTER_STAT(VEHICLESTAT_W2MODE, int)
70 REGISTER_STAT(NADE_TIMER, float)
71 REGISTER_STAT(SECRETS_TOTAL, float)
72 REGISTER_STAT(SECRETS_FOUND, float)
73 REGISTER_STAT(RESPAWN_TIME, float)
74 REGISTER_STAT(ROUNDSTARTTIME, float)
75 REGISTER_STAT(MONSTERS_TOTAL, int)
76 REGISTER_STAT(MONSTERS_KILLED, int)
77 REGISTER_STAT(BUFFS, int)
78 REGISTER_STAT(NADE_BONUS, float)
79 REGISTER_STAT(NADE_BONUS_TYPE, int)
80 REGISTER_STAT(NADE_BONUS_SCORE, float)
81 REGISTER_STAT(HEALING_ORB, float)
82 REGISTER_STAT(HEALING_ORB_ALPHA, float)
83 REGISTER_STAT(PLASMA, int)
84 REGISTER_STAT(OK_AMMO_CHARGE, float)
85 REGISTER_STAT(OK_AMMO_CHARGEPOOL, float)
86 REGISTER_STAT(FROZEN, int)
87 REGISTER_STAT(REVIVE_PROGRESS, float)
88 REGISTER_STAT(ROUNDLOST, int)
89 REGISTER_STAT(BUFF_TIME, float)
90 REGISTER_STAT(CTF_FLAGSTATUS, int)
91
92 #ifdef SVQC
93 int autocvar_g_multijump;
94 float autocvar_g_multijump_add;
95 float autocvar_g_multijump_speed;
96 float autocvar_g_multijump_maxspeed;
97 float autocvar_g_multijump_dodging = 1;
98 #endif
99 REGISTER_STAT(MULTIJUMP_DODGING, int, autocvar_g_multijump_dodging)
100 REGISTER_STAT(MULTIJUMP_MAXSPEED, float, autocvar_g_multijump_maxspeed)
101 REGISTER_STAT(MULTIJUMP_ADD, int, autocvar_g_multijump_add)
102 REGISTER_STAT(MULTIJUMP_SPEED, float, autocvar_g_multijump_speed)
103 .int multijump_count;
104 REGISTER_STAT(MULTIJUMP_COUNT, int, this.multijump_count)
105 REGISTER_STAT(MULTIJUMP, int, autocvar_g_multijump)
106 REGISTER_STAT(DOUBLEJUMP, int, autocvar_sv_doublejump)
107
108 #ifdef SVQC
109 bool g_bugrigs;
110 bool g_bugrigs_planar_movement;
111 bool g_bugrigs_planar_movement_car_jumping;
112 float g_bugrigs_reverse_spinning;
113 float g_bugrigs_reverse_speeding;
114 float g_bugrigs_reverse_stopping;
115 float g_bugrigs_air_steering;
116 float g_bugrigs_angle_smoothing;
117 float g_bugrigs_friction_floor;
118 float g_bugrigs_friction_brake;
119 float g_bugrigs_friction_air;
120 float g_bugrigs_accel;
121 float g_bugrigs_speed_ref;
122 float g_bugrigs_speed_pow;
123 float g_bugrigs_steer;
124 #endif
125 REGISTER_STAT(BUGRIGS, int, g_bugrigs)
126 REGISTER_STAT(BUGRIGS_ACCEL, float, g_bugrigs_accel)
127 REGISTER_STAT(BUGRIGS_AIR_STEERING, int, g_bugrigs_air_steering)
128 REGISTER_STAT(BUGRIGS_ANGLE_SMOOTHING, int, g_bugrigs_angle_smoothing)
129 REGISTER_STAT(BUGRIGS_CAR_JUMPING, int, g_bugrigs_planar_movement_car_jumping)
130 REGISTER_STAT(BUGRIGS_FRICTION_AIR, float, g_bugrigs_friction_air)
131 REGISTER_STAT(BUGRIGS_FRICTION_BRAKE, float, g_bugrigs_friction_brake)
132 REGISTER_STAT(BUGRIGS_FRICTION_FLOOR, float, g_bugrigs_friction_floor)
133 REGISTER_STAT(BUGRIGS_PLANAR_MOVEMENT, int, g_bugrigs_planar_movement)
134 REGISTER_STAT(BUGRIGS_REVERSE_SPEEDING, int, g_bugrigs_reverse_speeding)
135 REGISTER_STAT(BUGRIGS_REVERSE_SPINNING, int, g_bugrigs_reverse_spinning)
136 REGISTER_STAT(BUGRIGS_REVERSE_STOPPING, int, g_bugrigs_reverse_stopping)
137 REGISTER_STAT(BUGRIGS_SPEED_POW, float, g_bugrigs_speed_pow)
138 REGISTER_STAT(BUGRIGS_SPEED_REF, float, g_bugrigs_speed_ref)
139 REGISTER_STAT(BUGRIGS_STEER, float, g_bugrigs_steer)
140
141 REGISTER_STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, int, cvar("sv_gameplayfix_downtracesupportsongroundflag"))
142 REGISTER_STAT(GAMEPLAYFIX_EASIERWATERJUMP, int, cvar("sv_gameplayfix_easierwaterjump"))
143 REGISTER_STAT(GAMEPLAYFIX_STEPDOWN, int, cvar("sv_gameplayfix_stepdown"))
144 REGISTER_STAT(GAMEPLAYFIX_STEPMULTIPLETIMES, int, cvar("sv_gameplayfix_stepmultipletimes"))
145 REGISTER_STAT(GAMEPLAYFIX_UNSTICKPLAYERS, int, cvar("sv_gameplayfix_unstickplayers"))
146 REGISTER_STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, int, autocvar_sv_gameplayfix_upwardvelocityclearsongroundflag)
147
148 REGISTER_STAT(MOVEVARS_JUMPSTEP, int, cvar("sv_jumpstep"))
149 REGISTER_STAT(NOSTEP, int, cvar("sv_nostep"))
150
151 REGISTER_STAT(MOVEVARS_FRICTION, float)
152 REGISTER_STAT(MOVEVARS_FRICTION_SLICK, float, autocvar_sv_friction_slick)
153 REGISTER_STAT(MOVEVARS_FRICTION_ONLAND, float, autocvar_sv_friction_on_land)
154
155 REGISTER_STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, int, autocvar_sv_jumpspeedcap_max_disable_on_ramps)
156 REGISTER_STAT(MOVEVARS_TRACK_CANJUMP, int)
157 /** cvar loopback */
158 REGISTER_STAT(MOVEVARS_CL_TRACK_CANJUMP, int)
159
160 #ifdef SVQC
161 int g_dodging;
162 float autocvar_sv_dodging_delay;
163 float autocvar_sv_dodging_wall_distance_threshold;
164 bool autocvar_sv_dodging_frozen;
165 bool autocvar_sv_dodging_frozen_doubletap;
166 float autocvar_sv_dodging_height_threshold;
167 float autocvar_sv_dodging_horiz_speed;
168 float autocvar_sv_dodging_horiz_speed_frozen;
169 float autocvar_sv_dodging_ramp_time;
170 float autocvar_sv_dodging_up_speed;
171 bool autocvar_sv_dodging_wall_dodging;
172 #endif
173
174 REGISTER_STAT(DODGING, int, g_dodging)
175 REGISTER_STAT(DODGING_DELAY, float, autocvar_sv_dodging_delay)
176 REGISTER_STAT(DODGING_DISTANCE_THRESHOLD, float, autocvar_sv_dodging_wall_distance_threshold)
177 REGISTER_STAT(DODGING_FROZEN, int, autocvar_sv_dodging_frozen)
178 REGISTER_STAT(DODGING_FROZEN_NO_DOUBLETAP, int, autocvar_sv_dodging_frozen_doubletap)
179 REGISTER_STAT(DODGING_HEIGHT_THRESHOLD, float, autocvar_sv_dodging_height_threshold)
180 REGISTER_STAT(DODGING_HORIZ_SPEED, float, autocvar_sv_dodging_horiz_speed)
181 REGISTER_STAT(DODGING_HORIZ_SPEED_FROZEN, float, autocvar_sv_dodging_horiz_speed_frozen)
182 REGISTER_STAT(DODGING_RAMP_TIME, float, autocvar_sv_dodging_ramp_time)
183 /** cvar loopback */
184 REGISTER_STAT(DODGING_TIMEOUT, float)
185 REGISTER_STAT(DODGING_UP_SPEED, float, autocvar_sv_dodging_up_speed)
186 REGISTER_STAT(DODGING_WALL, int, autocvar_sv_dodging_wall_dodging)
187
188 REGISTER_STAT(JETPACK_ACCEL_SIDE, float, autocvar_g_jetpack_acceleration_side)
189 REGISTER_STAT(JETPACK_ACCEL_UP, float, autocvar_g_jetpack_acceleration_up)
190 REGISTER_STAT(JETPACK_ANTIGRAVITY, float, autocvar_g_jetpack_antigravity)
191 REGISTER_STAT(JETPACK_FUEL, float, autocvar_g_jetpack_fuel)
192 REGISTER_STAT(JETPACK_MAXSPEED_SIDE, float, autocvar_g_jetpack_maxspeed_side)
193 REGISTER_STAT(JETPACK_MAXSPEED_UP, float, autocvar_g_jetpack_maxspeed_up)
194
195 REGISTER_STAT(MOVEVARS_HIGHSPEED, float, autocvar_g_movement_highspeed)
196
197 // freeze tag, clan arena
198 REGISTER_STAT(REDALIVE, int)
199 REGISTER_STAT(BLUEALIVE, int)
200 REGISTER_STAT(YELLOWALIVE, int)
201 REGISTER_STAT(PINKALIVE, int)
202
203 // domination
204 REGISTER_STAT(DOM_TOTAL_PPS, float)
205 REGISTER_STAT(DOM_PPS_RED, float)
206 REGISTER_STAT(DOM_PPS_BLUE, float)
207 REGISTER_STAT(DOM_PPS_YELLOW, float)
208 REGISTER_STAT(DOM_PPS_PINK, float)
209
210 REGISTER_STAT(TELEPORT_MAXSPEED, float, autocvar_g_teleport_maxspeed)
211 REGISTER_STAT(TELEPORT_TELEFRAG_AVOID, int, autocvar_g_telefrags_avoid)
212
213 #ifdef SVQC
214 #include "movetypes/movetypes.qh"
215 #endif
216
217 REGISTER_STAT(MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, float)
218 REGISTER_STAT(MOVEVARS_AIRCONTROL_PENALTY, float)
219 REGISTER_STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW, float)
220 REGISTER_STAT(MOVEVARS_AIRSTRAFEACCEL_QW, float)
221 REGISTER_STAT(MOVEVARS_AIRCONTROL_POWER, float)
222 noref bool autocvar_sv_gameplayfix_nogravityonground;
223 REGISTER_STAT(MOVEFLAGS, int, MOVEFLAG_VALID
224                               | (autocvar_sv_gameplayfix_q2airaccelerate ? MOVEFLAG_Q2AIRACCELERATE : 0)
225                               | (autocvar_sv_gameplayfix_nogravityonground ? MOVEFLAG_NOGRAVITYONGROUND : 0)
226                               | (autocvar_sv_gameplayfix_gravityunaffectedbyticrate ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0))
227
228 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, float)
229 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_ACCEL, float)
230 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_TOPSPEED, float)
231 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_TURNACCEL, float)
232 REGISTER_STAT(MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, float)
233
234 REGISTER_STAT(MOVEVARS_AIRSTOPACCELERATE, float)
235 REGISTER_STAT(MOVEVARS_AIRSTRAFEACCELERATE, float)
236 REGISTER_STAT(MOVEVARS_MAXAIRSTRAFESPEED, float)
237 REGISTER_STAT(MOVEVARS_AIRCONTROL, float)
238 REGISTER_STAT(FRAGLIMIT, float, autocvar_fraglimit)
239 REGISTER_STAT(TIMELIMIT, float, autocvar_timelimit)
240 #ifdef SVQC
241 float autocvar_sv_wallfriction;
242 #endif
243 REGISTER_STAT(MOVEVARS_WALLFRICTION, int, autocvar_sv_wallfriction)
244 REGISTER_STAT(MOVEVARS_TICRATE, float, autocvar_sys_ticrate)
245 REGISTER_STAT(MOVEVARS_TIMESCALE, float, autocvar_slowmo)
246 REGISTER_STAT(MOVEVARS_GRAVITY, float, autocvar_sv_gravity)
247 REGISTER_STAT(MOVEVARS_STOPSPEED, float)
248 REGISTER_STAT(MOVEVARS_MAXSPEED, float)
249 REGISTER_STAT(MOVEVARS_ACCELERATE, float)
250 REGISTER_STAT(MOVEVARS_AIRACCELERATE, float)
251 .float gravity;
252 // FIXME: Was 0 on server, 1 on client. Still want that?
253 REGISTER_STAT(MOVEVARS_ENTGRAVITY, float, (this.gravity) ? this.gravity : 1)
254 REGISTER_STAT(MOVEVARS_JUMPVELOCITY, float)
255 REGISTER_STAT(MOVEVARS_MAXAIRSPEED, float)
256 REGISTER_STAT(MOVEVARS_STEPHEIGHT, float, autocvar_sv_stepheight)
257 REGISTER_STAT(MOVEVARS_AIRACCEL_QW, float)
258 REGISTER_STAT(MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, float)
259 #endif