#define REGISTER_HUD_PANEL(id, draw_func, name, configflags, showflags) \
void draw_func(); \
- REGISTER(hud_panels, HUD_PANEL, id, m_id, new(hud_panel)) { \
- make_pure(this); \
+ REGISTER(hud_panels, HUD_PANEL, id, m_id, new_pure(hud_panel)) { \
this.panel_id = this.m_id; \
this.panel_draw = draw_func; \
this.panel_name = #name; \
int dt_identity(int i) { return i; }
#define REGISTER_DEATHTYPE(id, msg_death, msg_death_by, extra) \
- REGISTER(Deathtypes, DEATH, id, m_id, new(deathtype)) { \
- make_pure(this); \
+ REGISTER(Deathtypes, DEATH, id, m_id, new_pure(deathtype)) { \
this.m_id += DT_FIRST; \
this.nent_name = #id; \
this.death_msgextra = extra; \
entity Create_Effect_Entity(string eff_name, bool eff_trail)
{
- entity this = new(effect_entity);
- make_pure(this);
+ entity this = new_pure(effect_entity);
this.eent_eff_name = eff_name;
this.eent_eff_trail = eff_trail;
return this;
#define PlayerSounds_from(i) _PlayerSounds_from(i, NULL)
#define REGISTER_PLAYERSOUND(id) \
.string _playersound_##id; \
- REGISTER(PlayerSounds, playersound, id, m_id, new(PlayerSound)) \
+ REGISTER(PlayerSounds, playersound, id, m_id, new_pure(PlayerSound)) \
{ \
- make_pure(this); \
this.m_playersoundstr = #id; \
this.m_playersoundfld = _playersound_##id; \
}
.int m_playersoundvt;
#define REGISTER_VOICEMSG(id, vt) \
.string _playersound_##id; \
- REGISTER(PlayerSounds, playersound, id, m_id, new(VoiceMessage)) \
+ REGISTER(PlayerSounds, playersound, id, m_id, new_pure(VoiceMessage)) \
{ \
- make_pure(this); \
this.instanceOfVoiceMessage = true; \
this.m_playersoundstr = #id; \
this.m_playersoundfld = _playersound_##id; \
REGISTRY(GlobalSounds, BITS(8) - 1)
#define GlobalSounds_from(i) _GlobalSounds_from(i, NULL)
#define REGISTER_GLOBALSOUND(id, str) \
- REGISTER(GlobalSounds, GS, id, m_id, new(GlobalSound)) \
+ REGISTER(GlobalSounds, GS, id, m_id, new_pure(GlobalSound)) \
{ \
- make_pure(this); \
this.m_globalsoundstr = str; \
}
REGISTER_REGISTRY(GlobalSounds)
#define REGISTER_IMPULSE(id, n) _REGISTER_IMPULSE(IMP_##id, id, n)
#define _REGISTER_IMPULSE(id, alias, n) \
- REGISTER(IMPULSES, id, m_id, new(Impulse)) \
+ REGISTER(IMPULSES, id, m_id, new_pure(Impulse)) \
{ \
- make_pure(this); \
this.impulse = n; \
IMPULSE_ALIAS(alias, "impulse " #n); \
}
#define CHIMPULSE(id, n) _CHIMPULSE(CHIMPULSE_##id, n)
#define _CHIMPULSE(id, n) \
- REGISTER(IMPULSES, id, m_id, new(Impulse)) \
+ REGISTER(IMPULSES, id, m_id, new_pure(Impulse)) \
{ \
- make_pure(this); \
this.impulse = n; \
}
REGISTER_REGISTRY(Minigames)
REGISTRY_CHECK(Minigames)
#define REGISTER_MINIGAME(name,nicename) \
- REGISTER(Minigames, MINIGAME_##name, m_id, new(minigame_descriptor)); \
+ REGISTER(Minigames, MINIGAME_##name, m_id, new_pure(minigame_descriptor)); \
void name##_hud_board(vector, vector); \
void name##_hud_status(vector, vector); \
int name##_client_event(entity, string, ...); \
REGISTER_REGISTRY(Minigames)
REGISTRY_CHECK(Minigames)
#define REGISTER_MINIGAME(name,nicename) \
- REGISTER(Minigames, MINIGAME_##name, m_id, new(minigame_descriptor)); \
+ REGISTER(Minigames, MINIGAME_##name, m_id, new_pure(minigame_descriptor)); \
int name##_server_event(entity, string, ...); \
REGISTER_INIT_POST(MINIGAME_##name) { \
make_pure(this); \
REGISTRY_CHECK(RadarIcons)
.int m_radaricon;
-#define REGISTER_RADARICON(id, num) REGISTER(RadarIcons, RADARICON, id, m_id, new(RadarIcon)) { make_pure(this); this.m_radaricon = num; this.netname = #id; }
+#define REGISTER_RADARICON(id, num) REGISTER(RadarIcons, RADARICON, id, m_id, new_pure(RadarIcon)) { this.m_radaricon = num; this.netname = #id; }
REGISTER_WAYPOINT(Null, "", '0 0 0', 1);
// =====================
// Global Entity Setup
// =====================
- entity notif = spawn();
- make_pure(notif);
+ entity notif = new_pure(notification);
switch(typeId)
{
case MSG_ANNCE:
noref entity b = this.baseline; \
if (!b) \
{ \
- b = this.baseline = new(baseline); \
- make_pure(b); \
+ b = this.baseline = new_pure(baseline); \
b.baseline_target = this; \
}
#ifdef SVQC
#define AL_NEW(this, n, default, T) \
MACRO_BEGIN \
{ \
- ArrayList _al = this = new(ArrayList); \
- make_pure(_al); \
+ ArrayList _al = this = new_pure(ArrayList); \
_al.al_buf = buf_create(); \
for (int i = 0, _n = _al.al_len = n; i < _n; ++i) \
{ \
.string sourceLocFile;
.int sourceLocLine;
entity _spawn();
+
+#ifndef SPAWN_PURE
+#define SPAWN_PURE 0
+#endif
+
+#if SPAWN_PURE
+entity spawn_pure() = #600;
+#else
+#define spawn_pure() _spawn()
+#endif
+
entity __spawn(string _classname, string _sourceFile, int _sourceLine, bool pure)
{
- entity this = _spawn();
+ entity this = pure ? spawn_pure() : _spawn();
this.classname = _classname;
this.sourceLocFile = _sourceFile;
this.sourceLocLine = _sourceLine;
} MACRO_END
#define REGISTRY_RESERVE(registry, fld, id, suffix) MACRO_BEGIN { \
- entity e = new(registry_reserved); \
- make_pure(e); \
+ entity e = new_pure(registry_reserved); \
e.registered_id = #id "/" #suffix; \
REGISTRY_PUSH(registry, fld, e); \
} MACRO_END
#define REGISTER_STAT_2(id, T) \
T _STAT(id); \
T CAT(_STAT(id), _prev); \
- REGISTER(Stats, STAT_##id, m_id, new(stat)) \
+ REGISTER(Stats, STAT_##id, m_id, new_pure(stat)) \
{ \
- make_pure(this); \
if (#T == "vector" || #T == "vectori") { \
REGISTRY_RESERVE(Stats, m_id, STAT_##id, y); \
REGISTRY_RESERVE(Stats, m_id, STAT_##id, z); \
#define _STAT(id) stat_##id
#define REGISTER_STAT_2(id, T) \
.T _STAT(id); \
- REGISTER(Stats, STAT_##id, m_id, new(stat)) \
+ REGISTER(Stats, STAT_##id, m_id, new_pure(stat)) \
{ \
- make_pure(this); \
if (#T == "vector" || #T == "vectori") { \
REGISTRY_RESERVE(Stats, m_id, STAT_##id, y); \
REGISTRY_RESERVE(Stats, m_id, STAT_##id, z); \