fix: keep the zone boundary lines and read the luz scene count as the client does

Each boundary line's destination is read as a map ID and an instance ID into a LWOZONEID. The scene count is a byte before version 37 and a u32 from it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-26 20:33:41 -05:00
parent b98be3695c
commit f8a99c45a5
4 changed files with 83 additions and 21 deletions

View File

@@ -70,7 +70,8 @@ void Zone::LoadZoneIntoMemory() {
BinaryIO::BinaryRead(file, m_SpawnpointRotation);
}
if (m_FileFormatVersion <= Zone::FileFormatVersion::LateAlpha) {
// A byte before version 37 (LateAlpha), a u32 from it
if (m_FileFormatVersion < Zone::FileFormatVersion::LateAlpha) {
uint8_t sceneCount;
BinaryIO::BinaryRead(file, sceneCount);
m_SceneCount = sceneCount;
@@ -80,17 +81,20 @@ void Zone::LoadZoneIntoMemory() {
LoadScene(file);
}
// Zone boundary lines — skip past them for correct file positioning
// Zone boundary lines: a count byte, then the lines
uint8_t numBoundaries = 0;
BinaryIO::BinaryRead(file, numBoundaries);
for (uint8_t i = 0; i < numBoundaries; ++i) {
NiPoint3 normal, point, spawnLocation;
uint32_t packed, destSceneID;
BinaryIO::BinaryRead(file, normal);
BinaryIO::BinaryRead(file, point);
BinaryIO::BinaryRead(file, packed);
BinaryIO::BinaryRead(file, destSceneID);
BinaryIO::BinaryRead(file, spawnLocation);
m_Boundaries.resize(numBoundaries);
for (auto& boundary : m_Boundaries) {
LWOMAPID destMapID = 0;
LWOINSTANCEID destInstanceID = 0;
BinaryIO::BinaryRead(file, boundary.normal);
BinaryIO::BinaryRead(file, boundary.point);
BinaryIO::BinaryRead(file, destMapID);
BinaryIO::BinaryRead(file, destInstanceID);
boundary.destinationZone = LWOZONEID(destMapID, destInstanceID, 0);
BinaryIO::BinaryRead(file, boundary.destinationSceneID);
BinaryIO::BinaryRead(file, boundary.spawnLocation);
}
BinaryIO::ReadString<uint8_t>(file, m_ZoneRawPath, BinaryIO::ReadType::String);