}
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;
else // step 4
{
// dprint("Step 4: time: ", ftos(time), "\n");
- if(vlen(this.origin - this.spawnorigin) > 10) // should not happen anymore
+ if(vdist(this.origin - this.spawnorigin, >, 10)) // should not happen anymore
LOG_TRACE("The ball moved too far away from its spawn origin.\nOffset: ",
vtos(this.origin - this.spawnorigin), " Velocity: ", vtos(this.velocity), "\n");
this.velocity = '0 0 0';
if(autocvar_g_nexball_football_physics == -1) // MrBougo try 1, before decompiling Rev's original
{
- if(vlen(other.velocity))
+ if(other.velocity)
this.velocity = other.velocity * 1.5 + '0 0 1' * autocvar_g_nexball_football_boost_up;
}
else if(autocvar_g_nexball_football_physics == 1) // MrBougo's modded Rev style: partially independant of the height of the aiming point
else if(other.solid == SOLID_BSP)
{
_sound(this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
- if(vlen(this.velocity) && !this.cnt)
+ if(this.velocity && !this.cnt)
this.nextthink = min(time + autocvar_g_nexball_delay_idle, this.teamtime);
}
}
// gather health and armor only
if (head.solid)
if ( ((head.health || head.armorvalue) && needarmor) || (head.weapons && needweapons ) )
- if (vlen(head.origin - org) < sradius)
+ if (vdist(head.origin - org, <, sradius))
{
t = head.bot_pickupevalfunc(this, head);
if (t > 0)
if(SAME_TEAM(tmp_entity, player))
if(random_target)
RandomSelection_Add(tmp_entity, 0, string_null, 1, 1);
- else if(vlen(tmp_entity.origin - spawn_loc) <= vlen(closest_target.origin - spawn_loc) || closest_target == world)
+ else if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == world)
closest_target = tmp_entity;
}
else
{
if(SAME_TEAM(tmp_entity, player))
- if(vlen(tmp_entity.origin - spawn_loc) <= vlen(closest_target.origin - spawn_loc) || closest_target == world)
+ if(vlen2(tmp_entity.origin - spawn_loc) <= vlen2(closest_target.origin - spawn_loc) || closest_target == world)
closest_target = tmp_entity;
}
}
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;
missile.projectiledeathtype = WEP_RPC.m_id;
setsize (missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
- setorigin (missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
+ setorigin(missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
W_SetupProjVelocity_Basic(missile, WEP_CVAR(rpc, speed), 0);
settouch(missile, W_RocketPropelledChainsaw_Touch);
item.effects |= EF_NODRAW; // hide the original weapon
item.movetype = MOVETYPE_FOLLOW;
item.aiment = wep; // attach the original weapon
- item.SendEntity3 = func_null;
+ setSendEntity(item, func_null);
}
#endif
this.angles_z = ((1-blendrate) * this.angles.z) + (push_angle.z * blendrate);
//a = this.origin;
- setorigin(this,r);
+ setorigin(this, r);
}
{
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);
}
}
void UpdateItemAfterTeleport(entity this)
{
- if(this.SendEntity3 == ItemSend)
+ if(getSendEntity(this) == ItemSend)
ItemUpdate(this);
}
sound (this, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound
else
sound (this, CH_TRIGGER, SND_ITEMRESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound
- setorigin (this, this.origin);
+ setorigin(this, this.origin);
if (Item_ItemsTime_Allow(this.itemdef) || this.weapons & WEPSET_SUPERWEAPONS)
{
else {
if (this.origin == '0 0 0') { // probably no origin brush, so don't spawn in the middle of the map..
floorZ = this.absmin.z;
- setorigin(this,((this.absmax+this.absmin)*.5));
+ setorigin(this, ((this.absmax + this.absmin) * 0.5));
this.origin_z = floorZ;
}
_setmodel(this, this.mdl_dead);
#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)
{
if(!this.target4factor)
this.target4factor = 1;
- if(vlen(this.targetnormal))
+ if(this.targetnormal)
this.targetnormal = normalize(this.targetnormal);
- if(vlen(this.target2normal))
+ if(this.target2normal)
this.target2normal = normalize(this.target2normal);
- if(vlen(this.target3normal))
+ if(this.target3normal)
this.target3normal = normalize(this.target3normal);
- if(vlen(this.target4normal))
+ if(this.target4normal)
this.target4normal = normalize(this.target4normal);
setblocked(this, generic_plat_blocked);
this.mangle = this.angles;
this.angles = '0 0 0';
- //setorigin (this, this.origin + '0 0 27'); // To fix a mappers' habit as old as Quake
- setorigin (this, this.origin);
+ //setorigin(this, this.origin + '0 0 27'); // To fix a mappers' habit as old as Quake
+ setorigin(this, this.origin);
IFTARGETED
{
{
IFTARGETED
{
- setorigin (this, this.pos1);
+ setorigin(this, this.pos1);
this.state = 4;
this.use = plat_use;
}
else
{
- setorigin (this, this.pos2);
+ setorigin(this, this.pos2);
this.state = 2;
this.use = plat_trigger_use;
}
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);
// assuming to allows PL_MIN to PL_MAX box and some more
#ifdef SVQC
from = player.origin;
- setorigin (player, to);
+ setorigin(player, to);
player.oldorigin = to; // don't undo the teleport by unsticking
player.angles = to_angles;
player.fixangle = true;
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
this.event_damage = multi_eventdamage;
this.takedamage = DAMAGE_YES;
this.solid = SOLID_BBOX;
- setorigin (this, this.origin); // make sure it links into the world
+ setorigin(this, this.origin); // make sure it links into the world
}
else
{
if ( !(this.spawnflags & SPAWNFLAG_NOTOUCH) )
{
settouch(this, multi_touch);
- setorigin (this, this.origin); // make sure it links into the world
+ setorigin(this, this.origin); // make sure it links into the world
}
}
}
spawnfunc(turret_checkpoint)
{
- setorigin(this,this.origin);
+ setorigin(this, this.origin);
setthink(this, turret_checkpoint_init);
this.nextthink = time + 0.2;
}
{
if(this.enemy != world)
if(vdist(this.origin - this.enemy.origin, <, this.owner.shot_radius * 3))
- setorigin(this,this.enemy.origin + randomvec() * this.owner.shot_radius);
+ setorigin(this, this.enemy.origin + randomvec() * this.owner.shot_radius);
#ifdef TURRET_DEBUG
float d = RadiusDamage (this, this.owner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, world, this.owner.shot_force, this.totalfrags, world);
float d = actor.shot_dmg;
float r = actor.target_range;
entity e = spawn();
- setorigin(e,actor.tur_shotorg);
+ setorigin(e, actor.tur_shotorg);
actor.target_validate_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_MISSILES | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK;
{
entity err = new(error_marker);
setmodel(err, MDL_MARKER);
- setorigin(err,where);
+ setorigin(err, where);
err.movetype = MOVETYPE_NONE;
setthink(err, marker_think);
err.nextthink = time;
{
entity err = spawn(info_marker);
setmodel(err, MDL_MARKER);
- setorigin(err,where);
+ setorigin(err, where);
err.movetype = MOVETYPE_NONE;
setthink(err, marker_think);
err.nextthink = time;
{
entity err = spawn(mark_misc);
setmodel(err, MDL_MARKER);
- setorigin(err,where);
+ setorigin(err, where);
err.movetype = MOVETYPE_NONE;
setthink(err, marker_think);
err.nextthink = time;
e.scale = (f_size/512);
//setsize(e, '0 0 0', '0 0 0');
//setattachment(e,onwho,"");
- setorigin(e,onwho.origin + '0 0 1');
+ setorigin(e, onwho.origin + '0 0 1');
e.alpha = 0.15;
e.movetype = MOVETYPE_FLY;
e.scale = (f_size/512);
setsize(e, '0 0 0', '0 0 0');
- setorigin(e,onwho.origin + '0 0 1');
+ setorigin(e, onwho.origin + '0 0 1');
e.alpha = 0.15;
e.movetype = MOVETYPE_FLY;
setmodel(e, MDL_TUR_C512); // precision set above
e.scale = (f_size/512);
setsize(e, '0 0 0', '0 0 0');
- setorigin(e,where+ '0 0 1');
+ setorigin(e, where + '0 0 1');
e.movetype = MOVETYPE_NONE;
e.velocity = '0 0 0';
e.colormod = v_color;
{
vector ang;
float p, y, len;
- if(vlen(vec) == 0)
+ if(vec == '0 0 0')
return 0;
//print("compress: ", vtos(vec), "\n");
ang = vectoangles(vec);
void bumblebee_gunner_exit(entity this, int _exitflag)
{
- entity player = this;
- entity gunner = player.vehicle;
+ entity player = ((this.owner.gun1 == this) ? this.owner.gunner1 : this.owner.gunner2);
+ entity gunner = this;
entity vehic = gunner.owner;
if(IS_REAL_CLIENT(player))
if(instance.gunner1)
{
entity e = instance.gunner1;
- instance.gun1.vehicle_exit(e, VHEF_EJECT);
+ instance.gun1.vehicle_exit(instance.gun1, VHEF_EJECT);
entity oldother = other;
other = e;
instance.phase = 0;
if(instance.gunner2)
{
entity e = instance.gunner2;
- instance.gun2.vehicle_exit(e, VHEF_EJECT);
+ instance.gun2.vehicle_exit(instance.gun2, VHEF_EJECT);
entity oldother = other;
other = e;
instance.phase = 0;
instance.gun3.enemy.effects |= EF_NODRAW;
if(instance.gunner1)
- instance.gun1.vehicle_exit(instance.gunner1, VHEF_EJECT);
+ instance.gun1.vehicle_exit(instance.gun1, VHEF_EJECT);
if(instance.gunner2)
- instance.gun2.vehicle_exit(instance.gunner2, VHEF_EJECT);
+ instance.gun2.vehicle_exit(instance.gun2, VHEF_EJECT);
instance.vehicle_exit(instance, VHEF_EJECT);
METHOD(Racer, vr_death, void(Racer thisveh, entity instance))
{
#ifdef SVQC
- instance.SendEntity = func_null; // stop networking this racer (for now)
+ setSendEntity(instance, func_null); // stop networking this racer (for now)
instance.health = 0;
instance.event_damage = func_null;
instance.solid = SOLID_CORPSE;
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);
}
}
n = 0;
if(e)
{
- if(vlen(e.origin - this.origin) < vlen(e.velocity) * frametime)
+ if(vlen2(e.origin - this.origin) < vlen2(e.velocity) * frametime)
++n;
for(p = e; (p = p.queuenext) != e; )
{
- if(vlen(p.origin - this.origin) < vlen(p.velocity) * frametime)
+ if(vlen2(p.origin - this.origin) < vlen2(p.velocity) * frametime)
++n;
}
if(n >= 2)
void W_Devastator_Attack(Weapon thiswep, entity actor)
{
- entity missile;
- entity flash;
-
W_DecreaseAmmo(thiswep, actor, WEP_CVAR(devastator, ammo));
W_SetupShot_ProjectileSize(actor, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
- missile = WarpZone_RefSys_SpawnSameRefSys(actor);
+ entity missile = WarpZone_RefSys_SpawnSameRefSys(actor);
missile.owner = missile.realowner = actor;
actor.lastrocket = missile;
if(WEP_CVAR(devastator, detonatedelay) >= 0)
CSQCProjectile(missile, WEP_CVAR(devastator, guiderate) == 0 && WEP_CVAR(devastator, speedaccel) == 0, PROJECTILE_ROCKET, false); // because of fly sound
// muzzle flash for 1st person view
- flash = spawn();
+ entity flash = spawn();
setmodel(flash, MDL_DEVASTATOR_MUZZLEFLASH); // precision set below
SUB_SetFade(flash, time, 0.1);
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
{
if(shockwave_hit[i] == head)
{
- if(vlen(final_force) > vlen(shockwave_hit_force[i])) { shockwave_hit_force[i] = final_force; }
+ if(vlen2(final_force) > vlen2(shockwave_hit_force[i])) { shockwave_hit_force[i] = final_force; }
if(final_damage > shockwave_hit_damage[i]) { shockwave_hit_damage[i] = final_damage; }
return false;
}
#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"
void CSQCModel_UnlinkEntity(entity e)
{
- e.SendEntity = func_null;
- e.SendEntity3 = func_null;
+ setSendEntity(e, func_null);
}
#pragma once
#if 1
- void voidfunc() { error("voidfunc"); }
+ void voidfunc() { }
#define MACRO_BEGIN if (1) {
#define MACRO_END } else voidfunc()
#else
.int Version; // deprecated, use SendFlags
.int SendFlags;
- .bool(entity to, int sendflags) SendEntity;
- /** return false to remove from the client */
- .bool(entity this, entity to, int sendflags) SendEntity3;
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
{
void Net_UnlinkEntity(entity e)
{
- e.SendEntity = func_null;
+ setSendEntity(e, func_null);
}
.void(entity this) uncustomizeentityforclient;
#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(camera_transform, vector, (vector org, vector ang), (entity this, vector org, vector ang), (this, org, ang))
#define setcamera_transform(e, f) SELFWRAP_SET(camera_transform, e, f)
+/** return false to remove from the client */
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)
+#define getSendEntity(e) SELFWRAP_GET(SendEntity, e)
-#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 \
{ \
WarpZone_View_Outside();
#ifndef KEEP_ROLL
- static float rollkill;
- if (STAT(HEALTH) <= 0 && STAT(HEALTH) != -666 && STAT(HEALTH) != -2342)
- {
- if(autocvar_cl_rollkillspeed)
- {
- rollkill += frametime * autocvar_cl_rollkillspeed;
- rollkill = min(1, rollkill);
- }
- float rick;
- rick = getproperty(VF_CL_VIEWANGLES_Z) * rollkill;
- setproperty(VF_CL_VIEWANGLES_Z, rick);
- ang.z *= rollkill;
- }
- else if(rollkill)
- rollkill = 0;
+ float rick;
+ float f;
+ if(autocvar_cl_rollkillspeed)
+ f = max(0, (1 - frametime * autocvar_cl_rollkillspeed));
+ else
+ f = 0;
+
+ rick = getproperty(VF_CL_VIEWANGLES_Z);
+ rick *= f;
+ setproperty(VF_CL_VIEWANGLES_Z, rick);
+ ang.z *= f;
#endif
setproperty(VF_ORIGIN, org);
{
// hit something
// adjust origin in the other direction...
- setorigin(e,e.origin - by * (1 - trace_fraction));
+ setorigin(e, e.origin - by * (1 - trace_fraction));
}
}
void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity)
{
#ifdef SVQC
- setorigin (player, to); // NOTE: this also aborts the move, when this is called by touch
+ setorigin(player, to); // NOTE: this also aborts the move, when this is called by touch
player.oldorigin = to; // for DP's unsticking
player.angles = to_angles;
player.fixangle = true;
traceline(this.origin + this.view_ofs, dst_ahead, true, world);
// Check head-banging against walls
- if(vlen(this.origin + this.view_ofs - trace_endpos) < 25 && !(this.aistatus & AI_STATUS_OUT_WATER))
+ if(vdist(this.origin + this.view_ofs - trace_endpos, <, 25) && !(this.aistatus & AI_STATUS_OUT_WATER))
{
PHYS_INPUT_BUTTON_JUMP(this) = true;
if(this.facingwalltime && time > this.facingwalltime)
// If for some reason the bot is closer to the next goal, pop the current one
if(this.goalstack01)
- if(vlen(this.goalcurrent.origin - this.origin) > vlen(this.goalstack01.origin - this.origin))
+ if(vlen2(this.goalcurrent.origin - this.origin) > vlen2(this.goalstack01.origin - this.origin))
if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
if(tracewalk(this, this.origin, this.mins, this.maxs, (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5, bot_navigation_movemode))
{
found = false;
while(wp_from)
{
- if(vlen(wp_from.origin-wp_from_pos)<1)
+ if(vdist(wp_from.origin - wp_from_pos, <, 1))
if(wp_from.classname == "waypoint")
{
found = true;
found = false;
while(wp_to)
{
- if(vlen(wp_to.origin-wp_to_pos)<1)
+ if(vdist(wp_to.origin - wp_to_pos, <, 1))
if(wp_to.classname == "waypoint")
{
found = true;
found = false;
while(wp_from)
{
- if(vlen(wp_from.origin-wp_from_pos)<5)
+ if(vdist(wp_from.origin - wp_from_pos, <, 5))
if(wp_from.classname == "waypoint")
{
found = true;
found = false;
while(wp_to)
{
- if(vlen(wp_to.origin-wp_to_pos)<5)
+ if(vdist(wp_to.origin - wp_to_pos, <, 5))
if(wp_to.classname == "waypoint")
{
found = true;
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)
{
// This also makes sure that an object can only pe picked up if in range, but does not get dropped if
// it goes out of range while slinging it around.
- if(vlen(this.origin - e.origin) <= autocvar_g_grab_range)
+ if(vdist(this.origin - e.origin, <=, autocvar_g_grab_range))
{
switch(e.grab)
{
{
if(closest_target)
{
- if(vlen(this.origin - head.origin) < vlen(this.origin - closest_target.origin))
+ if(vlen2(this.origin - head.origin) < vlen2(this.origin - closest_target.origin))
{ closest_target = head; }
}
else { closest_target = head; }
{
entity veh;
for(veh = world; (veh = findflags(veh, vehicle_flags, VHF_ISVEHICLE)); )
- if(vlen(veh.origin - this.origin) < autocvar_g_vehicles_enter_radius)
+ if(vdist(veh.origin - this.origin, <, autocvar_g_vehicles_enter_radius))
if(!IS_DEAD(veh))
if(veh.takedamage != DAMAGE_NO)
if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, this))
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;
targ.oldvelocity = targ.velocity;
targ.spawnorigin = spot.origin;
- setorigin (targ, spot.origin + '0 0 1' * (1 - targ.mins.z - 24));
+ setorigin(targ, spot.origin + '0 0 1' * (1 - targ.mins.z - 24));
// don't reset back to last position, even if new position is stuck in solid
targ.oldorigin = targ.origin;
targ.prevorigin = targ.origin;
if(DEATH_WEAPONOF(deathtype) != WEP_TUBA) // do not send tuba damage (bandwidth hog)
{
force = inflictorvelocity;
- if(vlen(force) == 0)
+ if(force == '0 0 0')
force = '0 0 -1';
else
force = normalize(force);
//setmodel (missile, MDL_HOOK); // precision set below
setsize (missile, '-3 -3 -3', '3 3 3');
- setorigin (missile, org);
+ setorigin(missile, org);
missile.state = 0; // not latched onto anything
targ = find(world, targetname, this.target);
this.target = targ.target;
- setorigin (this, targ.origin);
+ setorigin(this, targ.origin);
setthink(this, train_next);
this.nextthink = time + 0.1;
}
this.lefty = this.light_lev;
this.use = dynlight_use;
setsize (this, '0 0 0', '0 0 0');
- setorigin (this, this.origin);
+ setorigin(this, this.origin);
//this.pflags = PFLAGS_FULLDYNAMIC;
this.solid = SOLID_NOT;
//this.blocked = func_null;
}
if(this.lodmodelindex1)
- if (!this.SendEntity)
+ if (!getSendEntity(this))
SetCustomizer(this, LOD_customize, LOD_uncustomize);
}
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
if(trace_dphitcontents == 0)
{
//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());
+ LOG_TRACEF("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Projectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", etof(this), this.classname, vtos(this.origin));
+ 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)
node.solid = SOLID_NOT;
setmodel(node, MDL_SQUARE);
- setorigin(node,node.origin);
+ setorigin(node, node.origin);
node.colormod = ncolor;
if(align)
s.angles = vectoangles(trace_plane_normal);
s.angles_x -= 90;
- setorigin(s,where);
+ setorigin(s, where);
}
void pathlib_showedge(vector where,float _lifetime,float rot)
e.nextthink = _lifetime;
e.scale = pathlib_gridsize / 512;
e.solid = SOLID_NOT;
- setorigin(e,where);
+ setorigin(e, where);
setmodel(e, MDL_EDGE);
//traceline(where + '0 0 32',where - '0 0 128',MOVE_WORLDONLY,e);
//e.angles = vectoangles(trace_plane_normal);
d2 = normalize(p - c);
d1 = normalize(c - n);
- if(vlen(d1-d2) < 0.25)
+ if(vdist(d1 - d2, <, 0.25))
{
//mark_error(c,30);
return 1;
path.owner = start;
path.path_next = next;
- setorigin(path,where);
+ setorigin(path, where);
if(!next)
path.classname = "path_end";
open = new(path_end);
open.owner = open;
- setorigin(open,path.origin);
+ setorigin(open, path.origin);
pathlib_cleanup();
a = spawn();
setthink(a, a_think);
a.nextthink = time;
- setorigin(a,start + movenode_stepup);
+ setorigin(a, start + movenode_stepup);
a.pos1 = trace_endpos;
//start - movenode_maxdrop
a.cnt = time + 10;
this.enemy = new(FLock Hunter);
setmodel(this.enemy, MDL_FLOCKER);
- setorigin(this.enemy,this.origin + '0 0 768' + (randomvec() * 128));
+ setorigin(this.enemy, this.origin + '0 0 768' + (randomvec() * 128));
this.enemy.scale = 3;
this.enemy.effects = EF_LOWPRECISION;
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;
}
}
void UpdateCSQCProjectile(entity e)
{
- if(e.SendEntity3 == CSQCProjectile_SendEntity)
+ if(getSendEntity(e) == CSQCProjectile_SendEntity)
{
// send new origin data
e.SendFlags |= 0x01;
}
// FIXME HACK
- else if(e.SendEntity3 == ItemSend)
+ else if(getSendEntity(e) == ItemSend)
{
ItemUpdate(e);
}
void UpdateCSQCProjectileAfterTeleport(entity e)
{
- if(e.SendEntity3 == CSQCProjectile_SendEntity)
+ if(getSendEntity(e) == CSQCProjectile_SendEntity)
{
// send new origin data
e.SendFlags |= 0x01;
Damage (ent, this, this, bdamage * f, deathtype, hitloc, ent.railgunforce * ffs);
// create a small explosion to throw gibs around (if applicable)
- //setorigin (explosion, hitloc);
+ //setorigin(explosion, hitloc);
//RadiusDamage (explosion, this, 10, 0, 50, world, world, 300, deathtype);
ent.railgunhitloc = '0 0 0';