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

Function MakeBOAVisTable

Descent3/BOA.cpp:1559–1903  ·  view source on GitHub ↗

Goes through all the rooms and determines their visibility in relation to one another

Source from the content-addressed store, hash-verified

1557#define VIS_TABLE_RESOLUTION 6
1558// Goes through all the rooms and determines their visibility in relation to one another
1559void MakeBOAVisTable(bool from_lighting) {
1560 int cur_check = BOAGetMineChecksum();
1561 int vis_stack[MAX_ROOMS * 10];
1562 int stack_count = 0;
1563 uint8_t already_checked[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS];
1564 uint8_t precomputed[MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS][MAX_ROOMS + MAX_BOA_TERRAIN_REGIONS];
1565
1566 // Removed this as we have to make a better checksum
1567
1568 if (cur_check == BOA_vis_checksum) {
1569 // Already done, so bail
1570 if (!from_lighting)
1571 EditorMessageBox("BOA vis table already computed.");
1572 return;
1573 }
1574
1575 BOA_vis_checksum = BOA_mine_checksum = 0;
1576#ifdef NEWEDITOR
1577 DoBOAVisProgressDialog(0.0f, 0, "Computing BOA");
1578 DoBOAVisProgressDialog(0.0f, 1);
1579#endif
1580 MakeBOA();
1581#ifdef NEWEDITOR
1582 DoBOAVisProgressDialog(100.0f, 2);
1583#endif
1584
1585 // Now compute all room to room visibility stuff
1586 int i, t, j;
1587
1588 mprintf(0, "Computing visibility for %d rooms.\n", Highest_room_index);
1589
1590 for (i = 0; i <= Highest_room_index + MAX_BOA_TERRAIN_REGIONS; i++) {
1591 for (t = 0; t <= Highest_room_index + MAX_BOA_TERRAIN_REGIONS; t++) {
1592 BOA_Array[i][t] &= ~BOAF_VIS;
1593 precomputed[i][t] = 255;
1594 }
1595
1596 BOA_Array[i][i] |= BOAF_VIS;
1597 }
1598
1599#ifdef NEWEDITOR
1600 DoBOAVisProgressDialog(0.0f, 0, "Computing BOA Vis. Table");
1601#endif
1602
1603 for (i = 0; i <= Highest_room_index; i++) {
1604 if (Rooms[i].used == 0)
1605 continue;
1606
1607 room *rp = &Rooms[i];
1608
1609#ifdef NEWEDITOR
1610 DoBOAVisProgressDialog((float)(i + 1) / (float)(Highest_room_index + 1), 1);
1611#endif
1612 mprintf_at(2, 4, 0, "Room=%d ", i);
1613
1614 if (rp->flags & RF_EXTERNAL)
1615 continue;
1616

Callers 2

OnBoaVisButtonMethod · 0.85
DoRadiosityForRoomsFunction · 0.85

Calls 10

BOAGetMineChecksumFunction · 0.85
DoBOAVisProgressDialogFunction · 0.85
MakeBOAFunction · 0.85
GetTerrainCellFromPosFunction · 0.85
TERRAIN_REGIONFunction · 0.85
check_point_to_faceFunction · 0.85
fvi_QuickRoomCheckFunction · 0.85
fvi_FindIntersectionFunction · 0.85
vm_VectorToMatrixFunction · 0.50

Tested by

no test coverage detected