]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/pathlib/utility.qc
Revert "Merge branch 'TimePath/bot_api' into 'master'\r"
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / pathlib / utility.qc
index 0a5ea42b1c22e7e996665ee98238dd55a6eb3307..9028f85e4f8be3ab4d65a21656634151522ecb4f 100644 (file)
@@ -1,18 +1,6 @@
-float fsnap(float val,float fsize)
-{
-    return rint(val / fsize) * fsize;
-}
+#include "utility.qh"
 
-vector vsnap(vector point,float fsize)
-{
-    vector vret;
-
-    vret_x = rint(point_x / fsize) * fsize;
-    vret_y = rint(point_y / fsize) * fsize;
-    vret_z = ceil(point_z / fsize) * fsize;
-
-    return vret;
-}
+#include "pathlib.qh"
 
 float location_isok(vector point, float water_isok, float air_isok)
 {
@@ -68,13 +56,13 @@ entity pathlib_nodeatpoint(vector where)
 
     ++pathlib_searched_cnt;
 
-    where_x = fsnap(where_x,pathlib_gridsize);
-    where_y = fsnap(where_y,pathlib_gridsize);
+    where.x = fsnap(where.x,pathlib_gridsize);
+    where.y = fsnap(where.y,pathlib_gridsize);
 
     node = findradius(where,pathlib_gridsize * 0.5);
     while(node)
     {
-        if(node.is_path_node == TRUE)
+        if(node.is_path_node == true)
             return node;
 
         node = node.chain;
@@ -84,7 +72,7 @@ entity pathlib_nodeatpoint(vector where)
 }
 
 float tile_check_cross(vector where)
-{
+{SELFPARAM();
     vector p,f,r;
 
     f = PLIB_FORWARD * tile_check_size;
@@ -94,32 +82,32 @@ float tile_check_cross(vector where)
     // forward-right
     p = where + f + r;
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
-    if not (location_isok(trace_endpos, 1, 0))
+    if (!location_isok(trace_endpos, 1, 0))
         return 0;
 
     // Forward-left
     p = where + f - r;
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
-    if not (location_isok(trace_endpos, 1, 0))
+    if (!location_isok(trace_endpos, 1, 0))
         return 0;
 
     // Back-right
     p = where - f + r;
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
-    if not (location_isok(trace_endpos, 1 ,0))
+    if (!location_isok(trace_endpos, 1 ,0))
         return 0;
 
     //Back-left
     p = where - f - r;
     traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, self);
-    if not (location_isok(trace_endpos, 1, 0))
+    if (!location_isok(trace_endpos, 1, 0))
         return 0;
 
     return 1;
 }
 
 float tile_check_plus(vector where)
-{
+{SELFPARAM();
     vector p,f,r;
 
     f = PLIB_FORWARD * tile_check_size;
@@ -128,33 +116,33 @@ float tile_check_plus(vector where)
     // forward
     p = where + f;
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
-    if not (location_isok(trace_endpos,1,0))
+    if (!location_isok(trace_endpos,1,0))
         return 0;
 
 
     //left
     p = where - r;
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
-    if not (location_isok(trace_endpos,1,0))
+    if (!location_isok(trace_endpos,1,0))
         return 0;
 
     // Right
     p = where + r;
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
-    if not (location_isok(trace_endpos,1,0))
+    if (!location_isok(trace_endpos,1,0))
         return 0;
 
     //Back
     p = where - f;
     traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
-    if not (location_isok(trace_endpos,1,0))
+    if (!location_isok(trace_endpos,1,0))
         return 0;
 
     return 1;
 }
 
 float tile_check_plus2(vector where)
-{
+{SELFPARAM();
     vector p,f,r;
     float i = 0, e = 0;