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(!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);
{
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);
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)
{
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;
}
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;
// 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))
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);
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;