diff options
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/Pickups.cpp | 21 | ||||
-rw-r--r-- | src/control/RoadBlocks.cpp | 2 | ||||
-rw-r--r-- | src/control/Script.cpp | 12 |
3 files changed, 17 insertions, 18 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) { diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index e7831b82..dee2cbe3 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -236,7 +236,7 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2) tmp.GetPosition().z += fModelRadius - 0.6f; pVehicle->m_matrix = tmp; pVehicle->PlaceOnRoadProperly(); - pVehicle->bIsStatic = false; + pVehicle->SetIsStatic(false); pVehicle->m_matrix.UpdateRW(); pVehicle->m_nDoorLock = CARLOCK_UNLOCKED; CCarCtrl::JoinCarWithRoadSystem(pVehicle); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 1cef2a46..a2ab5f0b 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1704,7 +1704,7 @@ static void PossiblyWakeThisEntity(CPhysical* pEntity, bool ifColLoaded = false) return; if (!ifColLoaded || CColStore::HasCollisionLoaded(pEntity->GetPosition())) { pEntity->bIsStaticWaitingForCollision = false; - if (!pEntity->IsStatic()) + if (!pEntity->GetIsStatic()) pEntity->AddToMovingList(); } } @@ -3973,7 +3973,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); - car->bIsStatic = false; + car->SetIsStatic(false); /* Again weird usage of virtual functions. */ if (car->IsBoat()) { car->Teleport(pos); @@ -9649,13 +9649,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) script_assert(pObject); if (ScriptParams[1]) { if (pObject->bIsStatic) { - pObject->bIsStatic = false; + pObject->SetIsStatic(false); pObject->AddToMovingList(); } } else { if (!pObject->bIsStatic) { - pObject->bIsStatic = true; + pObject->SetIsStatic(true); pObject->RemoveFromMovingList(); } } @@ -13727,7 +13727,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) pVehicle->bDontLoadCollision = true; if (pVehicle->bIsStaticWaitingForCollision) { pVehicle->bIsStaticWaitingForCollision = false; - if (!pVehicle->IsStatic()) + if (!pVehicle->GetIsStatic()) pVehicle->AddToMovingList(); } } @@ -13750,7 +13750,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) pPed->bDontLoadCollision = true; if (pPed->bIsStaticWaitingForCollision) { pPed->bIsStaticWaitingForCollision = false; - if (!pPed->IsStatic()) + if (!pPed->GetIsStatic()) pPed->AddToMovingList(); } } |