metaforce/DataSpec/DNAMP1/FRME.hpp

275 lines
7.8 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-01-19 05:32:34 +00:00
2018-06-29 20:21:36 +00:00
#include "DataSpec/DNACommon/DNACommon.hpp"
2016-01-19 05:32:34 +00:00
#include "DNAMP1.hpp"
2016-03-04 23:04:53 +00:00
#include <athena/FileWriter.hpp>
2018-02-22 07:24:51 +00:00
#include "athena/DNAOp.hpp"
2016-01-19 05:32:34 +00:00
2018-12-08 05:30:43 +00:00
namespace DataSpec::DNAMP1 {
struct FRME : BigDNA {
AT_DECL_EXPLICIT_DNA
Value<atUint32> version;
Value<atUint32> unk1;
Value<atUint32> modelCount; // Matches MODL widgets
Value<atUint32> unk3;
Value<atUint32> widgetCount;
struct Widget : BigDNA {
2018-02-22 07:24:51 +00:00
AT_DECL_EXPLICIT_DNA
2018-12-08 05:30:43 +00:00
FRME* owner;
DNAFourCC type;
struct WidgetHeader : BigDNA {
AT_DECL_DNA
String<-1> name;
String<-1> parent;
Value<bool> useAnimController;
Value<bool> defaultVisible;
Value<bool> defaultActive;
Value<bool> cullFaces;
Value<atVec4f> color;
Value<atUint32> modelDrawFlags;
} header;
struct IWidgetInfo : BigDNAV {
Delete _dBase;
virtual FourCC fourcc() const = 0;
2016-01-19 05:32:34 +00:00
};
2018-12-08 05:30:43 +00:00
std::unique_ptr<IWidgetInfo> widgetInfo;
Value<bool> isWorker;
Value<atUint16> workerId = 0;
Value<atVec3f> origin;
Value<atVec3f> basis[3];
Value<atVec3f> rotationCenter;
Value<atInt32> unk1;
Value<atInt16> unk2;
struct BWIGInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::BWIG"sv; }
FourCC fourcc() const override { return FOURCC('BWIG'); }
2018-12-08 05:30:43 +00:00
};
struct HWIGInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::HWIG"sv; }
FourCC fourcc() const override { return FOURCC('HWIG'); }
2018-12-08 05:30:43 +00:00
};
struct CAMRInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::CAMR"sv; }
2018-12-08 05:30:43 +00:00
enum class ProjectionType { Perspective, Orthographic };
Value<ProjectionType> projectionType;
struct IProjection : BigDNAV {
Delete _d;
const ProjectionType type;
IProjection(ProjectionType t) : type(t) {}
};
struct PerspectiveProjection : IProjection {
AT_DECL_DNAV
PerspectiveProjection() : IProjection(ProjectionType::Perspective) {}
Value<float> fov;
Value<float> aspect;
Value<float> znear;
Value<float> zfar;
};
struct OrthographicProjection : IProjection {
AT_DECL_DNAV
OrthographicProjection() : IProjection(ProjectionType::Orthographic) {}
Value<float> left;
Value<float> right;
Value<float> top;
Value<float> bottom;
Value<float> znear;
Value<float> zfar;
};
std::unique_ptr<IProjection> projection;
FourCC fourcc() const override { return FOURCC('CAMR'); }
2018-12-08 05:30:43 +00:00
};
struct MODLInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::MODL"sv; }
2018-12-08 05:30:43 +00:00
UniqueID32 model;
enum class BlendMode { Unknown0, Unknown1, Unknown2, Additive };
Value<atUint32> blendMode;
Value<atUint32> lightMask;
FourCC fourcc() const override { return FOURCC('MODL'); }
2018-12-08 05:30:43 +00:00
};
struct LITEInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::LITE"sv; }
2018-12-08 05:30:43 +00:00
enum class ELightType : atUint32 {
Spot = 0,
Point = 1,
Directional = 2,
LocalAmbient = 3,
Custom = 4,
};
Value<ELightType> type;
Value<float> distC;
Value<float> distL;
Value<float> distQ;
Value<float> angC;
Value<float> angL;
Value<float> angQ;
Value<atUint32> loadedIdx;
Value<float> cutoff; /* Spot only */
FourCC fourcc() const override { return FOURCC('LITE'); }
2018-12-08 05:30:43 +00:00
};
struct ENRGInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::ENRG"sv; }
2018-12-08 05:30:43 +00:00
UniqueID32 texture;
FourCC fourcc() const override { return FOURCC('ENRG'); }
2018-12-08 05:30:43 +00:00
};
struct METRInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::METR"sv; }
2018-12-08 05:30:43 +00:00
Value<bool> unk1;
Value<bool> noRoundUp;
Value<atUint32> maxCapacity;
Value<atUint32> workerCount;
FourCC fourcc() const override { return FOURCC('METR'); }
2018-12-08 05:30:43 +00:00
};
struct GRUPInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::GRUP"sv; }
2018-12-08 05:30:43 +00:00
Value<atInt16> defaultWorker;
Value<bool> unk3;
FourCC fourcc() const override { return FOURCC('GRUP'); }
2018-12-08 05:30:43 +00:00
};
struct TBGPInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::TBGP"sv; }
2018-12-08 05:30:43 +00:00
Value<atUint16> elementCount;
Value<atUint16> unk2;
Value<atUint32> unkEnum;
Value<atUint16> defaultSelection;
Value<atUint16> un4;
Value<bool> selectWraparound;
Value<bool> unk6;
Value<float> unkFloat1;
Value<float> unkFloat2;
Value<bool> unk7;
Value<float> unkFloat3;
Value<atUint16> unk8;
Value<atUint16> unk9;
Value<atUint16> unk10;
Value<atUint16> unk11;
FourCC fourcc() const override { return FOURCC('TBGP'); }
2018-12-08 05:30:43 +00:00
};
struct SLGPInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::SLGP"sv; }
2018-12-08 05:30:43 +00:00
Value<float> min;
Value<float> max;
Value<float> cur;
Value<float> increment;
FourCC fourcc() const override { return FOURCC('SLGP'); }
2018-12-08 05:30:43 +00:00
};
2016-01-19 05:32:34 +00:00
2018-12-08 05:30:43 +00:00
struct PANEInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::PANE"sv; }
2018-12-08 05:30:43 +00:00
Value<float> xDim;
Value<float> zDim;
Value<atVec3f> scaleCenter;
FourCC fourcc() const override { return FOURCC('PANE'); }
2018-12-08 05:30:43 +00:00
};
struct TXPNInfo : IWidgetInfo {
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::TXPN"sv; }
2018-12-08 05:30:43 +00:00
enum class Justification : atUint32 {
Left = 0,
Center,
Right,
Full,
NLeft,
NCenter,
NRight,
LeftMono,
CenterMono,
RightMono
};
enum class VerticalJustification : atUint32 {
Top = 0,
Center,
Bottom,
Full,
NTop,
NCenter,
NBottom,
LeftMono,
CenterMono,
RightMono
};
2019-08-11 00:49:41 +00:00
AT_DECL_EXPLICIT_DNAV_NO_TYPE
2018-12-08 05:30:43 +00:00
atUint32 version = 0;
TXPNInfo() {}
TXPNInfo(atUint32 version) : version(version) {}
Value<float> xDim;
Value<float> zDim;
Value<atVec3f> scaleCenter;
UniqueID32 font;
Value<bool> wordWrap;
Value<bool> horizontal;
Value<Justification> justification;
Value<VerticalJustification> verticalJustification;
Value<atVec4f> fillColor;
Value<atVec4f> outlineColor;
Value<atVec2f> blockExtent; /* In points; converted to int by loader */
/* The following is only found in V1 */
UniqueID32 jpnFont;
Value<atInt32> jpnPointScale[2] = {};
FourCC fourcc() const override { return FOURCC('TXPN'); }
2018-12-08 05:30:43 +00:00
};
struct IMGPInfo : IWidgetInfo {
2019-08-11 00:49:41 +00:00
AT_DECL_DNAV_NO_TYPE
2019-10-01 07:38:03 +00:00
std::string_view DNATypeV() const override { return "FRME::IMGP"sv; }
2018-12-08 05:30:43 +00:00
UniqueID32 texture;
Value<atUint32> unk1;
Value<atUint32> unk2;
Value<atUint32> quadCoordCount;
Vector<atVec3f, AT_DNA_COUNT(quadCoordCount)> quadCoords;
Value<atUint32> uvCoordCount;
Vector<atVec2f, AT_DNA_COUNT(uvCoordCount)> uvCoords;
FourCC fourcc() const override { return FOURCC('IMGP'); }
2018-12-08 05:30:43 +00:00
};
};
Vector<Widget, AT_DNA_COUNT(widgetCount)> widgets;
static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
};
2016-01-19 05:32:34 +00:00
2018-12-08 05:30:43 +00:00
} // namespace DataSpec::DNAMP1