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

Function RoomAddFaces

editor/Erooms.cpp:1423–1455  ·  view source on GitHub ↗

Create space for additional faces in a room. Allocates a new faces array, copies from the old list, and frees the old list The new faces are at the end of the list, so none of the old faces change number Parameters: rp - the room num_new_faces - how many faces are being added to the room Returns: the number of the first new face

Source from the content-addressed store, hash-verified

1421// num_new_faces - how many faces are being added to the room
1422// Returns: the number of the first new face
1423int RoomAddFaces(room *rp, int num_new_faces) {
1424 int i;
1425
1426 if (num_new_faces == 0)
1427 return 0;
1428
1429 face *newfaces = (face *)mem_malloc((rp->num_faces + num_new_faces) * sizeof(*newfaces));
1430
1431 ASSERT(newfaces != NULL);
1432
1433 for (i = 0; i < rp->num_faces; i++)
1434 newfaces[i] = rp->faces[i];
1435
1436 mem_free(rp->faces);
1437
1438 rp->faces = newfaces;
1439 rp->num_faces += num_new_faces;
1440
1441 if (rp->num_bbf_regions) {
1442 for (i = 0; i < rp->num_bbf_regions; i++) {
1443 mem_free(rp->bbf_list[i]);
1444 }
1445 mem_free(rp->bbf_list);
1446 mem_free(rp->num_bbf);
1447 mem_free(rp->bbf_list_min_xyz);
1448 mem_free(rp->bbf_list_max_xyz);
1449 mem_free(rp->bbf_list_sector);
1450
1451 rp->num_bbf_regions = 0;
1452 }
1453
1454 return (rp->num_faces - num_new_faces);
1455}
1456
1457// Check if a point is inside, outside, or on an edge of a polygon
1458// Parameters: checkv - the point to be checked

Callers 9

OnTrigAddFloatingMethod · 0.85
OnCreateVolumeConeMethod · 0.85
OnEdgeVolumetricMethod · 0.85
ClipFaceFunction · 0.85
TriangulateFaceFunction · 0.85
EndNewFaceFunction · 0.85
CombineRoomsFunction · 0.85
SplitFaceFunction · 0.85
MergeObjectIntoRoomFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected