13 #define MAGIC_STATS(_, x) \ 14 _(x, MOVEVARS_AIRACCEL_QW_STRETCHFACTOR, 220) \ 15 _(x, MOVEVARS_AIRCONTROL_PENALTY, 221) \ 16 _(x, MOVEVARS_AIRSPEEDLIMIT_NONQW, 222) \ 17 _(x, MOVEVARS_AIRSTRAFEACCEL_QW, 223) \ 18 _(x, MOVEVARS_AIRCONTROL_POWER, 224) \ 19 _(x, MOVEFLAGS, 225) \ 20 _(x, MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, 226) \ 21 _(x, MOVEVARS_WARSOWBUNNY_ACCEL, 227) \ 22 _(x, MOVEVARS_WARSOWBUNNY_TOPSPEED, 228) \ 23 _(x, MOVEVARS_WARSOWBUNNY_TURNACCEL, 229) \ 24 _(x, MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, 230) \ 25 _(x, MOVEVARS_AIRSTOPACCELERATE, 231) \ 26 _(x, MOVEVARS_AIRSTRAFEACCELERATE, 232) \ 27 _(x, MOVEVARS_MAXAIRSTRAFESPEED, 233) \ 28 _(x, MOVEVARS_AIRCONTROL, 234) \ 29 _(x, FRAGLIMIT, 235) \ 30 _(x, TIMELIMIT, 236) \ 31 _(x, MOVEVARS_WALLFRICTION, 237) \ 32 _(x, MOVEVARS_FRICTION, 238) \ 33 _(x, MOVEVARS_WATERFRICTION, 239) \ 34 _(x, MOVEVARS_TICRATE, 240) \ 35 _(x, MOVEVARS_TIMESCALE, 241) \ 36 _(x, MOVEVARS_GRAVITY, 242) \ 37 _(x, MOVEVARS_STOPSPEED, 243) \ 38 _(x, MOVEVARS_MAXSPEED, 244) \ 39 _(x, MOVEVARS_SPECTATORMAXSPEED, 245) \ 40 _(x, MOVEVARS_ACCELERATE, 246) \ 41 _(x, MOVEVARS_AIRACCELERATE, 247) \ 42 _(x, MOVEVARS_WATERACCELERATE, 248) \ 43 _(x, MOVEVARS_ENTGRAVITY, 249) \ 44 _(x, MOVEVARS_JUMPVELOCITY, 250) \ 45 _(x, MOVEVARS_EDGEFRICTION, 251) \ 46 _(x, MOVEVARS_MAXAIRSPEED, 252) \ 47 _(x, MOVEVARS_STEPHEIGHT, 253) \ 48 _(x, MOVEVARS_AIRACCEL_QW, 254) \ 49 _(x, MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION, 255) \ 54 #define MAGIC_STATS_FIX_MANUAL(it, var, id) \ 55 if (it.registered_id == "STAT_" #var) { --g_magic_stats_hole; it.m_id = id; } else 57 #define MAGIC_STATS_FIX_AUTO(it, var, id) \ 58 if (it.m_id == id) { ++g_magic_stats_hole; ++it.m_id; } 60 #define MAGIC_STATS_FIX(it) \ 61 it.m_id += g_magic_stats_hole; \ 62 MAGIC_STATS(MAGIC_STATS_FIX_MANUAL, it) { MAGIC_STATS(MAGIC_STATS_FIX_AUTO, it) } 64 #define REGISTER_STAT(...) EVAL_REGISTER_STAT(OVERLOAD(REGISTER_STAT, __VA_ARGS__)) 65 #define EVAL_REGISTER_STAT(...) __VA_ARGS__ 69 #define STAT(...) EVAL_STAT(OVERLOAD(STAT, __VA_ARGS__)) 70 #define EVAL_STAT(...) __VA_ARGS__ 71 #define STAT_1(id) (RVALUE, _STAT(id)) 72 #define STAT_2(id, cl) STAT_1(id) 74 #define getstat_int(id) getstati(id, 0, 24) 75 #define getstat_bool(id) boolean(getstati(id)) 76 #define getstat_float(id) getstatf(id) 77 #define getstat_vector(id) vec3(getstat_float(id + 0), getstat_float(id + 1), getstat_float(id + 2)) 78 #define getstat_vectori(id) vec3(getstat_int(id + 0), getstat_int(id + 1), getstat_int(id + 2)) 80 #define _STAT(id) g_stat_##id 81 #define REGISTER_STAT_2(id, T) \ 84 REGISTER(Stats, STAT_##id, m_id, new_pure(stat)) \ 86 if (#T == "vector" || #T == "vectori") { \ 87 REGISTRY_RESERVE(Stats, m_id, STAT_##id, y); \ 88 REGISTRY_RESERVE(Stats, m_id, STAT_##id, z); \ 91 ACCUMULATE void stats_get() \ 93 T it = getstat_##T(STAT_##id.m_id); \ 97 #define REGISTER_STAT_3(x, T, expr) REGISTER_STAT_2(x, T) 103 #define STAT(...) EVAL_STAT(OVERLOAD_(STAT, __VA_ARGS__)) 104 #define EVAL_STAT(...) __VA_ARGS__ 105 #define STAT_1(id) (RVALUE, STAT_2(id, STATS)) 106 #define STAT_2(id, cl) (cl)._STAT(id) 108 #define addstat_int(id, fld) addstat(id, AS_INT, fld) 109 #define addstat_bool(id, fld) addstat(id, AS_INT, fld) 110 #define addstat_float(id, fld) addstat(id, AS_FLOAT, fld) 111 #define addstat_vector(id, fld) MACRO_BEGIN \ 112 addstat_float(id + 0, fld##_x); \ 113 addstat_float(id + 1, fld##_y); \ 114 addstat_float(id + 2, fld##_z); \ 116 #define addstat_vectori(id, fld) MACRO_BEGIN \ 117 addstat_int(id + 0, fld##_x); \ 118 addstat_int(id + 1, fld##_y); \ 119 addstat_int(id + 2, fld##_z); \ 121 const int AS_STRING = 1;
122 const int AS_INT = 2;
123 const int AS_FLOAT = 8;
131 for (
int i = 0, n = 256 - r; i < n; ++i) {
132 #define X(_, name, id) if (i == id) continue; 135 addstat(r + i, AS_INT, __stat_null);
139 #define _STAT(id) stat_##id 140 #define REGISTER_STAT_2(id, T) \ 142 REGISTER(Stats, STAT_##id, m_id, new_pure(stat)) \ 144 if (#T == "vector" || #T == "vectori") { \ 145 REGISTRY_RESERVE(Stats, m_id, STAT_##id, y); \ 146 REGISTRY_RESERVE(Stats, m_id, STAT_##id, z); \ 149 ACCUMULATE void stats_add() \ 151 .T fld = _STAT(id); \ 152 addstat_##T(STAT_##id.m_id, fld); \ 154 void GlobalStats_update(
entity this) {}
155 void GlobalStats_updateglobal() {}
157 #define REGISTER_STAT_3(id, T, expr) \ 158 REGISTER_STAT_2(id, T); \ 159 ACCUMULATE void GlobalStats_update(entity this) { STAT(id, this) = (expr); } \ 160 ACCUMULATE void GlobalStats_updateglobal() { entity this = STATS; STAT(id, this) = (expr); } \ 161 STATIC_INIT(worldstat_##id) { entity this = STATS; STAT(id, this) = (expr); } 163 #define REGISTER_STAT_2(id, type) 164 #define REGISTER_STAT_3(id, T, expr)
#define MAGIC_STATS_FIX(it)
#define REGISTRY_CHECK(id)
#define REGISTRY_SORT(...)
STATIC_INIT(Stats_renumber)
#define REGISTER_REGISTRY(id)
#define REGISTRY_DEFINE_GET(id, null)
#define REGISTRY(id, max)
Declare a new registry.
#define MAGIC_STATS(_, x)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const int STATS_ENGINE_RESERVE
#define new_pure(class)
purely logical entities (.origin doesn't work)
#define FOREACH(list, cond, body)