| 292 | |
| 293 | static TArray<DVector2> points; |
| 294 | static int insideLoop(int vertex, TArray<int>& loop) |
| 295 | { |
| 296 | points.Resize(loop.Size() - 1); |
| 297 | for (unsigned ii = 0; ii < loop.Size() - 1; ii++) |
| 298 | { |
| 299 | points[ii] = wall[loop[ii]].pos; |
| 300 | } |
| 301 | |
| 302 | // to reliably detect walls where vertices lie directly on outer walls, we must test the wall's center as well. |
| 303 | // SW: Wanton Destrcution's $bath.map, sector 601 is an example for that. |
| 304 | DVector2 pts[] = { wall[vertex].pos, wall[vertex].center() }; |
| 305 | for (int i = 0; i < 2; i++) |
| 306 | { |
| 307 | int isinside = insidePoly(pts[i].X, pts[i].Y, points.Data(), points.Size()); |
| 308 | if (isinside == 1) return 1; |
| 309 | } |
| 310 | return -1; |
| 311 | } |
| 312 | |
| 313 | static int insideLoop(TArray<int>& check, TArray<int>& loop) |
| 314 | { |