summaryrefslogtreecommitdiffstats
path: root/src/control/Pickups.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-05-19 16:46:18 +0200
committereray orçunus <erayorcunus@gmail.com>2020-05-19 16:46:18 +0200
commit99574ebfc61a79b34f4681eaa2debefbae174875 (patch)
treea3edae2913a4af9682f7ecfec53367a484c2975c /src/control/Pickups.cpp
parentMelee weapons(half-working), Ped and Hud bits (diff)
parentMerge pull request #564 from Xinerki/miami (diff)
downloadre3-99574ebfc61a79b34f4681eaa2debefbae174875.tar
re3-99574ebfc61a79b34f4681eaa2debefbae174875.tar.gz
re3-99574ebfc61a79b34f4681eaa2debefbae174875.tar.bz2
re3-99574ebfc61a79b34f4681eaa2debefbae174875.tar.lz
re3-99574ebfc61a79b34f4681eaa2debefbae174875.tar.xz
re3-99574ebfc61a79b34f4681eaa2debefbae174875.tar.zst
re3-99574ebfc61a79b34f4681eaa2debefbae174875.zip
Diffstat (limited to 'src/control/Pickups.cpp')
-rw-r--r--src/control/Pickups.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 78b8d198..cccf9cc4 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -172,12 +172,12 @@ CPickup::GiveUsAPickUpObject(int32 handle)
}
bool
-CPickup::CanBePickedUp(CPlayerPed *player)
+CPickup::CanBePickedUp(CPlayerPed *player, int playerId)
{
assert(m_pObject != nil);
bool cannotBePickedUp =
- (m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > 99.5f)
- || (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > 99.5f)
+ (m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > CWorld::Players[playerId].m_nMaxArmour - 0.5f)
+ || (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > CWorld::Players[playerId].m_nMaxHealth - 0.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_BRIBE && player->m_pWanted->m_nWantedLevel == 0)
|| (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame));
return !cannotBePickedUp;
@@ -233,7 +233,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
}
// if we didn't then we've got nothing to do
- if (isPickupTouched && CanBePickedUp(player)) {
+ if (isPickupTouched && CanBePickedUp(player, playerId)) {
CPad::GetPad(0)->StartShake(120, 100);
switch (m_eType)
{
@@ -497,14 +497,14 @@ CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex)
DMAudio.PlayFrontEndSound(SOUND_PICKUP_ADRENALINE, 0);
return true;
} else if (modelIndex == MI_PICKUP_BODYARMOUR) {
- player->m_fArmour = 100.0f;
+ player->m_fArmour = CWorld::Players[playerIndex].m_nMaxArmour;
DMAudio.PlayFrontEndSound(SOUND_PICKUP_ARMOUR, 0);
return true;
} else if (modelIndex == MI_PICKUP_INFO) {
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
return true;
} else if (modelIndex == MI_PICKUP_HEALTH) {
- player->m_fHealth = 100.0f;
+ player->m_fHealth = CWorld::Players[playerIndex].m_nMaxHealth;
DMAudio.PlayFrontEndSound(SOUND_PICKUP_HEALTH, 0);
return true;
} else if (modelIndex == MI_PICKUP_BONUS) {