}
make_impure(it);
assert(getthink(entcs), eprint(entcs));
- WITHSELF(entcs, getthink(entcs)(entcs));
+ getthink(entcs)(entcs);
if (!entcs.has_origin) continue;
if (entcs.m_entcs_private)
{
#undef X
this.iflags |= IFLAG_ORIGIN;
InterpolateOrigin_Note(this);
- WITHSELF(this, getthink(this)(this));
+ getthink(this)(this);
return true;
}
bprint("The ", Team_ColoredFullName(this.team), " held the ball for too long.\n");
DropBall(this.ballcarried, this.ballcarried.owner.origin, '0 0 0');
entity e = this.ballcarried;
- WITHSELF(e, ResetBall(e));
+ ResetBall(e);
}
else
this.items |= IT_KEY1;
if(e && e.monster_loot)
{
e.noalign = true;
- WITHSELF(e, e.monster_loot(e));
+ e.monster_loot(e);
e.gravity = 1;
e.movetype = MOVETYPE_TOSS;
e.reset = SUB_Remove;
{
entity oldother = other;
other = player;
- WITHSELF(it, gettouch(it)(it));
+ gettouch(it)(it);
other = oldother;
}
}
e.cnt = item.cnt;
e.team = item.team;
e.spawnfunc_checked = true;
- WITHSELF(e, spawnfunc_item_minst_cells(e));
+ spawnfunc_item_minst_cells(e);
return true;
}
e.noalign = true;
e.pickup_anyway = true;
e.spawnfunc_checked = true;
- WITHSELF(e, spawnfunc_item_armor_small(e));
+ spawnfunc_item_armor_small(e);
if (!wasfreed(e)) { // might have been blocked by a mutator
e.movetype = MOVETYPE_TOSS;
e.gravity = 1;
{
other = oth;
- WITHSELF(this, gettouch(this)(this));
+ gettouch(this)(this);
other = oldother;
}
{
other = this;
- WITHSELF(oth, gettouch(oth)(oth));
+ gettouch(oth)(oth);
other = oldother;
}
trace_plane_dist = 0;
trace_ent = this;
- WITHSELF(it, gettouch(it)(it));
+ gettouch(it)(it);
}
});
this.move_nextthink = 0;
this.move_time = time;
other = world;
- WITHSELF(this, this.move_think(this));
+ this.move_think(this);
}
}
#elif defined(CSQC)
-void conveyor_draw(entity this) { WITHSELF(this, conveyor_think(this)); }
+void conveyor_draw(entity this) { conveyor_think(this); }
void conveyor_init(entity this)
{
entity own = this.owner;
SUB_THINK(own, this.think1);
remove(this);
- WITHSELF(own, SUB_THUNK(own)(own));
+ SUB_THUNK(own)(own);
}
}
this.SUB_NEXTTHINK = this.SUB_LTIME + traveltime;
// invoke controller
- WITHSELF(controller, getthink(controller)(controller));
+ getthink(controller)(controller);
}
void SUB_CalcMove (entity this, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
value = strcat("target_spawn_helper", value);
putentityfieldstring(target_spawn_spawnfunc_field, e, value);
- WITHSELF(e, e.target_spawn_spawnfunc(e));
+ e.target_spawn_spawnfunc(e);
// We called an external function, so we have to re-tokenize msg.
n = tokenize_console(msg);
gamestart_use(this, NULL, NULL);
}
-void self_spawnfunc_trigger_gamestart(entity this);
spawnfunc(trigger_gamestart)
{
this.use = gamestart_use;
- this.reset2 = self_spawnfunc_trigger_gamestart;
+ this.reset2 = spawnfunc_trigger_gamestart;
if(this.wait)
{
else
InitializeEntity(this, gamestart_use_this, INITPRIO_FINDTARGET);
}
-void self_spawnfunc_trigger_gamestart(entity this) { WITHSELF(this, spawnfunc_trigger_gamestart(this)); }
#endif
if (wep1.wr_checkammo1(wep1, vehic))
{
.entity weaponentity = weaponentities[0];
- WITHSELF(vehic, wep1.wr_think(wep1, vehic, weaponentity, 1));
+ wep1.wr_think(wep1, vehic, weaponentity, 1);
}
if(vehic.vehicle_flags & VHF_SHIELDREGEN)
STATIC_INIT_LATE(W_PROP_reloader)
{
entity e = W_PROP_reloader = new_pure(W_PROP_reloader);
- WITHSELF(e, (setthink(e, W_PROP_think))(e));
+ setthink(e, W_PROP_think);
+ W_PROP_think(e);
}
#endif
beam.beam_bursting = burst;
Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
- WITHSELF(beam, getthink(beam)(beam));
+ getthink(beam)(beam);
}
void Arc_Smoke(entity actor)
{
if (time >= missile.nextthink)
{
- WITHSELF(missile, getthink(missile)(missile));
+ getthink(missile)(missile);
}
}
#pragma once
+#undef ChangeYaw
+#undef checkclient
+#undef droptofloor
+#undef error
+#undef movetogoal
#undef objerror
+#undef walkmove
+
+#ifdef MENUQC
+ #define NULL (0, null_entity)
+ #define world NULL
+#else
+ #define NULL (0, world)
+#endif
#pragma once
+#define ChangeYaw builtin_ChangeYaw
+#define checkclient builtin_checkclient
+#define droptofloor builtin_droptofloor
+#define error builtin_error
+#define movetogoal builtin_movetogoal
#define objerror builtin_objerror
+#define walkmove builtin_walkmove
#include <dpdefs/post.qh>
+#include "self.qh"
+
#define USING(name, T) typedef T name
#include "bool.qh"
#include "registry.qh"
#include "registry_net.qh"
#include "replicate.qh"
-#include "self.qh"
#include "sortlist.qc"
#include "sort.qh"
#include "spawnfunc.qh"
#pragma once
#if 1
- void voidfunc() { error("voidfunc"); }
+ void voidfunc() { }
#define MACRO_BEGIN if (1) {
#define MACRO_END } else voidfunc()
#else
#include "nil.qh"
#include "static.qh"
-#ifdef MENUQC
- #define NULL (0, null_entity)
- #define world NULL
-#else
- #define NULL (0, world)
-#endif
-
.vector origin;
.bool pure_data;
/** @deprecated use new_pure or NEW(class) */
SELFWRAP(SendEntity, bool, (entity to, int sendflags), (entity this, entity to, int sendflags), (this, to, sendflags))
#define setSendEntity(e, f) SELFWRAP_SET(SendEntity, e, f)
-#ifdef SVQC
-void make_safe_for_remove(entity this);
+#define ChangeYaw(e, ...) (__self = (e), builtin_ChangeYaw(__VA_ARGS__))
+#define checkclient(e, ...) (__self = (e), builtin_checkclient(__VA_ARGS__))
+#ifndef SVQC
+ #define droptofloor(e, ...) (__self = (e), builtin_droptofloor(__VA_ARGS__))
#endif
-
-void objerror(entity this, string s)
-{
-#ifdef SVQC
- make_safe_for_remove(this);
+#define error(...) (__self = (NULL), builtin_error(__VA_ARGS__))
+#define movetogoal(e, ...) (__self = (e), builtin_movetogoal(__VA_ARGS__))
+#ifndef SVQC
+ #define objerror(e, ...) (__self = (e), builtin_objerror(__VA_ARGS__))
+#else
+ void make_safe_for_remove(entity this);
+ #define objerror(e, ...) (__self = (e), make_safe_for_remove(__self), builtin_objerror(__VA_ARGS__))
#endif
- WITHSELF(this, builtin_objerror(s));
-}
+#define walkmove(e, ...) (__self = (e), builtin_walkmove(__VA_ARGS__))
#ifndef MENUQC
-void adaptor_think2touch(entity this) { WITH(entity, other, NULL, gettouch(this)(this)); }
void adaptor_think2use(entity this) { if (this.use) this.use(this, NULL, NULL); }
#endif
#define _spawnfunc_check(fld) \
if (fieldname == #fld) continue;
+ noref bool __spawnfunc_expecting;
noref entity __spawnfunc_expect;
bool __spawnfunc_unreachable_workaround = true;
void __spawnfunc_##id(entity this); \
[[accumulate]] void spawnfunc_##id(entity this) \
{ \
- if (__self == __spawnfunc_expect) \
+ if (__spawnfunc_expecting) \
{ \
/* engine call */ \
+ __spawnfunc_expecting = false; \
+ this = __spawnfunc_expect; \
__spawnfunc_expect = NULL; \
- this = __self; \
} \
else \
{ \
e.angles = fixedvectoangles2(trace_plane_normal, v_forward);
e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
}
- WITHSELF(e, spawnfunc_func_breakable(e));
+ spawnfunc_func_breakable(e);
// now, is it valid?
if(f == 0)
{
FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
if (it.reset)
{
- WITHSELF(it, it.reset(it)); // needs WITHSELF, as some spawnfuncs are set to .reset
+ it.reset(it);
continue;
}
if (it.team_saved) it.team = it.team_saved;
setthink(randomseed, RandomSeed_Think);
Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
- WITHSELF(randomseed, getthink(randomseed)(randomseed)); // sets random seed and nextthink
+ getthink(randomseed)(randomseed); // sets random seed and nextthink
}
spawnfunc(__init_dedicated_server)
bprint(it.netname, " ^7wins.\n");
));
- WITHSELF(NULL, target_music_kill());
+ target_music_kill();
if(autocvar_g_campaign)
CampaignPreIntermission();
//dprint("Delayed initialization: ", e.classname, "\n");
if (func)
{
- WITHSELF(e, func(e));
+ func(e);
}
else
{
{
if(!(IS_ONGROUND(this))) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING
this.projectiledeathtype |= HITTYPE_SPLASH;
- WITHSELF(this, adaptor_think2use(this));
+ adaptor_think2use(this);
}
// deferred dropping
{
//dprint("A hit happened with zero hit contents... DEBUG THIS, this should never happen for projectiles! Projectile will self-destruct.\n");
LOG_TRACEF("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", etof(this), this.classname, vtos(this.origin));
- WITHSELF(this, checkclient());
+ checkclient(this);
}
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
return true;
this.netname = teamname;
this.cnt = teamcolor;
this.spawnfunc_checked = true;
- WITHSELF(this, spawnfunc_ctf_team(this));
+ spawnfunc_ctf_team(this);
}
void ctf_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
this.netname = teamname;
this.cnt = teamcolor;
this.spawnfunc_checked = true;
- WITHSELF(this, spawnfunc_tdm_team(this));
+ spawnfunc_tdm_team(this);
}
void tdm_DelayedInit(entity this)
bool DoesQ3ARemoveThisEntity(entity this);
void SV_OnEntityPreSpawnFunction()
{ENGINE_EVENT();
+ __spawnfunc_expecting = true;
__spawnfunc_expect = this;
if (this)
if (this.gametypefilter != "")
if (!isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, this.gametypefilter))
{
remove(this);
+ __spawnfunc_expecting = false;
return;
}
if(this.cvarfilter != "")
{
//print("cvarfilter fail\n");
remove(this);
+ __spawnfunc_expecting = false;
return;
}
}
if(DoesQ3ARemoveThisEntity(this))
{
remove(this);
+ __spawnfunc_expecting = false;
return;
}
if(MUTATOR_CALLHOOK(OnEntityPreSpawn, this))
{
remove(this);
+ __spawnfunc_expecting = false;
return;
}
}