From dbd1477d017377cdeaacdd360187c930bf3e8d8f Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 8 Oct 2022 01:12:48 -0400 Subject: [PATCH] Match & link CScriptPickup Former-commit-id: a7cefd7c4bf6e404ce6204c1411bc33544b03bfb --- asm/MetroidPrime/Player/CPlayerGun.s | 8 ++++---- asm/MetroidPrime/ScriptObjects/CScriptPickup.s | 4 ++-- configure.py | 1 + include/Kyoto/Math/CTransform4f.hpp | 6 +++--- include/Kyoto/Math/CVector3f.hpp | 6 +++--- include/MetroidPrime/CPhysicsActor.hpp | 11 ++++++++--- include/MetroidPrime/Player/CPlayer.hpp | 5 +++-- include/MetroidPrime/Player/CPlayerGun.hpp | 1 - src/MetroidPrime/ScriptObjects/CScriptPickup.cpp | 2 +- 9 files changed, 25 insertions(+), 19 deletions(-) diff --git a/asm/MetroidPrime/Player/CPlayerGun.s b/asm/MetroidPrime/Player/CPlayerGun.s index ebe013e9..be3491f0 100644 --- a/asm/MetroidPrime/Player/CPlayerGun.s +++ b/asm/MetroidPrime/Player/CPlayerGun.s @@ -156,8 +156,8 @@ lbl_805A6E18: .balign 8 # CPlayerGun -.global lbl_805A8D70 -lbl_805A8D70: +.global skTractorBeamFactor__10CPlayerGun +skTractorBeamFactor__10CPlayerGun: .skip 0x4 .global lbl_805A8D74 lbl_805A8D74: @@ -5906,7 +5906,7 @@ lbl_8003F4C0: /* 8003F4F0 0003C450 98 9E 08 32 */ stb r4, 0x832(r30) lbl_8003F4F4: /* 8003F4F4 0003C454 C0 3E 03 40 */ lfs f1, 0x340(r30) -/* 8003F4F8 0003C458 C0 0D A1 B0 */ lfs f0, lbl_805A8D70@sda21(r13) +/* 8003F4F8 0003C458 C0 0D A1 B0 */ lfs f0, skTractorBeamFactor__10CPlayerGun@sda21(r13) /* 8003F4FC 0003C45C FC 01 00 40 */ fcmpo cr0, f1, f0 /* 8003F500 0003C460 40 81 02 2C */ ble lbl_8003F72C /* 8003F504 0003C464 7F C3 F3 78 */ mr r3, r30 @@ -10826,7 +10826,7 @@ __sinit_CPlayerGun_cpp: /* 80043BAC 00040B0C 38 61 00 0C */ addi r3, r1, 0xc /* 80043BB0 00040B10 C0 42 84 FC */ lfs f2, lbl_805AA21C@sda21(r2) /* 80043BB4 00040B14 D0 04 00 04 */ stfs f0, 4(r4) -/* 80043BB8 00040B18 D0 6D A1 B0 */ stfs f3, lbl_805A8D70@sda21(r13) +/* 80043BB8 00040B18 D0 6D A1 B0 */ stfs f3, skTractorBeamFactor__10CPlayerGun@sda21(r13) /* 80043BBC 00040B1C C0 62 84 6C */ lfs f3, lbl_805AA18C@sda21(r2) /* 80043BC0 00040B20 D0 04 00 08 */ stfs f0, 8(r4) /* 80043BC4 00040B24 C0 82 84 7C */ lfs f4, lbl_805AA19C@sda21(r2) diff --git a/asm/MetroidPrime/ScriptObjects/CScriptPickup.s b/asm/MetroidPrime/ScriptObjects/CScriptPickup.s index 1789b3da..b84bcb42 100644 --- a/asm/MetroidPrime/ScriptObjects/CScriptPickup.s +++ b/asm/MetroidPrime/ScriptObjects/CScriptPickup.s @@ -710,7 +710,7 @@ lbl_800C2DD8: lbl_800C2E44: /* 800C2E44 000BFDA4 C0 22 8D C8 */ lfs f1, lbl_805AAAE8@sda21(r2) lbl_800C2E48: -/* 800C2E48 000BFDA8 C0 0D A1 B0 */ lfs f0, lbl_805A8D70@sda21(r13) +/* 800C2E48 000BFDA8 C0 0D A1 B0 */ lfs f0, skTractorBeamFactor__10CPlayerGun@sda21(r13) /* 800C2E4C 000BFDAC FC 01 00 40 */ fcmpo cr0, f1, f0 /* 800C2E50 000BFDB0 40 80 00 3C */ bge lbl_800C2E8C /* 800C2E54 000BFDB4 88 1E 02 8C */ lbz r0, 0x28c(r30) @@ -745,7 +745,7 @@ lbl_800C2E9C: lbl_800C2EC0: /* 800C2EC0 000BFE20 C0 22 8D C8 */ lfs f1, lbl_805AAAE8@sda21(r2) lbl_800C2EC4: -/* 800C2EC4 000BFE24 C0 0D A1 B0 */ lfs f0, lbl_805A8D70@sda21(r13) +/* 800C2EC4 000BFE24 C0 0D A1 B0 */ lfs f0, skTractorBeamFactor__10CPlayerGun@sda21(r13) /* 800C2EC8 000BFE28 FC 01 00 40 */ fcmpo cr0, f1, f0 /* 800C2ECC 000BFE2C 40 81 01 28 */ ble lbl_800C2FF4 /* 800C2ED0 000BFE30 80 BF 08 70 */ lwz r5, 0x870(r31) diff --git a/configure.py b/configure.py index aba97e75..ff0a5644 100755 --- a/configure.py +++ b/configure.py @@ -31,6 +31,7 @@ COMPLETE_OBJECTS = [ "MetroidPrime/CMemoryDrawEnum", "MetroidPrime/HUD/CHUDMemoParms", "MetroidPrime/ScriptObjects/CScriptDebugCameraWaypoint", + "MetroidPrime/ScriptObjects/CScriptPickup", "Weapons/IWeaponRenderer", "Collision/CMaterialList", "Collision/CMaterialFilter", diff --git a/include/Kyoto/Math/CTransform4f.hpp b/include/Kyoto/Math/CTransform4f.hpp index ddaa270d..834cbe02 100644 --- a/include/Kyoto/Math/CTransform4f.hpp +++ b/include/Kyoto/Math/CTransform4f.hpp @@ -43,9 +43,9 @@ public: f32 Get21() const { return m2.GetY(); } f32 Get22() const { return m2.GetZ(); } f32 Get23() const { return posZ; } - CVector3f GetColumn(EDimX dim) const { return CVector3f(m0.GetX(), m1.GetX(), m2.GetX()); } - CVector3f GetColumn(EDimY dim) const { return CVector3f(m0.GetY(), m1.GetY(), m2.GetY()); } - CVector3f GetColumn(EDimZ dim) const { return CVector3f(m0.GetZ(), m1.GetZ(), m2.GetZ()); } + CVector3f GetColumn(EDimX dim) const { return CVector3f(m0[dim], m1[dim], m2[dim]); } + CVector3f GetColumn(EDimY dim) const { return CVector3f(m0[dim], m1[dim], m2[dim]); } + CVector3f GetColumn(EDimZ dim) const { return CVector3f(m0[dim], m1[dim], m2[dim]); } // GetColumn__12CTransform4fCFi // GetCStyleMatrix__12CTransform4fCFv CTransform4f GetInverse() const; diff --git a/include/Kyoto/Math/CVector3f.hpp b/include/Kyoto/Math/CVector3f.hpp index 9d5c74e9..bd271492 100644 --- a/include/Kyoto/Math/CVector3f.hpp +++ b/include/Kyoto/Math/CVector3f.hpp @@ -53,9 +53,9 @@ public: f32& operator[](EDimX dim) { return mX; } f32& operator[](EDimY dim) { return mY; } f32& operator[](EDimZ dim) { return mZ; } - f32 operator[](EDimX) const { return mX; } - f32 operator[](EDimY) const { return mY; } - f32 operator[](EDimZ) const { return mZ; } + const f32& operator[](EDimX) const { return mX; } + const f32& operator[](EDimY) const { return mY; } + const f32& operator[](EDimZ) const { return mZ; } f32& operator[](int i) { return (&mX)[i]; } f32 operator[](int i) const { return (&mX)[i]; } diff --git a/include/MetroidPrime/CPhysicsActor.hpp b/include/MetroidPrime/CPhysicsActor.hpp index 741ab684..b86c4060 100644 --- a/include/MetroidPrime/CPhysicsActor.hpp +++ b/include/MetroidPrime/CPhysicsActor.hpp @@ -69,7 +69,8 @@ public: // CPhysicsActor virtual const CCollisionPrimitive* GetCollisionPrimitive() const; virtual CTransform4f GetPrimitiveTransform() const; - virtual void CollidedWith(TUniqueId id, const CCollisionInfoList& list, CStateManager& mgr); + virtual void CollidedWith(const TUniqueId& id, const CCollisionInfoList& list, + CStateManager& mgr); virtual f32 GetStepDownHeight() const; virtual f32 GetStepUpHeight() const; virtual f32 GetWeight() const; @@ -101,7 +102,9 @@ public: const CVector3f& GetConstantForceWR() const { return xfc_constantForce; } void SetConstantForceWR(const CVector3f& force) { xfc_constantForce = force; } const CAxisAngle& GetAngularMomentumWR() const { return x108_angularMomentum; } - void SetAngularMomentumWR(const CAxisAngle& angularMomentum) { x108_angularMomentum = angularMomentum; } + void SetAngularMomentumWR(const CAxisAngle& angularMomentum) { + x108_angularMomentum = angularMomentum; + } const CVector3f& GetMomentumWR() const { return x150_momentum; } void SetMomentumWR(const CVector3f& momentum) { x150_momentum = momentum; } const CVector3f& GetForceWR() const { return x15c_force; } @@ -111,7 +114,9 @@ public: const CAxisAngle& GetTorqueWR() const { return x174_torque; } void SetTorqueWR(const CAxisAngle& torque) { x174_torque = torque; } const CAxisAngle& GetAngularImpulseWR() const { return x180_angularImpulse; } - void SetAngularImpulseWR(const CAxisAngle& angularImpulse) { x180_angularImpulse = angularImpulse; } + void SetAngularImpulseWR(const CAxisAngle& angularImpulse) { + x180_angularImpulse = angularImpulse; + } CPhysicsState GetPhysicsState() const; void SetPhysicsState(const CPhysicsState& state); diff --git a/include/MetroidPrime/Player/CPlayer.hpp b/include/MetroidPrime/Player/CPlayer.hpp index 3163ad14..ce20ebea 100644 --- a/include/MetroidPrime/Player/CPlayer.hpp +++ b/include/MetroidPrime/Player/CPlayer.hpp @@ -140,7 +140,8 @@ public: // CPhysicsActor const CCollisionPrimitive* GetCollisionPrimitive() const override; CTransform4f GetPrimitiveTransform() const override; - void CollidedWith(TUniqueId id, const CCollisionInfoList& list, CStateManager& mgr) override; + void CollidedWith(const TUniqueId& id, const CCollisionInfoList& list, + CStateManager& mgr) override; f32 GetStepDownHeight() const override; f32 GetStepUpHeight() const override; f32 GetWeight() const override; @@ -172,7 +173,7 @@ public: ESurfaceRestraints GetSurfaceRestraint() const { return x2b0_outOfWaterTicks == 2 ? GetCurrentSurfaceRestraint() : kSR_Water; } - + TUniqueId GetOrbitTargetId() const { return x310_orbitTargetId; } TUniqueId GetOrbitNextTargetId() const { return x33c_orbitNextTargetId; } TUniqueId GetScanningObjectId() const { return x3b4_scanningObject; } diff --git a/include/MetroidPrime/Player/CPlayerGun.hpp b/include/MetroidPrime/Player/CPlayerGun.hpp index 64b0a1be..ccc37bad 100644 --- a/include/MetroidPrime/Player/CPlayerGun.hpp +++ b/include/MetroidPrime/Player/CPlayerGun.hpp @@ -172,7 +172,6 @@ public: void DropPowerBomb(CStateManager&) const; void SetPhazonBeamFeedback(bool); - bool IsCharging() const { return x834_24_charging; } float GetChargeBeamFactor() const { return x834_24_charging ? x340_chargeBeamFactor : 0.f; } static float GetTractorBeamFactor() { return skTractorBeamFactor; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp b/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp index 0fcceed3..a984c8b2 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp @@ -187,7 +187,7 @@ void CScriptPickup::Touch(CActor& act, CStateManager& mgr) { if (opts.GetShowPowerBombAmmoMessage()) { opts.IncrementPowerBombAmmoCount(); CSamusHud::DisplayHudMemo(rstl::wstring_l(gpStringTable->GetString(109)), - CHUDMemoParms(0.5f, true, false, false)); + CHUDMemoParms(5.f, true, false, false)); } } }