mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-21 22:24:21 +00:00
- Add eSceneType enum (General, Audio) replacing raw uint32_t in SceneRef - Filter BuildSceneGraph to only include General scenes - Skip transitions referencing non-general scenes in adjacency graph - Rename SceneRef unknown fields to scenePosition/sceneRadius - Zone parsing and Level improvements Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
123 lines
2.5 KiB
C++
123 lines
2.5 KiB
C++
#pragma once
|
|
#include "dZMCommon.h"
|
|
#include <map>
|
|
#include <iostream>
|
|
#include "Zone.h"
|
|
|
|
struct LvlDrawDistances {
|
|
float fogNear{};
|
|
float fogFar{};
|
|
float postFogSolid{};
|
|
float postFogFade{};
|
|
float staticObjDistance{};
|
|
float dynamicObjDistance{};
|
|
};
|
|
|
|
struct LvlCullVal {
|
|
uint32_t groupID{};
|
|
float min{};
|
|
float max{};
|
|
};
|
|
|
|
struct LvlLightingInfo {
|
|
float blendTime{};
|
|
float ambient[3]{};
|
|
float specular[3]{};
|
|
float upperHemi[3]{};
|
|
NiPoint3 position;
|
|
bool hasDrawDistances{};
|
|
LvlDrawDistances minDraw;
|
|
LvlDrawDistances maxDraw;
|
|
std::vector<LvlCullVal> cullVals;
|
|
float fogNear{};
|
|
float fogFar{};
|
|
float fogColor[3]{};
|
|
float dirLight[3]{};
|
|
NiPoint3 startPosition;
|
|
NiQuaternion startRotation = QuatUtils::IDENTITY;
|
|
bool hasSpawn{};
|
|
};
|
|
|
|
struct LvlSkydomeInfo {
|
|
std::string filename;
|
|
std::string skyLayerFilename;
|
|
std::string ringLayer[4];
|
|
};
|
|
|
|
struct LvlEditorColor { float r{}, g{}, b{}; };
|
|
|
|
struct LvlEditorSettings {
|
|
std::vector<LvlEditorColor> savedColors;
|
|
};
|
|
|
|
struct LvlEnvironmentData {
|
|
LvlLightingInfo lighting;
|
|
LvlSkydomeInfo skydome;
|
|
LvlEditorSettings editor;
|
|
bool hasEditor{};
|
|
};
|
|
|
|
struct LvlParticle {
|
|
uint16_t priority{};
|
|
NiPoint3 position;
|
|
NiQuaternion rotation = QuatUtils::IDENTITY;
|
|
std::string effectNames;
|
|
LwoNameValue config;
|
|
};
|
|
|
|
class Level {
|
|
public:
|
|
enum ChunkTypeID : uint16_t {
|
|
FileInfo = 1000,
|
|
SceneEnviroment = 2000,
|
|
SceneObjectData,
|
|
SceneParticleData
|
|
};
|
|
|
|
enum ChunkTypes {
|
|
Enviroment,
|
|
Objects,
|
|
Particles
|
|
};
|
|
|
|
struct FileInfoChunk {
|
|
uint32_t version;
|
|
uint32_t revision;
|
|
uint32_t enviromentChunkStart;
|
|
uint32_t objectChunkStart;
|
|
uint32_t particleChunkStart;
|
|
};
|
|
|
|
struct Header {
|
|
uint32_t id;
|
|
uint16_t chunkVersion;
|
|
ChunkTypeID chunkType;
|
|
uint32_t size;
|
|
uint32_t startPosition;
|
|
FileInfoChunk fileInfo;
|
|
LWOSCENEID lwoSceneID;
|
|
};
|
|
|
|
public:
|
|
Level(Zone* parentZone, const std::string& filepath);
|
|
|
|
static void MakeSpawner(const SceneObject& obj);
|
|
|
|
std::map<uint32_t, Header> m_ChunkHeaders;
|
|
LvlEnvironmentData m_Environment;
|
|
bool m_HasEnvironment{};
|
|
std::vector<LvlParticle> m_Particles;
|
|
private:
|
|
Zone* m_ParentZone;
|
|
|
|
//private functions:
|
|
void ReadChunks(std::istream& file);
|
|
void ReadFileInfoChunk(std::istream& file, Header& header);
|
|
void ReadEnvironmentChunk(std::istream& file, Header& header);
|
|
void ReadLighting(std::istream& file, uint32_t version);
|
|
void ReadSkydome(std::istream& file, uint32_t version);
|
|
void ReadEditor(std::istream& file);
|
|
void ReadSceneObjectDataChunk(std::istream& file, Header& header);
|
|
void ReadParticleChunk(std::istream& file, Header& header);
|
|
};
|