]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Simplify maths for most vlen cases
authorMario <mario@smbclan.net>
Mon, 4 Jan 2016 05:41:51 +0000 (15:41 +1000)
committerMario <mario@smbclan.net>
Mon, 4 Jan 2016 05:41:51 +0000 (15:41 +1000)
46 files changed:
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/minigames/minigame/pong.qc
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/dodging/dodging.qc
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/mutators/mutator/sandbox/sandbox.qc
qcsrc/common/mutators/mutator/spawn_near_teammate/spawn_near_teammate.qc
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/triggers/teleporters.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/flac_weapon.qc
qcsrc/common/turrets/turret/fusionreactor.qc
qcsrc/common/turrets/turret/hellion_weapon.qc
qcsrc/common/turrets/turret/hk_weapon.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/porto.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/lib/warpzone/common.qc
qcsrc/lib/warpzone/server.qc
qcsrc/menu/menu.qc
qcsrc/server/anticheat.qc
qcsrc/server/bot/aim.qc
qcsrc/server/steerlib.qc
qcsrc/server/weapons/tracing.qc

index acd372c98060af069da8cf542a1dbffe8a92589e..b4d7672957c92893beea1e49ad07f756c1cc98c0 100644 (file)
@@ -570,11 +570,9 @@ void ons_ControlPoint_Icon_Think()
        {
                int _enemy_count = 0;
                int _friendly_count = 0;
-               float _dist;
 
                FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), LAMBDA(
-                       _dist = vlen(it.origin - self.origin);
-                       if(_dist < autocvar_g_onslaught_cp_proxydecap_distance)
+                       if(vdist(it.origin - self.origin, <, autocvar_g_onslaught_cp_proxydecap_distance))
                        {
                                if(SAME_TEAM(it, self))
                                        ++_friendly_count;
@@ -1622,8 +1620,8 @@ entity ons_Nearest_ControlPoint(vector pos, float max_dist)
        {
                if(SAME_TEAM(tmp_entity, self))
                if(tmp_entity.iscaptured)
-               if(max_dist <= 0 || vlen(tmp_entity.origin - pos) <= max_dist)
-               if(vlen(tmp_entity.origin - pos) <= vlen(closest_target.origin - pos) || closest_target == world)
+               if(max_dist <= 0 || vdist(tmp_entity.origin - pos, <=, max_dist))
+               if(vlen2(tmp_entity.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == world)
                        closest_target = tmp_entity;
                tmp_entity = tmp_entity.chain;
        }
@@ -1631,8 +1629,8 @@ entity ons_Nearest_ControlPoint(vector pos, float max_dist)
        while(tmp_entity)
        {
                if(SAME_TEAM(tmp_entity, self))
-               if(max_dist <= 0 || vlen(tmp_entity.origin - pos) < max_dist)
-               if(vlen(tmp_entity.origin - pos) <= vlen(closest_target.origin - pos) || closest_target == world)
+               if(max_dist <= 0 || vdist(tmp_entity.origin - pos, <, max_dist))
+               if(vlen2(tmp_entity.origin - pos) <= vlen2(closest_target.origin - pos) || closest_target == world)
                        closest_target = tmp_entity;
                tmp_entity = tmp_entity.chain;
        }
index 359003fffc8e676a051d972ead0bc304e3cad08f..87c75f48c59ab05ac3b9ce01d4c628ccb66a3580 100644 (file)
@@ -124,7 +124,7 @@ bool pong_paddle_hit(entity ball, int pteam)
                return false;
        vector near_point = box_nearest(paddle.mins+paddle.origin,
                                                                        paddle.maxs+paddle.origin, ball.origin);
-       return vlen(near_point-ball.origin) <= ball.pong_length ;
+       return vdist(near_point - ball.origin, <=, ball.pong_length);
 }
 
 // Checks for a goal, when that happes adds scores and resets the ball
index c72e55015ed9684f235d11188507813f18ca13b3..37c6301fbdbf8fcd5bd8f97620821f88c7f0914c 100644 (file)
@@ -192,13 +192,12 @@ void M_Mage_Attack_Spike_Think()
                float turnrate = (autocvar_g_monster_mage_attack_spike_turnrate); // how fast to turn
                vector desireddir = normalize(eorg - self.origin);
                vector olddir = normalize(self.velocity); // get my current direction
-               float dist = vlen(eorg - self.origin);
 
                // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P )
-               if ((autocvar_g_monster_mage_attack_spike_smart) && (dist > (autocvar_g_monster_mage_attack_spike_smart_mindist)))
+               if ((autocvar_g_monster_mage_attack_spike_smart) && vdist(eorg - self.origin, >, autocvar_g_monster_mage_attack_spike_smart_mindist))
                {
                        // Is it a better idea (shorter distance) to trace to the target itself?
-                       if ( vlen(self.origin + olddir * self.wait) < dist)
+                       if ( vlen2(self.origin + olddir * self.wait) < vlen2(eorg - self.origin))
                                traceline(self.origin, self.origin + olddir * self.wait, false, self);
                        else
                                traceline(self.origin, eorg, false, self);
index 136b24f2f8f302b5e3d64986baa2cdfdd425e3d4..0ffa60f8cc44c2311af878cadd017029b6b060c5 100644 (file)
@@ -189,11 +189,11 @@ bool M_Shambler_Attack(int attack_type, entity actor, entity targ)
                }
                case MONSTER_ATTACK_RANGED:
                {
-                       float randomness = random(), enemy_len = vlen(actor.enemy.origin - actor.origin);
+                       float randomness = random();
 
                        if(time >= actor.shambler_lastattack) // shambler doesn't attack much
                        if(IS_ONGROUND(actor))
-                       if(randomness <= 0.5 && enemy_len <= autocvar_g_monster_shambler_attack_smash_range)
+                       if(randomness <= 0.5 && vdist(actor.enemy.origin - actor.origin, <=, autocvar_g_monster_shambler_attack_smash_range))
                        {
                                setanim(actor, actor.anim_melee2, true, true, false);
                                Monster_Delay(actor, 1, 0.7, M_Shambler_Attack_Smash);
@@ -203,7 +203,7 @@ bool M_Shambler_Attack(int attack_type, entity actor, entity targ)
                                actor.shambler_lastattack = time + 3 + random() * 1.5;
                                return true;
                        }
-                       else if(randomness <= 0.1 && enemy_len >= autocvar_g_monster_shambler_attack_smash_range * 1.5) // small chance, don't want this spammed
+                       else if(randomness <= 0.1 && vdist(actor.enemy.origin - actor.origin, >=, autocvar_g_monster_shambler_attack_smash_range * 1.5)) // small chance, don't want this spammed
                        {
                                setanim(actor, actor.anim_shoot, true, true, false);
                                actor.state = MONSTER_ATTACK_MELEE; // maybe we should rename this to something more general
index 02b6a59508980f7ac29015967157f79b39af438e..b7d398da6dbdf1874bec30623f4751009a299ee9 100644 (file)
@@ -101,13 +101,15 @@ void M_Wyvern_Attack_Fireball_Explode()
        SELFPARAM();
        Send_Effect(EFFECT_FIREBALL_EXPLODE, self.origin, '0 0 0', 1);
 
-       entity owner = self.realowner;
+       entity own = self.realowner;
 
-       RadiusDamage(self, owner, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force, world, world, autocvar_g_monster_wyvern_attack_fireball_radius, self.projectiledeathtype, world);
+       RadiusDamage(self, own, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force, world, world, autocvar_g_monster_wyvern_attack_fireball_radius, self.projectiledeathtype, world);
 
-       for (entity e = world; (e = findfloat(e, takedamage, DAMAGE_AIM)); )
-       if (vlen(e.origin - self.origin) <= (autocvar_g_monster_wyvern_attack_fireball_radius))
-               Fire_AddDamage(e, owner, 5 * MONSTER_SKILLMOD(owner), (autocvar_g_monster_wyvern_attack_fireball_damagetime), self.projectiledeathtype);
+       FOREACH_ENTITY_FLOAT(takedamage, DAMAGE_AIM,
+       {
+               if(vdist(it.origin - self.origin, <=, autocvar_g_monster_wyvern_attack_fireball_radius))
+                       Fire_AddDamage(it, own, 5 * MONSTER_SKILLMOD(own), autocvar_g_monster_wyvern_attack_fireball_damagetime, self.projectiledeathtype);
+       });
 
        remove(self);
 }
index 10725c0d6b40e1fb01efc34a3bf2fa891709b855..ccc3b83aa982915a816d9d9e3405fa3f0d3d99b7 100644 (file)
@@ -138,7 +138,7 @@ entity Monster_FindTarget(entity mon)
                        if(closest_target)
                        {
                                vector closest_target_center = CENTER_OR_VIEWOFS(closest_target);
-                               if(vlen(ent_center - head_center) < vlen(ent_center - closest_target_center))
+                               if(vlen2(ent_center - head_center) < vlen2(ent_center - closest_target_center))
                                        { closest_target = head; }
                        }
                        else { closest_target = head; }
@@ -429,9 +429,7 @@ void Monster_Attack_Check(entity this, entity targ)
        || (time < this.attack_finished_single[0])
        ) { return; }
 
-       float targ_vlen = vlen(targ.origin - this.origin);
-
-       if(targ_vlen <= this.attack_range)
+       if(vdist(targ.origin - this.origin, <=, this.attack_range))
        {
                bool attack_success = this.monster_attackfunc(MONSTER_ATTACK_MELEE, this, targ);
                if(attack_success == 1)
@@ -440,7 +438,7 @@ void Monster_Attack_Check(entity this, entity targ)
                        return;
        }
 
-       if(targ_vlen > this.attack_range)
+       if(vdist(targ.origin - this.origin, >, this.attack_range))
        {
                float attack_success = this.monster_attackfunc(MONSTER_ATTACK_RANGED, this, targ);
                if(attack_success == 1)
@@ -569,7 +567,7 @@ vector Monster_Move_Target(entity this, entity targ)
                        || (this.enemy.flags & FL_NOTARGET)
                        || (this.enemy.alpha < 0.5 && this.enemy.alpha != 0)
                        || (this.enemy.takedamage == DAMAGE_NO)
-                       || (vlen(this.origin - targ_origin) > this.target_range)
+                       || (vdist(this.origin - targ_origin, >, this.target_range))
                        || ((trace_fraction < 1) && (trace_ent != this.enemy)))
                {
                        this.enemy = world;
@@ -858,7 +856,7 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
        if(!(this.spawnflags & MONSTERFLAG_FLY_VERTICAL) && !(this.flags & FL_SWIM))
                this.moveto_z = this.origin_z;
 
-       if(vlen(this.origin - this.moveto) > 100)
+       if(vdist(this.origin - this.moveto, >, 100))
        {
                float do_run = (this.enemy || this.monster_moveto);
                if(IS_ONGROUND(this) || ((this.flags & FL_FLY) || (this.flags & FL_SWIM)))
@@ -867,7 +865,7 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
                if(time > this.pain_finished) // TODO: use anim_finished instead!
                if(!this.state)
                if(time > this.anim_finished)
-               if(vlen(this.velocity) > 10)
+               if(vdist(this.velocity, >, 10))
                        setanim(this, ((do_run) ? this.anim_run : this.anim_walk), true, false, false);
                else
                        setanim(this, this.anim_idle, true, false, false);
@@ -884,7 +882,7 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
                if(time > this.anim_finished)
                if(time > this.pain_finished)
                if(!this.state)
-               if(vlen(this.velocity) <= 30)
+               if(vdist(this.velocity, <=, 30))
                        setanim(this, this.anim_idle, true, false, false);
        }
 
@@ -1171,7 +1169,7 @@ void Monster_Move_2D(entity this, float mspeed, bool allow_jumpoff)
 
        if(time > this.pain_finished)
        if(time > this.attack_finished_single[0])
-       if(vlen(this.velocity) > 10)
+       if(vdist(this.velocity, >, 10))
                setanim(this, this.anim_walk, true, false, false);
        else
                setanim(this, this.anim_idle, true, false, false);
index 889b0db2f28149beb01ec0717c03ee9647fad852..32fe2d87dfdfffabd95453302a629662ff0c85ad 100644 (file)
@@ -545,11 +545,10 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate)
 
        if(frag_target.buffs & BUFF_BASH.m_itemid)
        if(frag_attacker != frag_target)
-       if(vlen(frag_force))
                frag_force = '0 0 0';
 
        if(frag_attacker.buffs & BUFF_BASH.m_itemid)
-       if(vlen(frag_force))
+       if(frag_force)
        if(frag_attacker == frag_target)
                frag_force *= autocvar_g_buffs_bash_force_self;
        else
@@ -700,10 +699,13 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon)
                FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
                        if(!IS_DEAD(it) && !STAT(FROZEN, it) && !it.vehicle)
                        if(DIFF_TEAM(it, self))
-                       if(vlen(self.origin - it.origin) <= best_distance)
                        {
-                               best_distance = vlen(self.origin - it.origin);
-                               closest = it;
+                               float test = vlen2(self.origin - it.origin);
+                               if(test <= best_distance * best_distance)
+                               {
+                                       best_distance = sqrt(test);
+                                       closest = it;
+                               }
                        }
                ));
 
