From: Mario Date: Wed, 31 Aug 2016 06:44:46 +0000 (+1000) Subject: Kill some more vlen uses X-Git-Tag: xonotic-v0.8.2~633 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5da6bc592812c014078f0eee3368773282659ff9;p=xonotic%2Fxonotic-data.pk3dir.git Kill some more vlen uses --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 8a583ba69..cd156e65e 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -980,7 +980,7 @@ void HUD_Crosshair(entity this) v = wcross_origin - wcross_oldorigin; v.x /= vid_conwidth; v.y /= vid_conheight; - if(vlen(v) > 0.01) + if(vdist(v, >, 0.01)) shottype = SHOTTYPE_HITOBSTRUCTION; } if(!autocvar_crosshair_hittest_showimpact) diff --git a/qcsrc/server/bot/default/waypoints.qc b/qcsrc/server/bot/default/waypoints.qc index efcd5ba37..5fb923799 100644 --- a/qcsrc/server/bot/default/waypoints.qc +++ b/qcsrc/server/bot/default/waypoints.qc @@ -34,7 +34,7 @@ entity waypoint_spawn(vector m1, vector m2, float f) w.solid = SOLID_TRIGGER; setorigin(w, (m1 + m2) * 0.5); setsize(w, m1 - w.origin, m2 - w.origin); - if (vlen(w.size) > 0) + if (w.size) w.wpisbox = true; if(!w.wpisbox) @@ -280,7 +280,7 @@ void waypoint_schedulerelink(entity wp) } else wp.model = ""; - wp.wpisbox = vlen(wp.size) > 0; + wp.wpisbox = vdist(wp.size, >, 0); wp.enemy = NULL; if (!(wp.wpflags & WAYPOINTFLAG_PERSONAL)) wp.owner = NULL; diff --git a/qcsrc/server/command/radarmap.qc b/qcsrc/server/command/radarmap.qc index acf2d40ae..a5e4a7547 100644 --- a/qcsrc/server/command/radarmap.qc +++ b/qcsrc/server/command/radarmap.qc @@ -26,7 +26,7 @@ float FullTraceFraction(vector a, vector mi, vector ma, vector b) float n, m; n = m = 0; - while (vlen(c - b) > 1) + while (vdist(c - b, >, 1)) { ++m; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 97e82b50e..3e4483636 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -839,7 +839,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d // apply push if (targ.damageforcescale) - if (vlen(force)) + if (force) if (!IS_PLAYER(targ) || time >= targ.spawnshieldtime || targ == attacker) { vector farce = damage_explosion_calcpush(targ.damageforcescale * force, targ.velocity, autocvar_g_balance_damagepush_speedfactor); @@ -863,7 +863,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d UpdateCSQCProjectile(targ); } // apply damage - if (damage != 0 || (targ.damageforcescale && vlen(force))) + if (damage != 0 || (targ.damageforcescale && force)) if (targ.event_damage) targ.event_damage (targ, inflictor, attacker, damage, deathtype, hitloc, force); @@ -1038,7 +1038,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in // print(" finaldmg ", ftos(finaldmg), " force ", vtos(force)); // print(" (", ftos(a), ")\n"); //} - if(finaldmg || vlen(force)) + if(finaldmg || force) { if(targ.iscreature) { diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index 3471083a9..0e5d7bd02 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -423,7 +423,7 @@ void kh_Key_Damage(entity this, entity inflictor, entity attacker, float damage, // immediately return is bad // maybe start a shorter countdown? } - if(vlen(force) <= 0) + if(force == '0 0 0') return; if(time > this.pushltime) if(IS_PLAYER(attacker)) diff --git a/qcsrc/server/steerlib.qc b/qcsrc/server/steerlib.qc index 5312eb814..1544fa384 100644 --- a/qcsrc/server/steerlib.qc +++ b/qcsrc/server/steerlib.qc @@ -144,7 +144,7 @@ vector steerlib_wander(entity this, float range, float tresh, vector oldpoint) vector wander_point; wander_point = v_forward - oldpoint; - if (vlen(wander_point) > tresh) + if (vdist(wander_point, >, tresh)) return oldpoint; range = bound(0,range,1);