#endif
#endif
-REGISTER_STAT(HEALTH, int, this.health)
-REGISTER_STAT(ARMOR, int, this.armorvalue)
-REGISTER_STAT(SHELLS, int, this.ammo_shells)
-REGISTER_STAT(NAILS, int, this.ammo_nails)
-REGISTER_STAT(ROCKETS, int, this.ammo_rockets)
-REGISTER_STAT(CELLS, int, this.ammo_cells)
-REGISTER_STAT(ITEMS, int, this.items)
-REGISTER_STAT(VIEWHEIGHT, int, this.view_ofs_z)
+REGISTER_STAT(HEALTH, int24, this.health)
+REGISTER_STAT(ARMOR, int24, this.armorvalue)
+REGISTER_STAT(SHELLS, int24, this.ammo_shells)
+REGISTER_STAT(NAILS, int24, this.ammo_nails)
+REGISTER_STAT(ROCKETS, int24, this.ammo_rockets)
+REGISTER_STAT(CELLS, int24, this.ammo_cells)
+REGISTER_STAT(ITEMS, int24, this.items)
+REGISTER_STAT(VIEWHEIGHT, int24, this.view_ofs_z)
#ifdef SVQC
/// all the weapons actually spawned in the map, does not include filtered items
REGISTER_STAT(PL_MAX, vector)
REGISTER_STAT(PL_CROUCH_MAX, vector)
-REGISTER_STAT(KH_KEYS, int)
+REGISTER_STAT(KH_KEYS, int24)
#ifdef SVQC
float W_WeaponRateFactor(entity this);
int autocvar_leadlimit;
#endif
REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor(this))
-REGISTER_STAT(GAME_STOPPED, int, game_stopped)
+REGISTER_STAT(GAME_STOPPED, int24, game_stopped)
REGISTER_STAT(GAMESTARTTIME, float, game_starttime)
REGISTER_STAT(STRENGTH_FINISHED, float)
REGISTER_STAT(INVINCIBLE_FINISHED, float)
/** arc heat in [0,1] */
-REGISTER_STAT(PRESSED_KEYS, int)
+REGISTER_STAT(PRESSED_KEYS, int24)
/** this stat could later contain some other bits of info, like, more server-side particle config */
REGISTER_STAT(ALLOW_OLDVORTEXBEAM, bool, autocvar_g_allow_oldvortexbeam)
-REGISTER_STAT(FUEL, int)
+REGISTER_STAT(FUEL, int24)
REGISTER_STAT(NB_METERSTART, float)
/** compressShotOrigin */
-REGISTER_STAT(SHOTORG, int)
+REGISTER_STAT(SHOTORG, int24)
REGISTER_STAT(LEADLIMIT, float, autocvar_leadlimit)
REGISTER_STAT(LEADLIMIT_AND_FRAGLIMIT, float, autocvar_leadlimit_and_fraglimit)
REGISTER_STAT(LAST_PICKUP, float)
-REGISTER_STAT(HUD, int)
+REGISTER_STAT(HUD, int24)
REGISTER_STAT(HIT_TIME, float)
-REGISTER_STAT(DAMAGE_DEALT_TOTAL, int)
+REGISTER_STAT(DAMAGE_DEALT_TOTAL, int24)
REGISTER_STAT(TYPEHIT_TIME, float)
REGISTER_STAT(SUPERWEAPONS_FINISHED, float)
REGISTER_STAT(AIR_FINISHED, float)
-REGISTER_STAT(VEHICLESTAT_HEALTH, int)
-REGISTER_STAT(VEHICLESTAT_SHIELD, int)
-REGISTER_STAT(VEHICLESTAT_ENERGY, int)
-REGISTER_STAT(VEHICLESTAT_AMMO1, int)
-REGISTER_STAT(VEHICLESTAT_RELOAD1, int)
-REGISTER_STAT(VEHICLESTAT_AMMO2, int)
-REGISTER_STAT(VEHICLESTAT_RELOAD2, int)
-REGISTER_STAT(VEHICLESTAT_W2MODE, int)
+REGISTER_STAT(VEHICLESTAT_HEALTH, int24)
+REGISTER_STAT(VEHICLESTAT_SHIELD, int24)
+REGISTER_STAT(VEHICLESTAT_ENERGY, int24)
+REGISTER_STAT(VEHICLESTAT_AMMO1, int24)
+REGISTER_STAT(VEHICLESTAT_RELOAD1, int24)
+REGISTER_STAT(VEHICLESTAT_AMMO2, int24)
+REGISTER_STAT(VEHICLESTAT_RELOAD2, int24)
+REGISTER_STAT(VEHICLESTAT_W2MODE, int24)
REGISTER_STAT(NADE_TIMER, float)
REGISTER_STAT(SECRETS_TOTAL, float)
REGISTER_STAT(SECRETS_FOUND, float)
REGISTER_STAT(RESPAWN_TIME, float)
REGISTER_STAT(ROUNDSTARTTIME, float, round_starttime)
-REGISTER_STAT(MONSTERS_TOTAL, int)
-REGISTER_STAT(MONSTERS_KILLED, int)
-REGISTER_STAT(BUFFS, int)
+REGISTER_STAT(MONSTERS_TOTAL, int24)
+REGISTER_STAT(MONSTERS_KILLED, int24)
+REGISTER_STAT(BUFFS, int24)
REGISTER_STAT(NADE_BONUS, float)
-REGISTER_STAT(NADE_BONUS_TYPE, int)
+REGISTER_STAT(NADE_BONUS_TYPE, int24)
REGISTER_STAT(NADE_BONUS_SCORE, float)
REGISTER_STAT(HEALING_ORB, float)
REGISTER_STAT(HEALING_ORB_ALPHA, float)
-REGISTER_STAT(PLASMA, int)
-REGISTER_STAT(FROZEN, int)
+REGISTER_STAT(PLASMA, int24)
+REGISTER_STAT(FROZEN, int24)
REGISTER_STAT(REVIVE_PROGRESS, float)
-REGISTER_STAT(ROUNDLOST, int)
+REGISTER_STAT(ROUNDLOST, int24)
REGISTER_STAT(BUFF_TIME, float)
-REGISTER_STAT(CTF_FLAGSTATUS, int)
+REGISTER_STAT(CTF_FLAGSTATUS, int24)
REGISTER_STAT(CAPTURE_PROGRESS, float)
REGISTER_STAT(ENTRAP_ORB, float)
REGISTER_STAT(ENTRAP_ORB_ALPHA, float)
-REGISTER_STAT(ITEMSTIME, int, autocvar_sv_itemstime)
+REGISTER_STAT(ITEMSTIME, int24, autocvar_sv_itemstime)
REGISTER_STAT(KILL_TIME, float)
REGISTER_STAT(VEIL_ORB, float)
REGISTER_STAT(VEIL_ORB_ALPHA, float)
float autocvar_g_multijump_dodging = 1;
bool autocvar_g_multijump_client = true;
#endif
-REGISTER_STAT(MULTIJUMP_DODGING, int, autocvar_g_multijump_dodging)
+REGISTER_STAT(MULTIJUMP_DODGING, int24, autocvar_g_multijump_dodging)
REGISTER_STAT(MULTIJUMP_MAXSPEED, float, autocvar_g_multijump_maxspeed)
-REGISTER_STAT(MULTIJUMP_ADD, int, autocvar_g_multijump_add)
+REGISTER_STAT(MULTIJUMP_ADD, int24, autocvar_g_multijump_add)
REGISTER_STAT(MULTIJUMP_SPEED, float, autocvar_g_multijump_speed)
REGISTER_STAT(MULTIJUMP_CLIENT, bool, autocvar_g_multijump_client)
.int multijump_count;
-REGISTER_STAT(MULTIJUMP_COUNT, int, this.multijump_count)
-REGISTER_STAT(MULTIJUMP, int, autocvar_g_multijump)
-REGISTER_STAT(DOUBLEJUMP, int, autocvar_sv_doublejump)
+REGISTER_STAT(MULTIJUMP_COUNT, int24, this.multijump_count)
+REGISTER_STAT(MULTIJUMP, int24, autocvar_g_multijump)
+REGISTER_STAT(DOUBLEJUMP, int24, autocvar_sv_doublejump)
#ifdef SVQC
bool g_bugrigs;
float g_bugrigs_speed_pow;
float g_bugrigs_steer;
#endif
-REGISTER_STAT(BUGRIGS, int, g_bugrigs)
+REGISTER_STAT(BUGRIGS, int24, g_bugrigs)
REGISTER_STAT(BUGRIGS_ACCEL, float, g_bugrigs_accel)
-REGISTER_STAT(BUGRIGS_AIR_STEERING, int, g_bugrigs_air_steering)
-REGISTER_STAT(BUGRIGS_ANGLE_SMOOTHING, int, g_bugrigs_angle_smoothing)
-REGISTER_STAT(BUGRIGS_CAR_JUMPING, int, g_bugrigs_planar_movement_car_jumping)
+REGISTER_STAT(BUGRIGS_AIR_STEERING, int24, g_bugrigs_air_steering)
+REGISTER_STAT(BUGRIGS_ANGLE_SMOOTHING, int24, g_bugrigs_angle_smoothing)
+REGISTER_STAT(BUGRIGS_CAR_JUMPING, int24, g_bugrigs_planar_movement_car_jumping)
REGISTER_STAT(BUGRIGS_FRICTION_AIR, float, g_bugrigs_friction_air)
REGISTER_STAT(BUGRIGS_FRICTION_BRAKE, float, g_bugrigs_friction_brake)
REGISTER_STAT(BUGRIGS_FRICTION_FLOOR, float, g_bugrigs_friction_floor)
-REGISTER_STAT(BUGRIGS_PLANAR_MOVEMENT, int, g_bugrigs_planar_movement)
-REGISTER_STAT(BUGRIGS_REVERSE_SPEEDING, int, g_bugrigs_reverse_speeding)
-REGISTER_STAT(BUGRIGS_REVERSE_SPINNING, int, g_bugrigs_reverse_spinning)
-REGISTER_STAT(BUGRIGS_REVERSE_STOPPING, int, g_bugrigs_reverse_stopping)
+REGISTER_STAT(BUGRIGS_PLANAR_MOVEMENT, int24, g_bugrigs_planar_movement)
+REGISTER_STAT(BUGRIGS_REVERSE_SPEEDING, int24, g_bugrigs_reverse_speeding)
+REGISTER_STAT(BUGRIGS_REVERSE_SPINNING, int24, g_bugrigs_reverse_spinning)
+REGISTER_STAT(BUGRIGS_REVERSE_STOPPING, int24, g_bugrigs_reverse_stopping)
REGISTER_STAT(BUGRIGS_SPEED_POW, float, g_bugrigs_speed_pow)
REGISTER_STAT(BUGRIGS_SPEED_REF, float, g_bugrigs_speed_ref)
REGISTER_STAT(BUGRIGS_STEER, float, g_bugrigs_steer)
int autocvar_sv_gameplayfix_noairborncorpse = 1;
int autocvar_sv_gameplayfix_noairborncorpse_allowsuspendeditems = 1;
#endif
-REGISTER_STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, int, autocvar_sv_gameplayfix_downtracesupportsongroundflag)
-REGISTER_STAT(GAMEPLAYFIX_EASIERWATERJUMP, int, autocvar_sv_gameplayfix_easierwaterjump)
-REGISTER_STAT(GAMEPLAYFIX_STEPDOWN, int, autocvar_sv_gameplayfix_stepdown)
+REGISTER_STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, int24, autocvar_sv_gameplayfix_downtracesupportsongroundflag)
+REGISTER_STAT(GAMEPLAYFIX_EASIERWATERJUMP, int24, autocvar_sv_gameplayfix_easierwaterjump)
+REGISTER_STAT(GAMEPLAYFIX_STEPDOWN, int24, autocvar_sv_gameplayfix_stepdown)
REGISTER_STAT(GAMEPLAYFIX_STEPDOWN_MAXSPEED, float, autocvar_sv_gameplayfix_stepdown_maxspeed)
-REGISTER_STAT(GAMEPLAYFIX_STEPMULTIPLETIMES, int, autocvar_sv_gameplayfix_stepmultipletimes)
-REGISTER_STAT(GAMEPLAYFIX_UNSTICKPLAYERS, int, autocvar_sv_gameplayfix_unstickplayers)
-REGISTER_STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, int, autocvar_sv_gameplayfix_upwardvelocityclearsongroundflag)
-REGISTER_STAT(GAMEPLAYFIX_WATERTRANSITION, int, autocvar_sv_gameplayfix_fixedcheckwatertransition)
-REGISTER_STAT(GAMEPLAYFIX_SLIDEMOVEPROJECTILES, int, autocvar_sv_gameplayfix_slidemoveprojectiles)
-REGISTER_STAT(GAMEPLAYFIX_GRENADEBOUNCESLOPES, int, autocvar_sv_gameplayfix_grenadebouncedownslopes)
-REGISTER_STAT(GAMEPLAYFIX_NOAIRBORNCORPSE, int, autocvar_sv_gameplayfix_noairborncorpse)
-REGISTER_STAT(NOAIRBORNCORPSE_ALLOWSUSPENDED, int, autocvar_sv_gameplayfix_noairborncorpse_allowsuspendeditems)
-
-REGISTER_STAT(MOVEVARS_JUMPSTEP, int, cvar("sv_jumpstep"))
-REGISTER_STAT(NOSTEP, int, cvar("sv_nostep"))
+REGISTER_STAT(GAMEPLAYFIX_STEPMULTIPLETIMES, int24, autocvar_sv_gameplayfix_stepmultipletimes)
+REGISTER_STAT(GAMEPLAYFIX_UNSTICKPLAYERS, int24, autocvar_sv_gameplayfix_unstickplayers)
+REGISTER_STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, int24, autocvar_sv_gameplayfix_upwardvelocityclearsongroundflag)
+REGISTER_STAT(GAMEPLAYFIX_WATERTRANSITION, int24, autocvar_sv_gameplayfix_fixedcheckwatertransition)
+REGISTER_STAT(GAMEPLAYFIX_SLIDEMOVEPROJECTILES, int24, autocvar_sv_gameplayfix_slidemoveprojectiles)
+REGISTER_STAT(GAMEPLAYFIX_GRENADEBOUNCESLOPES, int24, autocvar_sv_gameplayfix_grenadebouncedownslopes)
+REGISTER_STAT(GAMEPLAYFIX_NOAIRBORNCORPSE, int24, autocvar_sv_gameplayfix_noairborncorpse)
+REGISTER_STAT(NOAIRBORNCORPSE_ALLOWSUSPENDED, int24, autocvar_sv_gameplayfix_noairborncorpse_allowsuspendeditems)
+
+REGISTER_STAT(MOVEVARS_JUMPSTEP, int24, cvar("sv_jumpstep"))
+REGISTER_STAT(NOSTEP, int24, cvar("sv_nostep"))
REGISTER_STAT(MOVEVARS_FRICTION, float)
REGISTER_STAT(MOVEVARS_FRICTION_SLICK, float, autocvar_sv_friction_slick)
REGISTER_STAT(MOVEVARS_FRICTION_ONLAND, float, autocvar_sv_friction_on_land)
-REGISTER_STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, int, autocvar_sv_jumpspeedcap_max_disable_on_ramps)
-REGISTER_STAT(MOVEVARS_TRACK_CANJUMP, int)
+REGISTER_STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, int24, autocvar_sv_jumpspeedcap_max_disable_on_ramps)
+REGISTER_STAT(MOVEVARS_TRACK_CANJUMP, int24)
/** cvar loopback */
-REGISTER_STAT(MOVEVARS_CL_TRACK_CANJUMP, int)
+REGISTER_STAT(MOVEVARS_CL_TRACK_CANJUMP, int24)
#ifdef SVQC
int g_dodging;
#endif
#if 0
-REGISTER_STAT(DODGING, int, g_dodging)
+REGISTER_STAT(DODGING, int24, g_dodging)
REGISTER_STAT(DODGING_DELAY, float, autocvar_sv_dodging_delay)
REGISTER_STAT(DODGING_DISTANCE_THRESHOLD, float, autocvar_sv_dodging_wall_distance_threshold)
-REGISTER_STAT(DODGING_FROZEN_DOUBLETAP, int, autocvar_sv_dodging_frozen_doubletap)
+REGISTER_STAT(DODGING_FROZEN_DOUBLETAP, int24, autocvar_sv_dodging_frozen_doubletap)
REGISTER_STAT(DODGING_HEIGHT_THRESHOLD, float, autocvar_sv_dodging_height_threshold)
REGISTER_STAT(DODGING_HORIZ_SPEED_MIN, float, autocvar_sv_dodging_horiz_speed_min)
REGISTER_STAT(DODGING_HORIZ_SPEED_MAX, float, autocvar_sv_dodging_horiz_speed_max)
REGISTER_STAT(DODGING_CLIENTSELECT, bool, autocvar_sv_dodging_clientselect)
#endif
/** cvar loopback */
-REGISTER_STAT(DODGING_FROZEN, int, autocvar_sv_dodging_frozen)
+REGISTER_STAT(DODGING_FROZEN, int24, autocvar_sv_dodging_frozen)
REGISTER_STAT(DODGING_TIMEOUT, float)
REGISTER_STAT(JETPACK_ACCEL_SIDE, float, autocvar_g_jetpack_acceleration_side)
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");
AUTOCVAR(g_walljump_velocity_z_factor, float, 0.5, "Upwards velocity factor, multiplied by normal jump velocity");
#endif
-REGISTER_STAT(WALLJUMP, int, autocvar_g_walljump)
+REGISTER_STAT(WALLJUMP, int24, autocvar_g_walljump)
REGISTER_STAT(WALLJUMP_VELOCITY_Z_FACTOR, float, autocvar_g_walljump_velocity_z_factor)
REGISTER_STAT(WALLJUMP_VELOCITY_XY_FACTOR, float, autocvar_g_walljump_velocity_xy_factor)
REGISTER_STAT(WALLJUMP_DELAY, float, autocvar_g_walljump_delay)
REGISTER_STAT(BLOODLOSS, float, autocvar_g_bloodloss)
// freeze tag, clan arena
-REGISTER_STAT(REDALIVE, int)
-REGISTER_STAT(BLUEALIVE, int)
-REGISTER_STAT(YELLOWALIVE, int)
-REGISTER_STAT(PINKALIVE, int)
+REGISTER_STAT(REDALIVE, int24)
+REGISTER_STAT(BLUEALIVE, int24)
+REGISTER_STAT(YELLOWALIVE, int24)
+REGISTER_STAT(PINKALIVE, int24)
// domination
REGISTER_STAT(DOM_TOTAL_PPS, float)
REGISTER_STAT(DOM_PPS_PINK, float)
REGISTER_STAT(TELEPORT_MAXSPEED, float, autocvar_g_teleport_maxspeed)
-REGISTER_STAT(TELEPORT_TELEFRAG_AVOID, int, autocvar_g_telefrags_avoid)
+REGISTER_STAT(TELEPORT_TELEFRAG_AVOID, int24, autocvar_g_telefrags_avoid)
-REGISTER_STAT(CAMERA_SPECTATOR, int)
+REGISTER_STAT(CAMERA_SPECTATOR, int24)
REGISTER_STAT(SPECTATORSPEED, float)
REGISTER_STAT(MOVEVARS_AIRCONTROL_BACKWARDS, bool)
REGISTER_STAT(MOVEVARS_AIRCONTROL_SIDEWARDS, bool)
noref bool autocvar_sv_gameplayfix_nogravityonground = true;
-REGISTER_STAT(MOVEFLAGS, int, MOVEFLAG_VALID
+REGISTER_STAT(MOVEFLAGS, int24, MOVEFLAG_VALID
| (autocvar_sv_gameplayfix_q2airaccelerate ? MOVEFLAG_Q2AIRACCELERATE : 0)
| (autocvar_sv_gameplayfix_nogravityonground ? MOVEFLAG_NOGRAVITYONGROUND : 0)
| (autocvar_sv_gameplayfix_gravityunaffectedbyticrate ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0))
#ifdef SVQC
float autocvar_sv_wallfriction;
#endif
-REGISTER_STAT(MOVEVARS_WALLFRICTION, int, autocvar_sv_wallfriction)
+REGISTER_STAT(MOVEVARS_WALLFRICTION, int24, autocvar_sv_wallfriction)
REGISTER_STAT(MOVEVARS_TICRATE, float, autocvar_sys_ticrate)
REGISTER_STAT(MOVEVARS_TIMESCALE, float, autocvar_slowmo)
REGISTER_STAT(MOVEVARS_GRAVITY, float, autocvar_sv_gravity)
#ifdef SVQC
int autocvar_sv_wallclip;
#endif
-REGISTER_STAT(MOVEVARS_WALLCLIP, int, autocvar_sv_wallclip)
+REGISTER_STAT(MOVEVARS_WALLCLIP, int24, autocvar_sv_wallclip)
-REGISTER_STAT(GUNALIGN, int)
+REGISTER_STAT(GUNALIGN, int24)
#ifdef SVQC
SPECTATE_COPYFIELD(_STAT(GUNALIGN))
#endif
.int m_id;
USING(vectori, vector);
+USING(int24, int);
REGISTRY(Stats, 256)
REGISTER_REGISTRY(Stats)
#define EVAL_REGISTER_STAT(...) __VA_ARGS__
#if defined(CSQC)
- #define stats_get_int() ReadInt24_t()
+ #define stats_get_int24() ReadInt24_t()
#define stats_get_bool() boolean(ReadByte())
#define stats_get_float() ReadFloat()
#define stats_get_vector() ReadVector()
.void(entity ent) m_receive;
#elif defined(SVQC)
- #define stats_write_int(chan,id,ent) WriteInt24_t(chan, STAT(id, ent))
+ #define stats_write_int24(chan,id,ent) WriteInt24_t(chan, STAT(id, ent))
#define stats_write_bool(chan,id,ent) WriteByte(chan, STAT(id, ent))
#define stats_write_float(chan,id,ent) WriteFloat(chan, STAT(id, ent))
#define stats_write_vector(chan,id,ent) WriteVector(chan, STAT(id, ent))
#define stats_write_vectori(chan,id,ent) WriteInt72_t(chan, STAT(id, ent))
+ #define stats_set_int24(id,ent,val) STAT(id, ent) = rint(val)
+ #define stats_set_bool(id,ent,val) STAT(id, ent) = (val)
+ #define stats_set_float(id,ent,val) STAT(id, ent) = (val)
+ #define stats_set_vector(id,ent,val) STAT(id, ent) = (val)
+ #define stats_set_vectori(id,ent,val) STAT(id, ent) = vec_rint(val)
+
+ #define stats_check_int24(id,ent,val) (STAT(id, ent) != rint(val))
+ #define stats_check_bool(id,ent,val) (STAT(id, ent) != (val))
+ #define stats_check_float(id,ent,val) (STAT(id, ent) != (val))
+ #define stats_check_vector(id,ent,val) (STAT(id, ent) != (val))
+ #define stats_check_vectori(id,ent,val) (STAT(id, ent) != vec_rint(val))
+
.bool(entity ent, entity player) m_check;
.void(entity ent, entity player) m_set;
.void(int chan, entity ent) m_send;
#define _STAT(id) stat_##id
#define REGISTER_STAT_2(id, T) \
.T _STAT(id); \
- bool STAT_##id##_check(entity ent, entity player) { return STAT(id, ent) != STAT(id, player); } \
- void STAT_##id##_set(entity ent, entity player) { STAT(id, ent) = STAT(id, player); } \
+ bool STAT_##id##_check(entity ent, entity player) { return stats_check_##T(id, ent, STAT(id, player)); } \
+ void STAT_##id##_set(entity ent, entity player) { stats_set_##T(id, ent, STAT(id, player)); } \
void STAT_##id##_send(int chan, entity ent) { stats_write_##T(chan, id, ent); } \
REGISTER(Stats, STAT_##id, m_id, new_pure(stat)) \
{ \
/** TODO: do we want the global copy to update? */
#define REGISTER_STAT_3(id, T, expr) \
REGISTER_STAT_2(id, T); \
- ACCUMULATE void GlobalStats_update(entity this) { STAT(id, this) = (expr); } \
- ACCUMULATE void GlobalStats_updateglobal() { entity this = STATS; STAT(id, this) = (expr); } \
- STATIC_INIT(worldstat_##id) { entity this = STATS; STAT(id, this) = (expr); }
+ ACCUMULATE void GlobalStats_update(entity this) { stats_set_##T(id, this, (expr)); } \
+ ACCUMULATE void GlobalStats_updateglobal() { entity this = STATS; stats_set_##T(id, this, (expr)); } \
+ STATIC_INIT(worldstat_##id) { entity this = STATS; stats_set_##T(id, this, (expr)); }
#else
#define REGISTER_STAT_2(id, type)
#define REGISTER_STAT_3(id, T, expr)
#endif
#ifdef SVQC
+const int STATS_MAX_UPDATES = 5; // maximum number of stats to update per frame
int statsminorBitsArr[Stats_groups_major];
void Stats_Write(entity data)
{
for (int i = 0; i < Stats_groups_major; ++i)
statsminorBitsArr[i] = 0;
+ int updateCount = 0;
int majorBits = 0;
FOREACH(Stats, true, {
+ if(updateCount >= STATS_MAX_UPDATES)
+ break; // no more updates this frame thank you very much!
const bool changed = it.m_check(data, data.owner);
if (changed) {
+ ++updateCount;
it.m_set(data, data.owner);
int maj = G_MAJOR(it.m_id);
majorBits = BITSET(majorBits, BIT(maj), true);