diff --git a/asm/Kyoto/Animation/CCharLayoutInfo.s b/asm/Kyoto/Animation/CCharLayoutInfo.s index 4b6e39eb..b83cd71d 100644 --- a/asm/Kyoto/Animation/CCharLayoutInfo.s +++ b/asm/Kyoto/Animation/CCharLayoutInfo.s @@ -350,7 +350,7 @@ lbl_802F7F64: /* 802F8048 002F4FA8 7C 7F 1B 78 */ mr r31, r3 /* 802F804C 002F4FAC 88 0D A7 6C */ lbz r0, lbl_805A932C@sda21(r13) /* 802F8050 002F4FB0 98 01 00 08 */ stb r0, 8(r1) -/* 802F8054 002F4FB4 4B D6 14 A5 */ bl sub_800594f8 +/* 802F8054 002F4FB4 4B D6 14 A5 */ bl "cinput_stream_helper,Q24rstl17rmemory_allocator>>__FRC82TType,Q24rstl17rmemory_allocator>>R12CInputStream" /* 802F8058 002F4FB8 80 01 00 24 */ lwz r0, 0x24(r1) /* 802F805C 002F4FBC 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 802F8060 002F4FC0 7C 08 03 A6 */ mtlr r0 diff --git a/asm/Kyoto/Animation/CCharacterInfo.s b/asm/Kyoto/Animation/CCharacterInfo.s index 7920ee10..0d90a78c 100644 --- a/asm/Kyoto/Animation/CCharacterInfo.s +++ b/asm/Kyoto/Animation/CCharacterInfo.s @@ -752,7 +752,7 @@ sub_802de18c: /* 802DE1A4 002DB104 7C 7F 1B 78 */ mr r31, r3 /* 802DE1A8 002DB108 88 0D A6 C4 */ lbz r0, lbl_805A9284@sda21(r13) /* 802DE1AC 002DB10C 98 01 00 08 */ stb r0, 8(r1) -/* 802DE1B0 002DB110 4B D7 B3 49 */ bl sub_800594f8 +/* 802DE1B0 002DB110 4B D7 B3 49 */ bl "cinput_stream_helper,Q24rstl17rmemory_allocator>>__FRC82TType,Q24rstl17rmemory_allocator>>R12CInputStream" /* 802DE1B4 002DB114 80 01 00 24 */ lwz r0, 0x24(r1) /* 802DE1B8 002DB118 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 802DE1BC 002DB11C 7C 08 03 A6 */ mtlr r0 diff --git a/asm/Kyoto/Particles/CParticleData.s b/asm/Kyoto/Particles/CParticleData.s index 82bc8dd3..8b8802cb 100644 --- a/asm/Kyoto/Particles/CParticleData.s +++ b/asm/Kyoto/Particles/CParticleData.s @@ -66,7 +66,7 @@ __ct__13CParticleDataFR12CInputStream: /* 803574BC 0035441C 7C 7F 1B 78 */ mr r31, r3 /* 803574C0 00354420 88 0D AA 94 */ lbz r0, lbl_805A9654@sda21(r13) /* 803574C4 00354424 98 01 00 08 */ stb r0, 8(r1) -/* 803574C8 00354428 4B D0 20 31 */ bl sub_800594f8 +/* 803574C8 00354428 4B D0 20 31 */ bl "cinput_stream_helper,Q24rstl17rmemory_allocator>>__FRC82TType,Q24rstl17rmemory_allocator>>R12CInputStream" /* 803574CC 0035442C 80 01 00 24 */ lwz r0, 0x24(r1) /* 803574D0 00354430 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 803574D4 00354434 7C 08 03 A6 */ mtlr r0 diff --git a/asm/MetroidPrime/CWorld.s b/asm/MetroidPrime/CWorld.s index 3b45935a..5d04d4c9 100644 --- a/asm/MetroidPrime/CWorld.s +++ b/asm/MetroidPrime/CWorld.s @@ -4226,15 +4226,15 @@ sub_800594bc: /* 800594D4 00056434 7C 7F 1B 78 */ mr r31, r3 /* 800594D8 00056438 88 0D A2 24 */ lbz r0, lbl_805A8DE4@sda21(r13) /* 800594DC 0005643C 98 01 00 08 */ stb r0, 8(r1) -/* 800594E0 00056440 48 00 00 19 */ bl sub_800594f8 +/* 800594E0 00056440 48 00 00 19 */ bl "cinput_stream_helper,Q24rstl17rmemory_allocator>>__FRC82TType,Q24rstl17rmemory_allocator>>R12CInputStream" /* 800594E4 00056444 80 01 00 24 */ lwz r0, 0x24(r1) /* 800594E8 00056448 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 800594EC 0005644C 7C 08 03 A6 */ mtlr r0 /* 800594F0 00056450 38 21 00 20 */ addi r1, r1, 0x20 /* 800594F4 00056454 4E 80 00 20 */ blr -.global sub_800594f8 -sub_800594f8: +.global "cinput_stream_helper,Q24rstl17rmemory_allocator>>__FRC82TType,Q24rstl17rmemory_allocator>>R12CInputStream" +"cinput_stream_helper,Q24rstl17rmemory_allocator>>__FRC82TType,Q24rstl17rmemory_allocator>>R12CInputStream": /* 800594F8 00056458 94 21 FF F0 */ stwu r1, -0x10(r1) /* 800594FC 0005645C 7C 08 02 A6 */ mflr r0 /* 80059500 00056460 7C A4 2B 78 */ mr r4, r5 diff --git a/configure.py b/configure.py index 8b88c35d..de418ebf 100755 --- a/configure.py +++ b/configure.py @@ -665,7 +665,7 @@ LIBS = [ ["Kyoto/Text/CStringTable", True], "Kyoto/Particles/CEmitterElement", "Kyoto/Particles/CEffectComponent", - "Kyoto/Particles/CParticleData", + ["Kyoto/Particles/CParticleData", False], "Kyoto/Animation/CVertexMorphEffect", "Kyoto/Animation/CSkinnedModelWithAvgNormals", ["Kyoto/CTimeProvider", True], diff --git a/include/Kyoto/Animation/CEffectComponent.hpp b/include/Kyoto/Animation/CEffectComponent.hpp index f6fe91e7..e61f0dd8 100644 --- a/include/Kyoto/Animation/CEffectComponent.hpp +++ b/include/Kyoto/Animation/CEffectComponent.hpp @@ -3,7 +3,7 @@ #include "types.h" -#include "Kyoto/Animation/CParticleData.hpp" +#include "Kyoto/Particles/CParticleData.hpp" class CEffectComponent { private: diff --git a/include/Kyoto/Animation/CPOINode.hpp b/include/Kyoto/Animation/CPOINode.hpp index eadaa51d..a449c4a7 100644 --- a/include/Kyoto/Animation/CPOINode.hpp +++ b/include/Kyoto/Animation/CPOINode.hpp @@ -4,7 +4,7 @@ #include "types.h" #include "Kyoto/Animation/CCharAnimTime.hpp" -#include "Kyoto/Animation/CParticleData.hpp" +#include "Kyoto/Particles/CParticleData.hpp" #include "rstl/string.hpp" diff --git a/include/Kyoto/Animation/CParticleData.hpp b/include/Kyoto/Particles/CParticleData.hpp similarity index 63% rename from include/Kyoto/Animation/CParticleData.hpp rename to include/Kyoto/Particles/CParticleData.hpp index 0060108a..cdbe7aa1 100644 --- a/include/Kyoto/Animation/CParticleData.hpp +++ b/include/Kyoto/Particles/CParticleData.hpp @@ -8,6 +8,7 @@ #include "rstl/string.hpp" +class CInputStream; class CParticleData { public: enum EParentedMode { @@ -16,8 +17,18 @@ public: kPM_ContinuousSystem, }; + CParticleData(int duration, const SObjectTag& tag, const rstl::string& boneName, float scale, + EParentedMode mode) + : x0_duration(duration) + , x4_particle(tag) + , xc_boneName(boneName) + , x1c_scale(scale) + , x20_parentMode(mode) {} + + CParticleData(CInputStream& in); + private: - uint x0_duration; + int x0_duration; SObjectTag x4_particle; rstl::string xc_boneName; float x1c_scale; diff --git a/include/Kyoto/Streams/CInputStream.hpp b/include/Kyoto/Streams/CInputStream.hpp index 7f87e562..a1a298fb 100644 --- a/include/Kyoto/Streams/CInputStream.hpp +++ b/include/Kyoto/Streams/CInputStream.hpp @@ -11,6 +11,11 @@ struct TType {}; template < typename T > T cinput_stream_helper(const TType< T >& type, CInputStream& in); +template < typename T > +TType< T > TGetType() { + return TType< T >(); +} + class CInputStream { public: CInputStream(int len); @@ -56,8 +61,8 @@ private: uint x20_bitOffset; }; -template -inline T cinput_stream_helper(const TType& type, CInputStream& in) { +template < typename T > +inline T cinput_stream_helper(const TType< T >& type, CInputStream& in) { return T(in); } template <> @@ -118,13 +123,10 @@ inline rstl::vector< T, Alloc >::vector(CInputStream& in, const Alloc& allocator #include "rstl/reserved_vector.hpp" template < typename T, int N > -inline rstl::reserved_vector< T, N >::reserved_vector(CInputStream& in) -: x0_count(in.ReadInt32()) { +inline rstl::reserved_vector< T, N >::reserved_vector(CInputStream& in) : x0_count(in.ReadInt32()) { for (int i = 0; i < x0_count; i++) { construct(&data()[i], in.Get(TType< T >())); } } - - #endif // _CINPUTSTREAM diff --git a/include/MetroidPrime/CParticleGenInfo.hpp b/include/MetroidPrime/CParticleGenInfo.hpp index 21ff9cac..f49f06af 100644 --- a/include/MetroidPrime/CParticleGenInfo.hpp +++ b/include/MetroidPrime/CParticleGenInfo.hpp @@ -1,7 +1,7 @@ #ifndef _CPARTICLEGENINFO #define _CPARTICLEGENINFO -#include "Kyoto/Animation/CParticleData.hpp" +#include "Kyoto/Particles/CParticleData.hpp" #include "MetroidPrime/TGameTypes.hpp" diff --git a/src/Kyoto/Particles/CParticleData.cpp b/src/Kyoto/Particles/CParticleData.cpp new file mode 100644 index 00000000..7055150c --- /dev/null +++ b/src/Kyoto/Particles/CParticleData.cpp @@ -0,0 +1,10 @@ +#include "Kyoto/Particles/CParticleData.hpp" + +#include "Kyoto/Streams/CInputStream.hpp" + +CParticleData::CParticleData(CInputStream& in) +: x0_duration(in.ReadLong()) +, x4_particle(in.ReadLong(), in.ReadLong()) +, xc_boneName(in.Get()) +, x1c_scale(in.ReadFloat()) +, x20_parentMode(EParentedMode(in.ReadLong())) {}