index 915dbe66346435b23da735cf90318b952412b667..09f169eb3d91bf5daf570b27b8e7c5190e52f0d5 100644 (file)
@@ -92,15 +92,15 @@ bool check_close_to_wall(entity this, float threshold)
 {
        if (PHYS_DODGING_WALL == 0) { return false; }
 
-       #define X(OFFSET)                                                                                                                               \
-       tracebox(this.origin, this.mins, this.maxs, this.origin + OFFSET, true, this);  \
-       if (trace_fraction < 1 && vlen (this.origin - trace_endpos) < threshold)                \
+#define X(OFFSET) \
+       tracebox(this.origin, this.mins, this.maxs, this.origin + OFFSET, true, this); \
+       if(trace_fraction < 1 && vdist(this.origin - trace_endpos, <, threshold)) \
                return true;
        X(1000*v_right);
        X(-1000*v_right);
        X(1000*v_forward);
        X(-1000*v_forward);
-       #undef X
+#undef X
 
        return false;
 }
index 6da57cb82bcc1decc0d61cb661fb0c3c7f13f8d1..c08c3690ee51d7d80b43637448bac8e6d3184e9a 100644 (file)
@@ -100,7 +100,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
 
                METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
                {
-                       if(vlen(self.origin-self.enemy.origin) < 3000 - bound(0, skill, 10) * 200)
+                       if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
                                self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
                        else
                                self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
index 6b97a28f1da092aee3465c5c1f7084492b08fe3e..2dffb42f89680e5382551472ae9691335a00d967 100644 (file)
@@ -108,7 +108,7 @@ entity sandbox_ObjectEdit_Get(float permissions)
        // Attached objects are SOLID_NOT and do not get traced.
 
        crosshair_trace_plusvisibletriggers(self);
-       if(vlen(self.origin - trace_ent.origin) > autocvar_g_sandbox_editor_distance_edit)
+       if(vdist(self.origin - trace_ent.origin, >, autocvar_g_sandbox_editor_distance_edit))
                return world; // out of trace range
        if(trace_ent.classname != "object")
                return world; // entity is not an object
index 51c598f17f6846c803b5f84ff3687e440fbd9785..168a06d2e568cb2f35247551ded00019cae6550d 100644 (file)
@@ -77,7 +77,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                                        pc = pointcontents(trace_endpos + '0 0 1');
                                        if(pc == CONTENT_EMPTY)
                                        {
-                                               if(vlen(it.velocity) > 5)
+                                               if(vdist(it.velocity, >, 5))
                                                        fixedmakevectors(vectoangles(it.velocity));
                                                else
                                                        fixedmakevectors(it.angles);
index ef9f059814c4632f277ab247bb0d65458c21bfc4..324f67b31088a0a05444979906118a6ab9c5c59b 100644 (file)
@@ -419,7 +419,7 @@ bool _Movetype_TestEntityPosition(entity this, vector ofs)  // SV_TestEntityPosi
        if(trace_startsolid)
                return true;
 
-       if(vlen(trace_endpos - this.move_origin) > 0.0001)
+       if(vdist(trace_endpos - this.move_origin, >, 0.0001))
                this.move_origin = trace_endpos;
        return false;
 }
index c00a4de26c558e1ab772198738acd8eabd6b475f..eae31ead021891d6b9f8e8803175a4bbda5363b1 100644 (file)
@@ -215,21 +215,21 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
 
 #ifdef SVQC
        if(e.speed)
-               if(vlen(player.velocity) > e.speed)
+               if(vdist(player.velocity, >, e.speed))
                        player.velocity = normalize(player.velocity) * max(0, e.speed);
 #elif defined(CSQC)
        if(e.speed)
-               if(vlen(player.move_velocity) > e.speed)
+               if(vdist(player.move_velocity, >, e.speed))
                        player.move_velocity = normalize(player.move_velocity) * max(0, e.speed);
 #endif
 
 #ifdef SVQC
        if(STAT(TELEPORT_MAXSPEED, player))
-               if(vlen(player.velocity) > STAT(TELEPORT_MAXSPEED, player))
+               if(vdist(player.velocity, >, STAT(TELEPORT_MAXSPEED, player)))
                        player.velocity = normalize(player.velocity) * max(0, STAT(TELEPORT_MAXSPEED, player));
 #elif defined(CSQC)
        if(STAT(TELEPORT_MAXSPEED, player))
-               if(vlen(player.move_velocity) > STAT(TELEPORT_MAXSPEED, player))
+               if(vdist(player.move_velocity, >, STAT(TELEPORT_MAXSPEED, player)))
                        player.move_velocity = normalize(player.move_velocity) * max(0, STAT(TELEPORT_MAXSPEED, player));
 #endif
 
index bbd9c990a5c2a238cad410da4195319ce7f35882..a06fbcbb96392c24fdc53b5b07573a4c48167318 100644 (file)
@@ -816,7 +816,7 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
 
                traceline(e_turret.origin + '0 0 16', v_tmp, 0, e_turret);
 
-               if (e_turret.aim_firetolerance_dist < vlen(v_tmp - trace_endpos))
+               if(vdist(v_tmp - trace_endpos, >, e_turret.aim_firetolerance_dist))
                        return -19;
        }
 
