#define _MUTATOR_HANDLE_POPTMP(type, id) id = tmp_##id;
#define _MUTATOR_HANDLE_POPOUT(type, id) id = out_##id;
-void RegisterHooks() {};
-void RegisterCallbacks() {};
+ACCUMULATE void RegisterHooks() {};
+ACCUMULATE void RegisterCallbacks() {};
#define MUTATOR_HOOKABLE(id, params) _MUTATOR_HOOKABLE(id, params)
#define _MUTATOR_HOOKABLE(id, params) \
}
#define REGISTER_MUTATOR(id, dependence) \
- bool MUTATORFUNC_##id##_hooks(int mode) { return = false; } \
- bool MUTATORFUNC_##id(int mode) { \
+ ACCUMULATE bool MUTATORFUNC_##id##_hooks(int mode) { return = false; } \
+ ACCUMULATE bool MUTATORFUNC_##id(int mode) { \
return = false; \
bool ret = MUTATORFUNC_##id##_hooks(mode); if (ret) return ret; \
} \
#define _MUTATOR_CALLBACK(name, func) \
Callback CB_##name; \
- bool func(); \
+ ACCUMULATE bool func(); \
ACCUMULATE void RegisterCallbacks() { CB_##name = NEW(Callback, func); }
#define MUTATOR_HOOKFUNCTION(...) \
#include "static.qh"
ERASEABLE
+ACCUMULATE
void RegisterCvars(void(string name, string def, string desc, bool archive, string file) f) {}
ERASEABLE
ACCUMULATE cname spawn##cname##_1(cname this)
#define CONSTRUCTOR(cname, ...) \
- cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) \
+ ACCUMULATE cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) \
{ \
return = this; \
} \
.string vtblname;
.entity vtblbase;
-void RegisterClasses() {}
+ACCUMULATE void RegisterClasses() {}
STATIC_INIT(RegisterClasses)
{
RegisterClasses();
ACCUMULATE void REGISTRY_DEPENDS_(id) {} \
REGISTRY_BEGIN(id) {} \
REGISTRY_END(id) {} \
- void _Register##id() {} \
+ ACCUMULATE void _Register##id() {} \
int id##_state = 0; \
void Register##id() { if (id##_state) return; id##_state = 1; REGISTRY_DEPENDS_(id); REGISTRY_BEGIN_(id); _Register##id(); id##_state = 2; REGISTRY_END_(id); } \
const int id##_MAX = max; \
/** before worldspawn */
#define STATIC_INIT_EARLY(func) _STATIC_INIT(func##_0, __static_init_0)
#define static_init_early() CALL_ACCUMULATED_FUNCTION(__static_init_0)
-void __static_init_0() {}
+ACCUMULATE void __static_init_0() {}
/** during worldspawn */
#define STATIC_INIT(func) _STATIC_INIT(func##_1, __static_init_1)
#define static_init() CALL_ACCUMULATED_FUNCTION(__static_init_1)
-void __static_init_1() {}
+ACCUMULATE void __static_init_1() {}
/** directly after STATIC_INIT */
#define STATIC_INIT_LATE(func) _STATIC_INIT(func##_2, __static_init_2)
#define static_init_late() CALL_ACCUMULATED_FUNCTION(__static_init_2)
-void __static_init_2() {}
+ACCUMULATE void __static_init_2() {}
/** directly after STATIC_INIT_LATE */
#define PRECACHE(func) _STATIC_INIT(func##_3, __static_init_3)
#define static_init_precache() CALL_ACCUMULATED_FUNCTION(__static_init_3)
-void __static_init_3() {}
+ACCUMULATE void __static_init_3() {}
/* other map entities spawn now */
/** before shutdown */
#define SHUTDOWN(func) _STATIC_INIT(func##_shutdown, __shutdown)
#define shutdownhooks() CALL_ACCUMULATED_FUNCTION( __shutdown)
-void __shutdown() {}
+ACCUMULATE void __shutdown() {}
#define EVAL_REGISTER_STAT(...) __VA_ARGS__
#if defined(CSQC)
/** Get all stats and store them as globals, access with `STAT(ID)` */
- void stats_get() {}
+ ACCUMULATE void stats_get() {}
#define STAT(...) EVAL_STAT(OVERLOAD(STAT, __VA_ARGS__))
#define EVAL_STAT(...) __VA_ARGS__
#define STAT_1(id) (RVALUE, _STAT(id))
/** Internal use only */
entity STATS;
/** Add all registered stats, access with `STAT(ID, player)` or `.type stat = _STAT(ID); player.stat` */
- void stats_add() {}
+ ACCUMULATE void stats_add() {}
#define STAT(...) EVAL_STAT(OVERLOAD_(STAT, __VA_ARGS__))
#define EVAL_STAT(...) __VA_ARGS__
#define STAT_1(id) (RVALUE, STAT_2(id, STATS))
.T fld = _STAT(id); \
addstat_##T(STAT_##id.m_id, fld); \
}
- void GlobalStats_update(entity this) {}
- void GlobalStats_updateglobal() {}
+ ACCUMULATE void GlobalStats_update(entity this) {}
+ ACCUMULATE void GlobalStats_updateglobal() {}
/** TODO: do we want the global copy to update? */
#define REGISTER_STAT_3(id, T, expr) \
REGISTER_STAT_2(id, T); \
float dist = vlen(vec2(this.origin + offset - destorg));
// if current and next goal are close to each other make sure
// actual_destorg isn't set beyond next_goal_org
- if (dist ** 2 > vlen2(vec2(next_goal_org - destorg)))
+ if (pow(dist, 2) > vlen2(vec2(next_goal_org - destorg)))
actual_destorg = next_goal_org;
else
actual_destorg = vec2(destorg) + dist * next_dir;
dragger.dragdistance = vlen(touchpoint - dragger.origin - dragger.view_ofs);
dragger.draglocalangle = draggee.angles.y - dragger.v_angle.y;
touchpoint = touchpoint - gettaginfo(draggee, 0);
- tagscale = (vlen(v_forward) ** -2);
+ tagscale = pow(vlen(v_forward), -2);
dragger.draglocalvector_x = touchpoint * v_forward * tagscale;
dragger.draglocalvector_y = touchpoint * v_right * tagscale;
dragger.draglocalvector_z = touchpoint * v_up * tagscale;
void Drag_SetSpeed(entity dragger, float s)
{
- dragger.dragspeed = (2 ** s);
+ dragger.dragspeed = pow(2, s);
}
void Drag_MoveBackward(entity dragger)
LOG_INFOF("THROUGHFLOOR: D=%f F=%f max(dD)=1/%f max(dF)=1/%f", finaldmg, vlen(force), mininv_d, mininv_f);
- total = 0.25 * (max(mininv_f, mininv_d) ** 2);
+ total = 0.25 * pow(max(mininv_f, mininv_d), 2);
if(autocvar_g_throughfloor_debug)
LOG_INFOF(" steps=%f", total);