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

Function WriteBNodeChunk

Descent3/LoadLevel.cpp:4577–4620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4575}
4576
4577void WriteBNodeChunk(CFILE *fp) {
4578 int i;
4579 int j;
4580 int k;
4581
4582 int start_pos;
4583 start_pos = StartChunk(fp, CHUNK_BNODES);
4584
4585 cf_WriteShort(fp, Highest_room_index + 8);
4586
4587 for (i = 0; i <= Highest_room_index + 8; i++) {
4588 if ((i <= Highest_room_index && !Rooms[i].used)) {
4589 cf_WriteByte(fp, 0);
4590 } else {
4591 cf_WriteByte(fp, 1);
4592 bn_list *bnlist = BNode_GetBNListPtr(i, true);
4593
4594 cf_WriteShort(fp, bnlist->num_nodes);
4595 if (bnlist->num_nodes) {
4596 for (j = 0; j < bnlist->num_nodes; j++) {
4597 cf_WriteFloat(fp, bnlist->nodes[j].pos.x);
4598 cf_WriteFloat(fp, bnlist->nodes[j].pos.y);
4599 cf_WriteFloat(fp, bnlist->nodes[j].pos.z);
4600
4601 cf_WriteShort(fp, bnlist->nodes[j].num_edges);
4602 if (bnlist->nodes[j].num_edges) {
4603 for (k = 0; k < bnlist->nodes[j].num_edges; k++) {
4604 cf_WriteShort(fp, bnlist->nodes[j].edges[k].end_room);
4605 cf_WriteByte(fp, bnlist->nodes[j].edges[k].end_index);
4606
4607 cf_WriteShort(fp, bnlist->nodes[j].edges[k].flags);
4608 cf_WriteShort(fp, bnlist->nodes[j].edges[k].cost);
4609
4610 cf_WriteFloat(fp, bnlist->nodes[j].edges[k].max_rad);
4611 }
4612 }
4613 }
4614 }
4615 }
4616 }
4617 cf_WriteByte(fp, BNode_verified ? 1 : 0);
4618
4619 EndChunk(fp, start_pos);
4620}
4621
4622void WriteBOAChunk(CFILE *fp) {
4623 int start_pos;

Callers 1

SaveLevelFunction · 0.85

Calls 6

StartChunkFunction · 0.85
cf_WriteShortFunction · 0.85
cf_WriteByteFunction · 0.85
BNode_GetBNListPtrFunction · 0.85
cf_WriteFloatFunction · 0.85
EndChunkFunction · 0.85

Tested by

no test coverage detected