mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-23 17:49:16 +01:00
Checks rewritten
This commit is contained in:
parent
2cf94348f5
commit
679f7bbcfa
@ -123,6 +123,18 @@ CPickup::GiveUsAPickUpObject(int32 handle)
|
|||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CPickup::CanBePickedUp(CPlayerPed *player)
|
||||||
|
{
|
||||||
|
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_BRIBE && player->m_pWanted->m_nWantedLevel == 0)
|
||||||
|
|| (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame));
|
||||||
|
return !cannotBePickedUp;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||||
{
|
{
|
||||||
@ -173,11 +185,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if we didn't then we've got nothing to do
|
// if we didn't then we've got nothing to do
|
||||||
if (isPickupTouched) {
|
if (isPickupTouched && CanBePickedUp(player)) {
|
||||||
if ((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_BRIBE || player->m_pWanted->m_nWantedLevel)
|
|
||||||
&& (m_pObject->GetModelIndex() != MI_PICKUP_KILLFRENZY || !CTheScripts::IsPlayerOnAMission() && !CDarkel::FrenzyOnGoing() && CGame::nastyGame)) {
|
|
||||||
CPad::GetPad(0)->StartShake(120, 100);
|
CPad::GetPad(0)->StartShake(120, 100);
|
||||||
switch (m_eType)
|
switch (m_eType)
|
||||||
{
|
{
|
||||||
@ -208,7 +216,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
|||||||
}
|
}
|
||||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON, m_pObject->GetModelIndex() - MI_GRENADE);
|
DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON, m_pObject->GetModelIndex() - MI_GRENADE);
|
||||||
}
|
}
|
||||||
else if (MI_PICKUP_CAMERA == m_pObject->GetModelIndex() && vehicle)
|
else if (m_pObject->GetModelIndex() == MI_PICKUP_CAMERA && vehicle != nil)
|
||||||
{
|
{
|
||||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
|
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
|
||||||
CPickups::bPickUpcamActivated = true;
|
CPickups::bPickUpcamActivated = true;
|
||||||
@ -275,7 +283,6 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
switch (m_eType)
|
switch (m_eType)
|
||||||
{
|
{
|
||||||
|
@ -42,6 +42,7 @@ public:
|
|||||||
bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId);
|
bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId);
|
||||||
private:
|
private:
|
||||||
bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; }
|
bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; }
|
||||||
|
inline bool CanBePickedUp(CPlayerPed *player);
|
||||||
void RemoveKeepType();
|
void RemoveKeepType();
|
||||||
void Remove();
|
void Remove();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user