MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / IsPathPointValid

Function IsPathPointValid

Descent3/BOA.cpp:1288–1324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1286#pragma optimize("", on)
1287
1288bool IsPathPointValid(int room, vector *pos) {
1289 // vector c_pnt = Rooms[room].path_pnt;
1290 int i;
1291
1292 if (Rooms[room].flags & RF_EXTERNAL)
1293 return true;
1294
1295 for (i = 0; i < Rooms[room].num_portals; i++) {
1296 fvi_info hit_info;
1297 fvi_query fq;
1298 int fate;
1299
1300 if (!BOA_PassablePortal(room, i))
1301 continue;
1302
1303 vector portal_pnt = Rooms[room].portals[i].path_pnt;
1304
1305 // shoot a ray from the light position to the current vertex
1306 fq.p0 = &portal_pnt;
1307 fq.p1 = pos;
1308 fq.startroom = room;
1309
1310 fq.rad = 5.0f;
1311 fq.flags =
1312 FQ_SOLID_PORTALS | FQ_NO_RELINK; // chrishack -- Might want to make FQ_IGNORE_MOVING_OBJECTS into a passed arg
1313 fq.thisobjnum = -1;
1314 fq.ignore_obj_list = NULL;
1315
1316 fate = fvi_FindIntersection(&fq, &hit_info);
1317
1318 if (fate != HIT_NONE) {
1319 return false;
1320 }
1321 }
1322
1323 return true;
1324}
1325
1326#define MAX_SUBDIVISIONS 12 // Actually 19 (we don't do extremities)
1327

Callers 1

ValidateRoomPathPointFunction · 0.85

Calls 2

BOA_PassablePortalFunction · 0.85
fvi_FindIntersectionFunction · 0.85

Tested by

no test coverage detected