diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-10-18 16:15:49 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-10-18 16:15:49 +0200 |
commit | 0d20f1c364e23ff68c26b77632f0fb80c0e54799 (patch) | |
tree | d22ab7f9ce5c336c3a112aaeff8bcb5a7e2db672 /src/control/Pickups.cpp | |
parent | Attractor obj. fixes (diff) | |
parent | lil fix (diff) | |
download | re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar.gz re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar.bz2 re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar.lz re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar.xz re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar.zst re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.zip |
Diffstat (limited to 'src/control/Pickups.cpp')
-rw-r--r-- | src/control/Pickups.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 7a9808f6..490be370 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -122,11 +122,11 @@ CPickup::GiveUsAPickUpObject(int32 handle) { CObject *object; - if (handle <= 0) object = new CObject(m_eModelIndex, false); - else { + if (handle >= 0) { CPools::MakeSureSlotInObjectPoolIsEmpty(handle); - object = new(handle) CObject(m_eModelIndex, false); - } + object = new (handle) CObject(m_eModelIndex, false); + } else + object = new CObject(m_eModelIndex, false); if (object == nil) return nil; object->ObjectCreatedBy = MISSION_OBJECT; @@ -729,7 +729,7 @@ CPickups::Update() #ifdef CAMERA_PICKUP if ( bPickUpcamActivated ) // taken from PS2 { - float dist = (FindPlayerCoors() - StaticCamCoors).Magnitude2D(); + float dist = Distance2D(StaticCamCoors, FindPlayerCoors()); float mult; if ( dist < 10.0f ) mult = 1.0f - (dist / 10.0f ); @@ -745,8 +745,7 @@ CPickups::Update() TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT); } - if ( FindPlayerVehicle() != pPlayerVehicle - || (FindPlayerCoors() - StaticCamCoors).Magnitude() > 40.0f + if ( FindPlayerVehicle() != pPlayerVehicle || Distance(StaticCamCoors, FindPlayerCoors()) > 40.0f || ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) ) { TheCamera.RestoreWithJumpCut(); @@ -836,7 +835,7 @@ CPickups::DoPickUpEffects(CEntity *entity) CObject *object = (CObject*)entity; if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) { - float dist = (TheCamera.GetPosition() - pos).Magnitude(); + float dist = Distance2D(pos, TheCamera.GetPosition()); const float MAXDIST = 12.0f; if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) { @@ -879,7 +878,7 @@ void CPickups::DoMineEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = (TheCamera.GetPosition() - pos).Magnitude(); + float dist = Distance(pos, TheCamera.GetPosition()); const float MAXDIST = 20.0f; if (dist < MAXDIST) { @@ -898,7 +897,7 @@ void CPickups::DoMoneyEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = (TheCamera.GetPosition() - pos).Magnitude(); + float dist = Distance(pos, TheCamera.GetPosition()); const float MAXDIST = 20.0f; if (dist < MAXDIST) { @@ -917,7 +916,7 @@ void CPickups::DoCollectableEffects(CEntity *entity) { const CVector &pos = entity->GetPosition(); - float dist = (TheCamera.GetPosition() - pos).Magnitude(); + float dist = Distance(pos, TheCamera.GetPosition()); const float MAXDIST = 14.0f; if (dist < MAXDIST) { |