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

Function LoadBSPNode

Descent3/bsp.cpp:214–240  ·  view source on GitHub ↗

Loads a bsp node from an open file and recurses with its children

Source from the content-addressed store, hash-verified

212
213// Loads a bsp node from an open file and recurses with its children
214void LoadBSPNode(CFILE *infile, bspnode **node) {
215 // Get the node type
216 uint8_t type = cf_ReadByte(infile);
217
218 // Allocate the node and set its type
219 *node = NewBSPNode();
220 ASSERT(*node);
221 bspnode *localnode = *node;
222
223 localnode->type = type;
224
225 if (type == BSP_EMPTY_LEAF || type == BSP_SOLID_LEAF)
226 return;
227
228 // Load the nodes plane
229 localnode->plane.a = cf_ReadFloat(infile);
230 localnode->plane.b = cf_ReadFloat(infile);
231 localnode->plane.c = cf_ReadFloat(infile);
232 localnode->plane.d = cf_ReadFloat(infile);
233 localnode->node_roomnum = cf_ReadShort(infile);
234 localnode->node_facenum = cf_ReadShort(infile);
235 localnode->node_subnum = cf_ReadByte(infile);
236
237 // Recurse to get the children
238 LoadBSPNode(infile, &localnode->front);
239 LoadBSPNode(infile, &localnode->back);
240}
241
242// Frees up a polygon and all the vertices associated with it
243void FreePolygon(bsppolygon *poly) {

Callers 1

LoadLevelFunction · 0.85

Calls 4

cf_ReadByteFunction · 0.85
NewBSPNodeFunction · 0.85
cf_ReadFloatFunction · 0.85
cf_ReadShortFunction · 0.85

Tested by

no test coverage detected