metaforce/DataSpec/DNAMP1/EVNT.hpp

93 lines
2.4 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2015-08-15 04:12:15 +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"
2015-08-15 04:12:15 +00:00
2018-12-08 05:30:43 +00:00
namespace DataSpec::DNAMP1 {
2015-08-15 04:12:15 +00:00
2018-12-08 05:30:43 +00:00
struct EVNT : BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
Value<atUint32> version;
2015-08-15 04:12:15 +00:00
2018-12-08 05:30:43 +00:00
struct POINode : BigDNA {
AT_DECL_DNA_YAML
Value<atUint16> unk0;
String<-1> name;
Value<atUint16> type;
struct CharAnimTime : BigDNA {
enum class Type : atUint32 { NonZero, ZeroIncreasing, ZeroSteady, ZeroDecreasing, Infinity };
2016-04-11 07:10:28 +00:00
2018-12-08 05:30:43 +00:00
AT_DECL_DNA_YAML
Value<float> time;
Value<Type> type;
2015-08-15 04:12:15 +00:00
};
2018-12-08 05:30:43 +00:00
CharAnimTime animTime;
Value<atUint32> idx;
Value<bool> unk2;
Value<float> weight;
Value<atUint32> charIdx;
Value<atUint32> flags;
};
2015-08-15 04:12:15 +00:00
2018-12-08 05:30:43 +00:00
struct BoolPOINode : POINode {
AT_DECL_DNA_YAML
Value<atUint8> value;
};
Value<atUint32> boolPOICount;
Vector<BoolPOINode, AT_DNA_COUNT(boolPOICount)> boolPOINodes;
2015-08-15 04:12:15 +00:00
2018-12-08 05:30:43 +00:00
struct Int32POINode : POINode {
AT_DECL_DNA_YAML
Value<atUint32> value;
String<-1> locator;
};
Value<atUint32> int32POICount;
Vector<Int32POINode, AT_DNA_COUNT(int32POICount)> int32POINodes;
2015-08-15 04:12:15 +00:00
2018-12-08 05:30:43 +00:00
struct ParticlePOINode : POINode {
AT_DECL_DNA_YAML
Value<atUint32> duration;
DNAFourCC ptype;
UniqueID32 id;
String<-1> locator;
Value<float> scale;
Value<atUint32> parentMode;
};
Value<atUint32> particlePOICount;
Vector<ParticlePOINode, AT_DNA_COUNT(particlePOICount)> particlePOINodes;
2016-01-19 05:32:34 +00:00
2018-12-08 05:30:43 +00:00
struct SoundPOINode : POINode {
AT_DECL_DNA_YAML
Value<atUint32> soundId;
Value<float> falloff;
Value<float> maxDist;
};
Value<atUint32> soundPOICount;
Vector<SoundPOINode, AT_DNA_COUNT(soundPOICount)> soundPOINodes;
2018-12-08 05:30:43 +00:00
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
EVNT evnt;
evnt.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(evnt, writer);
return true;
}
2018-12-08 05:30:43 +00:00
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
EVNT evnt;
athena::io::FileReader reader(inPath.getAbsolutePath());
athena::io::FromYAMLStream(evnt, reader);
athena::io::FileWriter ws(outPath.getAbsolutePath());
evnt.write(ws);
return true;
}
2015-08-15 04:12:15 +00:00
2018-12-08 05:30:43 +00:00
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const {
for (const ParticlePOINode& node : particlePOINodes)
g_curSpec->flattenDependencies(node.id, pathsOut);
}
};
2015-08-15 04:12:15 +00:00
2018-12-08 05:30:43 +00:00
} // namespace DataSpec::DNAMP1