| 708 | } |
| 709 | |
| 710 | int 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 | |
| 751 | namespace TEN::Collision::Room |
| 752 | { |
no test coverage detected