5 float location_isok(vector point, float water_isok, float air_isok)
9 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
12 pc = pointcontents(point);
13 pc2 = pointcontents(point - '0 0 1');
30 if (pc2 == CONTENT_SOLID)
33 if (pc2 == CONTENT_EMPTY)
37 if (pc2 == CONTENT_WATER)
53 entity pathlib_nodeatpoint(vector where)
57 ++pathlib_searched_cnt;
59 where.x = fsnap(where.x,pathlib_gridsize);
60 where.y = fsnap(where.y,pathlib_gridsize);
62 node = findradius(where,pathlib_gridsize * 0.5);
65 if(node.is_path_node == true)
74 float tile_check_cross(entity this, vector where)
78 f = PLIB_FORWARD * tile_check_size;
79 r = PLIB_RIGHT * tile_check_size;
84 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
85 if (!location_isok(trace_endpos, 1, 0))
90 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
91 if (!location_isok(trace_endpos, 1, 0))
96 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
97 if (!location_isok(trace_endpos, 1 ,0))
102 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
103 if (!location_isok(trace_endpos, 1, 0))
109 float tile_check_plus(entity this, vector where)
113 f = PLIB_FORWARD * tile_check_size;
114 r = PLIB_RIGHT * tile_check_size;
118 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
119 if (!location_isok(trace_endpos,1,0))
125 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
126 if (!location_isok(trace_endpos,1,0))
131 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
132 if (!location_isok(trace_endpos,1,0))
137 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
138 if (!location_isok(trace_endpos,1,0))
144 float tile_check_plus2(entity this, vector where)
149 f = PLIB_FORWARD * pathlib_gridsize;
150 r = PLIB_RIGHT * pathlib_gridsize;
152 //#define pathlib_node_edgeflag_left 2
153 //#define pathlib_node_edgeflag_right 4
154 //#define pathlib_node_edgeflag_forward 8
155 //#define pathlib_node_edgeflag_back 16
159 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
160 if (location_isok(trace_endpos,1,0))
163 e |= pathlib_node_edgeflag_forward;
169 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
170 if (location_isok(trace_endpos,1,0))
173 e |= pathlib_node_edgeflag_left;
179 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
180 if (location_isok(trace_endpos,1,0))
183 e |= pathlib_node_edgeflag_right;
188 traceline(p+tile_check_up,p-tile_check_down,MOVE_WORLDONLY,this);
189 if (location_isok(trace_endpos,1,0))
192 e |= pathlib_node_edgeflag_back;
197 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
198 if (location_isok(trace_endpos, 1, 0))
201 e |= pathlib_node_edgeflag_forwardright;
206 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
207 if (location_isok(trace_endpos, 1, 0))
210 e |= pathlib_node_edgeflag_forwardleft;
215 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
216 if (location_isok(trace_endpos, 1 ,0))
219 e |= pathlib_node_edgeflag_backright;
224 traceline(p + tile_check_up, p - tile_check_down, MOVE_WORLDONLY, this);
225 if (location_isok(trace_endpos, 1, 0))
228 e |= pathlib_node_edgeflag_backleft;
233 e = pathlib_node_edgeflag_none;
238 float tile_check_star(entity this, vector where)
240 if(tile_check_plus(this, where))
241 return tile_check_cross(this, where);