USING(mutatorfunc_t, bool(int));
-CLASS(Mutator, Object)
+CLASS(Mutator, RealObject)
ATTRIB(Mutator, m_id, int, 0);
ATTRIB(Mutator, m_name, string);
ATTRIB(Mutator, mutatorfunc, mutatorfunc_t);
}
else
{
- entity net_notif = new_pure(net_notification);
+ entity net_notif = new(net_notification);
IL_PUSH(g_notifications, net_notif);
net_notif.owner = notif;
net_notif.nent_broadcast = broadcast;
entity _spawn();
#ifndef SPAWN_PURE
-#define SPAWN_PURE 0
+#define SPAWN_PURE 1
#endif
// pure entities: need no .origin
this.sourceLoc = _sourceLoc;
if (pure) {
make_pure(this);
- #ifdef CSQC
- setorigin(this, (world.mins + world.maxs) * 0.5);
- #endif
- #ifdef SVQC
+#if !SPAWN_PURE
+#ifdef CSQC
+ setorigin(this, (world.mins + world.maxs) * 0.5);
+#endif
+#ifdef SVQC
setorigin(this, (world.mins + world.maxs) * 0.5);
- #endif
+#endif
+#endif
}
return this;
}
// Macros to hide this implementation detail:
#ifdef __STDC__
#define NEW(cname, ...) \
- OVERLOAD_(spawn##cname, new_pure(cname) P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
+ OVERLOAD_(spawn##cname, (spawn##cname##Pure ? new_pure(cname) : new(cname)) P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
#define _TRANSMUTE(cname, this, ...) \
OVERLOAD_(spawn##cname, this P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
OVERLOAD_(spawn##cname, this P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
#else
#define NEW(cname, ...) \
- OVERLOAD(spawn##cname, new_pure(cname),##__VA_ARGS__)
+ OVERLOAD(spawn##cname, (spawn##cname##Pure ? new_pure(cname) : new(cname)),##__VA_ARGS__)
#define _TRANSMUTE(cname, this, ...) \
OVERLOAD(spawn##cname, this,##__VA_ARGS__)
#define CLASS(cname, base) \
+ const bool spawn##cname##Pure = spawn##base##Pure; \
entityclass(cname, base); \
class(cname).bool instanceOf##cname; \
DEBUG_STUFF(cname) \
#define SUPER(cname) (cname##_vtbl.vtblbase)
+#define remove(this) delete(this)
+
#define spawn_static(this)
#define spawn_1(this)
#define _vtbl NULL
+
+#define spawnPure true
CLASS(Object, );
DESTRUCTOR(Object) { builtin_remove(this); }
- #define remove(this) delete(this)
METHOD(Object, describe, string(Object this))
{
TC(Object, this);
returns(sprintf("entity %i", this), "nopreview_map");
}
ENDCLASS(Object)
+#undef spawnpure
+
+#define spawnObjectPure false
+CLASS(RealObject, Object);
+ENDCLASS(RealObject)
+#undef spawnObjectPure
+
#undef spawn_static
#undef spawn_1
#undef _vtbl
void ClientData_Attach(entity this)
{
- Net_LinkEntity(CS(this).clientdata = new_pure(clientdata), false, 0, ClientData_Send);
+ Net_LinkEntity(CS(this).clientdata = new(clientdata), false, 0, ClientData_Send);
CS(this).clientdata.drawonlytoclient = this;
CS(this).clientdata.owner = this;
}
void ClientInit_Spawn()
{
- entity e = new_pure(clientinit);
+ entity e = new(clientinit);
setthink(e, ClientInit_CheckUpdate);
Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
void Nagger_Init()
{
- Net_LinkEntity(nagger = new_pure(nagger), false, 0, Nagger_SendEntity);
+ Net_LinkEntity(nagger = new(nagger), false, 0, Nagger_SendEntity);
}
void Nagger_VoteChanged()
}
void RandomSeed_Spawn()
{
- randomseed = new_pure(randomseed);
+ randomseed = new(randomseed);
setthink(randomseed, RandomSeed_Think);
Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
void TeamScore_Spawn(float t, string name)
{
- entity ts = new_pure(csqc_score_team);
+ entity ts = new(csqc_score_team);
ts.netname = name; // not used yet, FIXME
ts.team = t;
Net_LinkEntity(ts, false, 0, TeamScore_SendEntity);
}
else
{
- scores_initialized = new_pure(ent_client_scoreinfo);
+ scores_initialized = new(ent_client_scoreinfo);
Net_LinkEntity(scores_initialized, false, 0, ScoreInfo_SendEntity);
}
if(teams & BIT(0))
{
if(CS(player).scorekeeper)
error("player already has a scorekeeper");
- entity sk = new_pure(scorekeeper);
+ entity sk = new(scorekeeper);
sk.owner = player;
Net_LinkEntity(sk, false, 0, PlayerScore_SendEntity);
CS(player).scorekeeper = sk;
// init/free
void accuracy_init(entity e)
{
- entity a = CS(e).accuracy = new_pure(accuracy);
+ entity a = CS(e).accuracy = new(accuracy);
a.owner = e;
a.drawonlytoclient = e;
Net_LinkEntity(a, false, 0, accuracy_send);