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

@@ -167,6 +167,22 @@ TEST(ZoneFileTests, ReadsVersionsBeforePrePreAlpha) {
EXPECT_EQ(zone.scenes[1].filename, "scene9.lvl");
}
// Versions 30-32 have no scene IDs: the client numbers the scenes in file order
TEST(ZoneFileTests, EarlyScenesAreNumberedInOrder) {
ZoneBytes w;
w.Put<uint32_t>(32).Put<uint32_t>(70).Put<uint8_t>(3).Text("a.lvl").Text("b.lvl").Text("c.lvl");
w.Put<uint8_t>(0).Text("zone.raw").Text("Name").Text("Description").Put<uint32_t>(0);
std::istringstream stream(w.data);
ZoneFile zone;
zone.Read(stream);
EXPECT_FALSE(stream.fail());
ASSERT_EQ(zone.scenes.size(), 3u);
EXPECT_EQ(zone.scenes[0].id, 0u);
EXPECT_EQ(zone.scenes[1].id, 1u);
EXPECT_EQ(zone.scenes[2].id, 2u);
EXPECT_EQ(zone.scenes[2].filename, "c.lvl");
}
// A PrePreAlpha (30) file ends at its terrain file's name: no zone name, description, transitions or paths
TEST(ZoneFileTests, PrePreAlphaHasNoZoneName) {
ZoneBytes w;