mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-19 18:25:27 +00:00
fix: read and keep a zone file's scenes as the client does
LuzFile::ReadLUZFile, LuzReader::ReadScenes and ZoneLoader::ReadZoneFile (1.10.64): - a version older than 20 is read as 20; - before version 30 a scene is a bare u32 SceneTable ID: in ID order, each one with a SceneTable row gets the next index (-1 past 255) as its ID and the row's sceneName as its file; the others are left out; - from 30 to 32 the file has no scene IDs: a scene's ID is its index in the file (they all had ID 0, colliding); - a later scene with the same ID and layer replaces an earlier one, a scene ID with no layer 0 scene is left out, and before version 41 only the layer 0 scenes are loaded. No 1.10.64 zone file has a duplicate scene, a scene without a layer 0 scene or another layer before version 41, so what live zones load is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include "ZoneScenes.h"
|
||||
#include "tinyxml2.h"
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "Raw.h"
|
||||
@@ -41,6 +43,10 @@ public:
|
||||
const uint32_t GetChecksum() const { return m_CheckSum; }
|
||||
LUTriggers::Trigger* GetTrigger(uint32_t sceneID, uint32_t triggerID) const;
|
||||
const Path* GetPath(std::string name) const;
|
||||
|
||||
// The CDClient SceneTable's sceneName for a scene of a file from before PrePreAlpha; the database's by default
|
||||
using SceneTableLookup = std::function<std::optional<std::string>(uint32_t sceneTableID)>;
|
||||
void SetSceneTableLookup(SceneTableLookup lookup) { m_SceneTableLookup = std::move(lookup); }
|
||||
const std::vector<Path>& GetPaths() const { return m_Paths; }
|
||||
// A path that isn't in the zone's files (tests); earlier GetPath pointers may move
|
||||
void AddPath(Path path) { m_Paths.push_back(std::move(path)); }
|
||||
@@ -97,6 +103,7 @@ private:
|
||||
std::vector<Path> m_Paths;
|
||||
|
||||
std::map<LWOSCENEID, uint32_t> m_MapRevisions; //rhs is the revision!
|
||||
SceneTableLookup m_SceneTableLookup;
|
||||
//private ("helper") functions:
|
||||
void LoadScene(ZoneScene&& zoneScene);
|
||||
void LoadLUTriggers(std::string triggerFile, SceneRef& scene);
|
||||
|
||||
Reference in New Issue
Block a user