fix: a zone file's boundaries and scene colours are named and kept as main has them

ZoneBoundary's destinationZone and destinationSceneID and the scene's NiColor, so main's scene tools and tests read
the zone this branch's reader loads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 11:41:35 -06:00
parent 19368f6259
commit 254f9b9919
3 changed files with 14 additions and 13 deletions

View File

@@ -124,9 +124,11 @@ void ZoneFile::ReadScene(std::istream& file, uint32_t index) {
} }
if (fileFormatVersion >= FileFormatVersion::LatePreAlpha) { if (fileFormatVersion >= FileFormatVersion::LatePreAlpha) {
BinaryIO::BinaryRead(file, scene.color_r); uint8_t r, b, g;
BinaryIO::BinaryRead(file, scene.color_b); BinaryIO::BinaryRead(file, r);
BinaryIO::BinaryRead(file, scene.color_g); BinaryIO::BinaryRead(file, b);
BinaryIO::BinaryRead(file, g);
scene.color = NiColor(r / 255.0f, g / 255.0f, b / 255.0f);
} }
scenes.push_back(std::move(scene)); scenes.push_back(std::move(scene));
@@ -180,8 +182,8 @@ void ZoneFile::ReadZoneBoundaries(std::istream& file) {
LWOINSTANCEID instanceID = 0; LWOINSTANCEID instanceID = 0;
BinaryIO::BinaryRead(file, mapID); BinaryIO::BinaryRead(file, mapID);
BinaryIO::BinaryRead(file, instanceID); BinaryIO::BinaryRead(file, instanceID);
boundary.destZoneID = LWOZONEID(mapID, instanceID, 0); boundary.destinationZone = LWOZONEID(mapID, instanceID, 0);
BinaryIO::BinaryRead(file, boundary.destSceneID); BinaryIO::BinaryRead(file, boundary.destinationSceneID);
BinaryIO::BinaryRead(file, boundary.spawnLocation); BinaryIO::BinaryRead(file, boundary.spawnLocation);
zoneBoundaries.push_back(boundary); zoneBoundaries.push_back(boundary);
} }

View File

@@ -11,6 +11,7 @@
#include "dCommonVars.h" #include "dCommonVars.h"
#include "NiPoint3.h" #include "NiPoint3.h"
#include "NiQuaternion.h" #include "NiQuaternion.h"
#include "NiColor.h"
#include "LDFFormat.h" #include "LDFFormat.h"
#include "eSceneType.h" #include "eSceneType.h"
#include "eWaypointCommandType.h" #include "eWaypointCommandType.h"
@@ -34,17 +35,15 @@ struct ZoneScene {
std::string name; std::string name;
NiPoint3 unknown1; NiPoint3 unknown1;
float unknown2{}; float unknown2{};
uint8_t color_r{}; NiColor color;
uint8_t color_g{};
uint8_t color_b{};
}; };
// A line the player crosses to leave the zone (the client's LuzReader::ReadZoneBoundaryLines) // A line the player crosses to leave the zone (the client's LuzReader::ReadZoneBoundaryLines)
struct ZoneBoundary { struct ZoneBoundary {
NiPoint3 normal; NiPoint3 normal;
NiPoint3 point; NiPoint3 point;
LWOZONEID destZoneID; // clone 0 LWOZONEID destinationZone; // clone 0
uint32_t destSceneID{}; uint32_t destinationSceneID{};
NiPoint3 spawnLocation; NiPoint3 spawnLocation;
}; };

View File

@@ -121,10 +121,10 @@ TEST(ZoneFileTests, ReadsZoneBoundaries) {
const auto& boundary = zone.zoneBoundaries[0]; const auto& boundary = zone.zoneBoundaries[0];
EXPECT_EQ(boundary.normal, NiPoint3(1, 0, 0)); EXPECT_EQ(boundary.normal, NiPoint3(1, 0, 0));
EXPECT_EQ(boundary.point, NiPoint3(10, 20, 30)); EXPECT_EQ(boundary.point, NiPoint3(10, 20, 30));
EXPECT_EQ(boundary.destZoneID, LWOZONEID(1100, 7, 0)); EXPECT_EQ(boundary.destinationZone, LWOZONEID(1100, 7, 0));
EXPECT_EQ(boundary.destSceneID, 4u); EXPECT_EQ(boundary.destinationSceneID, 4u);
EXPECT_EQ(boundary.spawnLocation, NiPoint3(5, 6, 7)); EXPECT_EQ(boundary.spawnLocation, NiPoint3(5, 6, 7));
EXPECT_EQ(zone.zoneBoundaries[1].destZoneID, LWOZONEID(1200, 0, 0)); EXPECT_EQ(zone.zoneBoundaries[1].destinationZone, LWOZONEID(1200, 0, 0));
EXPECT_EQ(zone.zoneRawPath, "zone.raw"); EXPECT_EQ(zone.zoneRawPath, "zone.raw");
EXPECT_EQ(zone.zoneName, "Name"); EXPECT_EQ(zone.zoneName, "Name");
EXPECT_EQ(zone.zoneDesc, "Description"); EXPECT_EQ(zone.zoneDesc, "Description");