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

Function PlaceRoom

editor/HRoom.cpp:583–614  ·  view source on GitHub ↗

Place a room for orientation before attachment Parameters: baseroomp - pointer to the room in the mine to which the new room will be attached baseface - the face on baseroomp to attach to placed_room - the number of the room to be attached placed_room_face the face on placed_room that's attached

Source from the content-addressed store, hash-verified

581// placed_room - the number of the room to be attached
582// placed_room_face the face on placed_room that's attached
583void PlaceRoom(room *baseroomp, int baseface, int placed_room, int placed_room_face, int placed_room_door) {
584 // Clear the placed group if one exists
585 Placed_group = NULL;
586
587 ASSERT(baseroomp->faces[baseface].portal_num == -1);
588
589 room *placedroomp = &Rooms[placed_room];
590
591 // Set globals
592 Placed_room = placed_room;
593 Placed_room_face = placed_room_face;
594 Placed_room_orient.fvec = baseroomp->faces[baseface].normal;
595 Placed_room_angle = 0;
596 Placed_baseroomp = baseroomp;
597 Placed_baseface = baseface;
598 Placed_door = placed_room_door;
599
600 // Compute attach points on each face
601#ifndef NEWEDITOR
602 ComputeCenterPointOnFace(&Placed_room_attachpoint, baseroomp, baseface);
603 ComputeCenterPointOnFace(&Placed_room_origin, placedroomp, placed_room_face);
604#else
605 ComputeFaceBoundingCircle(&Placed_room_attachpoint, baseroomp, baseface);
606 ComputeFaceBoundingCircle(&Placed_room_origin, placedroomp, placed_room_face);
607#endif
608
609 // Compute initial orientation matrix
610 ComputePlacedRoomMatrix();
611
612 // Set the flag
613 State_changed = 1;
614}
615
616// Lined up a placed room. Moves the placed room so the closest vert to basevert lines up exactly,
617// and the edge from basevert to basevert+1 lines up with the corresponding edge on the placed room.

Callers 2

OnRoomPlaceRoomMethod · 0.85
PlaceDoorFunction · 0.85

Calls 2

ComputeCenterPointOnFaceFunction · 0.85
ComputePlacedRoomMatrixFunction · 0.85

Tested by

no test coverage detected