mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 07:30:01 +00:00
Pickup fixes
This commit is contained in:
parent
af53267b74
commit
632569cff3
|
@ -54,20 +54,15 @@ uint8 aWeaponGreens[] = { 0, 255, 128, 255, 0, 255, 128, 255, 0, 255, 255, 0, 25
|
||||||
uint8 aWeaponBlues[] = { 0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255, 0, 128, 255, 0, 0 };
|
uint8 aWeaponBlues[] = { 0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255, 0, 128, 255, 0, 0 };
|
||||||
float aWeaponScale[] = { 1.0f, 2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f, 1.0f, 1.0f, 1.0f };
|
float aWeaponScale[] = { 1.0f, 2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
|
|
||||||
void
|
|
||||||
CPickup::RemoveKeepType()
|
inline void
|
||||||
|
CPickup::Remove()
|
||||||
{
|
{
|
||||||
CWorld::Remove(m_pObject);
|
CWorld::Remove(m_pObject);
|
||||||
delete m_pObject;
|
delete m_pObject;
|
||||||
|
|
||||||
m_bRemoved = true;
|
m_bRemoved = true;
|
||||||
m_pObject = nil;
|
m_pObject = nil;
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CPickup::Remove()
|
|
||||||
{
|
|
||||||
RemoveKeepType();
|
|
||||||
m_eType = PICKUP_NONE;
|
m_eType = PICKUP_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +126,6 @@ CPickup::GiveUsAPickUpObject(int32 handle)
|
||||||
bool
|
bool
|
||||||
CPickup::CanBePickedUp(CPlayerPed *player)
|
CPickup::CanBePickedUp(CPlayerPed *player)
|
||||||
{
|
{
|
||||||
assert(m_pObject != nil);
|
|
||||||
bool cannotBePickedUp =
|
bool cannotBePickedUp =
|
||||||
(m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > 99.5f)
|
(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_HEALTH && player->m_fHealth > 99.5f)
|
||||||
|
@ -144,6 +138,7 @@ bool
|
||||||
CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||||
{
|
{
|
||||||
float waterLevel;
|
float waterLevel;
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
if (m_bRemoved) {
|
if (m_bRemoved) {
|
||||||
if (CTimer::GetTimeInMilliseconds() > m_nTimer) {
|
if (CTimer::GetTimeInMilliseconds() > m_nTimer) {
|
||||||
|
@ -204,9 +199,12 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||||
player->m_nSelectedWepSlot = player->GetWeaponSlot(CPickups::WeaponForModel(m_pObject->GetModelIndex()));
|
player->m_nSelectedWepSlot = player->GetWeaponSlot(CPickups::WeaponForModel(m_pObject->GetModelIndex()));
|
||||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON_BOUGHT, m_pObject->GetModelIndex() - MI_GRENADE);
|
DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON_BOUGHT, m_pObject->GetModelIndex() - MI_GRENADE);
|
||||||
}
|
}
|
||||||
RemoveKeepType();
|
result = true;
|
||||||
|
CWorld::Remove(m_pObject);
|
||||||
|
delete m_pObject;
|
||||||
|
m_pObject = nil;
|
||||||
m_nTimer = CTimer::GetTimeInMilliseconds() + 5000;
|
m_nTimer = CTimer::GetTimeInMilliseconds() + 5000;
|
||||||
return true;
|
m_bRemoved = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PICKUP_ON_STREET:
|
case PICKUP_ON_STREET:
|
||||||
|
@ -235,8 +233,12 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||||
m_nTimer = CTimer::GetTimeInMilliseconds() + 720000;
|
m_nTimer = CTimer::GetTimeInMilliseconds() + 720000;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveKeepType();
|
result = true;
|
||||||
return true;
|
CWorld::Remove(m_pObject);
|
||||||
|
delete m_pObject;
|
||||||
|
m_pObject = nil;
|
||||||
|
m_bRemoved = true;
|
||||||
|
break;
|
||||||
case PICKUP_ONCE:
|
case PICKUP_ONCE:
|
||||||
case PICKUP_ONCE_TIMEOUT:
|
case PICKUP_ONCE_TIMEOUT:
|
||||||
if (!CPickups::GivePlayerGoodiesWithPickUpMI(m_pObject->GetModelIndex(), playerId)) {
|
if (!CPickups::GivePlayerGoodiesWithPickUpMI(m_pObject->GetModelIndex(), playerId)) {
|
||||||
|
@ -247,8 +249,9 @@ 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);
|
||||||
}
|
}
|
||||||
|
result = true;
|
||||||
Remove();
|
Remove();
|
||||||
return true;
|
break;
|
||||||
case PICKUP_COLLECTABLE1:
|
case PICKUP_COLLECTABLE1:
|
||||||
CWorld::Players[playerId].m_nCollectedPackages++;
|
CWorld::Players[playerId].m_nCollectedPackages++;
|
||||||
CWorld::Players[playerId].m_nMoney += 1000;
|
CWorld::Players[playerId].m_nMoney += 1000;
|
||||||
|
@ -260,18 +263,20 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||||
} else
|
} else
|
||||||
CGarages::TriggerMessage("CO_ONE", CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages, 5000, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
|
CGarages::TriggerMessage("CO_ONE", CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages, 5000, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
|
||||||
|
|
||||||
|
result = true;
|
||||||
Remove();
|
Remove();
|
||||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_HIDDEN_PACKAGE, 0);
|
DMAudio.PlayFrontEndSound(SOUND_PICKUP_HIDDEN_PACKAGE, 0);
|
||||||
return true;
|
break;
|
||||||
case PICKUP_MONEY:
|
case PICKUP_MONEY:
|
||||||
CWorld::Players[playerId].m_nMoney += m_nQuantity;
|
CWorld::Players[playerId].m_nMoney += m_nQuantity;
|
||||||
sprintf(gString, "$%d", m_nQuantity);
|
sprintf(gString, "$%d", m_nQuantity);
|
||||||
#ifdef MONEY_MESSAGES
|
#ifdef MONEY_MESSAGES
|
||||||
CMoneyMessages::RegisterOne(m_vecPos + CVector(0.0f, 0.0f, 1.0f), gString, 0, 255, 0, 0.5f, 0.5f);
|
CMoneyMessages::RegisterOne(m_vecPos + CVector(0.0f, 0.0f, 1.0f), gString, 0, 255, 0, 0.5f, 0.5f);
|
||||||
#endif
|
#endif
|
||||||
|
result = true;
|
||||||
Remove();
|
Remove();
|
||||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0);
|
DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0);
|
||||||
return true;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -298,7 +303,9 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||||
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
|
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||||
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
|
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
|
||||||
touched = true;
|
touched = true;
|
||||||
break; // added break here
|
#ifdef FIX_BUGS
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,12 +327,17 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||||
bool explode = false;
|
bool explode = false;
|
||||||
if (CTimer::GetTimeInMilliseconds() > m_nTimer)
|
if (CTimer::GetTimeInMilliseconds() > m_nTimer)
|
||||||
explode = true;
|
explode = true;
|
||||||
else {// added else here since vehicle lookup is useless
|
#ifdef FIX_BUGS
|
||||||
|
else// added else here since vehicle lookup is useless
|
||||||
|
#endif
|
||||||
|
{
|
||||||
for (int32 i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) {
|
for (int32 i = CPools::GetVehiclePool()->GetSize()-1; i >= 0; i--) {
|
||||||
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
|
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||||
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
|
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
|
||||||
explode = true;
|
explode = true;
|
||||||
break; // added break here
|
#ifdef FIX_BUGS
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -352,8 +364,8 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||||
m_pObject->UpdateRwFrame();
|
m_pObject->UpdateRwFrame();
|
||||||
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 2.0f)) {
|
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 2.0f)) {
|
||||||
Remove();
|
Remove();
|
||||||
|
result = true;
|
||||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_FLOAT_PACKAGE, 0);
|
DMAudio.PlayFrontEndSound(SOUND_PICKUP_FLOAT_PACKAGE, 0);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
|
@ -361,7 +373,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
|
||||||
}
|
}
|
||||||
if (!m_bRemoved && (m_eType == PICKUP_ONCE_TIMEOUT || m_eType == PICKUP_MONEY) && CTimer::GetTimeInMilliseconds() > m_nTimer)
|
if (!m_bRemoved && (m_eType == PICKUP_ONCE_TIMEOUT || m_eType == PICKUP_MONEY) && CTimer::GetTimeInMilliseconds() > m_nTimer)
|
||||||
Remove();
|
Remove();
|
||||||
return false;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -41,10 +41,9 @@ public:
|
||||||
CObject *GiveUsAPickUpObject(int32 handle);
|
CObject *GiveUsAPickUpObject(int32 handle);
|
||||||
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; }
|
inline bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; }
|
||||||
inline bool CanBePickedUp(CPlayerPed *player);
|
inline bool CanBePickedUp(CPlayerPed *player);
|
||||||
void RemoveKeepType();
|
inline void Remove();
|
||||||
void Remove();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VALIDATE_SIZE(CPickup, 0x1C);
|
VALIDATE_SIZE(CPickup, 0x1C);
|
||||||
|
|
Loading…
Reference in a new issue