diff --git a/asm/MetroidPrime/Cameras/CBallCamera.s b/asm/MetroidPrime/Cameras/CBallCamera.s index 01885fa7..f7115e2c 100644 --- a/asm/MetroidPrime/Cameras/CBallCamera.s +++ b/asm/MetroidPrime/Cameras/CBallCamera.s @@ -13564,7 +13564,7 @@ __dt__11CBallCameraFv: lbl_8008CD34: /* 8008CD34 00089C94 38 7E 04 7C */ addi r3, r30, 0x47c /* 8008CD38 00089C98 38 80 FF FF */ li r4, -1 -/* 8008CD3C 00089C9C 48 00 01 71 */ bl __dt__Q211CBallCamera23SFailsafeStateContainerFv +/* 8008CD3C 00089C9C 48 00 01 71 */ bl "__dt__Q24rstl43single_ptrFv" /* 8008CD40 00089CA0 38 7E 03 7C */ addi r3, r30, 0x37c /* 8008CD44 00089CA4 38 80 FF FF */ li r4, -1 /* 8008CD48 00089CA8 4B FD 08 A1 */ bl __dt__13CCameraSplineFv @@ -13667,8 +13667,8 @@ lbl_8008CE88: /* 8008CEA4 00089E04 38 21 00 50 */ addi r1, r1, 0x50 /* 8008CEA8 00089E08 4E 80 00 20 */ blr -.global __dt__Q211CBallCamera23SFailsafeStateContainerFv -__dt__Q211CBallCamera23SFailsafeStateContainerFv: +.global "__dt__Q24rstl43single_ptrFv" +"__dt__Q24rstl43single_ptrFv": /* 8008CEAC 00089E0C 94 21 FF D0 */ stwu r1, -0x30(r1) /* 8008CEB0 00089E10 7C 08 02 A6 */ mflr r0 /* 8008CEB4 00089E14 90 01 00 34 */ stw r0, 0x34(r1) diff --git a/include/MetroidPrime/Cameras/CBallCamera.hpp b/include/MetroidPrime/Cameras/CBallCamera.hpp index 1004a7cf..baed092e 100644 --- a/include/MetroidPrime/Cameras/CBallCamera.hpp +++ b/include/MetroidPrime/Cameras/CBallCamera.hpp @@ -26,17 +26,16 @@ private: class CCameraCollider { public: - CCameraCollider(f32 radius, CVector3f vec, const CCameraSpring& spring, f32 scale); - // : x4_radius(radius) - // , x8_lastLocalPos(vec) - // , x14_localPos(vec) - // , x20_scaledWorldPos(vec) - // , x2c_lastWorldPos(vec) - // , x38_spring(spring) - // , x4c_occlusionCount(0) - // , x50_scale(scale) {} - CCameraCollider(const CCameraCollider&); - virtual ~CCameraCollider(); + CCameraCollider(f32 radius, CVector3f vec, const CCameraSpring& spring, f32 scale) + : x4_radius(radius) + , x8_lastLocalPos(vec) + , x14_localPos(vec) + , x20_scaledWorldPos(vec) + , x2c_lastWorldPos(vec) + , x38_spring(spring) + , x4c_occlusionCount(0) + , x50_scale(scale) {} + virtual ~CCameraCollider() {} f32 GetRadius() const { return x4_radius; } // TODO @@ -145,23 +144,10 @@ private: rstl::vector< CVector3f > x90_splinePoints; SFailsafeState(); - // ~SFailsafeState(); - }; - struct SFailsafeStateContainer { - SFailsafeState* x0_failsafeState; - - SFailsafeStateContainer() : x0_failsafeState(new SFailsafeState) {} - ~SFailsafeStateContainer(); // { } }; struct SUnknown { SUnknown(); }; - struct SUnknownContainer { - SUnknown* x0_; - - SUnknownContainer() : x0_(new SUnknown) {} - ~SUnknownContainer() { delete x0_; } - }; EBallCameraBehaviour x188_behaviour; bool x18c_24_ : 1; @@ -269,8 +255,8 @@ private: f32 x470_clampVelTimer; f32 x474_clampVelRange; uint x478_shortMoveCount; - SFailsafeStateContainer x47c_failsafeStateContainer; - SUnknownContainer x480_; + rstl::single_ptr< SFailsafeState > x47c_failsafeState; + rstl::single_ptr< SUnknown > x480_; }; CHECK_SIZEOF(CBallCamera, 0x488) diff --git a/src/MetroidPrime/Cameras/CBallCamera.cpp b/src/MetroidPrime/Cameras/CBallCamera.cpp index 14bcbb53..73eaa23f 100644 --- a/src/MetroidPrime/Cameras/CBallCamera.cpp +++ b/src/MetroidPrime/Cameras/CBallCamera.cpp @@ -13,16 +13,6 @@ static CMaterialList kLineOfSightExcludeList = static CMaterialFilter kLineOfSightFilter = CMaterialFilter::MakeIncludeExclude(kLineOfSightIncludeList, kLineOfSightExcludeList); -CCameraCollider::CCameraCollider(f32 radius, CVector3f vec, const CCameraSpring& spring, f32 scale) -: x4_radius(radius) -, x8_lastLocalPos(vec) -, x14_localPos(vec) -, x20_scaledWorldPos(vec) -, x2c_lastWorldPos(vec) -, x38_spring(spring) -, x4c_occlusionCount(0) -, x50_scale(scale) {} - // TODO non-matching CBallCamera::CBallCamera(TUniqueId uid, TUniqueId watchedId, const CTransform4f& xf, f32 fovY, f32 nearZ, f32 farZ, f32 aspect) @@ -144,16 +134,13 @@ CBallCamera::CBallCamera(TUniqueId uid, TUniqueId watchedId, const CTransform4f& , x470_clampVelTimer(0.f) , x474_clampVelRange(0.f) , x478_shortMoveCount(0) -// , x47c_failsafeState(new SFailsafeState) -, x47c_failsafeStateContainer() -, x480_() { +, x47c_failsafeState(new SFailsafeState) +, x480_(new SUnknown) { SetupColliders(x264_smallColliders, 2.31f, 2.31f, 0.1f, 3, 2.f, 0.5f, -M_PIF / 2.f); SetupColliders(x274_mediumColliders, 4.62f, 4.62f, 0.1f, 6, 2.f, 0.5f, -M_PIF / 2.f); SetupColliders(x284_largeColliders, 7.f, 7.f, 0.1f, 12, 2.f, 0.5f, -M_PIF / 2.f); } -CBallCamera::SFailsafeStateContainer::~SFailsafeStateContainer() { delete x0_failsafeState; } - CBallCamera::~CBallCamera() {} void CBallCamera::TeleportColliders(rstl::vector< CCameraCollider >& colliderList, CVector3f pos) { @@ -220,18 +207,6 @@ void CBallCamera::ResetToTweaks(CStateManager& mgr) { x18e_26_ = false; } -CCameraCollider::~CCameraCollider() {} - -CCameraCollider::CCameraCollider(const CCameraCollider& other) -: x4_radius(other.x4_radius) -, x8_lastLocalPos(other.x8_lastLocalPos) -, x14_localPos(other.x14_localPos) -, x20_scaledWorldPos(other.x20_scaledWorldPos) -, x2c_lastWorldPos(other.x2c_lastWorldPos) -, x38_spring(other.x38_spring) -, x4c_occlusionCount(other.x4c_occlusionCount) -, x50_scale(other.x50_scale) {} - void CBallCamera::SetupColliders(rstl::vector< CCameraCollider >& out, f32 xMag, f32 zMag, f32 radius, int count, f32 k, f32 max, f32 startAngle) { out.reserve(count);