From f3656746b6c9b444b1bade8bd8c26c815ca64d5d Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Thu, 6 Oct 2022 19:45:09 +0300 Subject: [PATCH] Add CPlayerGun::GetBeamVelocity Former-commit-id: e804eb837330a755dd76736e40cf73dc9539f118 --- include/MetroidPrime/Weapons/CGunWeapon.hpp | 1 + src/MetroidPrime/Player/CPlayerGun.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/MetroidPrime/Weapons/CGunWeapon.hpp b/include/MetroidPrime/Weapons/CGunWeapon.hpp index 6fa48f1f..e35622c6 100644 --- a/include/MetroidPrime/Weapons/CGunWeapon.hpp +++ b/include/MetroidPrime/Weapons/CGunWeapon.hpp @@ -78,6 +78,7 @@ public: virtual void Unload(CStateManager& mgr); virtual bool IsLoaded() const; + const CVelocityInfo& GetVelocityInfo() const { return x1d0_velInfo; } rstl::optional_object< CModelData >& SolidModelData() { return x10_solidModelData; } CAABox GetBounds() const; diff --git a/src/MetroidPrime/Player/CPlayerGun.cpp b/src/MetroidPrime/Player/CPlayerGun.cpp index 282d7ef1..635d4f12 100644 --- a/src/MetroidPrime/Player/CPlayerGun.cpp +++ b/src/MetroidPrime/Player/CPlayerGun.cpp @@ -562,11 +562,13 @@ void CPlayerGun::InitMuzzleData() { } } -void CPlayerGun::InitCTData() { - x77c_comboXferGen = rstl::auto_ptr< CElementGen >(); -} +void CPlayerGun::InitCTData() { x77c_comboXferGen = rstl::auto_ptr< CElementGen >(); } -float CPlayerGun::GetBeamVelocity() const { return 0.0f; } +float CPlayerGun::GetBeamVelocity() const { + if (x72c_currentBeam->IsLoaded()) + return x72c_currentBeam->GetVelocityInfo().GetVelocity(int(x330_chargeState)).GetY(); + return 10.f; +} TUniqueId CPlayerGun::GetTargetId(CStateManager&) { return TUniqueId(0, 0); }