From 1884f89f53dbf405138f1a2f3651698bdcdb89b6 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Thu, 3 Mar 2016 15:01:37 -1000 Subject: [PATCH] New atdna YAML handling --- DataSpec/DNACommon/DNACommon.hpp | 21 ++++--- DataSpec/DNACommon/PAK.cpp | 4 ++ DataSpec/DNACommon/ParticleCommon.hpp | 10 +-- DataSpec/DNAMP1/AFSM.hpp | 8 +-- DataSpec/DNAMP1/ANCS.cpp | 66 ++++++-------------- DataSpec/DNAMP1/EVNT.cpp | 16 ++--- DataSpec/DNAMP1/SCLY.cpp | 51 +++++++-------- DataSpec/DNAMP2/ANCS.cpp | 75 ++++++----------------- DataSpec/DNAMP2/ANCS.hpp | 2 +- DataSpec/DNAMP3/CHAR.cpp | 4 +- Runtime/Particle/CElementGen.cpp | 32 +++++----- Runtime/Particle/CGenDescription.hpp | 22 +++---- Runtime/Particle/CParticleDataFactory.cpp | 16 ++--- hecl | 2 +- 14 files changed, 133 insertions(+), 196 deletions(-) diff --git a/DataSpec/DNACommon/DNACommon.hpp b/DataSpec/DNACommon/DNACommon.hpp index e2ec519c7..14b6f1c93 100644 --- a/DataSpec/DNACommon/DNACommon.hpp +++ b/DataSpec/DNACommon/DNACommon.hpp @@ -90,11 +90,7 @@ public: if (!g_PakRouter) LogDNACommon.report(LogVisor::FatalError, "UniqueIDBridge::setPakRouter must be called before translatePakIdToPath"); - HECL::ProjectPath res = g_PakRouter->getWorking(id); - if (!res) - LogDNACommon.report(LogVisor::FatalError, - "unable to translate %s to path", id.toString().c_str()); - return res; + return g_PakRouter->getWorking(id); } static HECL::ProjectPath MakePathFromString(const std::string& str) { @@ -126,7 +122,10 @@ public: { if (!operator bool()) return; - writer.writeString(nullptr, UniqueIDBridge::TranslatePakIdToPath(*this).getRelativePathUTF8()); + HECL::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this); + if (!path) + return; + writer.writeString(nullptr, path.getRelativePathUTF8()); } size_t binarySize(size_t __isz) const {return __isz + 4;} @@ -186,7 +185,10 @@ public: { if (!operator bool()) return; - writer.writeString(nullptr, UniqueIDBridge::TranslatePakIdToPath(*this).getRelativePathUTF8()); + HECL::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this); + if (!path) + return; + writer.writeString(nullptr, path.getRelativePathUTF8()); } size_t binarySize(size_t __isz) const {return __isz + 8;} @@ -267,7 +269,10 @@ public: { if (!operator bool()) return; - writer.writeString(nullptr, UniqueIDBridge::TranslatePakIdToPath(*this).getRelativePathUTF8()); + HECL::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this); + if (!path) + return; + writer.writeString(nullptr, path.getRelativePathUTF8()); } size_t binarySize(size_t __isz) const {return __isz + 16;} diff --git a/DataSpec/DNACommon/PAK.cpp b/DataSpec/DNACommon/PAK.cpp index 66a2f21c5..48193470a 100644 --- a/DataSpec/DNACommon/PAK.cpp +++ b/DataSpec/DNACommon/PAK.cpp @@ -498,9 +498,11 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter::lookupEntry(co if (currentPAK) { +#ifndef NDEBUG if (!silenceWarnings) LogDNACommon.report(LogVisor::Warning, "unable to find PAK entry %s in current PAK", entry.toString().c_str()); +#endif return nullptr; } @@ -516,9 +518,11 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter::lookupEntry(co } } +#ifndef NDEBUG if (!silenceWarnings) LogDNACommon.report(LogVisor::Warning, "unable to find PAK entry %s", entry.toString().c_str()); +#endif if (nodeOut) *nodeOut = nullptr; return nullptr; diff --git a/DataSpec/DNACommon/ParticleCommon.hpp b/DataSpec/DNACommon/ParticleCommon.hpp index f325d61ed..ebccec0ee 100644 --- a/DataSpec/DNACommon/ParticleCommon.hpp +++ b/DataSpec/DNACommon/ParticleCommon.hpp @@ -1416,18 +1416,20 @@ struct SpawnSystemKeyframeData : BigYAML r.leaveSubRecord(); } spawns.clear(); - if (r.enterSubVector("spawns")) + size_t spawnsCount; + if (r.enterSubVector("spawns", spawnsCount)) { - spawns.reserve(r.getCurNode()->m_seqChildren.size()); + spawns.reserve(spawnsCount); for (const auto& child : r.getCurNode()->m_seqChildren) { if (r.enterSubRecord(nullptr)) { spawns.emplace_back(); spawns.back().first = r.readUint32("startFrame"); - if (r.enterSubVector("systems")) + size_t systemsCount; + if (r.enterSubVector("systems", systemsCount)) { - spawns.back().second.reserve(r.getCurNode()->m_seqChildren.size()); + spawns.back().second.reserve(systemsCount); for (const auto& in : r.getCurNode()->m_seqChildren) { spawns.back().second.emplace_back(); diff --git a/DataSpec/DNAMP1/AFSM.hpp b/DataSpec/DNAMP1/AFSM.hpp index 4c3b0b3e7..0a06010dd 100644 --- a/DataSpec/DNAMP1/AFSM.hpp +++ b/DataSpec/DNAMP1/AFSM.hpp @@ -122,12 +122,10 @@ struct AFSM : public BigYAML void read(Athena::io::YAMLDocReader& __dna_docin) { - /* triggerCount */ - triggerCount = __dna_docin.readUint32("triggerCount"); int i = 0; /* triggers */ - __dna_docin.enumerate("triggers", triggers, triggerCount, - [&](Athena::io::YAMLDocReader& in, Trigger& tr){ + triggerCount = __dna_docin.enumerate("triggers", triggers, + [&](Athena::io::YAMLDocReader& in, Trigger& tr){ tr.first = i == 0; tr.read(in); i++; @@ -136,8 +134,6 @@ struct AFSM : public BigYAML void write(Athena::io::YAMLDocWriter& __dna_docout) const { - /* triggerCount */ - __dna_docout.writeUint32("triggerCount", triggerCount); /* triggers */ __dna_docout.enumerate("triggers", triggers); } diff --git a/DataSpec/DNAMP1/ANCS.cpp b/DataSpec/DNAMP1/ANCS.cpp index 8f9a11d11..648586c61 100644 --- a/DataSpec/DNAMP1/ANCS.cpp +++ b/DataSpec/DNAMP1/ANCS.cpp @@ -82,7 +82,8 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(A parmType = reader.readUint32("parmType"); unk1 = reader.readUint32("unk1"); unk2 = reader.readFloat("unk2"); - reader.enterSubVector("parmVals"); + size_t parmValsCount; + reader.enterSubVector("parmVals", parmValsCount); switch (DataType(parmType)) { case DataType::Int32: @@ -247,17 +248,16 @@ size_t ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::binarySize(siz void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(Athena::io::YAMLDocReader& reader) { id = reader.readUint32("id"); - atUint32 parmInfoCount = reader.readUint32("parmInfoCount"); - atUint32 animInfoCount = reader.readUint32("animInfoCount"); - reader.enumerate("parmInfos", parmInfos, parmInfoCount); + size_t parmInfoCount = reader.enumerate("parmInfos", parmInfos); - reader.enumerate("animInfos", animInfos, animInfoCount, + reader.enumerate("animInfos", animInfos, [this, parmInfoCount](Athena::io::YAMLDocReader& reader, AnimInfo& ai) { ai.id = reader.readUint32("id"); ai.parmVals.reserve(parmInfoCount); - reader.enterSubVector("parmVals"); + size_t parmValsCount; + reader.enterSubVector("parmVals", parmValsCount); for (const ParmInfo& pi : parmInfos) { switch (ParmInfo::DataType(pi.parmType)) @@ -285,8 +285,6 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(Athena::io: void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::write(Athena::io::YAMLDocWriter& writer) const { writer.writeUint32("id", id); - writer.writeUint32("parmInfoCount", parmInfos.size()); - writer.writeUint32("animInfoCount", animInfos.size()); writer.enumerate("parmInfos", parmInfos); @@ -533,25 +531,20 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader) reader.enumerate("cskr", cskr); reader.enumerate("cinf", cinf); - atUint32 animationCount = reader.readUint32("animationCount"); - reader.enumerate("animations", animations, animationCount); + reader.enumerate("animations", animations); reader.enumerate("pasDatabase", pasDatabase); - atUint32 partCount = reader.readUint32("partCount"); - reader.enumerate("part", partResData.part, partCount); + reader.enumerate("part", partResData.part); - atUint32 swhcCount = reader.readUint32("swhcCount"); - reader.enumerate("swhc", partResData.swhc, swhcCount); + reader.enumerate("swhc", partResData.swhc); - atUint32 unkCount = reader.readUint32("unkCount"); - reader.enumerate("unk", partResData.unk, unkCount); + reader.enumerate("unk", partResData.unk); partResData.elsc.clear(); if (sectionCount > 5) { - atUint32 elscCount = reader.readUint32("elscCount"); - reader.enumerate("elsc", partResData.elsc, elscCount); + reader.enumerate("elsc", partResData.elsc); } unk1 = reader.readUint32("unk1"); @@ -559,15 +552,13 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader) animAABBs.clear(); if (sectionCount > 1) { - atUint32 aabbCount = reader.readUint32("animAABBCount"); - reader.enumerate("part", animAABBs, aabbCount); + reader.enumerate("part", animAABBs); } effects.clear(); if (sectionCount > 2) { - atUint32 effectCount = reader.readUint32("effectCount"); - reader.enumerate("effects", effects, effectCount); + reader.enumerate("effects", effects); } if (sectionCount > 3) @@ -579,8 +570,7 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader) animIdxs.clear(); if (sectionCount > 4) { - atUint32 animIdxCount = reader.readUint32("animIdxCount"); - reader.enumerate("animIdxs", animIdxs, animIdxCount); + reader.enumerate("animIdxs", animIdxs); } } @@ -608,23 +598,18 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer) writer.enumerate("cskr", cskr); writer.enumerate("cinf", cinf); - writer.writeUint32("animationCount", animations.size()); writer.enumerate("animations", animations); writer.enumerate("pasDatabase", pasDatabase); - writer.writeUint32("partCount", partResData.part.size()); writer.enumerate("part", partResData.part); - writer.writeUint32("swhcCount", partResData.swhc.size()); writer.enumerate("swhc", partResData.swhc); - writer.writeUint32("unkCount", partResData.unk.size()); writer.enumerate("unk", partResData.unk); if (sectionCount > 5) { - writer.writeUint32("elscCount", partResData.elsc.size()); writer.enumerate("elsc", partResData.elsc); } @@ -632,13 +617,11 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer) if (sectionCount > 1) { - writer.writeUint32("animAABBCount", animAABBs.size()); writer.enumerate("animAABBs", animAABBs); } if (sectionCount > 2) { - writer.writeUint32("effectCount", effects.size()); writer.enumerate("effects", effects); } @@ -650,7 +633,6 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer) if (sectionCount > 4) { - writer.writeUint32("animIdxCount", animIdxs.size()); writer.enumerate("animIdxs", animIdxs); } } @@ -961,18 +943,15 @@ void ANCS::AnimationSet::read(Athena::io::YAMLDocReader& reader) { atUint16 sectionCount = reader.readUint16("sectionCount"); - atUint32 animationCount = reader.readUint32("animationCount"); - reader.enumerate("animations", animations, animationCount); + reader.enumerate("animations", animations); - atUint32 transitionCount = reader.readUint32("transitionCount"); - reader.enumerate("transitions", transitions, transitionCount); + reader.enumerate("transitions", transitions); reader.enumerate("defaultTransition", defaultTransition); additiveAnims.clear(); if (sectionCount > 1) { - atUint32 additiveAnimCount = reader.readUint32("additiveAnimCount"); - reader.enumerate("additiveAnims", additiveAnims, additiveAnimCount); + reader.enumerate("additiveAnims", additiveAnims); floatA = reader.readFloat("floatA"); floatB = reader.readFloat("floatB"); } @@ -980,15 +959,13 @@ void ANCS::AnimationSet::read(Athena::io::YAMLDocReader& reader) halfTransitions.clear(); if (sectionCount > 2) { - atUint32 halfTransitionCount = reader.readUint32("halfTransitionCount"); - reader.enumerate("halfTransitions", halfTransitions, halfTransitionCount); + reader.enumerate("halfTransitions", halfTransitions); } animResources.clear(); if (sectionCount > 3) { - atUint32 animResourcesCount = reader.readUint32("animResourcesCount"); - reader.enumerate("animResources", animResources, animResourcesCount); + reader.enumerate("animResources", animResources); } } @@ -1006,16 +983,13 @@ void ANCS::AnimationSet::write(Athena::io::YAMLDocWriter& writer) const writer.writeUint16("sectionCount", sectionCount); - writer.writeUint32("animationCount", animations.size()); writer.enumerate("animations", animations); - writer.writeUint32("transitionCount", transitions.size()); writer.enumerate("transitions", transitions); writer.enumerate("defaultTransition", defaultTransition); if (sectionCount > 1) { - writer.writeUint32("additiveAnimCount", additiveAnims.size()); writer.enumerate("additiveAnims", additiveAnims); writer.writeFloat("floatA", floatA); writer.writeFloat("floatB", floatB); @@ -1023,13 +997,11 @@ void ANCS::AnimationSet::write(Athena::io::YAMLDocWriter& writer) const if (sectionCount > 2) { - writer.writeUint32("halfTransitionCount", halfTransitions.size()); writer.enumerate("halfTransitions", halfTransitions); } if (sectionCount > 3) { - writer.writeUint32("animResourcesCount", animResources.size()); writer.enumerate("animResources", animResources); } } diff --git a/DataSpec/DNAMP1/EVNT.cpp b/DataSpec/DNAMP1/EVNT.cpp index 0af53708b..edb181b4b 100644 --- a/DataSpec/DNAMP1/EVNT.cpp +++ b/DataSpec/DNAMP1/EVNT.cpp @@ -50,20 +50,16 @@ void EVNT::read(Athena::io::YAMLDocReader& reader) { version = reader.readUint32("version"); - atUint32 loopCount = reader.readUint32("loopCount"); - reader.enumerate("loopEvents", loopEvents, loopCount); + reader.enumerate("loopEvents", loopEvents); uevtEvents.clear(); - atUint32 uevtCount = reader.readUint32("uevtCount"); - reader.enumerate("uevtEvents", uevtEvents, uevtCount); + reader.enumerate("uevtEvents", uevtEvents); - atUint32 effectCount = reader.readUint32("effectCount"); - reader.enumerate("effectEvents", effectEvents, effectCount); + reader.enumerate("effectEvents", effectEvents); if (version == 2) { - atUint32 sfxCount = reader.readUint32("sfxCount"); - reader.enumerate("sfxEvents", sfxEvents, sfxCount); + reader.enumerate("sfxEvents", sfxEvents); } } @@ -71,18 +67,14 @@ void EVNT::write(Athena::io::YAMLDocWriter& writer) const { writer.writeUint32("version", version); - writer.writeUint32("loopCount", loopEvents.size()); writer.enumerate("loopEvents", loopEvents); - writer.writeUint32("uevtCount", uevtEvents.size()); writer.enumerate("uevtEvents", uevtEvents); - writer.writeUint32("effectCount", effectEvents.size()); writer.enumerate("effectEvents", effectEvents); if (version == 2) { - writer.writeUint32("sfxCount", sfxEvents.size()); writer.enumerate("sfxEvents", sfxEvents); } } diff --git a/DataSpec/DNAMP1/SCLY.cpp b/DataSpec/DNAMP1/SCLY.cpp index 5c55dff79..d868d8313 100644 --- a/DataSpec/DNAMP1/SCLY.cpp +++ b/DataSpec/DNAMP1/SCLY.cpp @@ -84,16 +84,14 @@ void SCLY::read(Athena::io::YAMLDocReader& docin) { fourCC = docin.readUint32("fourCC"); version = docin.readUint32("version"); - layerCount = docin.readUint32("layerCount"); - docin.enumerate("layerSizes", layerSizes, layerCount); - docin.enumerate("layers", layers, layerCount); + layerCount = docin.enumerate("layerSizes", layerSizes); + docin.enumerate("layers", layers); } void SCLY::write(Athena::io::YAMLDocWriter& docout) const { docout.writeUint32("fourCC", fourCC); docout.writeUint32("version", version); - docout.writeUint32("layerCount", layerCount); docout.enumerate("layerSizes", layerSizes); docout.enumerate("layers", layers); } @@ -136,29 +134,35 @@ void SCLY::ScriptLayer::read(Athena::io::IStreamReader& rs) void SCLY::ScriptLayer::read(Athena::io::YAMLDocReader& rs) { unknown = rs.readUByte("unknown"); - objectCount = rs.readUint32("objectCount"); - objects.reserve(objectCount); - rs.enterSubVector("objects"); - for (atUint32 i = 0; i < objectCount; i++) + size_t objCount; + objects.clear(); + if (rs.enterSubVector("objects", objCount)) { - rs.enterSubRecord(nullptr); - atUint8 type = rs.readUByte("type"); - auto iter = std::find_if(SCRIPT_OBJECT_DB.begin(), SCRIPT_OBJECT_DB.end(), [&type](const ScriptObjectSpec* obj) -> bool - { return obj->type == type; }); - - if (iter != SCRIPT_OBJECT_DB.end()) + objectCount = objCount; + objects.reserve(objCount); + for (atUint32 i = 0; i < objectCount; i++) { - std::unique_ptr obj((*iter)->a()); - obj->read(rs); - obj->type = type; - objects.push_back(std::move(obj)); - } - else - Log.report(LogVisor::FatalError, _S("Unable to find type 0x%X in object database"), (atUint32)type); + rs.enterSubRecord(nullptr); + atUint8 type = rs.readUByte("type"); + auto iter = std::find_if(SCRIPT_OBJECT_DB.begin(), SCRIPT_OBJECT_DB.end(), [&type](const ScriptObjectSpec* obj) -> bool + { return obj->type == type; }); - rs.leaveSubRecord(); + if (iter != SCRIPT_OBJECT_DB.end()) + { + std::unique_ptr obj((*iter)->a()); + obj->read(rs); + obj->type = type; + objects.push_back(std::move(obj)); + } + else + Log.report(LogVisor::FatalError, _S("Unable to find type 0x%X in object database"), (atUint32)type); + + rs.leaveSubRecord(); + } + rs.leaveSubVector(); } - rs.leaveSubVector(); + else + objectCount = 0; } void SCLY::ScriptLayer::write(Athena::io::IStreamWriter& ws) const @@ -186,7 +190,6 @@ size_t SCLY::ScriptLayer::binarySize(size_t __isz) const void SCLY::ScriptLayer::write(Athena::io::YAMLDocWriter& ws) const { ws.writeUByte("unknown", unknown); - ws.writeUint32("objectCount", objectCount); ws.enterSubVector("objects"); for (const std::unique_ptr& obj : objects) { diff --git a/DataSpec/DNAMP2/ANCS.cpp b/DataSpec/DNAMP2/ANCS.cpp index 6e4b8b74f..226aa0572 100644 --- a/DataSpec/DNAMP2/ANCS.cpp +++ b/DataSpec/DNAMP2/ANCS.cpp @@ -247,43 +247,34 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader) reader.enumerate("cskr", cskr); reader.enumerate("cinf", cinf); - atUint32 animationCount = reader.readUint32("animationCount"); - reader.enumerate("animations", animations, animationCount); + reader.enumerate("animations", animations); reader.enumerate("pasDatabase", pasDatabase); - atUint32 partCount = reader.readUint32("partCount"); - reader.enumerate("part", partResData.part, partCount); + reader.enumerate("part", partResData.part); - atUint32 swhcCount = reader.readUint32("swhcCount"); - reader.enumerate("swhc", partResData.swhc, swhcCount); + reader.enumerate("swhc", partResData.swhc); - atUint32 unkCount = reader.readUint32("unkCount"); - reader.enumerate("unk", partResData.unk, unkCount); + reader.enumerate("unk", partResData.unk); - atUint32 elscCount = reader.readUint32("elscCount"); - reader.enumerate("elsc", partResData.elsc, elscCount); + reader.enumerate("elsc", partResData.elsc); - atUint32 spscCount = reader.readUint32("spscCount"); - reader.enumerate("spsc", partResData.spsc, spscCount); + reader.enumerate("spsc", partResData.spsc); - atUint32 unk2Count = reader.readUint32("unk2Count"); - reader.enumerate("unk2", partResData.unk2, unk2Count); + reader.enumerate("unk2", partResData.unk2); unk1 = reader.readUint32("unk1"); animAABBs.clear(); if (sectionCount > 1) { - atUint32 aabbCount = reader.readUint32("animAABBCount"); - reader.enumerate("part", animAABBs, aabbCount); + reader.enumerate("part", animAABBs); } effects.clear(); if (sectionCount > 2) { - atUint32 effectCount = reader.readUint32("effectCount"); - reader.enumerate("effects", effects, effectCount); + reader.enumerate("effects", effects); } if (sectionCount > 3) @@ -295,8 +286,7 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader) animIdxs.clear(); if (sectionCount > 4) { - atUint32 animIdxCount = reader.readUint32("animIdxCount"); - reader.enumerate("animIdxs", animIdxs, animIdxCount); + reader.enumerate("animIdxs", animIdxs); } extents.clear(); @@ -304,8 +294,7 @@ void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader) { unk4 = reader.readUint32("unk4"); unk5 = reader.readUByte("unk5"); - atUint32 extentsCount = reader.readUint32("extentsCount"); - reader.enumerate("extents", extents, extentsCount); + reader.enumerate("extents", extents); } } @@ -335,40 +324,31 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer) writer.enumerate("cskr", cskr); writer.enumerate("cinf", cinf); - writer.writeUint32("animationCount", animations.size()); writer.enumerate("animations", animations); writer.enumerate("pasDatabase", pasDatabase); - writer.writeUint32("partCount", partResData.part.size()); writer.enumerate("part", partResData.part); - writer.writeUint32("swhcCount", partResData.swhc.size()); writer.enumerate("swhc", partResData.swhc); - writer.writeUint32("unkCount", partResData.unk.size()); writer.enumerate("unk", partResData.unk); - writer.writeUint32("elscCount", partResData.elsc.size()); writer.enumerate("elsc", partResData.elsc); - writer.writeUint32("spscCount", partResData.spsc.size()); writer.enumerate("spsc", partResData.spsc); - writer.writeUint32("unk2Count", partResData.unk2.size()); writer.enumerate("unk2", partResData.unk2); writer.writeUint32("unk1", unk1); if (sectionCount > 1) { - writer.writeUint32("animAABBCount", animAABBs.size()); writer.enumerate("animAABBs", animAABBs); } if (sectionCount > 2) { - writer.writeUint32("effectCount", effects.size()); writer.enumerate("effects", effects); } @@ -380,7 +360,6 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer) if (sectionCount > 4) { - writer.writeUint32("animIdxCount", animIdxs.size()); writer.enumerate("animIdxs", animIdxs); } @@ -388,7 +367,6 @@ void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer) { writer.writeUint32("unk4", unk4); writer.writeUByte("unk5", unk5); - writer.writeUint32("extentsCount", extents.size()); writer.enumerate("extents", extents); } } @@ -520,18 +498,15 @@ void ANCS::AnimationSet::read(Athena::io::YAMLDocReader& reader) { atUint16 sectionCount = reader.readUint16("sectionCount"); - atUint32 animationCount = reader.readUint32("animationCount"); - reader.enumerate("animations", animations, animationCount); + reader.enumerate("animations", animations); - atUint32 transitionCount = reader.readUint32("transitionCount"); - reader.enumerate("transitions", transitions, transitionCount); + reader.enumerate("transitions", transitions); reader.enumerate("defaultTransition", defaultTransition); additiveAnims.clear(); if (sectionCount > 1) { - atUint32 additiveAnimCount = reader.readUint32("additiveAnimCount"); - reader.enumerate("additiveAnims", additiveAnims, additiveAnimCount); + reader.enumerate("additiveAnims", additiveAnims); floatA = reader.readFloat("floatA"); floatB = reader.readFloat("floatB"); } @@ -539,15 +514,13 @@ void ANCS::AnimationSet::read(Athena::io::YAMLDocReader& reader) halfTransitions.clear(); if (sectionCount > 2) { - atUint32 halfTransitionCount = reader.readUint32("halfTransitionCount"); - reader.enumerate("halfTransitions", halfTransitions, halfTransitionCount); + reader.enumerate("halfTransitions", halfTransitions); } evnts.clear(); if (sectionCount > 3) { - atUint32 evntsCount = reader.readUint32("evntsCount"); - reader.enumerate("evnts", evnts, evntsCount); + reader.enumerate("evnts", evnts); } } @@ -665,40 +638,32 @@ void ANCS::AnimationSet::EVNT::read(Athena::io::YAMLDocReader& reader) { version = reader.readUint32("version"); - atUint32 loopCount = reader.readUint32("loopCount"); - reader.enumerate("loopEvents", loopEvents, loopCount); + reader.enumerate("loopEvents", loopEvents); uevtEvents.clear(); if (version == 2) { - atUint32 uevtCount = reader.readUint32("uevtCount"); - reader.enumerate("uevtEvents", uevtEvents, uevtCount); + reader.enumerate("uevtEvents", uevtEvents); } - atUint32 effectCount = reader.readUint32("effectCount"); - reader.enumerate("effectEvents", effectEvents, effectCount); + reader.enumerate("effectEvents", effectEvents); - atUint32 sfxCount = reader.readUint32("sfxCount"); - reader.enumerate("sfxEvents", sfxEvents, sfxCount); + reader.enumerate("sfxEvents", sfxEvents); } void ANCS::AnimationSet::EVNT::write(Athena::io::YAMLDocWriter& writer) const { writer.writeUint32("version", version); - writer.writeUint32("loopCount", loopEvents.size()); writer.enumerate("loopEvents", loopEvents); if (version == 2) { - writer.writeUint32("uevtCount", uevtEvents.size()); writer.enumerate("uevtEvents", uevtEvents); } - writer.writeUint32("effectCount", effectEvents.size()); writer.enumerate("effectEvents", effectEvents); - writer.writeUint32("sfxCount", sfxEvents.size()); writer.enumerate("sfxEvents", sfxEvents); } diff --git a/DataSpec/DNAMP2/ANCS.hpp b/DataSpec/DNAMP2/ANCS.hpp index 780be2092..32601abc8 100644 --- a/DataSpec/DNAMP2/ANCS.hpp +++ b/DataSpec/DNAMP2/ANCS.hpp @@ -139,7 +139,7 @@ struct ANCS : BigYAML Value idx; Value unk2; Value unk3; - Value unk4; + Value unk4; Value unk5; }; diff --git a/DataSpec/DNAMP3/CHAR.cpp b/DataSpec/DNAMP3/CHAR.cpp index 7395e073e..61df490b9 100644 --- a/DataSpec/DNAMP3/CHAR.cpp +++ b/DataSpec/DNAMP3/CHAR.cpp @@ -54,8 +54,7 @@ void CHAR::AnimationInfo::EVNT::SFXEvent::read(Athena::io::YAMLDocReader& reader reader.enumerate("caudId", caudId); unk1 = reader.readUint32("unk1"); unk2 = reader.readUint32("unk2"); - unk3 = reader.readUint32("unk3"); - reader.enumerate("unk3Vals", unk3Vals, unk3); + unk3 = reader.enumerate("unk3Vals", unk3Vals); extraType = reader.readUint32("extraType"); if (extraType == 1) extraFloat = reader.readFloat("extraFloat"); @@ -67,7 +66,6 @@ void CHAR::AnimationInfo::EVNT::SFXEvent::write(Athena::io::YAMLDocWriter& write writer.enumerate("caudId", caudId); writer.writeUint32("unk1", unk1); writer.writeUint32("unk2", unk2); - writer.writeUint32("unk3", unk3); writer.enumerate("unk3Vals", unk3Vals); writer.writeUint32("extraType", extraType); if (extraType == 1) diff --git a/Runtime/Particle/CElementGen.cpp b/Runtime/Particle/CElementGen.cpp index 652d7a804..a460aaffe 100644 --- a/Runtime/Particle/CElementGen.cpp +++ b/Runtime/Particle/CElementGen.cpp @@ -276,7 +276,7 @@ CElementGen::CElementGen(const TToken& gen, { CGenDescription* desc = x1c_genDesc.GetObj(); - CIntElement* seedElem = desc->x1c_SEED.get(); + CIntElement* seedElem = desc->x1c_x10_SEED.get(); if (seedElem) { int seedVal; @@ -361,7 +361,7 @@ CElementGen::CElementGen(const TToken& gen, psivElem->GetValue(0, x218_PSIV); */ - CIntElement* maxpElem = desc->x28_MAXP.get(); + CIntElement* maxpElem = desc->x28_x1c_MAXP.get(); if (maxpElem) maxpElem->GetValue(x50_curFrame, x70_MAXP); @@ -375,7 +375,7 @@ CElementGen::CElementGen(const TToken& gen, x225_26_LINE = desc->x44_24_x30_24_LINE; x225_27_FXLL = desc->x44_25_x30_25_FXLL; - CVectorElement* pofsElem = desc->x18_POFS.get(); + CVectorElement* pofsElem = desc->x18_xc_POFS.get(); if (pofsElem) pofsElem->GetValue(x50_curFrame, x94_POFS); @@ -512,7 +512,7 @@ bool CElementGen::InternalUpdate(double dt) x2c0_maxSize = 0.f; float grte = 0.f; CParticleGlobals::SetEmitterTime(x50_curFrame); - CRealElement* grteElem = desc->x2c_GRTE.get(); + CRealElement* grteElem = desc->x2c_x20_GRTE.get(); if (grteElem->GetValue(x50_curFrame, grte)) { x2c_particleLists.clear(); @@ -527,7 +527,7 @@ bool CElementGen::InternalUpdate(double dt) if (!x68_particleEmission || x50_curFrame >= x214_PSLT) genCount = 0; - CIntElement* maxpElem = desc->x28_MAXP.get(); + CIntElement* maxpElem = desc->x28_x1c_MAXP.get(); if (maxpElem) maxpElem->GetValue(x50_curFrame, x70_MAXP); @@ -690,10 +690,10 @@ void CElementGen::UpdateExistingParticles() if (x225_26_LINE) { - CRealElement* leng = desc->x20_LENG.get(); + CRealElement* leng = desc->x20_x14_LENG.get(); if (leng) err |= leng->GetValue(particleFrame, particle.x2c_lineLengthOrSize); - CRealElement* widt = desc->x24_WIDT.get(); + CRealElement* widt = desc->x24_x18_WIDT.get(); if (widt) err |= widt->GetValue(particleFrame, particle.x30_lineWidthOrRota); } @@ -707,7 +707,7 @@ void CElementGen::UpdateExistingParticles() err |= size->GetValue(particleFrame, particle.x2c_lineLengthOrSize); } - CColorElement* colr = desc->x30_COLR.get(); + CColorElement* colr = desc->x30_x24_COLR.get(); if (colr) err |= colr->GetValue(particleFrame, particle.x34_color); @@ -746,14 +746,14 @@ void CElementGen::CreateNewParticles(int count) CElementGen::CParticle& particle = g_StaticParticleList[staticIdx]; particle.x28_startFrame = x50_curFrame; - CIntElement* ltme = desc->x34_LTME.get(); + CIntElement* ltme = desc->x34_x28_LTME.get(); if (ltme) ltme->GetValue(0, particle.x0_endFrame); CParticleGlobals::SetParticleLifetime(particle.x0_endFrame); CParticleGlobals::UpdateParticleLifetimeTweenValues(0); particle.x0_endFrame += x50_curFrame; - CColorElement* colr = desc->x30_COLR.get(); + CColorElement* colr = desc->x30_x24_COLR.get(); if (colr) colr->GetValue(0, particle.x34_color); else @@ -778,13 +778,13 @@ void CElementGen::CreateNewParticles(int count) if (x225_26_LINE) { - CRealElement* leng = desc->x20_LENG.get(); + CRealElement* leng = desc->x20_x14_LENG.get(); if (leng) leng->GetValue(0, particle.x2c_lineLengthOrSize); else particle.x2c_lineLengthOrSize = 1.f; - CRealElement* widt = desc->x24_WIDT.get(); + CRealElement* widt = desc->x24_x18_WIDT.get(); if (widt) widt->GetValue(0, particle.x30_lineWidthOrRota); else @@ -850,7 +850,7 @@ void CElementGen::UpdatePSTranslationAndOrientation() } */ - CVectorElement* pofs = desc->x18_POFS.get(); + CVectorElement* pofs = desc->x18_xc_POFS.get(); if (pofs) pofs->GetValue(x50_curFrame, x94_POFS); @@ -1441,7 +1441,7 @@ void CElementGen::RenderLines() CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::InvSrcAlpha, ERglLogicOp::Clear); } - CRealElement* widt = desc->x24_WIDT.get(); + CRealElement* widt = desc->x24_x18_WIDT.get(); bool widtConst = false; if (widt) widtConst = widt->IsConstant(); @@ -1701,7 +1701,7 @@ void CElementGen::RenderParticles() { float theta = particle.x30_lineWidthOrRota * M_PI / 180.f; float sinT = sinf(theta) * size; - float cosT = sinf(theta) * size; + float cosT = cosf(theta) * size; switch (m_shaderClass) { @@ -1836,7 +1836,7 @@ void CElementGen::RenderParticles() { float theta = particle.x30_lineWidthOrRota * M_PI / 180.f; float sinT = sinf(theta) * size; - float cosT = sinf(theta) * size; + float cosT = cosf(theta) * size; for (int i=0 ; i__ */ /* Removed from demo */ - //std::unique_ptr x0_PSIV; - //std::unique_ptr x4_PSVM; - //std::unique_ptr x8_PSOV; + // std::unique_ptr x0_PSIV; + // std::unique_ptr x4_PSVM; + // std::unique_ptr x8_PSOV; std::unique_ptr xc_x0_PSLT; std::unique_ptr x10_x4_PSWT; std::unique_ptr x14_x8_PSTS; - std::unique_ptr x18_POFS; - std::unique_ptr x1c_SEED; - std::unique_ptr x20_LENG; - std::unique_ptr x24_WIDT; - std::unique_ptr x28_MAXP; - std::unique_ptr x2c_GRTE; - std::unique_ptr x30_COLR; - std::unique_ptr x34_LTME; + std::unique_ptr x18_xc_POFS; + std::unique_ptr x1c_x10_SEED; + std::unique_ptr x20_x14_LENG; + std::unique_ptr x24_x18_WIDT; + std::unique_ptr x28_x1c_MAXP; + std::unique_ptr x2c_x20_GRTE; + std::unique_ptr x30_x24_COLR; + std::unique_ptr x34_x28_LTME; /* Removed from demo (replaced by EMTR) */ // std::unique_ptr x38_ILOC; // std::unique_ptr x3c_IVEC; diff --git a/Runtime/Particle/CParticleDataFactory.cpp b/Runtime/Particle/CParticleDataFactory.cpp index cf044ebf5..af2ed2343 100644 --- a/Runtime/Particle/CParticleDataFactory.cpp +++ b/Runtime/Particle/CParticleDataFactory.cpp @@ -873,7 +873,7 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->x40_x2c_EMTR.reset(GetEmitterElement(in)); break; case SBIG('COLR'): - fillDesc->x30_COLR.reset(GetColorElement(in)); + fillDesc->x30_x24_COLR.reset(GetColorElement(in)); break; case SBIG('CIND'): fillDesc->x45_30_x32_24_CIND = GetBool(in); @@ -885,7 +885,7 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->xa0_x8c_CSSD.reset(GetIntElement(in)); break; case SBIG('GRTE'): - fillDesc->x2c_GRTE.reset(GetRealElement(in)); + fillDesc->x2c_x20_GRTE.reset(GetRealElement(in)); break; case SBIG('FXLL'): fillDesc->x44_25_x30_25_FXLL = GetBool(in); @@ -919,10 +919,10 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->x104_xf0_LCLR.reset(GetColorElement(in)); break; case SBIG('LENG'): - fillDesc->x20_LENG.reset(GetRealElement(in)); + fillDesc->x20_x14_LENG.reset(GetRealElement(in)); break; case SBIG('MAXP'): - fillDesc->x28_MAXP.reset(GetIntElement(in)); + fillDesc->x28_x1c_MAXP.reset(GetIntElement(in)); break; case SBIG('LOFF'): fillDesc->x10c_xf8_LOFF.reset(GetVectorElement(in)); @@ -940,7 +940,7 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->x44_29_x30_29_LIT_ = GetBool(in); break; case SBIG('LTME'): - fillDesc->x34_LTME.reset(GetIntElement(in)); + fillDesc->x34_x28_LTME.reset(GetIntElement(in)); break; case SBIG('LSLA'): fillDesc->x11c_x108_LSLA.reset(GetRealElement(in)); @@ -991,7 +991,7 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->x70_x5c_PMRT.reset(GetVectorElement(in)); break; case SBIG('POFS'): - fillDesc->x18_POFS.reset(GetVectorElement(in)); + fillDesc->x18_xc_POFS.reset(GetVectorElement(in)); break; case SBIG('PMUS'): fillDesc->x45_24_x31_26_PMUS = GetBool(in); @@ -1015,7 +1015,7 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->x10_x4_PSWT.reset(GetIntElement(in)); break; case SBIG('SEED'): - fillDesc->x1c_SEED.reset(GetIntElement(in)); + fillDesc->x1c_x10_SEED.reset(GetIntElement(in)); break; case SBIG('PMOO'): fillDesc->x45_25_x31_27_PMOO = GetBool(in); @@ -1072,7 +1072,7 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i fillDesc->x44_27_x30_27_ZBUF = GetBool(in); break; case SBIG('WIDT'): - fillDesc->x24_WIDT.reset(GetRealElement(in)); + fillDesc->x24_x18_WIDT.reset(GetRealElement(in)); break; case SBIG('ORNT'): fillDesc->x30_30_ORNT = GetBool(in); diff --git a/hecl b/hecl index 448e1953e..9611e3ace 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 448e1953e1ac457aa2ab21aef3030a04aca1e53e +Subproject commit 9611e3ace238f580570f1449142d3ef2f040ed72