]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add NearestPointOnBoundingBox (copy of WarpZoneLib_NearestPointOnBox) as shared funct...
authorterencehill <piuntn@gmail.com>
Fri, 18 Mar 2022 13:50:33 +0000 (14:50 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 18 Mar 2022 13:50:33 +0000 (14:50 +0100)
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/lib/vector.qh
qcsrc/server/damage.qc

index 6b357968a7c8ac993ac234b82b622a3d55314d39..2429a301775621f979893f2eab1be96c61488a46 100644 (file)
@@ -479,7 +479,7 @@ void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity)
                        // 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)))
index 13869b016ef35f03f16f8be5d5cfbb0e14ad9282..23bfdf05593ff178f4f31c35d4319d4985d6626a 100644 (file)
@@ -177,13 +177,23 @@ vector vec_epsilon(vector this, float eps)
        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
index 32620218bca23fa7ed120c187b703e4e4ce9c7dd..ce2dd04b3ea139bcbf985b2b34229ab9c254571b 100644 (file)
@@ -919,7 +919,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
                        // 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);