// WEAPONTODO: replace with simpler method
vector nearest_on_line = (w_shotorg + a * w_shotdir);
- vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
+ vector nearest_to_attacker = NearestPointOnBoundingBox(center + head.mins, center + head.maxs, nearest_on_line);
if((vdist(head.WarpZone_findradius_dist, <=, WEP_CVAR(shockwave, blast_distance)))
&& (W_Shockwave_Attack_IsVisible(actor, head, nearest_on_line, w_shotorg, attack_endpos)))
ERASEABLE
vector NearestPointOnBox(entity box, vector org)
{
- vector m1 = box.mins + box.origin;
- vector m2 = box.maxs + box.origin;
+ vector mi = box.mins + box.origin;
+ vector ma = box.maxs + box.origin;
return vec3(
- bound(m1.x, org.x, m2.x),
- bound(m1.y, org.y, m2.y),
- bound(m1.z, org.z, m2.z)
+ bound(mi.x, org.x, ma.x),
+ bound(mi.y, org.y, ma.y),
+ bound(mi.z, org.z, ma.z)
);
}
+
+ERASEABLE
+vector NearestPointOnBoundingBox(vector mi, vector ma, vector org)
+{
+ return vec3(
+ bound(mi.x, org.x, ma.x),
+ bound(mi.y, org.y, ma.y),
+ bound(mi.z, org.z, ma.z)
+ );
+}
#endif
// measure distance from nearest point on target (not origin)
// to nearest point on inflictor (not origin)
nearest = targ.WarpZone_findradius_nearest;
- vector inflictornearest = WarpZoneLib_NearestPointOnBox(
+ vector inflictornearest = NearestPointOnBoundingBox(
inflictororigin - (inflictor.maxs - inflictor.mins) * 0.5,
inflictororigin + (inflictor.maxs - inflictor.mins) * 0.5,
nearest);