1 float fsnap(float val,float fsize)
3 return rint(val / fsize) * fsize;
6 vector vsnap(vector point,float fsize)
10 vret_x = rint(point_x / fsize) * fsize;
11 vret_y = rint(point_y / fsize) * fsize;
12 vret_z = ceil(point_z / fsize) * fsize;
17 float location_isok(vector point, float water_isok, float air_isok)
21 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
24 pc = pointcontents(point);
25 pc2 = pointcontents(point - '0 0 1');
42 if (pc2 == CONTENT_SOLID)
45 if (pc2 == CONTENT_EMPTY)
49 if (pc2 == CONTENT_WATER)
65 entity pathlib_nodeatpoint(vector where)
69 ++pathlib_searched_cnt;
71 where_x = fsnap(where_x,pathlib_gridsize);
72 where_y = fsnap(where_y,pathlib_gridsize);
74 node = findradius(where,pathlib_gridsize * 0.5);
77 if(node.is_path_node == TRUE)
86 float tile_check_cross(vector where)
90 f = PLIB_FORWARD * tile_check_size;
91 r = PLIB_RIGHT * tile_check_size;
95 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
96 if not (location_isok(trace_endpos,1,0))
101 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
102 if not (location_isok(trace_endpos,1,0))
107 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
108 if not (location_isok(trace_endpos,1,0))
113 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
114 if not (location_isok(trace_endpos,1,0))
120 float tile_check_plus(vector where)
124 f = PLIB_FORWARD * tile_check_size;
125 r = PLIB_RIGHT * tile_check_size;
129 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
130 if not (location_isok(trace_endpos,1,0))
135 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
136 if not (location_isok(trace_endpos,1,0))
142 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
143 if not (location_isok(trace_endpos,1,0))
148 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,self);
149 if not (location_isok(trace_endpos,1,0))
155 float tile_check_star(vector where)
157 if(tile_check_plus(where))
158 return tile_check_cross(where);