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

Function EBNode_MakeDefaultTerrainNodes

editor/ebnode.cpp:1086–1118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1084//}
1085
1086void EBNode_MakeDefaultTerrainNodes(int region) {
1087 int i, j;
1088
1089 ASSERT(region >= 0 || region < BOA_num_terrain_regions);
1090
1091 mprintf(0, "TR %d has %d nodes\n", region, BOA_num_connect[region]);
1092
1093 // Adds the nodes from portals
1094 for (i = 0; i < BOA_num_connect[region]; i++) {
1095 int end_room = BOA_connect[region][i].roomnum;
1096 room *rp = &Rooms[end_room];
1097 int p = BOA_connect[region][i].portal;
1098
1099 vector pos;
1100 pos = rp->portals[p].path_pnt - rp->faces[rp->portals[p].portal_face].normal * 0.75f;
1101
1102 int external_room = rp->portals[p].croom;
1103 int external_portal = rp->portals[p].cportal;
1104 ASSERT(Rooms[external_room].flags & RF_EXTERNAL);
1105 Rooms[external_room].portals[external_portal].bnode_index = i;
1106
1107 EBNode_AddNode(Highest_room_index + region + 1, &pos, false, false);
1108 EBNode_AddEdge(i, Highest_room_index + region + 1, p, end_room);
1109 }
1110
1111 // Add the edges
1112 for (i = 0; i < BOA_num_connect[region]; i++) {
1113 // Edges go both ways - always
1114 for (j = i + 1; j < BOA_num_connect[region]; j++) {
1115 EBNode_AddEdge(i, Highest_room_index + region + 1, j, Highest_room_index + region + 1);
1116 }
1117 }
1118}
1119
1120void EBNode_MakeFirstPass(void) {
1121 int i;

Callers 1

EBNode_MakeFirstPassFunction · 0.85

Calls 2

EBNode_AddNodeFunction · 0.85
EBNode_AddEdgeFunction · 0.85

Tested by

no test coverage detected