metaforce/DataSpec/DNAMP2/MLVL.hpp

117 lines
3.3 KiB
C++
Raw Normal View History

#ifndef __DNAMP2_MLVL_HPP__
#define __DNAMP2_MLVL_HPP__
2015-09-23 06:35:07 +00:00
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MLVL.hpp"
#include "DNAMP2.hpp"
2015-07-10 05:28:08 +00:00
2017-12-29 08:08:12 +00:00
namespace DataSpec::DNAMP2
2015-07-10 05:28:08 +00:00
{
2015-09-23 06:35:07 +00:00
struct MLVL : BigYAML
2015-07-10 05:28:08 +00:00
{
2015-09-23 06:35:07 +00:00
DECL_YAML
Value<atUint32> magic;
2015-07-10 05:28:08 +00:00
Value<atUint32> version;
UniqueID32 worldNameId;
UniqueID32 darkWorldNameId;
Value<atUint32> unk;
UniqueID32 saveWorldId;
UniqueID32 worldSkyboxId;
Value<atUint32> areaCount;
2015-09-23 06:35:07 +00:00
struct Area : BigYAML
2015-07-10 05:28:08 +00:00
{
2015-09-23 06:35:07 +00:00
DECL_YAML
2015-07-10 05:28:08 +00:00
UniqueID32 areaNameId;
Value<atVec4f> transformMtx[3];
Value<atVec3f> aabb[2];
UniqueID32 areaMREAId;
Value<atUint32> areaId;
2015-07-10 05:28:08 +00:00
Value<atUint32> attachedAreaCount;
Vector<atUint16, DNA_COUNT(attachedAreaCount)> attachedAreas;
Value<atUint32> padding;
Value<atUint32> depCount;
2015-09-23 06:35:07 +00:00
struct Dependency : BigYAML
2015-07-10 05:28:08 +00:00
{
2015-09-23 06:35:07 +00:00
DECL_YAML
2015-07-10 05:28:08 +00:00
UniqueID32 id;
2015-08-23 06:42:29 +00:00
DNAFourCC type;
2015-07-10 05:28:08 +00:00
};
Vector<Dependency, DNA_COUNT(depCount)> deps;
Value<atUint32> depLayerCount;
Vector<atUint32, DNA_COUNT(depLayerCount)> depLayers;
Value<atUint32> dockCount;
2015-09-23 06:35:07 +00:00
struct Dock : BigYAML
2015-07-10 05:28:08 +00:00
{
2015-09-23 06:35:07 +00:00
DECL_YAML
2015-07-10 05:28:08 +00:00
Value<atUint32> endpointCount;
2015-09-23 06:35:07 +00:00
struct Endpoint : BigYAML
2015-07-10 05:28:08 +00:00
{
2015-09-23 06:35:07 +00:00
DECL_YAML
2015-07-10 05:28:08 +00:00
Value<atUint32> areaIdx;
Value<atUint32> dockIdx;
};
Vector<Endpoint, DNA_COUNT(endpointCount)> endpoints;
Value<atUint32> planeVertCount;
Vector<atVec3f, DNA_COUNT(planeVertCount)> planeVerts;
};
Vector<Dock, DNA_COUNT(dockCount)> docks;
Value<atUint32> relCount;
Vector<String<-1>, DNA_COUNT(relCount)> relFilenames;
Value<atUint32> relOffsetCount;
Vector<atUint32, DNA_COUNT(relOffsetCount)> relOffsets;
String<-1> internalAreaName;
};
Vector<Area, DNA_COUNT(areaCount)> areas;
2015-07-10 05:28:08 +00:00
UniqueID32 worldMap;
Value<atUint8> unknown2;
Value<atUint32> unknown3;
Value<atUint32> layerFlagCount;
2015-09-23 06:35:07 +00:00
struct LayerFlags : BigYAML
2015-07-10 05:28:08 +00:00
{
2015-09-23 06:35:07 +00:00
DECL_YAML
2015-07-10 05:28:08 +00:00
Value<atUint32> layerCount;
Value<atUint64> flags;
};
Vector<LayerFlags, DNA_COUNT(layerFlagCount)> layerFlags;
Value<atUint32> layerNameCount;
Vector<String<-1>, DNA_COUNT(layerNameCount)> layerNames;
Value<atUint32> layerNameOffsetCount;
Vector<atUint32, DNA_COUNT(layerNameOffsetCount)> layerNameOffsets;
2015-09-23 06:35:07 +00:00
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
2016-03-04 23:04:53 +00:00
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const DNAMP1::PAK::Entry& entry,
bool force,
2017-12-29 08:08:12 +00:00
hecl::blender::Token& btok,
2016-03-04 23:04:53 +00:00
std::function<void(const hecl::SystemChar*)> fileChanged)
2015-09-23 06:35:07 +00:00
{
MLVL mlvl;
mlvl.read(rs);
2016-08-22 03:47:48 +00:00
athena::io::FileWriter writer(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath());
mlvl.toYAMLStream(writer);
2017-12-29 08:08:12 +00:00
hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
entry, force, fileChanged);
2015-09-23 06:35:07 +00:00
}
2015-07-10 05:28:08 +00:00
};
}
#endif // __DNAMP2_MLVL_HPP__