| 1743 | } |
| 1744 | |
| 1745 | void LoadBoxes() |
| 1746 | { |
| 1747 | // Read boxes |
| 1748 | int boxCount = ReadCount(CUBE(1024)); |
| 1749 | TENLog("Box count: " + std::to_string(boxCount), LogLevel::Info); |
| 1750 | g_Level.PathfindingBoxes.resize(boxCount); |
| 1751 | ReadBytes(g_Level.PathfindingBoxes.data(), boxCount * sizeof(BOX_INFO)); |
| 1752 | |
| 1753 | // Read overlaps |
| 1754 | int overlapCount = ReadCount(CUBE(1024)); |
| 1755 | TENLog("Overlap count: " + std::to_string(overlapCount), LogLevel::Info); |
| 1756 | g_Level.Overlaps.resize(overlapCount); |
| 1757 | ReadBytes(g_Level.Overlaps.data(), overlapCount * sizeof(OVERLAP)); |
| 1758 | |
| 1759 | // Read zones |
| 1760 | int zoneGroupCount = ReadCount(CUBE(1024)); |
| 1761 | TENLog("Zone group count: " + std::to_string(zoneGroupCount), LogLevel::Info); |
| 1762 | |
| 1763 | for (int i = 0; i < 2; i++) |
| 1764 | { |
| 1765 | for (int j = 0; j < zoneGroupCount; j++) |
| 1766 | { |
| 1767 | if (j >= (int)ZoneType::MaxZone) |
| 1768 | { |
| 1769 | int excessiveZoneGroups = zoneGroupCount - j + 1; |
| 1770 | TENLog("Level file contains extra pathfinding data, number of excessive zone groups is " + |
| 1771 | std::to_string(excessiveZoneGroups) + ". These zone groups will be ignored.", LogLevel::Warning); |
| 1772 | CurrentDataPtr += boxCount * sizeof(int); |
| 1773 | } |
| 1774 | else |
| 1775 | { |
| 1776 | g_Level.Zones[j][i].resize(boxCount); |
| 1777 | ReadBytes(g_Level.Zones[j][i].data(), boxCount * sizeof(int)); |
| 1778 | } |
| 1779 | } |
| 1780 | } |
| 1781 | |
| 1782 | // By default all blockable boxes are blocked |
| 1783 | for (int i = 0; i < boxCount; i++) |
| 1784 | { |
| 1785 | if (g_Level.PathfindingBoxes[i].flags & BLOCKABLE) |
| 1786 | g_Level.PathfindingBoxes[i].flags |= BLOCKED; |
| 1787 | } |
| 1788 | } |
| 1789 | |
| 1790 | void LoadMirrors() |
| 1791 | { |