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

Function JoinRoomsExact

editor/HRoom.cpp:1516–1541  ·  view source on GitHub ↗

Connects two rooms if they already match up exactly Parameters: attroomp,attface - one end of the new room baseroom,baseface - the other end of the new room

Source from the content-addressed store, hash-verified

1514// Parameters: attroomp,attface - one end of the new room
1515// baseroom,baseface - the other end of the new room
1516void JoinRoomsExact(room *attroomp, int attface, room *baseroomp, int baseface) {
1517 // Check that the two faces don't already have portals
1518 if (attroomp->faces[attface].portal_num != -1) {
1519 OutrageMessageBox("Cannot join: There is already a portal at %d:%d", ROOMNUM(attroomp), attface);
1520 return;
1521 }
1522 if (baseroomp->faces[baseface].portal_num != -1) {
1523 OutrageMessageBox("Cannot join: There is already a portal at %d:%d", ROOMNUM(baseroomp), baseface);
1524 return;
1525 }
1526
1527 // Check if we can do an exact match
1528 if (!MatchPortalFaces(baseroomp, baseface, attroomp, attface, 1)) {
1529 OutrageMessageBox("Cannot do exact join: These faces do not match");
1530 return;
1531 }
1532
1533 // Make the two faces match exactly
1534 MatchPortalFaces(baseroomp, baseface, attroomp, attface);
1535
1536 // Create the portals between the rooms
1537 LinkRoomsSimple(Rooms, ROOMNUM(baseroomp), baseface, ROOMNUM(attroomp), attface);
1538
1539 // Set Changed flag
1540 World_changed = 1;
1541}
1542
1543bool FaceIsPlanar(int nv, int16_t *face_verts, vector *normal, vector *verts);
1544

Callers 1

OnRoomJoinRoomsExactMethod · 0.85

Calls 2

OutrageMessageBoxFunction · 0.85
MatchPortalFacesFunction · 0.85

Tested by

no test coverage detected