MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / FindRoomNumber

Function FindRoomNumber

TombEngine/Game/room.cpp:787–813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

785}
786
787int FindRoomNumber(const Vector3i& pos, int startRoomNumber, bool onlyNeighbors)
788{
789 if (startRoomNumber != NO_VALUE && startRoomNumber < g_Level.Rooms.size())
790 {
791 const auto& room = g_Level.Rooms[startRoomNumber];
792 for (int neighborRoomNumber : room.NeighborRoomNumbers)
793 {
794 const auto& neighborRoom = g_Level.Rooms[neighborRoomNumber];
795 if (neighborRoomNumber != startRoomNumber && IsPointInRoom(pos, neighborRoomNumber))
796 {
797 return neighborRoomNumber;
798 }
799 }
800 }
801
802 if (!onlyNeighbors)
803 {
804 // TODO: Optimise search to O(log n) with BVH. -- Sezz 2025.03.01
805 for (int roomNumber = 0; roomNumber < g_Level.Rooms.size(); roomNumber++)
806 {
807 if (IsPointInRoom(pos, roomNumber))
808 return roomNumber;
809 }
810 }
811
812 return (startRoomNumber != NO_VALUE) ? startRoomNumber : 0;
813}
814
815Vector3i GetRoomCenter(int roomNumber)
816{

Callers 15

DoVehicleWaterMovementFunction · 0.85
UpdateVehicleRoomFunction · 0.85
VentilatorEffectFunction · 0.85
CalculateSpotCamerasFunction · 0.85
GetTargetOnLOSFunction · 0.85
SpawnDustParticlesMethod · 0.85
ProbeMethod · 0.85
CreateFunction · 0.85
SetPositionMethod · 0.85
EmitParticleFunction · 0.85
EmitAdvancedParticleFunction · 0.85

Calls 2

IsPointInRoomFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected