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-10-26 02:31:09 +00:00
enum Type : atUint32
{
MOBlueDoor = 0,
MOShieldDoor = 1,
MOIceDoor = 2,
MOWaveDoor = 3,
MOPlasmaDoor = 4,
MOBigDoor1 = 5,
MOBigDoor2 = 6,
MOIceDoorCeiling = 7,
MOIceDoorFloor = 8,
MOWaveDoorCeiling = 9,
MOWaveDoorFloor = 10,
MOIceDoorFloor2 = 13,
MOWaveDoorFloor2 = 14,
MODownArrowYellow = 27, /* Maintenance Tunnel */
MOUpArrowYellow = 28, /* Phazon Processing Center */
MODownArrowGreen = 29, /* Elevator A */
MOUpArrowGreen = 30, /* Elite Control Access */
MODownArrowRed = 31, /* Elevator B */
MOUpArrowRed = 32, /* Fungal Hall Access */
MOTransportLift = 33,
MOSaveStation = 34,
MOMissileStation = 37
};
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