diff --git a/include/MetroidPrime/Player/CPlayerState.hpp b/include/MetroidPrime/Player/CPlayerState.hpp index 8b24b02f..a8e43143 100644 --- a/include/MetroidPrime/Player/CPlayerState.hpp +++ b/include/MetroidPrime/Player/CPlayerState.hpp @@ -125,7 +125,7 @@ public: void EnableItem(EItemType type); bool HasPowerUp(EItemType type) const; uint GetPowerUp(EItemType type); - uint GetItemCapacity(EItemType type) const; + int GetItemCapacity(EItemType type) const; uint GetItemAmount(EItemType type) const; void DecrPickUp(EItemType type, int amount); void IncrPickUp(EItemType type, int amount); diff --git a/src/MetroidPrime/Player/CPlayerState.cpp b/src/MetroidPrime/Player/CPlayerState.cpp index 4da5df8f..74b76061 100644 --- a/src/MetroidPrime/Player/CPlayerState.cpp +++ b/src/MetroidPrime/Player/CPlayerState.cpp @@ -271,7 +271,7 @@ uint CPlayerState::GetItemAmount(CPlayerState::EItemType type) const { return 0; } -uint CPlayerState::GetItemCapacity(CPlayerState::EItemType type) const { +int CPlayerState::GetItemCapacity(CPlayerState::EItemType type) const { if (type < 0 || kIT_Max - 1 < type) { return 0; } @@ -413,15 +413,19 @@ void CPlayerState::SetIsFusionEnabled(bool val) { x0_26_fusion = val; } int CPlayerState::GetTotalPickupCount() const { return 99; } int CPlayerState::CalculateItemCollectionRate() const { - int total = GetItemCapacity(kIT_PowerBombs); + int total = 0; + + int pbCount = GetItemCapacity(kIT_PowerBombs); + if (pbCount >= 4) + pbCount = pbCount - 3; - if (total >= 4) - total -= 3; total += GetItemCapacity(kIT_WaveBeam); - total += GetItemCapacity(kIT_IceBeam); + int iceBeam = GetItemCapacity(kIT_IceBeam); total += GetItemCapacity(kIT_PlasmaBeam); total += GetItemCapacity(kIT_Missiles) / 5; - total += GetItemCapacity(kIT_MorphBallBombs); + + int aux = total + GetItemCapacity(kIT_MorphBallBombs); + total = aux + pbCount; total += GetItemCapacity(kIT_Flamethrower); total += GetItemCapacity(kIT_ThermalVisor); total += GetItemCapacity(kIT_ChargeBeam); @@ -448,7 +452,7 @@ int CPlayerState::CalculateItemCollectionRate() const { total += GetItemCapacity(kIT_World); total += GetItemCapacity(kIT_Spirit); total += GetItemCapacity(kIT_Newborn); - return total + GetItemCapacity(kIT_Wavebuster); + return iceBeam + total + GetItemCapacity(kIT_Wavebuster); } int CPlayerState::GetMissileCostForAltAttack() const {