fix(zone): scenes of version 30-32 zone files are numbered like the client

Zone files before version 33 have no scene IDs. The client gives each
scene its index in the file as its ID, -1 past 255, with layer 0
(LuzReader::ReadScenes, 1.10.64, via the LWOSceneID from the loop
index); the reader left every such scene at ID 0, so a zone with several
scenes had them all collide on one ID.

The version 30 zones on disk have one scene each, so what they read is
unchanged.

Check in game: nothing to check on live worlds (all are version 36+).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 05:11:27 -05:00
parent d4fc595e2d
commit 9f390958f5
4 changed files with 22 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ void ZoneFile::ReadHeader(std::istream& file) {
} else BinaryIO::BinaryRead(file, sceneCount);
for (uint32_t i = 0; i < sceneCount; ++i) {
ReadScene(file);
ReadScene(file, i);
}
ReadZoneBoundaries(file);
@@ -70,7 +70,7 @@ void ZoneFile::Read(std::istream& file) {
}
}
void ZoneFile::ReadScene(std::istream& file) {
void ZoneFile::ReadScene(std::istream& file, uint32_t index) {
ZoneScene scene;
// Before PrePreAlpha a scene is only its SceneTable ID; ResolveSceneTable finds its file (LuzReader::ReadScenes)
@@ -82,6 +82,8 @@ void ZoneFile::ReadScene(std::istream& file) {
}
BinaryIO::ReadString<uint8_t>(file, scene.filename, BinaryIO::ReadType::String);
// Until LatePreAlpha the file has no scene IDs: a scene's ID is its index (-1 past 255) in the file
scene.id = index < 256 ? index : UINT32_MAX;
if (fileFormatVersion >= FileFormatVersion::LatePreAlpha) {
BinaryIO::BinaryRead(file, scene.id);

View File

@@ -255,7 +255,7 @@ struct ZoneFile {
void ResolveSceneTable(const std::function<std::optional<std::string>(uint32_t)>& sceneName);
private:
void ReadScene(std::istream& file);
void ReadScene(std::istream& file, uint32_t index);
void ReadZoneBoundaries(std::istream& file);
void ReadSceneTransition(std::istream& file);
SceneTransitionInfo ReadSceneTransitionInfo(std::istream& file);