void SV_OnEntityPreSpawnFunction()
{
ENGINE_EVENT();
- if (_SV_OnEntityPreSpawnFunction) _SV_OnEntityPreSpawnFunction(this);
+ __spawnfunc_expecting = true;
+ __spawnfunc_expect = this;
}
#define SV_OnEntityPreSpawnFunction _SV_OnEntityPreSpawnFunction
g_map_entities = IL_NEW(); \
IL_EACH(g_spawn_queue, true, __spawnfunc_spawn(it)); \
MACRO_END
-
+#ifdef SVQC
+ void _SV_OnEntityPreSpawnFunction(entity this);
+#endif
void __spawnfunc_spawn(entity prototype)
{
entity e = new(clone);
#define X(T, fld, def) { e.fld = e.__spawnfunc_##fld; e.__spawnfunc_##fld = def; }
SPAWNFUNC_INTERNAL_FIELDS(X);
#undef X
+#ifdef SVQC
+ _SV_OnEntityPreSpawnFunction(e);
+ if (wasfreed(e)) {
+ return;
+ }
+#endif
e.__spawnfunc_constructor(e);
}
void SV_OnEntityPreSpawnFunction(entity this)
{
- __spawnfunc_expecting = true;
- __spawnfunc_expect = this;
if (this)
if (this.gametypefilter != "")
if (!isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, this.gametypefilter))
return;
LABEL(cleanup)
builtin_remove(this);
- __spawnfunc_expecting = false;
}
void WarpZone_PostInitialize_Callback()