Place a room on the terrain for orientation before attachment Parameters: cellnum - the cell where the room is being placed placed_room - the number of the room to be attached placed_room_face the face on placed_room that's attached
| 1840 | // placed_room - the number of the room to be attached |
| 1841 | // placed_room_face the face on placed_room that's attached |
| 1842 | void PlaceExternalRoom(int cellnum, int placed_room, int placed_room_face, bool align_to_terrain) { |
| 1843 | room *placedroomp = &Rooms[placed_room]; |
| 1844 | |
| 1845 | // Clear the placed group if one exists |
| 1846 | Placed_group = NULL; |
| 1847 | |
| 1848 | // Clear the placed door if one exists |
| 1849 | if (Placed_door != -1) { |
| 1850 | ASSERT(Placed_room != -1); |
| 1851 | FreeRoom(&Rooms[Placed_room]); |
| 1852 | Placed_door = Placed_door = -1; |
| 1853 | } |
| 1854 | |
| 1855 | // Set globals |
| 1856 | Placed_room = placed_room; |
| 1857 | Placed_room_face = placed_room_face; |
| 1858 | Placed_room_angle = 0; |
| 1859 | Placed_baseroomp = NULL; |
| 1860 | |
| 1861 | if (align_to_terrain) |
| 1862 | Placed_room_orient.fvec = TerrainNormals[MAX_TERRAIN_LOD - 1][cellnum].normal1; |
| 1863 | else |
| 1864 | Placed_room_orient.fvec = Identity_matrix.uvec; |
| 1865 | |
| 1866 | // Compute attach point on terrain |
| 1867 | ComputeTerrainSegmentCenter(&Placed_room_attachpoint, cellnum); |
| 1868 | |
| 1869 | // Compute attach points on each face |
| 1870 | #ifndef NEWEDITOR |
| 1871 | ComputeCenterPointOnFace(&Placed_room_origin, placedroomp, placed_room_face); |
| 1872 | #else |
| 1873 | ComputeFaceBoundingCircle(&Placed_room_origin, placedroomp, placed_room_face); |
| 1874 | #endif |
| 1875 | |
| 1876 | // Compute initial orientation matrix |
| 1877 | ComputePlacedRoomMatrix(); |
| 1878 | |
| 1879 | // Set the flag |
| 1880 | State_changed = 1; |
| 1881 | } |
| 1882 | |
| 1883 | // Find all the matching faces between two rooms and join them |
| 1884 | // Returns the number of new portals created |
no test coverage detected