metaforce/DataSpec/DNAMP1/AFSM.hpp

52 lines
1.5 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-02-04 02:04:05 +00:00
2016-03-04 23:04:53 +00:00
#include <athena/FileWriter.hpp>
2018-06-29 20:21:36 +00:00
#include "DataSpec/DNACommon/DNACommon.hpp"
2016-02-04 02:04:05 +00:00
#include "DNAMP1.hpp"
2018-12-08 05:30:43 +00:00
namespace DataSpec::DNAMP1 {
struct AFSM : public BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> stateCount;
Vector<String<-1>, AT_DNA_COUNT(stateCount)> stateNames;
Value<atUint32> triggerCount;
2016-02-04 02:04:05 +00:00
2018-12-08 05:30:43 +00:00
struct State : public BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> transitionCount;
struct Transition : public BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
Value<atUint32> triggerCount;
2016-02-04 02:04:05 +00:00
2018-12-08 05:30:43 +00:00
struct Trigger : public BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
bool first = false;
String<-1> name;
Value<float> parameter;
Value<atUint32> targetState;
};
Vector<Trigger, AT_DNA_COUNT(triggerCount)> triggers;
2016-02-04 02:04:05 +00:00
};
2018-12-08 05:30:43 +00:00
Vector<Transition, AT_DNA_COUNT(transitionCount)> transitions;
};
Vector<State, AT_DNA_COUNT(stateCount)> states;
2016-02-04 02:04:05 +00:00
2018-12-08 05:30:43 +00:00
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
AFSM afsm;
afsm.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(afsm, writer);
return true;
}
2018-04-07 20:55:57 +00:00
2018-12-08 05:30:43 +00:00
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
AFSM afsm;
athena::io::FileReader reader(inPath.getAbsolutePath());
athena::io::FromYAMLStream(afsm, reader);
athena::io::FileWriter ws(outPath.getAbsolutePath());
afsm.write(ws);
return true;
}
2016-02-04 02:04:05 +00:00
};
2018-12-08 05:30:43 +00:00
} // namespace DataSpec::DNAMP1