Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
stats.qh File Reference
#include "registry.qh"
#include "sort.qh"
Include dependency graph for stats.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _REGISTRY_RESERVE_BOOL(Stats, m_id, id)
#define _REGISTRY_RESERVE_FLOAT(Stats, m_id, id)
#define _REGISTRY_RESERVE_INT(Stats, m_id, id)
#define _REGISTRY_RESERVE_VECTOR(Stats, m_id, id)
#define _REGISTRY_RESERVE_VECTORI(Stats, m_id, id)
#define _STAT(id)
#define EVAL_REGISTER_STAT(...)
#define EVAL_STAT(...)
#define getstat_BOOL(id)
#define getstat_FLOAT(id)
#define getstat_INT(id)
#define getstat_VECTOR(id)
#define getstat_VECTORI(id)
#define MAGIC_STATS(_, x)
#define MAGIC_STATS_FIX(it)
#define MAGIC_STATS_FIX_AUTO(it, var, id)
#define MAGIC_STATS_FIX_MANUAL(it, var, id)
#define REGISTER_STAT(...)
#define REGISTER_STAT_2(id, T)
#define REGISTER_STAT_3(id, T, expr)
#define STAT(...)
#define STAT_1(id)
#define STAT_2(id, cl)
#define type_BOOL   bool
#define type_FLOAT   float
#define type_INT   int
#define type_VECTOR   vector
#define type_VECTORI   vector

Functions

 STATIC_INIT (stats_add)
 STATIC_INIT (Stats_renumber)
void stats_get ()
 Get all stats and store them as globals, access with STAT(ID)

Variables

int g_magic_stats_hole = 0
int m_id
const int STATS_ENGINE_RESERVE = 32

Macro Definition Documentation

◆ _REGISTRY_RESERVE_BOOL

#define _REGISTRY_RESERVE_BOOL ( Stats,
m_id,
id )

Definition at line 70 of file stats.qh.

◆ _REGISTRY_RESERVE_FLOAT

#define _REGISTRY_RESERVE_FLOAT ( Stats,
m_id,
id )

Definition at line 71 of file stats.qh.

◆ _REGISTRY_RESERVE_INT

#define _REGISTRY_RESERVE_INT ( Stats,
m_id,
id )

Definition at line 69 of file stats.qh.

◆ _REGISTRY_RESERVE_VECTOR

