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

Function IsRoomVisible

Descent3/TelComAutoMap.cpp:419–445  ·  view source on GitHub ↗

Returns true if the external room is in the view cone Else returns false

Source from the content-addressed store, hash-verified

417// Returns true if the external room is in the view cone
418// Else returns false
419bool IsRoomVisible(room *rp, float *nearz) {
420 g3Point pnt;
421 uint8_t ccode;
422
423 vector corners[8];
424
425 MakePointsFromMinMax(corners, &rp->min_xyz, &rp->max_xyz);
426
427 *nearz = 90000000;
428 uint8_t andbyte = 0xff;
429 for (int t = 0; t < 8; t++) {
430 g3_RotatePoint(&pnt, &corners[t]);
431
432 if (pnt.p3_z < *nearz)
433 *nearz = pnt.p3_z;
434
435 ccode = g3_CodePoint(&pnt);
436 if (!ccode)
437 return true;
438 andbyte &= ccode;
439 }
440
441 if (andbyte)
442 return false;
443
444 return true;
445}
446
447void TCAMRenderRoom(int roomnum) {
448 ASSERT(Rooms[roomnum].used);

Callers 1

TCAMRenderRoomFunction · 0.85

Calls 3

MakePointsFromMinMaxFunction · 0.85
g3_RotatePointFunction · 0.85
g3_CodePointFunction · 0.85

Tested by

no test coverage detected