}
// Can we even aim this thing?
- tvt_thadv = angleofs3(e_turret.tur_head.origin, e_turret.angles + e_turret.tur_head.angles, e_target);
+ tvt_thadv = angleofs3(e_turret.tur_head.origin, e_turret.angles + e_turret.tur_head.angles, e_target.origin);
tvt_tadv = shortangle_vxy(angleofs(e_turret, e_target), e_turret.angles);
tvt_thadf = vlen(tvt_thadv);
tvt_tadf = vlen(tvt_tadv);
#pragma once
-float shortangle_f(float ang1, float ang2);
-float anglemods(float v);
float turret_tag_fire_update(entity this);
-vector shortangle_vxy(vector ang1, vector ang2);
-vector angleofs(entity from, entity to);
-vector angleofs3(vector from, vector from_a, entity to);
void FireImoBeam(entity this, vector start, vector end, vector smin, vector smax, float bforce, float f_dmg, float f_velfactor, float deathtype);
}
/*
-* Return the angle between two enteties
+* Return the angle offset between angle ang and angle of the vector from->to
*/
-vector angleofs(entity from, entity to)
-{
- vector v_res;
-
- v_res = normalize(to.origin - from.origin);
- v_res = vectoangles(v_res);
- v_res = v_res - from.angles;
-
- if (v_res_x < 0) v_res_x += 360;
- if (v_res_x > 180) v_res_x -= 360;
- if (v_res_y < 0) v_res_y += 360;
- if (v_res_y > 180) v_res_y -= 360;
-
- return v_res;
-}
-
-vector angleofs3(vector from, vector from_a, entity to)
+vector angleofs3(vector from, vector ang, vector to)
{
vector v_res;
- v_res = normalize(to.origin - from);
+ v_res = normalize(to - from);
v_res = vectoangles(v_res);
- v_res = v_res - from_a;
+ v_res = v_res - ang;
if (v_res_x < 0) v_res_x += 360;
if (v_res_x > 180) v_res_x -= 360;
return v_res;
}
+
+#define angleofs(from, to) angleofs3(from.origin, from.angles, to.origin)