diff --git a/DataSpec/DNACommon/DNACommon.hpp b/DataSpec/DNACommon/DNACommon.hpp index 03bba6b2c..9ba67f498 100644 --- a/DataSpec/DNACommon/DNACommon.hpp +++ b/DataSpec/DNACommon/DNACommon.hpp @@ -41,9 +41,10 @@ public: /* PAK 32-bit Unique ID */ class UniqueID32 : public BigYAML { - uint32_t m_id; + uint32_t m_id = 0; public: Delete expl; + inline operator bool() const {return m_id;} inline void read(Athena::io::IStreamReader& reader) {m_id = reader.readUint32();} inline void write(Athena::io::IStreamWriter& writer) const @@ -67,9 +68,10 @@ public: /* PAK 64-bit Unique ID */ class UniqueID64 : public BigDNA { - uint64_t m_id; + uint64_t m_id = 0; public: Delete expl; + inline operator bool() const {return m_id;} inline void read(Athena::io::IStreamReader& reader) {m_id = reader.readUint64();} inline void write(Athena::io::IStreamWriter& writer) const @@ -98,6 +100,8 @@ class UniqueID128 : public BigDNA }; public: Delete expl; + UniqueID128() {m_id[0]=0; m_id[1]=0;} + inline operator bool() const {return m_id[0] && m_id[1];} inline void read(Athena::io::IStreamReader& reader) { m_id[0] = reader.readUint64(); diff --git a/DataSpec/DNAMP1/ANCS.cpp b/DataSpec/DNAMP1/ANCS.cpp new file mode 100644 index 000000000..df8af92a4 --- /dev/null +++ b/DataSpec/DNAMP1/ANCS.cpp @@ -0,0 +1,1172 @@ +#include "ANCS.hpp" + +namespace Retro +{ +namespace DNAMP1 +{ + +void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(Athena::io::IStreamReader& reader) +{ + parmType = reader.readUint32(); + unk1 = reader.readUint32(); + unk2 = reader.readFloat(); + switch(DataType(parmType)) + { + case DataType::DTInt32: + parmVals[0].int32 = reader.readInt32(); + parmVals[1].int32 = reader.readInt32(); + break; + case DataType::DTUInt32: + case DataType::DTEnum: + parmVals[0].uint32 = reader.readUint32(); + parmVals[1].uint32 = reader.readUint32(); + break; + case DataType::DTFloat: + parmVals[0].float32 = reader.readFloat(); + parmVals[1].float32 = reader.readFloat(); + break; + case DataType::DTBool: + parmVals[0].bool1 = reader.readBool(); + parmVals[1].bool1 = reader.readBool(); + break; + } +} + +void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(Athena::io::IStreamWriter& writer) const +{ + writer.writeUint32(parmType); + writer.writeUint32(unk1); + writer.writeFloat(unk2); + switch(DataType(parmType)) + { + case DataType::DTInt32: + writer.writeInt32(parmVals[0].int32); + writer.writeInt32(parmVals[1].int32); + break; + case DataType::DTUInt32: + case DataType::DTEnum: + writer.writeUint32(parmVals[0].uint32); + writer.writeUint32(parmVals[0].uint32); + break; + case DataType::DTFloat: + writer.writeFloat(parmVals[0].float32); + writer.writeFloat(parmVals[0].float32); + break; + case DataType::DTBool: + writer.writeBool(parmVals[0].bool1); + writer.writeBool(parmVals[0].bool1); + break; + } +} + +void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::fromYAML(Athena::io::YAMLDocReader& reader) +{ + parmType = reader.readUint32("parmType"); + unk1 = reader.readUint32("unk1"); + unk2 = reader.readFloat("unk2"); + reader.enterSubVector("parmVals"); + switch(DataType(parmType)) + { + case DataType::DTInt32: + parmVals[0].int32 = reader.readInt32(nullptr); + parmVals[1].int32 = reader.readInt32(nullptr); + break; + case DataType::DTUInt32: + case DataType::DTEnum: + parmVals[0].uint32 = reader.readUint32(nullptr); + parmVals[1].uint32 = reader.readUint32(nullptr); + break; + case DataType::DTFloat: + parmVals[0].float32 = reader.readFloat(nullptr); + parmVals[1].float32 = reader.readFloat(nullptr); + break; + case DataType::DTBool: + parmVals[0].bool1 = reader.readBool(nullptr); + parmVals[1].bool1 = reader.readBool(nullptr); + break; + default: break; + } + reader.leaveSubVector(); +} + +void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::toYAML(Athena::io::YAMLDocWriter& writer) const +{ + writer.writeUint32("parmType", parmType); + writer.writeUint32("unk1", unk1); + writer.writeFloat("unk2", unk2); + writer.enterSubVector("parmVals"); + switch(DataType(parmType)) + { + case DataType::DTInt32: + writer.writeInt32(nullptr, parmVals[0].int32); + writer.writeInt32(nullptr, parmVals[1].int32); + break; + case DataType::DTUInt32: + case DataType::DTEnum: + writer.writeUint32(nullptr, parmVals[0].uint32); + writer.writeUint32(nullptr, parmVals[0].uint32); + break; + case DataType::DTFloat: + writer.writeFloat(nullptr, parmVals[0].float32); + writer.writeFloat(nullptr, parmVals[0].float32); + break; + case DataType::DTBool: + writer.writeBool(nullptr, parmVals[0].bool1); + writer.writeBool(nullptr, parmVals[0].bool1); + break; + } + writer.leaveSubVector(); +} + +void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(Athena::io::IStreamReader& reader) +{ + id = reader.readUint32(); + atUint32 parmInfoCount = reader.readUint32(); + atUint32 animInfoCount = reader.readUint32(); + + parmInfos.reserve(parmInfoCount); + for (int i=0 ; i 5) + { + atUint32 elscCount = reader.readUint32(); + partResData.elsc.clear(); + partResData.elsc.reserve(elscCount); + for (int i=0 ; i 1) + { + atUint32 aabbCount = reader.readUint32(); + animAABBs.reserve(aabbCount); + for (int i=0 ; i 2) + { + atUint32 effectCount = reader.readUint32(); + effects.reserve(effectCount); + for (int i=0 ; i 3) + { + cmdlOverride.read(reader); + cskrOverride.read(reader); + } + + animIdxs.clear(); + if (sectionCount > 4) + { + atUint32 aidxCount = reader.readUint32(); + animIdxs.reserve(aidxCount); + for (int i=0 ; i 5) + { + writer.writeUint32(partResData.elsc.size()); + for (const UniqueID32& id : partResData.elsc) + id.write(writer); + } + + writer.writeUint32(unk1); + + if (sectionCount > 1) + { + writer.writeUint32(animAABBs.size()); + for (const ActionAABB& aabb : animAABBs) + aabb.write(writer); + } + + if (sectionCount > 2) + { + writer.writeUint32(effects.size()); + for (const Effect& effect : effects) + effect.write(writer); + } + + if (sectionCount > 3) + { + cmdlOverride.write(writer); + cskrOverride.write(writer); + } + + if (sectionCount > 4) + { + writer.writeUint32(animIdxs.size()); + for (atUint32 idx : animIdxs) + writer.writeUint32(idx); + } +} + +void ANCS::CharacterSet::CharacterInfo::fromYAML(Athena::io::YAMLDocReader& reader) +{ + idx = reader.readUint32("idx"); + atUint16 sectionCount = reader.readUint16("sectionCount"); + name = reader.readString("name"); + reader.enterSubRecord("cmdl"); + cmdl.fromYAML(reader); + reader.leaveSubRecord(); + reader.enterSubRecord("cskr"); + cskr.fromYAML(reader); + reader.leaveSubRecord(); + reader.enterSubRecord("cinf"); + cinf.fromYAML(reader); + reader.leaveSubRecord(); + + atUint32 animationCount = reader.readUint32("animationCount"); + animations.reserve(animationCount); + reader.enterSubVector("animations"); + for (int i=0 ; i 5) + { + atUint32 elscCount = reader.readUint32("elscCount"); + partResData.elsc.clear(); + partResData.elsc.reserve(elscCount); + reader.enterSubVector("elsc"); + for (int i=0 ; i 1) + { + atUint32 aabbCount = reader.readUint32("animAABBCount"); + animAABBs.reserve(aabbCount); + reader.enterSubVector("animAABBs"); + for (int i=0 ; i 2) + { + atUint32 effectCount = reader.readUint32("effectCount"); + effects.reserve(effectCount); + reader.enterSubVector("effects"); + for (int i=0 ; i 3) + { + reader.enterSubRecord("cmdlOverride"); + cmdlOverride.fromYAML(reader); + reader.leaveSubRecord(); + reader.enterSubRecord("cskrOverride"); + cskrOverride.fromYAML(reader); + reader.leaveSubRecord(); + } + + animIdxs.clear(); + if (sectionCount > 4) + { + atUint32 animIdxCount = reader.readUint32("animIdxCount"); + animIdxs.reserve(animIdxCount); + reader.enterSubVector("animIdxs"); + for (int i=0 ; i 5) + { + writer.writeUint32("elscCount", partResData.elsc.size()); + writer.enterSubVector("elsc"); + for (const UniqueID32& id : partResData.elsc) + { + writer.enterSubRecord(nullptr); + id.toYAML(writer); + writer.leaveSubRecord(); + } + writer.leaveSubVector(); + } + + writer.writeUint32("unk1", unk1); + + if (sectionCount > 1) + { + writer.writeUint32("animAABBCount", animAABBs.size()); + writer.enterSubVector("animAABBs"); + for (const ActionAABB& aabb : animAABBs) + { + writer.enterSubRecord(nullptr); + aabb.toYAML(writer); + writer.leaveSubRecord(); + } + writer.leaveSubVector(); + } + + if (sectionCount > 2) + { + writer.writeUint32("effectCount", effects.size()); + writer.enterSubVector("effects"); + for (const Effect& effect : effects) + { + writer.enterSubRecord(nullptr); + effect.toYAML(writer); + writer.leaveSubRecord(); + } + writer.leaveSubVector(); + } + + if (sectionCount > 3) + { + writer.enterSubRecord("cmdlOverride"); + cmdlOverride.toYAML(writer); + writer.leaveSubRecord(); + writer.enterSubRecord("cskrOverride"); + cskrOverride.toYAML(writer); + writer.leaveSubRecord(); + } + + if (sectionCount > 4) + { + writer.writeUint32("animIdxCount", animIdxs.size()); + writer.enterSubVector("animIdxs"); + for (atUint32 idx : animIdxs) + writer.writeUint32(nullptr, idx); + writer.leaveSubVector(); + } +} + +void ANCS::AnimationSet::MetaAnimFactory::read(Athena::io::IStreamReader& reader) +{ + IMetaAnim::Type type(IMetaAnim::Type(reader.readUint32())); + switch (type) + { + case IMetaAnim::MAPrimitive: + m_anim.reset(new struct MetaAnimPrimitive); + m_anim->read(reader); + break; + case IMetaAnim::MABlend: + m_anim.reset(new struct MetaAnimBlend); + m_anim->read(reader); + break; + case IMetaAnim::MAPhaseBlend: + m_anim.reset(new struct MetaAnimPhaseBlend); + m_anim->read(reader); + break; + case IMetaAnim::MARandom: + m_anim.reset(new struct MetaAnimRandom); + m_anim->read(reader); + break; + case IMetaAnim::MASequence: + m_anim.reset(new struct MetaAnimSequence); + m_anim->read(reader); + break; + default: + m_anim.reset(nullptr); + break; + } +} + +void ANCS::AnimationSet::MetaAnimFactory::write(Athena::io::IStreamWriter& writer) const +{ + if (!m_anim) + return; + writer.writeInt32(m_anim->m_type); + m_anim->write(writer); +} + +void ANCS::AnimationSet::MetaAnimFactory::fromYAML(Athena::io::YAMLDocReader& reader) +{ + std::string type = reader.readString("type"); + std::transform(type.begin(), type.end(), type.begin(), tolower); + if (!type.compare("primitive")) + { + m_anim.reset(new struct MetaAnimPrimitive); + m_anim->fromYAML(reader); + } + else if (!type.compare("blend")) + { + m_anim.reset(new struct MetaAnimBlend); + m_anim->fromYAML(reader); + } + else if (!type.compare("phaseblend")) + { + m_anim.reset(new struct MetaAnimPhaseBlend); + m_anim->fromYAML(reader); + } + else if (!type.compare("random")) + { + m_anim.reset(new struct MetaAnimRandom); + m_anim->fromYAML(reader); + } + else if (!type.compare("sequence")) + { + m_anim.reset(new struct MetaAnimSequence); + m_anim->fromYAML(reader); + } + else + { + m_anim.reset(nullptr); + } + +} + +void ANCS::AnimationSet::MetaTransFactory::read(Athena::io::IStreamReader& reader) +{ + IMetaTrans::Type type(IMetaTrans::Type(reader.readUint32())); + switch (type) + { + case IMetaTrans::MTMetaAnim: + m_trans.reset(new struct MetaTransMetaAnim); + m_trans->read(reader); + break; + case IMetaTrans::MTTrans: + m_trans.reset(new struct MetaTransTrans); + m_trans->read(reader); + break; + case IMetaTrans::MTPhaseTrans: + m_trans.reset(new struct MetaTransPhaseTrans); + m_trans->read(reader); + break; + case IMetaTrans::MTNoTrans: + default: + m_trans.reset(nullptr); + break; + } +} + +void ANCS::AnimationSet::MetaTransFactory::write(Athena::io::IStreamWriter& writer) const +{ + if (!m_trans) + { + writer.writeInt32(IMetaTrans::MTNoTrans); + return; + } + writer.writeInt32(m_trans->m_type); + m_trans->write(writer); +} + +void ANCS::AnimationSet::MetaTransFactory::fromYAML(Athena::io::YAMLDocReader& reader) +{ + std::string type = reader.readString("type"); + std::transform(type.begin(), type.end(), type.begin(), tolower); + if (!type.compare("metaanim")) + { + m_trans.reset(new struct MetaTransMetaAnim); + m_trans->fromYAML(reader); + } + else if (!type.compare("trans")) + { + m_trans.reset(new struct MetaTransTrans); + m_trans->fromYAML(reader); + } + else if (!type.compare("phasetrans")) + { + m_trans.reset(new struct MetaTransPhaseTrans); + m_trans->fromYAML(reader); + } + else + { + m_trans.reset(nullptr); + } + +} + +void ANCS::AnimationSet::MetaTransFactory::toYAML(Athena::io::YAMLDocWriter& writer) const +{ + if (!m_trans) + { + writer.writeString("type", "NoTrans"); + return; + } + writer.writeString("type", m_trans->m_typeStr?m_trans->m_typeStr:"NoTrans"); + m_trans->toYAML(writer); +} + +void ANCS::AnimationSet::MetaAnimFactory::toYAML(Athena::io::YAMLDocWriter& writer) const +{ + if (!m_anim) + return; + writer.writeString("type", m_anim->m_typeStr); + m_anim->toYAML(writer); +} + +void ANCS::AnimationSet::read(Athena::io::IStreamReader& reader) +{ + atUint16 sectionCount = reader.readUint16(); + + atUint32 animationCount = reader.readUint32(); + animations.reserve(animationCount); + for (int i=0 ; i 1) + { + atUint32 additiveAnimCount = reader.readUint32(); + additiveAnims.reserve(additiveAnimCount); + for (int i=0 ; i 2) + { + atUint32 halfTransitionCount = reader.readUint32(); + halfTransitions.reserve(halfTransitionCount); + for (int i=0 ; i 3) + { + atUint32 animResourcesCount = reader.readUint32(); + animResources.reserve(animResourcesCount); + for (int i=0 ; i 1) + { + writer.writeUint32(additiveAnims.size()); + for (const auto& aa : additiveAnims) + aa.write(writer); + writer.writeFloat(floatA); + writer.writeFloat(floatB); + } + + if (sectionCount > 2) + { + writer.writeUint32(halfTransitions.size()); + for (const auto& ht : halfTransitions) + ht.write(writer); + } + + if (sectionCount > 3) + { + writer.writeUint32(animResources.size()); + for (const auto& ar : animResources) + ar.write(writer); + } +} + +void ANCS::AnimationSet::fromYAML(Athena::io::YAMLDocReader& reader) +{ + atUint16 sectionCount = reader.readUint16("sectionCount"); + + atUint32 animationCount = reader.readUint32("animationCount"); + animations.reserve(animationCount); + reader.enterSubVector("animations"); + for (int i=0 ; i 1) + { + atUint32 additiveAnimCount = reader.readUint32("additiveAnimCount"); + additiveAnims.reserve(additiveAnimCount); + reader.enterSubVector("additiveAnims"); + for (int i=0 ; i 2) + { + atUint32 halfTransitionCount = reader.readUint32("halfTransitionCount"); + halfTransitions.reserve(halfTransitionCount); + reader.enterSubVector("halfTransitions"); + for (int i=0 ; i 3) + { + atUint32 animResourcesCount = reader.readUint32("animResourcesCount"); + animResources.reserve(animResourcesCount); + reader.enterSubVector("animResources"); + for (int i=0 ; i 1) + { + writer.writeUint32("additiveAnimCount", additiveAnims.size()); + writer.enterSubVector("additiveAnims"); + for (const auto& aa : additiveAnims) + { + writer.enterSubRecord(nullptr); + aa.toYAML(writer); + writer.leaveSubRecord(); + } + writer.leaveSubVector(); + writer.writeFloat("floatA", floatA); + writer.writeFloat("floatB", floatB); + } + + if (sectionCount > 2) + { + writer.writeUint32("halfTransitionCount", halfTransitions.size()); + writer.enterSubVector("halfTransitions"); + for (const auto& ht : halfTransitions) + { + writer.enterSubRecord(nullptr); + ht.toYAML(writer); + writer.leaveSubRecord(); + } + writer.leaveSubVector(); + } + + if (sectionCount > 3) + { + writer.writeUint32("animResourcesCount", animResources.size()); + writer.enterSubVector("animResources"); + for (const auto& ar : animResources) + { + writer.enterSubRecord(nullptr); + ar.toYAML(writer); + writer.leaveSubRecord(); + } + writer.leaveSubVector(); + } +} + +} +} + diff --git a/DataSpec/DNAMP1/ANCS.hpp b/DataSpec/DNAMP1/ANCS.hpp new file mode 100644 index 000000000..e48cd42cd --- /dev/null +++ b/DataSpec/DNAMP1/ANCS.hpp @@ -0,0 +1,344 @@ +#ifndef _DNAMP1_ANCS_HPP_ +#define _DNAMP1_ANCS_HPP_ + +#include "../DNACommon/DNACommon.hpp" + +namespace Retro +{ +namespace DNAMP1 +{ + +struct ANCS : BigYAML +{ + DECL_YAML + Value version; + + struct CharacterSet : BigYAML + { + DECL_YAML + Value version; + Value characterCount; + struct CharacterInfo : BigYAML + { + Delete expl; + + atUint32 idx; + std::string name; + UniqueID32 cmdl; + UniqueID32 cskr; + UniqueID32 cinf; + + struct Animation : BigYAML + { + DECL_YAML + Value animIdx; + String<-1> strA; + String<-1> strB; + }; + std::vector animations; + + struct PASDatabase : BigYAML + { + DECL_YAML + Value magic; + Value animStateCount; + Value defaultState; + struct AnimState : BigYAML + { + Delete expl; + atUint32 id; + + struct ParmInfo : BigYAML + { + Delete expl; + enum DataType + { + DTInt32 = 0, + DTUInt32 = 1, + DTFloat = 2, + DTBool = 3, + DTEnum = 4 + }; + union Parm + { + atInt32 int32; + atUint32 uint32; + float float32; + bool bool1; + Parm() : int32(0) {} + Parm(atInt32 val) : int32(val) {} + Parm(atUint32 val) : uint32(val) {} + Parm(float val) : float32(val) {} + Parm(bool val) : bool1(val) {} + }; + + atUint32 parmType; + atUint32 unk1; + float unk2; + Parm parmVals[2]; + + void read(Athena::io::IStreamReader& reader); + void write(Athena::io::IStreamWriter& writer) const; + void fromYAML(Athena::io::YAMLDocReader& reader); + void toYAML(Athena::io::YAMLDocWriter& writer) const; + }; + std::vector parmInfos; + + struct AnimInfo + { + atUint32 id; + std::vector parmVals; + }; + std::vector animInfos; + + void read(Athena::io::IStreamReader& reader); + void write(Athena::io::IStreamWriter& writer) const; + void fromYAML(Athena::io::YAMLDocReader& reader); + void toYAML(Athena::io::YAMLDocWriter& writer) const; + }; + } pasDatabase; + + struct ParticleResData + { + std::vector part; + std::vector swhc; + std::vector unk; + std::vector elsc; + } partResData; + + atUint32 unk1; + + struct ActionAABB : BigYAML + { + DECL_YAML + String<-1> name; + Value aabb[2]; + }; + std::vector animAABBs; + + struct Effect : BigYAML + { + DECL_YAML + String<-1> name; + Value compCount; + struct EffectComponent : BigYAML + { + DECL_YAML + String<-1> name; + FourCC type; + UniqueID32 id; + String<-1> name2; + Value unk1; + Value unk2; + Value unk3; + }; + Vector comps; + }; + std::vector effects; + + UniqueID32 cmdlOverride; + UniqueID32 cskrOverride; + + std::vector animIdxs; + + void read(Athena::io::IStreamReader& reader); + void write(Athena::io::IStreamWriter& writer) const; + void fromYAML(Athena::io::YAMLDocReader& reader); + void toYAML(Athena::io::YAMLDocWriter& writer) const; + + }; + } characterSet; + + struct AnimationSet : BigYAML + { + Delete expl; + + struct IMetaAnim : BigYAML + { + Delete expl; + void read(Athena::io::IStreamReader&) {} + void write(Athena::io::IStreamWriter&) const {} + void fromYAML(Athena::io::YAMLDocReader&) {} + void toYAML(Athena::io::YAMLDocWriter&) const {} + enum Type + { + MAPrimitive = 0, + MABlend = 1, + MAPhaseBlend = 2, + MARandom = 3, + MASequence = 4 + } m_type; + const char* m_typeStr; + IMetaAnim(Type type, const char* typeStr) + : m_type(type), m_typeStr(typeStr) {} + }; + struct MetaAnimFactory : BigYAML + { + Delete expl; + std::unique_ptr m_anim; + void read(Athena::io::IStreamReader& reader); + void write(Athena::io::IStreamWriter& writer) const; + void fromYAML(Athena::io::YAMLDocReader& reader); + void toYAML(Athena::io::YAMLDocWriter& writer) const; + }; + struct MetaAnimPrimitive : IMetaAnim + { + MetaAnimPrimitive() : IMetaAnim(MAPrimitive, "Primitive") {} + DECL_YAML + UniqueID32 animId; + Value animIdx; + String<-1> animName; + Value unk1; + Value unk2; + }; + struct MetaAnimBlend : IMetaAnim + { + MetaAnimBlend() : IMetaAnim(MABlend, "Blend") {} + DECL_YAML + MetaAnimFactory animA; + MetaAnimFactory animB; + Value unkFloat; + Value unk; + }; + struct MetaAnimPhaseBlend : IMetaAnim + { + MetaAnimPhaseBlend() : IMetaAnim(MAPhaseBlend, "PhaseBlend") {} + DECL_YAML + MetaAnimFactory animA; + MetaAnimFactory animB; + Value unkFloat; + Value unk; + }; + struct MetaAnimRandom : IMetaAnim + { + MetaAnimRandom() : IMetaAnim(MARandom, "Random") {} + DECL_YAML + Value animCount; + struct Child : BigYAML + { + DECL_YAML + MetaAnimFactory anim; + Value probability; + }; + Vector children; + }; + struct MetaAnimSequence : IMetaAnim + { + MetaAnimSequence() : IMetaAnim(MASequence, "Sequence") {} + DECL_YAML + Value animCount; + Vector children; + }; + + struct Animation : BigYAML + { + DECL_YAML + String<-1> name; + MetaAnimFactory metaAnim; + }; + std::vector animations; + + struct IMetaTrans : BigYAML + { + Delete expl; + void read(Athena::io::IStreamReader&) {} + void write(Athena::io::IStreamWriter&) const {} + void fromYAML(Athena::io::YAMLDocReader&) {} + void toYAML(Athena::io::YAMLDocWriter&) const {} + enum Type + { + MTMetaAnim = 0, + MTTrans = 1, + MTPhaseTrans = 2, + MTNoTrans = 3, + } m_type; + const char* m_typeStr; + IMetaTrans(Type type, const char* typeStr) + : m_type(type), m_typeStr(typeStr) {} + }; + struct MetaTransFactory : BigYAML + { + Delete expl; + std::unique_ptr m_trans; + void read(Athena::io::IStreamReader& reader); + void write(Athena::io::IStreamWriter& writer) const; + void fromYAML(Athena::io::YAMLDocReader& reader); + void toYAML(Athena::io::YAMLDocWriter& writer) const; + }; + struct MetaTransMetaAnim : IMetaTrans + { + MetaTransMetaAnim() : IMetaTrans(MTMetaAnim, "MetaAnim") {} + DECL_YAML + MetaAnimFactory anim; + }; + struct MetaTransTrans : IMetaTrans + { + MetaTransTrans() : IMetaTrans(MTTrans, "Trans") {} + DECL_YAML + Value time; + Value unk1; + Value unk2; + Value unk3; + Value unk4; + + }; + struct MetaTransPhaseTrans : IMetaTrans + { + MetaTransPhaseTrans() : IMetaTrans(MTPhaseTrans, "PhaseTrans") {} + DECL_YAML + Value time; + Value unk1; + Value unk2; + Value unk3; + Value unk4; + }; + + struct Transition : BigYAML + { + DECL_YAML + Value unk; + Value animIdxA; + Value animIdxB; + MetaTransFactory metaTrans; + }; + std::vector transitions; + + struct AdditiveAnimationInfo : BigYAML + { + DECL_YAML + Value animIdx; + Value unk1; + Value unk2; + }; + std::vector additiveAnims; + + float floatA = 0.0; + float floatB = 0.0; + + struct HalfTransition : BigYAML + { + DECL_YAML + Value animIdx; + MetaTransFactory metaTrans; + }; + std::vector halfTransitions; + + struct AnimationResources : BigYAML + { + DECL_YAML + UniqueID32 animId; + UniqueID32 evntId; + }; + std::vector animResources; + + void read(Athena::io::IStreamReader& reader); + void write(Athena::io::IStreamWriter& writer) const; + void fromYAML(Athena::io::YAMLDocReader& reader); + void toYAML(Athena::io::YAMLDocWriter& writer) const; + } animationSet; +}; + +} +} + +#endif // _DNAMP1_ANCS_HPP_ diff --git a/DataSpec/DNAMP1/CMakeLists.txt b/DataSpec/DNAMP1/CMakeLists.txt index ae9a255f3..de47efcf9 100644 --- a/DataSpec/DNAMP1/CMakeLists.txt +++ b/DataSpec/DNAMP1/CMakeLists.txt @@ -1,6 +1,7 @@ make_dnalist(liblist PAK MLVL + ANCS CMDL CMDLMaterials) add_library(DNAMP1 @@ -8,5 +9,6 @@ add_library(DNAMP1 ${liblist} PAK.cpp STRG.hpp STRG.cpp + ANCS.cpp CMDL.cpp CMDLMaterials.cpp)