From f1049381a62f31ee533e959a91d2730283937c04 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Wed, 11 Jan 2023 18:01:00 -0800 Subject: [PATCH] Split POI nodes into their own headers, add weak imps to CSoundPOINode Former-commit-id: 91313bf6190d3686eafb07d5be5249272436e8a9 --- include/Kyoto/Animation/CBoolPOINode.hpp | 21 ++++++ include/Kyoto/Animation/CInt32POINode.hpp | 27 ++++++++ include/Kyoto/Animation/CPOINode.hpp | 71 +------------------- include/Kyoto/Animation/CParticlePOINode.hpp | 24 +++++++ include/Kyoto/Animation/CSoundPOINode.hpp | 42 ++++++++++++ include/MetroidPrime/CAnimData.hpp | 7 +- src/Kyoto/Animation/CBoolPOINode.cpp | 2 +- src/Kyoto/Animation/CInt32POINode.cpp | 2 +- src/Kyoto/Animation/CParticlePOINode.cpp | 2 +- 9 files changed, 123 insertions(+), 75 deletions(-) create mode 100644 include/Kyoto/Animation/CBoolPOINode.hpp create mode 100644 include/Kyoto/Animation/CInt32POINode.hpp create mode 100644 include/Kyoto/Animation/CParticlePOINode.hpp create mode 100644 include/Kyoto/Animation/CSoundPOINode.hpp diff --git a/include/Kyoto/Animation/CBoolPOINode.hpp b/include/Kyoto/Animation/CBoolPOINode.hpp new file mode 100644 index 00000000..9efb310b --- /dev/null +++ b/include/Kyoto/Animation/CBoolPOINode.hpp @@ -0,0 +1,21 @@ +#ifndef _CBOOLPOINODE +#define _CBOOLPOINODE + +#include "Kyoto/Animation/CPOINode.hpp" + +class CBoolPOINode : public CPOINode { +public: + CBoolPOINode(rstl::string name, ushort type, const CCharAnimTime& time, int index, bool unique, + float weight, int charIdx, int flags, bool value); + // : CPOINode(name, type, time, index, unique, weight, charIdx, flags), x38_val(value) {} + + CBoolPOINode(CInputStream& in); + static CBoolPOINode CopyNodeMinusStartTime(const CBoolPOINode& node, + const CCharAnimTime& startTime); + bool GetValue() const { return x38_val; } + +private: + bool x38_val; +}; + +#endif // _CBOOLPOINODE diff --git a/include/Kyoto/Animation/CInt32POINode.hpp b/include/Kyoto/Animation/CInt32POINode.hpp new file mode 100644 index 00000000..d2799000 --- /dev/null +++ b/include/Kyoto/Animation/CInt32POINode.hpp @@ -0,0 +1,27 @@ +#ifndef _CINT32POINODE +#define _CINT32POINODE + +#include "Kyoto/Animation/CPOINode.hpp" + +class CInt32POINode : public CPOINode { +public: + CInt32POINode(rstl::string name, ushort type, const CCharAnimTime& time, int index, bool unique, + float weight, int charIdx, int flags, int value, const rstl::string& locatorName); + /*: CPOINode(name, type, time, index, unique, weight, charIdx, flags) + , x38_val(value) + , x3c_lctrName(locatorName) {} */ + + explicit CInt32POINode(CInputStream& in); + + static CInt32POINode CopyNodeMinusStartTime(const CInt32POINode& node, + const CCharAnimTime& startTime); + + int GetValue() const { return x38_val; } + const rstl::string& GetLocatorName() const { return x3c_lctrName; } + +private: + int x38_val; + rstl::string x3c_lctrName; +}; + +#endif // _CINT32POINODE diff --git a/include/Kyoto/Animation/CPOINode.hpp b/include/Kyoto/Animation/CPOINode.hpp index b61e96ef..a3beea33 100644 --- a/include/Kyoto/Animation/CPOINode.hpp +++ b/include/Kyoto/Animation/CPOINode.hpp @@ -4,8 +4,6 @@ #include "types.h" #include "Kyoto/Animation/CCharAnimTime.hpp" -#include "Kyoto/Particles/CParticleData.hpp" - #include "rstl/string.hpp" enum EPOIType { @@ -19,6 +17,7 @@ enum EPOIType { kPT_Sound = 8, }; +class CInputStream; class CPOINode { public: CPOINode(const rstl::string& name, ushort type, const CCharAnimTime& time, int index, bool unique, @@ -52,73 +51,5 @@ protected: }; CHECK_SIZEOF(CPOINode, 0x38) -class CBoolPOINode : public CPOINode { -public: - CBoolPOINode(rstl::string name, ushort type, const CCharAnimTime& time, int index, bool unique, - float weight, int charIdx, int flags, bool value); /* -: CPOINode(name, type, time, index, unique, weight, charIdx, flags) -, x38_val(value) {} -*/ - CBoolPOINode(CInputStream& in); - static CBoolPOINode CopyNodeMinusStartTime(const CBoolPOINode& node, - const CCharAnimTime& startTime); - bool GetValue() const { return x38_val; } - -private: - bool x38_val; -}; - -class CInt32POINode : public CPOINode { -public: - CInt32POINode(rstl::string name, ushort type, const CCharAnimTime& time, int index, bool unique, - float weight, int charIdx, int flags, int value, - const rstl::string& locatorName); /* -: CPOINode(name, type, time, index, unique, weight, charIdx, flags) -, x38_val(value) -, x3c_lctrName(locatorName) {} -*/ - - explicit CInt32POINode(CInputStream& in); - - static CInt32POINode CopyNodeMinusStartTime(const CInt32POINode& node, - const CCharAnimTime& startTime); - - int GetValue() const { return x38_val; } - const rstl::string& GetLocatorName() const { return x3c_lctrName; } - -private: - int x38_val; - rstl::string x3c_lctrName; -}; - -class CParticlePOINode : public CPOINode { -public: - CParticlePOINode(rstl::string name, ushort type, const CCharAnimTime& time, int index, - bool unique, float weight, int charIdx, int flags, const CParticleData& data); /* - : CPOINode(name, type, time, index, unique, - weight, charIdx, flags) , x38_val(value) - */ - explicit CParticlePOINode(CInputStream& in); - - const CParticleData& GetParticleData() const { return x38_data; } - - static CParticlePOINode CopyNodeMinusStartTime(const CParticlePOINode& node, - const CCharAnimTime& startTime); - -private: - CParticleData x38_data; -}; - -class CSoundPOINode : public CPOINode { -public: - uint GetSoundId() const { return x38_sfxId; } - float GetFallOff() const { return x3c_falloff; } - float GetMaxDistance() const { return x40_maxDist; } - -private: - uint x38_sfxId; - float x3c_falloff; - float x40_maxDist; -}; #endif // _CPOINODE diff --git a/include/Kyoto/Animation/CParticlePOINode.hpp b/include/Kyoto/Animation/CParticlePOINode.hpp new file mode 100644 index 00000000..6f03bca4 --- /dev/null +++ b/include/Kyoto/Animation/CParticlePOINode.hpp @@ -0,0 +1,24 @@ +#ifndef _CPARTICLEPOINODE +#define _CPARTICLEPOINODE + +#include "Kyoto/Animation/CPOINode.hpp" +#include "Kyoto/Particles/CParticleData.hpp" + +class CParticlePOINode : public CPOINode { +public: + CParticlePOINode(rstl::string name, ushort type, const CCharAnimTime& time, int index, + bool unique, float weight, int charIdx, int flags, const CParticleData& data); + //: CPOINode(name, type, time, index, unique, weight, charIdx, flags), x38_val(value) {} + + explicit CParticlePOINode(CInputStream& in); + + const CParticleData& GetParticleData() const { return x38_data; } + + static CParticlePOINode CopyNodeMinusStartTime(const CParticlePOINode& node, + const CCharAnimTime& startTime); + +private: + CParticleData x38_data; +}; + +#endif // _CPARTICLEPOINODE diff --git a/include/Kyoto/Animation/CSoundPOINode.hpp b/include/Kyoto/Animation/CSoundPOINode.hpp new file mode 100644 index 00000000..30776d0f --- /dev/null +++ b/include/Kyoto/Animation/CSoundPOINode.hpp @@ -0,0 +1,42 @@ +#ifndef _CSOUNDPOINODE +#define _CSOUNDPOINODE + +#include "Kyoto/Animation/CPOINode.hpp" +#include "Kyoto/Streams/CInputStream.hpp" + +class CSoundPOINode : public CPOINode { +public: + CSoundPOINode(rstl::string name, ushort type, const CCharAnimTime& time, int index, bool unique, + float weight, int charIdx, int flags, int sfxId, float fallOff, float maxDist); + /* : CPOINode(name, type, time, index, unique, weight, charIdx, flags) + , x38_sfxId(sfxId) + , x3c_falloff(fallOff) + , x40_maxDist(maxDist) {} + */ + + CSoundPOINode(CInputStream& in); + /*: CPOINode(in) + , x38_sfxId(in.ReadInt32()) + , x3c_falloff(in.ReadFloat()) + , x40_maxDist(in.ReadFloat()) {} + */ + + uint GetSoundId() const { return x38_sfxId; } + float GetFallOff() const { return x3c_falloff; } + float GetMaxDistance() const { return x40_maxDist; } + + static CSoundPOINode CopyNodeMinusStartTime(const CSoundPOINode& node, + const CCharAnimTime& startTime) { + return CSoundPOINode(node.GetString(), node.GetPoiType(), node.GetTime() - startTime, + node.GetIndex(), node.GetSaveState(), node.GetWeight(), + node.GetCharacterIndex(), node.GetFlags(), node.GetSoundId(), + node.GetFallOff(), node.GetMaxDistance()); + } + +private: + uint x38_sfxId; + float x3c_falloff; + float x40_maxDist; +}; + +#endif // _CSOUNDPOINODE diff --git a/include/MetroidPrime/CAnimData.hpp b/include/MetroidPrime/CAnimData.hpp index 3cd87099..4b881198 100644 --- a/include/MetroidPrime/CAnimData.hpp +++ b/include/MetroidPrime/CAnimData.hpp @@ -3,12 +3,15 @@ #include "types.h" +#include "Kyoto/Animation/CBoolPOINode.hpp" +#include "Kyoto/Animation/CCharacterInfo.hpp" +#include "Kyoto/Animation/CInt32POINode.hpp" +#include "Kyoto/Animation/CParticlePOINode.hpp" +#include "Kyoto/Animation/CSoundPOINode.hpp" #include "MetroidPrime/ActorCommon.hpp" #include "MetroidPrime/CAdditiveAnimPlayback.hpp" #include "MetroidPrime/CAnimPlaybackParms.hpp" -#include "Kyoto/Animation/CCharacterInfo.hpp" #include "MetroidPrime/CHierarchyPoseBuilder.hpp" -#include "Kyoto/Animation/CPOINode.hpp" #include "MetroidPrime/CParticleDatabase.hpp" #include "MetroidPrime/CPoseAsTransforms.hpp" diff --git a/src/Kyoto/Animation/CBoolPOINode.cpp b/src/Kyoto/Animation/CBoolPOINode.cpp index bf6be9a5..f9b81c8c 100644 --- a/src/Kyoto/Animation/CBoolPOINode.cpp +++ b/src/Kyoto/Animation/CBoolPOINode.cpp @@ -1,4 +1,4 @@ -#include "Kyoto/Animation/CPOINode.hpp" +#include "Kyoto/Animation/CBoolPOINode.hpp" #include "Kyoto/Streams/CInputStream.hpp" diff --git a/src/Kyoto/Animation/CInt32POINode.cpp b/src/Kyoto/Animation/CInt32POINode.cpp index a77e4906..e39cf5e3 100644 --- a/src/Kyoto/Animation/CInt32POINode.cpp +++ b/src/Kyoto/Animation/CInt32POINode.cpp @@ -1,4 +1,4 @@ -#include "Kyoto/Animation/CPOINode.hpp" +#include "Kyoto/Animation/CInt32POINode.hpp" #include "Kyoto/Streams/CInputStream.hpp" CInt32POINode::CInt32POINode(CInputStream& in) diff --git a/src/Kyoto/Animation/CParticlePOINode.cpp b/src/Kyoto/Animation/CParticlePOINode.cpp index 4a6ea9dc..c1bbe9ce 100644 --- a/src/Kyoto/Animation/CParticlePOINode.cpp +++ b/src/Kyoto/Animation/CParticlePOINode.cpp @@ -1,4 +1,4 @@ -#include "Kyoto/Animation/CPOINode.hpp" +#include "Kyoto/Animation/CParticlePOINode.hpp" CParticlePOINode::CParticlePOINode(CInputStream& in) : CPOINode(in), x38_data(in) {}