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

Function IsRoomOutside

TombEngine/Game/room.cpp:710–749  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

708}
709
710int IsRoomOutside(int x, int y, int z)
711{
712 if (x < 0 || z < 0)
713 return NO_VALUE;
714
715 int xTable = x / BLOCK(1);
716 int zTable = z / BLOCK(1);
717
718 if (OutsideRoomTable[xTable][zTable].empty())
719 return NO_VALUE;
720
721 for (int i = 0; i < OutsideRoomTable[xTable][zTable].size(); i++)
722 {
723 int roomNumber = OutsideRoomTable[xTable][zTable][i];
724 const auto& room = g_Level.Rooms[roomNumber];
725
726 if ((x > (room.Position.x + BLOCK(1)) && x < (room.Position.x + (room.XSize - 1) * BLOCK(1))) &&
727 (y > room.TopHeight && y < room.BottomHeight) &&
728 (z > (room.Position.z + BLOCK(1)) && z < (room.Position.z + (room.ZSize - 1) * BLOCK(1))))
729 {
730 auto pointColl = GetPointCollision(Vector3i(x, y, z), roomNumber);
731
732 if (pointColl.GetFloorHeight() == NO_HEIGHT || y > pointColl.GetFloorHeight())
733 return NO_VALUE;
734
735 if (y < pointColl.GetCeilingHeight())
736 return NO_VALUE;
737
738 if (TestEnvironmentFlags(ENV_FLAG_WATER, room.flags) ||
739 TestEnvironmentFlags(ENV_FLAG_WIND, room.flags))
740 {
741 return pointColl.GetRoomNumber();
742 }
743
744 return NO_VALUE;
745 }
746 }
747
748 return NO_VALUE;
749}
750
751namespace TEN::Collision::Room
752{

Callers 5

SetupLensFlareFunction · 0.85
UpdateRespawnedBaboonFunction · 0.85
RespawnAhmetFunction · 0.85
CalculateSpotCamerasFunction · 0.85
SpawnWeatherParticlesMethod · 0.85

Calls 8

GetPointCollisionFunction · 0.85
TestEnvironmentFlagsFunction · 0.85
Vector3iClass · 0.70
emptyMethod · 0.45
sizeMethod · 0.45
GetFloorHeightMethod · 0.45
GetCeilingHeightMethod · 0.45
GetRoomNumberMethod · 0.45

Tested by

no test coverage detected