@@ -1376,7 +1376,7 @@ float turret_initialize(Turret tur)
 
 #ifdef TURRET_DEBUG
        self.tur_debug_start = self.nextthink;
-       while (vlen(self.tur_debug_rvec) < 2)
+       while(vdist(self.tur_debug_rvec, <, 2))
                self.tur_debug_rvec = randomvec() * 4;
 
        self.tur_debug_rvec_x = fabs(self.tur_debug_rvec_x);
index 09c41550e98f73a7a6b7553408dcc91b896d692c..dc3b460e94291277593f33e14d67f6093b56e768 100644 (file)
@@ -42,7 +42,7 @@ void ewheel_move_path()
 {SELFPARAM();
 #ifdef EWHEEL_FANCYPATH
     // Are we close enougth to a path node to switch to the next?
-    if (vlen(self.origin  - self.pathcurrent.origin) < 64)
+    if(vdist(self.origin - self.pathcurrent.origin, <, 64))
         if (self.pathcurrent.path_next == world)
         {
             // Path endpoint reached
@@ -67,7 +67,7 @@ void ewheel_move_path()
             self.pathcurrent = self.pathcurrent.path_next;
 
 #else
-    if (vlen(self.origin - self.pathcurrent.origin) < 64)
+    if(vdist(self.origin - self.pathcurrent.origin, <, 64))
         self.pathcurrent = self.pathcurrent.enemy;
 #endif
 
@@ -131,7 +131,7 @@ void ewheel_move_idle()
     }
 
     self.frame = 0;
-    if (vlen(self.velocity))
+    if(self.velocity)
         movelib_brake_simple(self, (autocvar_g_turrets_unit_ewheel_speed_stop));
 }
 
@@ -168,7 +168,7 @@ spawnfunc(turret_ewheel) { if(!turret_initialize(TUR_EWHEEL)) remove(self); }
 
             self.velocity_z = vz;
 
-            if(vlen(self.velocity))
+            if(self.velocity)
                 self.SendFlags |= TNSF_MOVE;
         }
         METHOD(EWheel, tr_death, void(EWheel this, entity it))
index d1b560bfb2ffbaa58b1274b5a796406cff52a9e0..f4bc70ccc1853acf8d2d381a2941c026e6e5ac61 100644 (file)
@@ -50,8 +50,8 @@ METHOD(FlacAttack, wr_think, void(entity thiswep, entity actor, .entity weaponen
 void turret_flac_projectile_think_explode()
 {
     SELFPARAM();
-    if (self.enemy != world)
-    if (vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 3)
+    if(self.enemy != world)
+    if(vdist(self.origin - self.enemy.origin, <, self.owner.shot_radius * 3))
         setorigin(self,self.enemy.origin + randomvec() * self.owner.shot_radius);
 
 #ifdef TURRET_DEBUG
index 55dcd62538b19b69e9aceb71de57e20fbb8b10d1..8ea1cbbd47f28f0e8b08b3bb268f4e58c9dd4ada 100644 (file)
@@ -34,7 +34,7 @@ bool turret_fusionreactor_firecheck()
     if (self.enemy.ammo >= self.enemy.ammo_max)
         return false;
 
-    if (vlen(self.enemy.origin - self.origin) > self.target_range)
+    if(vdist(self.enemy.origin - self.origin, >, self.target_range))
         return false;
 
     if(self.team != self.enemy.team)
index 4a559b08ee7f87e28aa23b2dfd1b54f611b190ed..0b118be1364e74cef956fe16448f940e47fe6faf 100644 (file)
@@ -75,7 +75,7 @@ void turret_hellion_missile_think()
         // Turn model
         self.angles = vectoangles(self.velocity);
 
-        if ( (vlen(self.origin - self.owner.origin)) > (self.owner.shot_radius * 5) )
+        if(vdist(self.origin - self.owner.origin, >, (self.owner.shot_radius * 5)))
             turret_projectile_explode();
 
         // Accelerate
@@ -87,7 +87,7 @@ void turret_hellion_missile_think()
     }
 
     // Enemy in range?
-    if (vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 0.2)
+    if(vdist(self.origin - self.enemy.origin, <, self.owner.shot_radius * 0.2))
         turret_projectile_explode();
 
     // Predict enemy position
index 58c22a79b524b8cb3ef641e2bbc5fe00c7b05c4e..5060e577238abd5048ea7dedb5cf389705b1dd60 100644 (file)
@@ -88,7 +88,7 @@ void turret_hk_missile_think()
                 if (!self.enemy)
                     self.enemy = e;
                 else
-                    if (vlen(self.origin - e.origin) < vlen(self.origin - self.enemy.origin))
+                    if (vlen2(self.origin - e.origin) < vlen2(self.origin - self.enemy.origin))
                         self.enemy = e;
             }
             e = e.chain;
index f15a6d0a7a18a42fbaec3972bdaca322fde9ad71..599e00c29d4e4d82cbc06c52c4087b7d847ca646 100644 (file)
@@ -182,7 +182,7 @@ void walker_rocket_loop3()
         return;
     }
 
-    if (vlen(self.origin - self.tur_shotorg) < 100 )
+    if(vdist(self.origin - self.tur_shotorg, <, 100))
     {
         self.think = walker_rocket_think;
         return;
@@ -206,7 +206,7 @@ void walker_rocket_loop2()
         return;
     }
 
-    if (vlen(self.origin - self.tur_shotorg) < 100 )
+    if(vdist(self.origin - self.tur_shotorg, <, 100))
     {
         self.tur_shotorg = self.origin - '0 0 200';
         self.think = walker_rocket_loop3;
@@ -305,7 +305,7 @@ void walker_move_path()
 {SELFPARAM();
 #ifdef WALKER_FANCYPATHING
     // Are we close enougth to a path node to switch to the next?
-    if (vlen(self.origin  - self.pathcurrent.origin) < 64)
+    if(vdist(self.origin - self.pathcurrent.origin, <, 64))
         if (self.pathcurrent.path_next == world)
         {
             // Path endpoint reached
@@ -334,7 +334,7 @@ void walker_move_path()
     walker_move_to(self.moveto, 0);
 
 #else
-    if (vlen(self.origin - self.pathcurrent.origin) < 64)
+    if(vdist(self.origin - self.pathcurrent.origin, <, 64))
         self.pathcurrent = self.pathcurrent.enemy;
 
     if(!self.pathcurrent)
@@ -362,7 +362,7 @@ spawnfunc(turret_walker) { if(!turret_initialize(TUR_WALKER)) remove(self); }
                 {
                     if(self.enemy_last_time != 0)
                     {
-                        if(vlen(self.origin - self.enemy_last_loc) < 128 || time - self.enemy_last_time > 10)
+                        if(vdist(self.origin - self.enemy_last_loc, <, 128) || time - self.enemy_last_time > 10)
                             self.enemy_last_time = 0;
                         else
                             walker_move_to(self.enemy_last_loc, 0);
index 391ce9984758880a31c3b7b41ac07a9e2e308580..0c1574e2e6a9c1f82c93e5ca12e126182ea0262e 100644 (file)
@@ -922,7 +922,7 @@ void vehicles_touch()
                if((self.origin_z + self.maxs_z) > (other.origin_z))
                if(vehicles_crushable(other))
                {
-                       if(vlen(self.velocity) >= 30)
+                       if(vdist(self.velocity, >=, 30))
                                Damage(other, self, self.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicles_crush_force);
 
                        return; // Dont do selfdamage when hitting "soft targets".
index 3bad3bcf10bed23ee603d6c0d9842976a7200647..cd2804a337bc10aee7d236538cd49c0b7f8b8f4d 100644 (file)
@@ -300,7 +300,7 @@ bool bumblebee_gunner_enter()
        if(!vehic.gunner1 && !vehic.gunner2 && ((time >= vehic.gun1.phase) + (time >= vehic.gun2.phase)) == 2)
        {
                // we can have some fun
-               if(vlen(real_origin(vehic.gun2) - player.origin) < vlen(real_origin(vehic.gun1) - player.origin))
+               if(vlen2(real_origin(vehic.gun2) - player.origin) < vlen2(real_origin(vehic.gun1) - player.origin))
                {
                        gunner = vehic.gun2;
                        vehic.gunner2 = player;
@@ -679,7 +679,7 @@ void bumblebee_exit(float eject)
 
        fixedmakevectors(self.angles);
        vector spot;
-       if(vlen(self.velocity) > autocvar_g_vehicle_bumblebee_speed_forward * 0.5)
+       if(vdist(self.velocity, >, autocvar_g_vehicle_bumblebee_speed_forward * 0.5))
                spot = self.origin + v_up * 128 + v_forward * 300;
        else
                spot = self.origin + v_up * 128 - v_forward * 300;
index 25d07612c6b985c73f5fcae3b71754c91062650a..848fa2ff78fc953af82da7f8577f15efe9041165 100644 (file)
@@ -220,7 +220,7 @@ float racer_frame()
        //racer.velocity_z = ftmp;
 
        int cont = pointcontents(racer.origin);
-       if(vlen(player.movement) != 0)
+       if(player.movement)
        {
                if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
                {
@@ -454,7 +454,7 @@ void racer_exit(float eject)
        }
        else
        {
-               if(vlen(self.velocity) > 2 * autocvar_sv_maxairspeed)
+               if(vdist(self.velocity, >, 2 * autocvar_sv_maxairspeed))
                {
                        self.owner.velocity = normalize(self.velocity) * autocvar_sv_maxairspeed * 2;
                        self.owner.velocity_z += 200;
index a4cf0dde2e958e0885b3d2326ee8fe59af030ea0..675d8f17bd70a66560c0c9bc4aaa880b9b53f391 100644 (file)
@@ -135,7 +135,7 @@ void racer_rocket_tracker()
     //vector
     float height_diff = predicted_origin_z - self.origin_z;
 
-    if(vlen(newdir - v_forward) > autocvar_g_vehicle_racer_rocket_locked_maxangle)
+    if(vdist(newdir - v_forward, >, autocvar_g_vehicle_racer_rocket_locked_maxangle))
     {
         //bprint("Target lost!\n");
         //dprint("OF:", ftos(vlen(newdir - v_forward)), "\n");
index 649977603b043d53095b7dd91a41f8872886653c..d012bd57337434ed4cb22a35f1a0f340985d5352 100644 (file)
@@ -136,7 +136,7 @@ void raptor_exit(float eject)
        }
        else
        {
-               if(vlen(self.velocity) > 2 * autocvar_sv_maxairspeed)
+               if(vdist(self.velocity, >, 2 * autocvar_sv_maxairspeed))
                {
                        self.owner.velocity = normalize(self.velocity) * autocvar_sv_maxairspeed * 2;
                        self.owner.velocity_z += 200;
@@ -446,7 +446,7 @@ float raptor_frame()
                {
                        if(_missile.flags & FL_PROJECTILE)
                        if(MISSILE_IS_TRACKING(_missile))
-                       if(vlen(self.origin - _missile.origin) < 2 * autocvar_g_vehicle_raptor_flare_range)
+                       if(vdist(self.origin - _missile.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
                                ++_incomming;
 
                        _missile = _missile.chain;
index 92c647624b79fb8f6907cbda03e3eae58228793a..175dbd0995348a055bd010518052f3506dc4e4dc 100644 (file)
@@ -165,7 +165,7 @@ void raptor_bomb_burst()
     {
         self.nextthink = time;
         traceline(self.origin, self.origin + (normalize(self.velocity) * autocvar_g_vehicle_raptor_bomblet_alt), MOVE_NORMAL, self);
-        if((trace_fraction == 1.0) || (vlen(self.origin - self.owner.origin) < autocvar_g_vehicle_raptor_bomblet_radius))
+        if((trace_fraction == 1.0) || (vdist(self.origin - self.owner.origin, <, autocvar_g_vehicle_raptor_bomblet_radius)))
         {
             UpdateCSQCProjectile(self);
             return;
@@ -251,7 +251,7 @@ void raptor_flare_think()
     while(_missile)
     {
         if(_missile.flags & FL_PROJECTILE)
-        if(vlen(self.origin - _missile.origin) < autocvar_g_vehicle_raptor_flare_range)
+        if(vdist(self.origin - _missile.origin, <, autocvar_g_vehicle_raptor_flare_range))
         if(random() > autocvar_g_vehicle_raptor_flare_chase)
             _missile.enemy = self;
         _missile = _missile.chain;
index 0004667cdb87698724a02c4fe3e7dd56eaf4939c..edb2a4758a3abcaea8df3829da48db32e5dc90d6 100644 (file)
@@ -181,7 +181,7 @@ float spiderbot_frame()
                }
                else if(time >= spider.jump_delay)
                {
-                       if(vlen(player.movement) == 0)
+                       if(!player.movement)
                        {
                                if(IS_ONGROUND(spider))
                                {
@@ -384,7 +384,7 @@ void spiderbot_exit(float eject)
        }
        else
        {
-               if(vlen(self.velocity) > autocvar_g_vehicle_spiderbot_speed_strafe)
+               if(vdist(self.velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe))
                {
                        self.owner.velocity = normalize(self.velocity) * vlen(self.velocity);
                        self.owner.velocity_z += 200;
index 7a657961d5f8c220d7e3a0b9f3c09031c19f0c1a..257eac801a5c409f854fa7092e5c100fd8b8817f 100644 (file)
@@ -50,7 +50,7 @@ void spiderbot_rocket_unguided()
 
     UpdateCSQCProjectile(self);
 
-    if (IS_DEAD(self.owner) || self.cnt < time || vlen(self.pos1 - self.origin) < 16)
+    if (IS_DEAD(self.owner) || self.cnt < time || vdist(self.pos1 - self.origin, <, 16))
         self.use();
 }
 
index 2a12c45640eaf9c1912e692d50067870f2af4721..ba36d8fc98c9c05eaeb82d1983b13e7ef6f35faa 100644 (file)
@@ -902,7 +902,7 @@ void Draw_ArcBeam(entity this)
                vector end_pos = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
 
                // un-adjust trueaim if shotend is too close
-               if(vlen(end_pos - start_pos) < g_trueaim_minrange)
+               if(vdist(end_pos - start_pos, <, g_trueaim_minrange))
                        end_pos = start_pos + (forward * g_trueaim_minrange);
 
                // move shot origin to the actual gun muzzle origin
index d714acab485e008263a3dd7b2dd212d0349f26b3..0272e424c96b528442f4f6b898d0d66e302d72b7 100644 (file)
@@ -211,7 +211,7 @@ void W_Devastator_RemoteExplode(.entity weaponentity)
        {
                if((self.spawnshieldtime >= 0)
                        ? (time >= self.spawnshieldtime) // timer
-                       : (vlen(NearestPointOnBox(self.realowner, self.origin) - self.origin) > WEP_CVAR(devastator, remote_radius)) // safety device
+                       : (vdist(NearestPointOnBox(self.realowner, self.origin) - self.origin, >, WEP_CVAR(devastator, remote_radius))) // safety device
                )
                {
                        W_Devastator_DoRemoteExplode(weaponentity);
index d766e6a8741df661e7fc874cd40646fadd4a206a..3e93644fb87e31f5f104a0cc5bdb1b4d2a865c25 100644 (file)
@@ -86,7 +86,7 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own)
                        if(WEP_CVAR(electro, combo_comboradius_thruwall))
                        {
                                // if distance is greater than thruwall distance, check to make sure it's not through a wall
-                               if(vlen(e.WarpZone_findradius_dist) > WEP_CVAR(electro, combo_comboradius_thruwall))
+                               if(vdist(e.WarpZone_findradius_dist, >, WEP_CVAR(electro, combo_comboradius_thruwall)))
                                {
                                        WarpZone_TraceLine(org, e.origin, MOVE_NOMONSTERS, e);
                                        if(trace_fraction != 1)
@@ -428,7 +428,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
                METHOD(Electro, wr_aim, void(entity thiswep))
                {
                        self.BUTTON_ATCK = self.BUTTON_ATCK2 = false;
-                       if(vlen(self.origin-self.enemy.origin) > 1000) { self.bot_secondary_electromooth = 0; }
+                       if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
                        if(self.bot_secondary_electromooth == 0)
                        {
                                float shoot;
index f39ad474a3820d2946fe20cf978984240f1276b8..50119a6879d26a688f13e03cb4c9fc29c2c2b487 100644 (file)
@@ -270,7 +270,7 @@ void W_Fireball_Firemine_Think()
        // make it "hot" once it leaves its owner
        if(self.owner)
        {
-               if(vlen(self.origin - self.owner.origin - self.owner.view_ofs) > WEP_CVAR_SEC(fireball, laserradius))
+               if(vdist(self.origin - self.owner.origin - self.owner.view_ofs, >, WEP_CVAR_SEC(fireball, laserradius)))
                {
                        self.cnt += 1;
                        if(self.cnt == 3)
index e2884ff7962c513d153898039e986f727df40270..d76095ec8bf60504366c1ee40f694b3d8219991a 100644 (file)
@@ -451,7 +451,7 @@ void Draw_GrapplingHook(entity this)
        {
                default:
                case NET_ENT_CLIENT_HOOK:
-                       if(vlen(trace_endpos - atrans) > 0.5)
+                       if(vdist(trace_endpos - atrans, >, 0.5))
                        {
                                setorigin(this, trace_endpos); // hook endpoint!
                                this.angles = vectoangles(trace_endpos - atrans);
index c17d07d65f99dc912e0d7004a0d3214869e6924a..f220752b30088816e7264c730ca18735f243b365 100644 (file)
@@ -244,7 +244,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
 
                METHOD(MachineGun, wr_aim, void(entity thiswep))
                {
-                       if(vlen(self.origin-self.enemy.origin) < 3000 - bound(0, skill, 10) * 200)
+                       if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
                                self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
                        else
                                self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
index f9c43f62d77297db54ae87e931520bd18eb3c659..e5c43f3a45879ac2e52df673ac08b8a0e412a7de 100644 (file)
@@ -172,7 +172,7 @@ void W_MineLayer_RemoteExplode()
        if(!IS_DEAD(self.realowner))
                if((self.spawnshieldtime >= 0)
                        ? (time >= self.spawnshieldtime) // timer
-                       : (vlen(NearestPointOnBox(self.realowner, self.origin) - self.origin) > WEP_CVAR(minelayer, remote_radius)) // safety device
+                       : (vdist(NearestPointOnBox(self.realowner, self.origin) - self.origin, >, WEP_CVAR(minelayer, remote_radius))) // safety device
                )
                {
                        W_MineLayer_DoRemoteExplode();
index 580a5bece594e77d7f68e4c950a34652b1ab745d..56b2759ec76766db8737e866111d6dd9f7597094 100644 (file)
@@ -91,7 +91,7 @@ void W_Porto_Fail(float failhard)
                        self.flags = FL_ITEM;
                        self.velocity = trigger_push_calculatevelocity(self.origin, self.realowner, 128);
                        tracetoss(self, self);
-                       if(vlen(trace_endpos - self.realowner.origin) < 128)
+                       if(vdist(trace_endpos - self.realowner.origin, <, 128))
                        {
                                W_ThrowNewWeapon(self.realowner, WEP_PORTO.m_id, 0, self.origin, self.velocity);
                                Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_FAILED);
index 1f79e59f696bf28a706c6fe930e6ee1d66c6ecd4..526ba0e2056ff866a84e34bb7ff99d9f6ea92cc7 100644 (file)
@@ -142,7 +142,7 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR
                {
                        self.BUTTON_ATCK=false;
                        self.BUTTON_ATCK2=false;
-                       if(vlen(self.origin-self.enemy.origin) > 1000)
+                       if(vdist(self.origin - self.enemy.origin, >, 1000))
                                self.bot_secondary_riflemooth = 0;
                        if(self.bot_secondary_riflemooth == 0)
                        {
index 98fe8c8f7070344628cee4f73d715f11ab984aff..a25e928cba43e8ea12d1e86fe0d731da5cef9685 100644 (file)
@@ -147,7 +147,7 @@ void W_Seeker_Missile_Think()
                if(WEP_CVAR(seeker, missile_smart) && (dist > WEP_CVAR(seeker, missile_smart_mindist)))
                {
                        // Is it a better idea (shorter distance) to trace to the target itself?
-                       if( vlen(self.origin + olddir * self.wait) < dist)
+                       if( vdist(self.origin + olddir * self.wait, <, dist))
                                traceline(self.origin, self.origin + olddir * self.wait, false, self);
                        else
                                traceline(self.origin, eorg, false, self);
@@ -400,7 +400,7 @@ void W_Seeker_Attack()
        {
                if(closest_target)
                {
-                       if(vlen(self.origin - tracker.tag_target.origin) < vlen(self.origin - closest_target.origin))
+                       if(vlen2(self.origin - tracker.tag_target.origin) < vlen2(self.origin - closest_target.origin))
                                closest_target = tracker.tag_target;
                }
                else
index 928ec4bef92d324a608fe8677eafa052eb532c9a..dba351eb61178cc15df70a887f0c5ce617098545 100644 (file)
@@ -229,7 +229,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
 
                METHOD(Shotgun, wr_aim, void(entity thiswep))
                {
-                       if(vlen(self.origin-self.enemy.origin) <= WEP_CVAR_SEC(shotgun, melee_range))
+                       if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range)))
                                self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
                        else
                                self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false);
@@ -293,7 +293,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
                METHOD(Shotgun, wr_checkammo2, bool(entity thiswep))
                {
                        if(IS_BOT_CLIENT(self))
-                       if(vlen(self.origin-self.enemy.origin) > WEP_CVAR_SEC(shotgun, melee_range))
+                       if(vdist(self.origin - self.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range)))
                                return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
                        switch(WEP_CVAR(shotgun, secondary))
                        {
index 080c6310bd0ad342a99b1dbdb69aa04959815d22..5a9b2abf975879fc8cd71cf00f7c5a4b1c08afdf 100644 (file)
@@ -43,7 +43,7 @@ vector WarpZone_camera_transform(vector org, vector ang)
 {SELFPARAM();
        vector vf, vr, vu;
        if(self.warpzone_fadestart)
-               if(vlen(org - self.origin - 0.5 * (self.mins + self.maxs)) > self.warpzone_fadeend + 400)
+               if(vdist(org - self.origin - 0.5 * (self.mins + self.maxs), >, self.warpzone_fadeend + 400))
                        return org;
                        // don't transform if zone faded out (plus 400qu safety margin for typical speeds and latencies)
                        // unneeded on client, on server this helps a lot
@@ -81,7 +81,7 @@ vector WarpZone_Camera_camera_transform(vector org, vector ang)
 {SELFPARAM();
        // a fixed camera view
        if(self.warpzone_fadestart)
-               if(vlen(org - self.origin - 0.5 * (self.mins + self.maxs)) > self.warpzone_fadeend + 400)
+               if(vdist(org - self.origin - 0.5 * (self.mins + self.maxs), >, self.warpzone_fadeend + 400))
                        return org;
                        // don't transform if zone faded out (plus 400qu safety margin for typical speeds and latencies)
                        // unneeded on client, on server this helps a lot
@@ -616,7 +616,7 @@ void WarpZone_FindRadius_Recurse(vector org, float rad,        vector org0,
                        if(trace_fraction < 1)
                                continue;
                }
-               if(!e.WarpZone_findradius_hit || vlen(e.WarpZone_findradius_dist) > vlen(org0 - p))
+               if(!e.WarpZone_findradius_hit || vlen2(e.WarpZone_findradius_dist) > vlen2(org0 - p))
                {
                        e.WarpZone_findradius_nearest = p;
                        e.WarpZone_findradius_dist = org0 - p;
index 9273750439382a5d2500d4fc8ada072f851304ac..22aaba8627e6e3ae072239ab1a9c2b3997eb7a5e 100644 (file)
@@ -634,7 +634,7 @@ void WarpZone_InitStep_UpdateTransform()
        {
                norm = norm * (1 / area);
                point = point * (1 / (3 * area));
-               if(vlen(norm) < 0.99)
+               if(vdist(norm, <, 0.99))
                {
                        LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " is nonplanar. BEWARE.\n");
                        area = 0; // no autofixing in this case
@@ -660,7 +660,7 @@ void WarpZone_InitStep_UpdateTransform()
                        ang.x = -ang.x;
                        if(norm * v_forward < 0.99)
                                LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " has been turned to match plane orientation (", vtos(self.aiment.angles), " -> ", vtos(ang), "\n");
-                       if(vlen(org - self.aiment.origin) > 0.5)
+                       if(vdist(org - self.aiment.origin, >, 0.5))
                                LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " has been moved to match the plane (", vtos(self.aiment.origin), " -> ", vtos(org), ").\n");
                }
        }
index 22ab7047c87519455f23b82836ae550f8e0427b8..1c7ed0386f5d63b90a1655c2e202ef639a7d40d8 100644 (file)
@@ -524,8 +524,7 @@ void m_tooltip(vector pos)
        {
                float f = bound(0, frametime * 2, 1);
                menuTooltipAveragedMousePos = menuTooltipAveragedMousePos * (1 - f) + pos * f;
-               f = vlen(pos - menuTooltipAveragedMousePos);
-               if (f < 0.01)
+               if (vdist(pos - menuTooltipAveragedMousePos, <, 0.01))
                {
                        it = m_findtooltipitem(main, pos);
 
index 877d41657ca9741e77bc7c09f03a0b3aa0cb1f42..865010ff5c5a6d8afdfbd0f2280c4dbb1f46edef 100644 (file)
@@ -85,7 +85,7 @@ void anticheat_physics(entity this)
        this.anticheat_div0_strafebot_movement_prev = this.movement;
 
        // Note: this actually tries to detect snap-aim.
-       if(vlen(this.anticheat_div0_strafebot_forward_prev) && time > this.anticheat_fixangle_endtime) {
+       if(this.anticheat_div0_strafebot_forward_prev && time > this.anticheat_fixangle_endtime) {
                float cosangle = this.anticheat_div0_strafebot_forward_prev * v_forward;
                float angle = cosangle < -1 ? M_PI : cosangle > 1 ? 0 : acos(cosangle);
                /*
index 0692659370063b1789b2de2e0d39fe698b48f5a1..79f0a2758c3b4a7b8c0ddbdf92cdc362eea228d4 100644 (file)
@@ -303,7 +303,7 @@ float bot_aimdir(vector v, float maxfiredeviation)
        // note the maxfiredeviation is in degrees so this has to convert to radians first
        //if ((normalize(v) * shotdir) >= cos(maxfiredeviation * (3.14159265358979323846 / 180)))
        if ((normalize(v) * shotdir) >= cos(maxfiredeviation * (3.14159265358979323846 / 180)))
-       if (vlen(trace_endpos-shotorg) < 500+500*bound(0, skill+self.bot_aggresskill, 10) || random()*random()>bound(0,(skill+self.bot_aggresskill)*0.05,1))
+       if(vdist(trace_endpos-shotorg, <, 500 + 500 * bound(0, skill + self.bot_aggresskill, 10)) || random()*random()>bound(0,(skill+self.bot_aggresskill)*0.05,1))
                self.bot_firetimer = time + bound(0.1, 0.5-(skill+self.bot_aggresskill)*0.05, 0.5);
        //traceline(shotorg,shotorg+shotdir*1000,false,world);
        //dprint(ftos(maxfiredeviation),"\n");
index ae850618d8110a9316ee2a6e6942c8b920154c91..7e05e7c75ede628c474356c9e022839a39754294 100644 (file)
@@ -591,7 +591,7 @@ void flocker_hunter_think()
     self.angles_x = self.angles.x * -1;
 
     if(self.enemy)
-    if(vlen(self.enemy.origin - self.origin) < 64)
+    if(vdist(self.enemy.origin - self.origin, <, 64))
     {
         ee = self.enemy;
         ee.health = -1;
index 01a23c1a5caf3cd6e66911e3066442f39a35268a..facf13f2028be61a41a13e39bae5fd2ba9a3a08c 100644 (file)
@@ -46,7 +46,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
        v_up = vu;
 
        // un-adjust trueaim if shotend is too close
-       if(vlen(w_shotend - (ent.origin + ent.view_ofs)) < autocvar_g_trueaim_minrange)
+       if(vdist(w_shotend - (ent.origin + ent.view_ofs), <, autocvar_g_trueaim_minrange))
                w_shotend = ent.origin + ent.view_ofs + s_forward * autocvar_g_trueaim_minrange;
 
        // track max damage
@@ -342,7 +342,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
 
 void fireBullet_trace_callback(vector start, vector hit, vector end)
 {
-       if(vlen(hit - start) > 16)
+       if(vdist(hit - start, >, 16))
                trailparticles(world, fireBullet_trace_callback_eff, start, hit);
        WarpZone_trace_forent = world;
        fireBullet_last_hit = world;
@@ -473,7 +473,7 @@ void fireBullet(vector start, vector dir, float spread, float max_solid_penetrat
 
                // Only show effect when going through a player (invisible otherwise)
                if (hit && (hit.solid != SOLID_BSP))
-                       if(vlen(trace_endpos - start) > 4)
+                       if(vdist(trace_endpos - start, >, 4))
                                trailparticles(self, fireBullet_trace_callback_eff, start, trace_endpos);
 
                start = trace_endpos;