diff --git a/include/MetroidPrime/Player/CPlayer.hpp b/include/MetroidPrime/Player/CPlayer.hpp index 294cf0ab..2eec3b5a 100644 --- a/include/MetroidPrime/Player/CPlayer.hpp +++ b/include/MetroidPrime/Player/CPlayer.hpp @@ -167,6 +167,10 @@ public: CPlayerGun* PlayerGun() { return x490_gun.get(); } const CPlayerGun* GetPlayerGun() const { return x490_gun.get(); } + + TUniqueId GetOrbitTargetId() const { return x310_orbitTargetId; } + TUniqueId GetOrbitNextTargetId() const { return x33c_orbitNextTargetId; } + TUniqueId GetScanningObjectId() const { return x3b4_scanningObject; } private: struct CVisorSteam { diff --git a/src/MetroidPrime/Player/CPlayerGun.cpp b/src/MetroidPrime/Player/CPlayerGun.cpp index 635d4f12..0112f138 100644 --- a/src/MetroidPrime/Player/CPlayerGun.cpp +++ b/src/MetroidPrime/Player/CPlayerGun.cpp @@ -570,7 +570,22 @@ float CPlayerGun::GetBeamVelocity() const { return 10.f; } -TUniqueId CPlayerGun::GetTargetId(CStateManager&) { return TUniqueId(0, 0); } +TUniqueId CPlayerGun::GetTargetId(CStateManager& mgr) { + TUniqueId ret = mgr.GetPlayer()->GetOrbitTargetId(); + if (x832_26_comboFiring && ret == kInvalidUniqueId && x310_currentBeam == CPlayerState::kBI_Wave) + ret = mgr.GetPlayer()->GetOrbitNextTargetId(); + + if (ret != kInvalidUniqueId) { + const CActor* act = TCastToConstPtr(mgr.GetObjectById(ret)); + if (act != nullptr) { + if (!act->GetMaterialList().HasMaterial(kMT_Target)) { + ret = kInvalidUniqueId; + } + } + } + + return ret; + } CPlayerGun::CGunMorph::CGunMorph(float gunTransformTime, float holoHoldTime) : x4_gunTransformTime(gunTransformTime), x10_holoHoldTime(fabs(holoHoldTime)) {}