metaforce/DataSpec/DNAMP1/MAPA.hpp

120 lines
3.5 KiB
C++
Raw Normal View History

2015-08-08 00:08:16 +00:00
#ifndef __DNAMP1_MAPA_HPP__
#define __DNAMP1_MAPA_HPP__
#include <vector>
2015-10-26 02:31:09 +00:00
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MAPA.hpp"
#include "DNAMP1.hpp"
2015-08-08 00:08:16 +00:00
namespace Retro
{
namespace DNAMP1
{
struct MAPA : BigDNA
{
DECL_DNA
Value<atUint32> magic;
Value<atUint32> version;
Value<atUint32> unknown1;
Value<atUint32> unknown2;
Value<atVec3f> aabbMin;
Value<atVec3f> aabbMax;
Value<atUint32> mappableObjectCount;
Value<atUint32> vertexCount;
Value<atUint32> surfaceCount;
struct MappableObject : BigDNA
{
DECL_DNA
2015-11-21 01:16:07 +00:00
enum class Type : atUint32
2015-10-26 02:31:09 +00:00
{
2015-11-21 01:16:07 +00:00
BlueDoor = 0,
ShieldDoor = 1,
IceDoor = 2,
WaveDoor = 3,
PlasmaDoor = 4,
BigDoor1 = 5,
BigDoor2 = 6,
IceDoorCeiling = 7,
IceDoorFloor = 8,
WaveDoorCeiling = 9,
WaveDoorFloor = 10,
IceDoorFloor2 = 13,
WaveDoorFloor2 = 14,
DownArrowYellow = 27, /* Maintenance Tunnel */
UpArrowYellow = 28, /* Phazon Processing Center */
DownArrowGreen = 29, /* Elevator A */
UpArrowGreen = 30, /* Elite Control Access */
DownArrowRed = 31, /* Elevator B */
UpArrowRed = 32, /* Fungal Hall Access */
TransportLift = 33,
SaveStation = 34,
MissileStation = 37
2015-10-26 02:31:09 +00:00
};
Value<Type> type;
2015-08-08 00:08:16 +00:00
Value<atUint32> unknown1;
2015-10-26 02:31:09 +00:00
Value<atUint32> sclyId;
2015-08-08 00:08:16 +00:00
Seek<DNA_COUNT(4), Athena::Current> seek1;
2015-10-26 02:31:09 +00:00
Value<atVec4f> transformMtx[3];
2015-08-08 00:08:16 +00:00
Seek<DNA_COUNT(0x10), Athena::Current> seek2;
};
Vector<MappableObject, DNA_COUNT(mappableObjectCount)> mappableObjects;
Vector<atVec3f, DNA_COUNT(vertexCount)> vertices;
struct SurfaceHeader : BigDNA
{
DECL_DNA
2015-08-09 01:12:52 +00:00
Value<atVec3f> normal;
2015-10-26 02:31:09 +00:00
Value<atVec3f> centroid;
Value<atUint32> polyOff;
Value<atUint32> edgeOff;
2015-08-08 00:08:16 +00:00
};
Vector<SurfaceHeader, DNA_COUNT(surfaceCount)> surfaceHeaders;
struct Surface : BigDNA
{
DECL_DNA
Value<atUint32> primitiveCount;
struct Primitive : BigDNA
{
DECL_DNA
Value<atUint32> type;
Value<atUint32> indexCount;
2015-10-26 02:31:09 +00:00
Vector<atUint8, DNA_COUNT(indexCount)> indices;
2015-08-08 00:08:16 +00:00
Align<4> align;
};
Vector<Primitive, DNA_COUNT(primitiveCount)> primitives;
Value<atUint32> borderCount;
struct Border : BigDNA
{
DECL_DNA
Value<atUint32> indexCount;
2015-10-26 02:31:09 +00:00
Vector<atUint8, DNA_COUNT(indexCount)> indices;
2015-08-08 00:08:16 +00:00
Align<4> align;
};
Vector<Border, DNA_COUNT(borderCount)> borders;
};
Vector<Surface, DNA_COUNT(surfaceCount)> surfaces;
2015-10-26 02:31:09 +00:00
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
{
MAPA mapa;
mapa.read(rs);
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
}
2015-08-08 00:08:16 +00:00
};
}
}
#endif