metaforce/DataSpec/DNAMP1/MLVL.hpp

170 lines
4.9 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2018-06-29 20:21:36 +00:00
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/MLVL.hpp"
#include "DNAMP1.hpp"
2015-06-24 20:56:23 +00:00
2017-12-29 08:08:12 +00:00
namespace DataSpec::DNAMP1
2015-06-24 20:56:23 +00:00
{
2018-02-22 07:24:51 +00:00
struct MLVL : BigDNA
2015-06-24 20:56:23 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA_YAML
Value<atUint32> magic;
2015-06-24 20:56:23 +00:00
Value<atUint32> version;
2015-07-09 06:40:55 +00:00
UniqueID32 worldNameId;
UniqueID32 saveWorldId;
UniqueID32 worldSkyboxId;
2015-06-24 20:56:23 +00:00
Value<atUint32> memRelayLinkCount;
2018-02-22 07:24:51 +00:00
struct MemRelayLink : BigDNA
2015-06-24 20:56:23 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA_YAML
2015-06-24 20:56:23 +00:00
Value<atUint32> memRelayId;
Value<atUint32> targetId;
Value<atUint16> msg;
2015-12-03 04:11:03 +00:00
Value<bool> active;
2015-06-24 20:56:23 +00:00
};
2018-02-25 08:23:27 +00:00
Vector<MemRelayLink, AT_DNA_COUNT(memRelayLinkCount)> memRelayLinks;
2015-06-24 20:56:23 +00:00
Value<atUint32> areaCount;
Value<atUint32> unknown1;
2018-02-22 07:24:51 +00:00
struct Area : BigDNA
2015-06-24 20:56:23 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA_YAML
2015-07-09 06:40:55 +00:00
UniqueID32 areaNameId;
2015-06-24 20:56:23 +00:00
Value<atVec4f> transformMtx[3];
Value<atVec3f> aabb[2];
2015-07-09 06:40:55 +00:00
UniqueID32 areaMREAId;
Value<atUint32> areaId;
2015-06-24 20:56:23 +00:00
Value<atUint32> attachedAreaCount;
2018-02-25 08:23:27 +00:00
Vector<atUint16, AT_DNA_COUNT(attachedAreaCount)> attachedAreas;
2015-06-24 20:56:23 +00:00
2018-02-22 07:24:51 +00:00
struct Dependency : BigDNA
2015-06-24 20:56:23 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA_YAML
2015-07-09 06:40:55 +00:00
UniqueID32 id;
2015-08-23 06:42:29 +00:00
DNAFourCC type;
2016-10-02 22:41:36 +00:00
Dependency() = default;
Dependency(const UniqueID32& idin, const hecl::FourCC& fcc)
2018-04-02 04:27:24 +00:00
: id(idin), type(fcc) {}
2015-06-24 20:56:23 +00:00
};
2018-04-02 04:27:24 +00:00
Value<atUint32> lazyDepCount;
Vector<Dependency, AT_DNA_COUNT(lazyDepCount)> lazyDeps;
Value<atUint32> depCount;
2018-02-25 08:23:27 +00:00
Vector<Dependency, AT_DNA_COUNT(depCount)> deps;
2015-06-24 20:56:23 +00:00
Value<atUint32> depLayerCount;
2018-02-25 08:23:27 +00:00
Vector<atUint32, AT_DNA_COUNT(depLayerCount)> depLayers;
2015-06-24 20:56:23 +00:00
Value<atUint32> dockCount;
2018-02-22 07:24:51 +00:00
struct Dock : BigDNA
2015-06-24 20:56:23 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA_YAML
2015-06-24 20:56:23 +00:00
Value<atUint32> endpointCount;
2018-02-22 07:24:51 +00:00
struct Endpoint : BigDNA
2015-06-24 20:56:23 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA_YAML
2015-06-24 20:56:23 +00:00
Value<atUint32> areaIdx;
Value<atUint32> dockIdx;
};
2018-02-25 08:23:27 +00:00
Vector<Endpoint, AT_DNA_COUNT(endpointCount)> endpoints;
2015-06-24 20:56:23 +00:00
Value<atUint32> planeVertCount;
2018-02-25 08:23:27 +00:00
Vector<atVec3f, AT_DNA_COUNT(planeVertCount)> planeVerts;
2015-06-24 20:56:23 +00:00
};
2018-02-25 08:23:27 +00:00
Vector<Dock, AT_DNA_COUNT(dockCount)> docks;
2015-06-24 20:56:23 +00:00
};
2018-02-25 08:23:27 +00:00
Vector<Area, AT_DNA_COUNT(areaCount)> areas;
2015-06-24 20:56:23 +00:00
2016-10-08 03:41:08 +00:00
void finishLastArea()
{
if (areas.size())
{
MLVL::Area& areaLast = areas.back();
areaLast.attachedAreaCount = areaLast.attachedAreas.size();
2018-04-02 04:27:24 +00:00
areaLast.lazyDepCount = areaLast.lazyDeps.size();
2016-10-08 03:41:08 +00:00
areaLast.depCount = areaLast.deps.size();
areaLast.depLayerCount = areaLast.depLayers.size();
areaLast.dockCount = areaLast.docks.size();
}
}
2015-07-09 06:40:55 +00:00
UniqueID32 worldMap;
2015-06-24 20:56:23 +00:00
Value<atUint8> unknown2;
Value<atUint32> unknown3;
Value<atUint32> audioGroupCount;
2018-02-22 07:24:51 +00:00
struct AudioGroup : BigDNA
2015-06-24 20:56:23 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA_YAML
2016-10-01 01:28:19 +00:00
Value<atUint32> groupId;
2015-07-09 06:40:55 +00:00
UniqueID32 agscId;
2015-06-24 20:56:23 +00:00
};
2018-02-25 08:23:27 +00:00
Vector<AudioGroup, AT_DNA_COUNT(audioGroupCount)> audioGroups;
2015-06-24 20:56:23 +00:00
String<-1> unkString;
Value<atUint32> layerFlagCount;
2018-02-22 07:24:51 +00:00
struct LayerFlags : BigDNA
2015-06-24 20:56:23 +00:00
{
2018-02-22 07:24:51 +00:00
AT_DECL_DNA_YAML
2015-06-24 20:56:23 +00:00
Value<atUint32> layerCount;
Value<atUint64> flags;
};
2018-02-25 08:23:27 +00:00
Vector<LayerFlags, AT_DNA_COUNT(layerFlagCount)> layerFlags;
2015-06-24 20:56:23 +00:00
Value<atUint32> layerNameCount;
2018-02-25 08:23:27 +00:00
Vector<String<-1>, AT_DNA_COUNT(layerNameCount)> layerNames;
2015-06-24 20:56:23 +00:00
Value<atUint32> layerNameOffsetCount;
2018-02-25 08:23:27 +00:00
Vector<atUint32, AT_DNA_COUNT(layerNameOffsetCount)> layerNameOffsets;
2015-08-02 04:25:38 +00:00
void readMeta(athena::io::YAMLDocReader& __dna_docin)
{
/* worldSkyboxId */
__dna_docin.enumerate("worldSkyboxId", worldSkyboxId);
/* audioGroupCount squelched */
/* audioGroups */
audioGroupCount = __dna_docin.enumerate("audioGroups", audioGroups);
}
void writeMeta(athena::io::YAMLDocWriter& __dna_docout) const
{
/* worldSkyboxId */
__dna_docout.enumerate("worldSkyboxId", worldSkyboxId);
/* audioGroupCount squelched */
/* audioGroups */
__dna_docout.enumerate("audioGroups", audioGroups);
}
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
2016-03-04 23:04:53 +00:00
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
2017-12-29 08:08:12 +00:00
hecl::blender::Token& btok,
2016-10-01 23:20:20 +00:00
std::function<void(const hecl::SystemChar*)> fileChanged);
2017-12-29 08:08:12 +00:00
using World = hecl::blender::World;
2016-10-01 23:20:20 +00:00
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
2016-12-25 01:36:42 +00:00
const World& wld,
2017-12-29 08:08:12 +00:00
hecl::blender::Token& btok);
static bool CookMAPW(const hecl::ProjectPath& outPath,
const World& wld,
2017-12-29 08:08:12 +00:00
hecl::blender::Token& btok);
static bool CookSAVW(const hecl::ProjectPath& outPath,
const World& wld);
2015-06-24 20:56:23 +00:00
};
2015-07-01 23:50:39 +00:00
}