#define _REGISTRY_RESERVE_VECTOR ( Stats,
m_id,
id )
Value:
REGISTRY_RESERVE(Stats, m_id, STAT_##id, y); \
REGISTRY_RESERVE(Stats, m_id, STAT_##id, z);
int m_id
Definition effect.qh:19
v y
Definition ent_cs.qc:121
#define REGISTRY_RESERVE(registry, fld, id, suffix)
Definition registry.qh:116

Definition at line 72 of file stats.qh.

72#define _REGISTRY_RESERVE_VECTOR(Stats, m_id, id) \
73 REGISTRY_RESERVE(Stats, m_id, STAT_##id, y); \
74 REGISTRY_RESERVE(Stats, m_id, STAT_##id, z);

◆ _REGISTRY_RESERVE_VECTORI

#define _REGISTRY_RESERVE_VECTORI ( Stats,
m_id,
id )
Value:
#define _REGISTRY_RESERVE_VECTOR(Stats, m_id, id)
Definition stats.qh:72

Definition at line 75 of file stats.qh.

◆ _STAT

#define _STAT ( id)
Value:
g_stat_##id

Definition at line 93 of file stats.qh.

◆ EVAL_REGISTER_STAT

#define EVAL_REGISTER_STAT ( ...)
Value:
__VA_ARGS__

Definition at line 78 of file stats.qh.

◆ EVAL_STAT

#define EVAL_STAT ( ...)
Value:
__VA_ARGS__

Definition at line 83 of file stats.qh.

◆ getstat_BOOL

#define getstat_BOOL ( id)
Value:
boolean(getstati(id))
#define boolean(value)
Definition bool.qh:9

Definition at line 88 of file stats.qh.

◆ getstat_FLOAT

#define getstat_FLOAT ( id)
Value:
getstatf(id)

Definition at line 89 of file stats.qh.

◆ getstat_INT

#define getstat_INT ( id)
Value:
getstati(id, 0, 24)

Definition at line 87 of file stats.qh.

◆ getstat_VECTOR

#define getstat_VECTOR ( id)
Value:
vec3(getstat_FLOAT(id + 0), getstat_FLOAT(id + 1), getstat_FLOAT(id + 2))
#define getstat_FLOAT(id)
Definition stats.qh:89
#define vec3(_x, _y, _z)
Definition vector.qh:95

Definition at line 90 of file stats.qh.

◆ getstat_VECTORI

#define getstat_VECTORI ( id)
Value:
vec3(getstat_INT(id + 0), getstat_INT(id + 1), getstat_INT(id + 2))
#define getstat_INT(id)
Definition stats.qh:87

Definition at line 91 of file stats.qh.

◆ MAGIC_STATS

#define MAGIC_STATS ( _,
x )

Definition at line 12 of file stats.qh.

12#define MAGIC_STATS(_, x) \
13 _(x, MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, 220) \
14 _(x, MOVEVARS_AIRCONTROL_PENALTY, 221) \
15 _(x, MOVEVARS_AIRSPEEDLIMIT_NONQW, 222) \
16 _(x, MOVEVARS_AIRSTRAFEACCEL_QW, 223) \
17 _(x, MOVEVARS_AIRCONTROL_POWER, 224) \
18 _(x, MOVEFLAGS, 225) \
19 _(x, MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, 226) \
20 _(x, MOVEVARS_WARSOWBUNNY_ACCEL, 227) \
21 _(x, MOVEVARS_WARSOWBUNNY_TOPSPEED, 228) \
22 _(x, MOVEVARS_WARSOWBUNNY_TURNACCEL, 229) \
23 _(x, MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, 230) \
24 _(x, MOVEVARS_AIRSTOPACCELERATE, 231) \
25 _(x, MOVEVARS_AIRSTRAFEACCELERATE, 232) \
26 _(x, MOVEVARS_MAXAIRSTRAFESPEED, 233) \
27 _(x, MOVEVARS_AIRCONTROL, 234) \
28 _(x, FRAGLIMIT, 235) \
29 _(x, TIMELIMIT, 236) \
30 _(x, MOVEVARS_WALLFRICTION, 237) \
31 _(x, MOVEVARS_FRICTION, 238) \
32 _(x, MOVEVARS_WATERFRICTION, 239) \
33 _(x, MOVEVARS_TICRATE, 240) \
34 _(x, MOVEVARS_TIMESCALE, 241) \
35 _(x, MOVEVARS_GRAVITY, 242) \
36 _(x, MOVEVARS_STOPSPEED, 243) \
37 _(x, MOVEVARS_MAXSPEED, 244) \
38 _(x, MOVEVARS_SPECTATORMAXSPEED, 245) \
39 _(x, MOVEVARS_ACCELERATE, 246) \
40 _(x, MOVEVARS_AIRACCELERATE, 247) \
41 _(x, MOVEVARS_WATERACCELERATE, 248) \
42 _(x, MOVEVARS_ENTGRAVITY, 249) \
43 _(x, MOVEVARS_JUMPVELOCITY, 250) \
44 _(x, MOVEVARS_EDGEFRICTION, 251) \
45 _(x, MOVEVARS_MAXAIRSPEED, 252) \
46 _(x, MOVEVARS_STEPHEIGHT, 253) \
47 _(x, MOVEVARS_AIRACCEL_QW, 254) \
48 _(x, MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, 255) \
49 /**/

◆ MAGIC_STATS_FIX

#define MAGIC_STATS_FIX ( it)
Value:
it.m_id += g_magic_stats_hole; \
#define MAGIC_STATS(_, x)
Definition stats.qh:12
#define MAGIC_STATS_FIX_MANUAL(it, var, id)
Definition stats.qh:53
int g_magic_stats_hole
Definition stats.qh:51
#define MAGIC_STATS_FIX_AUTO(it, var, id)
Definition stats.qh:56

Definition at line 59 of file stats.qh.

59#define MAGIC_STATS_FIX(it) \
60 it.m_id += g_magic_stats_hole; \
61 MAGIC_STATS(MAGIC_STATS_FIX_MANUAL, it) { MAGIC_STATS(MAGIC_STATS_FIX_AUTO, it) }

Referenced by STATIC_INIT().

◆ MAGIC_STATS_FIX_AUTO

#define MAGIC_STATS_FIX_AUTO ( it,
var,
id )
Value:
if (it.m_id == id) { ++g_magic_stats_hole; ++it.m_id; }

Definition at line 56 of file stats.qh.

56#define MAGIC_STATS_FIX_AUTO(it, var, id) \
57 if (it.m_id == id) { ++g_magic_stats_hole; ++it.m_id; }

◆ MAGIC_STATS_FIX_MANUAL

#define MAGIC_STATS_FIX_MANUAL ( it,
var,
id )
Value:
if (it.registered_id == "STAT_" #var) { --g_magic_stats_hole; it.m_id = id; } else

Definition at line 53 of file stats.qh.

53#define MAGIC_STATS_FIX_MANUAL(it, var, id) \
54 if (it.registered_id == "STAT_" #var) { --g_magic_stats_hole; it.m_id = id; } else

◆ REGISTER_STAT

#define REGISTER_STAT ( ...)
Value:
#define EVAL_REGISTER_STAT(...)
Definition stats.qh:78
#define REGISTER_STAT(...)
Definition stats.qh:77
#define OVERLOAD(F,...)
Definition misc.qh:12

Definition at line 77 of file stats.qh.

◆ REGISTER_STAT_2

#define REGISTER_STAT_2 ( id,
T )
Value:
type_##T _STAT(id); \
/* T CAT(_STAT(id), _prev); */ \
REGISTER(Stats, STAT_##id, m_id, new_pure(stat)) \
{ \
_REGISTRY_RESERVE_##T(Stats, m_id, id) \
} \
{ \
type_##T it = getstat_##T(STAT_##id.m_id); \
/* if (it != CAT(_STAT(id), _prev)) \
CAT(_STAT(id), _prev) = */ _STAT(id) = it; \
}
#define ACCUMULATE
Definition _all.inc:31
void stats_get()
Get all stats and store them as globals, access with STAT(ID)
Definition stats.qh:81
#define _STAT(id)
Definition stats.qh:93
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67

Definition at line 94 of file stats.qh.

94 #define REGISTER_STAT_2(id, T) \
95 type_##T _STAT(id); \
96 /* T CAT(_STAT(id), _prev); */ \
97 REGISTER(Stats, STAT_##id, m_id, new_pure(stat)) \
98 { \
99 _REGISTRY_RESERVE_##T(Stats, m_id, id) \
100 } \
101 ACCUMULATE void stats_get() \
102 { \
103 type_##T it = getstat_##T(STAT_##id.m_id); \
104 /* if (it != CAT(_STAT(id), _prev)) \
105 CAT(_STAT(id), _prev) = */ _STAT(id) = it; \

◆ REGISTER_STAT_3

#define REGISTER_STAT_3 ( id,
T,
expr )
Value:
#define REGISTER_STAT_2(id, T)
Definition stats.qh:94

Definition at line 106 of file stats.qh.

◆ STAT

#define STAT ( ...)
Value:
EVAL_STAT(OVERLOAD(STAT, __VA_ARGS__))
#define STAT(...)
Definition stats.qh:82
#define EVAL_STAT(...)
Definition stats.qh:83

Definition at line 82 of file stats.qh.

Referenced by accuracy_add(), ammo_pickupevalfunc(), Announcer_Countdown(), Announcer_Gamestart(), Announcer_Time(), bot_serverframe(), buff_Think(), buff_Touch(), bumblebee_gunner_enter(), bumblebee_gunner_exit(), bumblebee_gunner_findgoodexit(), bumblebee_gunner_frame(), bumblebee_pilot_frame(), CA_count_alive_players(), CheatCommand(), CheatImpulse(), CL_WeaponEntity_SetModel(), client_hasweapon(), CreatureFrame_hotliquids(), crosshair_getcolor(), CSQC_Ent_Update(), CSQC_UpdateView(), CSQCPlayer_PredictTo(), Damage(), Draw_GrapplingHook(), Draw_WaypointSprite(), DrawAmmoNades(), DrawCAItem(), DrawDomItem(), DrawReticle(), DropBall(), DrownPlayer(), EndFrame(), Fire_ApplyDamage(), FireGrapplingHook(), fpscounter_update(), freezetag_count_alive_players(), freezetag_Freeze(), freezetag_Ice_Think(), freezetag_isEliminated(), freezetag_LastPlayerForTeam(), freezetag_Unfreeze(), ft_RemovePlayer(), GetCurrentFov(), GetPressedKeys(), GiveBall(), GiveItems(), GiveRandomWeapons(), GiveWarmupResources(), GiveWeapon(), GrapplingHookThink(), have_pickup_item(), havocbot_ai(), havocbot_chooseenemy(), havocbot_goalrating_ft_freeplayers(), havocbot_goalrating_item_can_be_left_to_teammate(), havocbot_goalrating_item_pickable_check_players(), havocbot_movetogoal(), havocbot_role_ft_offense(), Headshot(), Heal(), HitSound(), HUD_Ammo(), HUD_Crosshair(), HUD_Damage(), HUD_Draw(), Hud_Dynamic_Frame(), HUD_HealthArmor(), HUD_InfoMessages(), HUD_ItemsTime(), HUD_Mod_CTF(), HUD_Mod_Keepaway(), HUD_Mod_KH(), HUD_Mod_LMS_Draw(), HUD_Mod_NexBall(), HUD_Mod_Survival(), HUD_Mod_TeamKeepaway(), HUD_Physics(), HUD_Pickup(), HUD_Pickup_Time(), HUD_Powerups(), HUD_PressedKeys(), HUD_RaceTimer(), HUD_Radar_InputEvent(), HUD_StrafeHUD(), HUD_Timer(), HUD_Weapons(), Item_GiveTo(), Item_ItemsTime_SetTime(), Item_ItemsTime_UpdateTime(), Item_Reset(), Item_Respawn(), Item_ScheduleRespawnIn(), Item_Touch(), jumppad_push(), kh_Key_Detach(), kh_update_state(), M_Mage_Defend_Heal_Check(), Monster_Enemy_Check(), monsters_setstatus(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), nade_ammo_touch(), nade_boom(), nade_burn_spawn(), nade_customize(), nade_damage(), nade_darkness_think(), nade_heal_touch(), nade_ice_think(), nade_pickup(), nade_prime(), nade_spawn(), nade_spawn_DestroyDamage(), nade_translocate_DestroyDamage(), nades_Clear(), nades_GiveBonus(), nades_RemoveBonus(), napalm_damage(), navigation_goalrating_end(), navigation_poptouchedgoals(), navigation_routerating(), navigation_routetogoal(), navigation_unstuck(), NET_HANDLE(), nexball_setstatus(), NIX_GiveCurrentWeapon(), ObserverOrSpectatorThink(), ons_Teleport(), Onslaught_CheckWinner(), Physics_UpdateStats(), Pickup_Update(), player_powerups(), PlayerDamage(), PlayerFrame(), PlayerPostThink(), PlayerThink(), PlayerUseKey(), PM_ClientMovement_UpdateStatus(), Porto_Draw(), PutObserverInServer(), PutPlayerInServer(), QuickMenu_Default(), raptor_frame(), raptor_impulse(), raptor_takeoff(), REGISTER_MUTATOR(), Scoreboard_Draw(), Scoreboard_MapStats_Draw(), Scoreboard_WouldDraw(), ScoreRules_basics(), set_dom_state(), SetSpectatee_status(), shotorg_adjust(), spawn_held_nade(), spawnfunc(), SpawnThrownWeapon(), SpectateCopy(), spiderbot_frame(), spiderbot_impulse(), spiderbot_rocket_do(), StartItem(), sys_phys_fix(), sys_phys_spectator_control(), sys_phys_update(), target_init_use(), target_speed_calculatevelocity(), toss_nade(), TrueAimCheck(), UpdateDamage(), vehicle_addplayerslot(), Vehicles_drawCrosshair(), Vehicles_drawHUD(), vehicles_enter(), vehicles_exit(), vehicles_think(), View_CheckButtonStatus(), View_PostProcessing(), View_SpectatorCamera(), viewmodel_animate(), viewmodel_draw(), W_Arc_Beam_Think(), W_Fireball_LaserPlay(), W_GiveWeapon(), W_MineLayer_Think(), W_Nexball_Attack(), W_Porto_Fail(), W_SwitchToOtherWeapon(), W_ThrowNewWeapon(), W_ThrowWeapon(), W_WeaponFrame(), WantEventchase(), WarpZone_FixView(), weapon_pickupevalfunc(), Weapons_Draw(), WepSet_GetFromStat(), and WepSet_GetFromStat_InMap().

◆ STAT_1

#define STAT_1 ( id)
Value:
(RVALUE, _STAT(id))
#define RVALUE
Marker for use in (RVALUE, (expr))
Definition macro.qh:14

Definition at line 84 of file stats.qh.

◆ STAT_2

#define STAT_2 ( id,
cl )
Value:
STAT_1(id)
#define STAT_1(id)
Definition stats.qh:84

Definition at line 85 of file stats.qh.

◆ type_BOOL

#define type_BOOL   bool

Definition at line 64 of file stats.qh.

◆ type_FLOAT

#define type_FLOAT   float

Definition at line 65 of file stats.qh.

◆ type_INT

#define type_INT   int

Definition at line 63 of file stats.qh.

◆ type_VECTOR

#define type_VECTOR   vector

Definition at line 66 of file stats.qh.

◆ type_VECTORI

#define type_VECTORI   vector

Definition at line 67 of file stats.qh.

Function Documentation

◆ STATIC_INIT() [1/2]

STATIC_INIT ( stats_add )

Definition at line 187 of file stats.qh.

◆ STATIC_INIT() [2/2]

STATIC_INIT ( Stats_renumber )

Definition at line 179 of file stats.qh.

181{
182 FOREACH(Stats, true, {
183 it.m_id = STATS_ENGINE_RESERVE + i;
184 MAGIC_STATS_FIX(it);
185 });
#define FOREACH(list, cond, body)
Definition iter.qh:19
const int STATS_ENGINE_RESERVE
Definition stats.qh:10
#define MAGIC_STATS_FIX(it)
Definition stats.qh:59

References FOREACH, MAGIC_STATS_FIX, NULL, REGISTRY_DEFINE_GET, STATIC_INIT, and STATS_ENGINE_RESERVE.

◆ stats_get()

void stats_get ( )

Get all stats and store them as globals, access with STAT(ID)

Definition at line 81 of file stats.qh.

81{}

Referenced by CSQC_UpdateView().

Variable Documentation

◆ g_magic_stats_hole

int g_magic_stats_hole = 0

Definition at line 51 of file stats.qh.

◆ m_id

int m_id

Definition at line 8 of file stats.qh.

◆ STATS_ENGINE_RESERVE

const int STATS_ENGINE_RESERVE = 32

Definition at line 10 of file stats.qh.

Referenced by STATIC_INIT().