mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-06 11:57:13 +00:00
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:
@@ -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);
|
||||
|
||||
@@ -45,6 +45,15 @@ struct SceneTransitionInfo {
|
||||
NiPoint3 position;
|
||||
};
|
||||
|
||||
// A zone boundary line from the .luz
|
||||
struct ZoneBoundary {
|
||||
NiPoint3 normal;
|
||||
NiPoint3 point;
|
||||
LWOZONEID destinationZone; // the clone ID is always 0
|
||||
uint32_t destinationSceneID{};
|
||||
NiPoint3 spawnLocation;
|
||||
};
|
||||
|
||||
struct SceneTransition {
|
||||
std::string name;
|
||||
std::vector<SceneTransitionInfo> points;
|
||||
@@ -236,6 +245,7 @@ public:
|
||||
const Raw::Raw& GetZoneRaw() const { return m_Raw; }
|
||||
const SceneRef* GetScene(LWOSCENEID sceneID) const;
|
||||
const std::vector<SceneTransition>& GetSceneTransitions() const { return m_SceneTransitions; }
|
||||
const std::vector<ZoneBoundary>& GetBoundaries() const { return m_Boundaries; }
|
||||
const std::map<LWOSCENEID, SceneRef>& GetScenes() const { return m_Scenes; }
|
||||
|
||||
private:
|
||||
@@ -258,6 +268,7 @@ private:
|
||||
|
||||
std::map<LWOSCENEID, SceneRef> m_Scenes;
|
||||
std::vector<SceneTransition> m_SceneTransitions;
|
||||
std::vector<ZoneBoundary> m_Boundaries;
|
||||
|
||||
uint32_t m_PathDataLength;
|
||||
uint32_t m_PathChunkVersion;
|
||||
|
||||
Reference in New Issue
Block a user