mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
LWOSCENEID and LWOSCENEID_INVALID move from dCommonVars.h to dZoneManager/LWOSCENEID.h; only the zone code uses them. The layer half is the scene's layer, now the new eSceneType (dCommon/dEnums) instead of a uint32_t: General (0), Audio (1, the *_audio.lvl scenes named "Audio") and FX (2, Nexus Tower's *_fxs.lvl scenes named "FXs"), the three layers the zone files of every client on disk use. ZoneScene's sceneType is an eSceneType too, so a scene's LWOSCENEID is built from it directly, and the dashboard compares against eSceneType::General instead of 0. The zone checksum still hashes the layer's number. Check in game: every world loads (the zone checksum the client checks is unchanged), Nexus Tower included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
93 lines
3.0 KiB
C++
93 lines
3.0 KiB
C++
#pragma once
|
|
|
|
#include "dZMCommon.h"
|
|
#include "LDFFormat.h"
|
|
#include "LWOSCENEID.h"
|
|
#include "ZoneFile.h"
|
|
#include "ZoneScenes.h"
|
|
#include "tinyxml2.h"
|
|
#include <string>
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
namespace LUTriggers {
|
|
struct Trigger;
|
|
};
|
|
|
|
class Level;
|
|
|
|
// A scene of the zone, with its level once loaded
|
|
struct SceneRef : ZoneScene {
|
|
std::unique_ptr<Level> level;
|
|
std::map<uint32_t, LUTriggers::Trigger*> triggers;
|
|
};
|
|
|
|
class Zone {
|
|
public:
|
|
using FileFormatVersion = ZoneFile::FileFormatVersion;
|
|
|
|
public:
|
|
Zone(const LWOZONEID zoneID);
|
|
~Zone();
|
|
|
|
void Initalize();
|
|
void LoadZoneIntoMemory();
|
|
std::string GetFilePathForZoneID() const;
|
|
uint32_t CalculateChecksum() const;
|
|
void LoadLevelsIntoMemory();
|
|
void AddRevision(LWOSCENEID sceneID, uint32_t revision);
|
|
const LWOZONEID& GetZoneID() const { return m_ZoneID; }
|
|
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;
|
|
const std::vector<Path>& GetPaths() const { return m_Paths; }
|
|
|
|
uint32_t GetWorldID() const { return m_WorldID; }
|
|
[[nodiscard]] std::string GetZoneName() const { return m_ZoneName; }
|
|
std::string GetZoneRawPath() const { return m_ZoneRawPath; }
|
|
std::string GetZonePath() const { return m_ZonePath; }
|
|
|
|
const NiPoint3& GetSpawnPos() const { return m_Spawnpoint; }
|
|
const NiQuaternion& GetSpawnRot() const { return m_SpawnpointRotation; }
|
|
|
|
// Which scenes the client keeps loaded where (ZoneScenes); the scene map is empty unless LoadSceneMap read it
|
|
const ZoneScenes::SceneGraph& GetSceneGraph() const { return m_SceneGraph; }
|
|
const ZoneScenes::SceneMap& GetSceneMap() const { return m_SceneMap; }
|
|
// Reads the terrain file's scene map (for scene ghosting); false when the zone has none
|
|
bool LoadSceneMap();
|
|
|
|
void SetSpawnPos(const NiPoint3& pos) { m_Spawnpoint = pos; }
|
|
void SetSpawnRot(const NiQuaternion& rot) { m_SpawnpointRotation = rot; }
|
|
|
|
private:
|
|
LWOZONEID m_ZoneID;
|
|
std::string m_ZoneFilePath;
|
|
uint32_t m_NumberOfObjectsLoaded;
|
|
uint32_t m_NumberOfSceneTransitionsLoaded;
|
|
FileFormatVersion m_FileFormatVersion;
|
|
uint32_t m_CheckSum;
|
|
uint32_t m_WorldID; //should be equal to the MapID
|
|
NiPoint3 m_Spawnpoint;
|
|
NiQuaternion m_SpawnpointRotation = QuatUtils::IDENTITY;
|
|
uint32_t m_SceneCount;
|
|
|
|
std::string m_ZonePath; //Path to the .luz's folder
|
|
std::string m_ZoneName; //Name given to the zone by a level designer
|
|
std::string m_ZoneDesc; //Description of the zone by a level designer
|
|
std::string m_ZoneRawPath; //Path to the .raw file of this zone.
|
|
|
|
std::map<LWOSCENEID, SceneRef> m_Scenes;
|
|
std::vector<SceneTransition> m_SceneTransitions;
|
|
ZoneScenes::SceneGraph m_SceneGraph;
|
|
ZoneScenes::SceneMap m_SceneMap;
|
|
|
|
uint32_t m_PathDataLength;
|
|
uint32_t m_PathChunkVersion;
|
|
std::vector<Path> m_Paths;
|
|
|
|
std::map<LWOSCENEID, uint32_t> m_MapRevisions; //rhs is the revision!
|
|
//private ("helper") functions:
|
|
void LoadScene(ZoneScene&& zoneScene);
|
|
void LoadLUTriggers(std::string triggerFile, SceneRef& scene);
|
|
};
|