From 7d758f3a9f7ad9b46cc9ab296166365597898bf5 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 30 Apr 2020 16:45:45 +0300 Subject: [PATCH] Adding getters and setters for type and status --- src/audio/AudioManager.cpp | 20 ++++----- src/audio/MusicManager.cpp | 2 +- src/control/CarAI.cpp | 16 +++---- src/control/CarCtrl.cpp | 26 +++++------ src/control/GameLogic.cpp | 12 ++--- src/control/Garages.cpp | 8 ++-- src/control/Record.cpp | 6 +-- src/control/Remote.cpp | 4 +- src/control/Replay.cpp | 4 +- src/control/RoadBlocks.cpp | 2 +- src/control/SceneEdit.cpp | 8 ++-- src/control/Script.cpp | 40 ++++++++--------- src/control/TrafficLights.cpp | 2 +- src/core/AnimViewer.cpp | 4 +- src/core/Cam.cpp | 4 +- src/core/Pad.cpp | 2 +- src/core/PlayerInfo.cpp | 10 ++--- src/core/Pools.cpp | 4 +- src/core/Wanted.cpp | 2 +- src/core/World.cpp | 14 +++--- src/core/re3.cpp | 2 +- src/entities/Entity.h | 13 ++++-- src/entities/Physical.cpp | 34 +++++++-------- src/objects/CutsceneObject.cpp | 2 +- src/objects/Object.cpp | 2 +- src/peds/CopPed.cpp | 2 +- src/peds/Ped.cpp | 76 ++++++++++++++++---------------- src/peds/PlayerPed.cpp | 2 +- src/peds/Population.cpp | 4 +- src/render/Renderer.cpp | 8 ++-- src/vehicles/Automobile.cpp | 80 +++++++++++++++++----------------- src/vehicles/Boat.cpp | 10 ++--- src/vehicles/CarGen.cpp | 6 +-- src/vehicles/Cranes.cpp | 2 +- src/vehicles/Heli.cpp | 4 +- src/vehicles/Plane.cpp | 10 ++--- src/vehicles/Train.cpp | 12 ++--- src/vehicles/Vehicle.cpp | 14 +++--- src/weapons/BulletInfo.cpp | 2 +- src/weapons/ProjectileInfo.cpp | 2 +- src/weapons/Weapon.cpp | 28 ++++++------ 41 files changed, 256 insertions(+), 249 deletions(-) diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 0c06bc67..be854539 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -4461,7 +4461,7 @@ void cAudioManager::ProcessFires(int32) if(gFireManager.m_aFires[i].m_bIsOngoing && gFireManager.m_aFires[i].m_bAudioSet) { entity = gFireManager.m_aFires[i].m_pEntity; if(entity) { - switch(entity->m_type & 7) { + switch(entity->GetType()) { case ENTITY_TYPE_BUILDING: m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; @@ -7097,7 +7097,7 @@ cAudioManager::ProcessPhysical(int32 id) { CPhysical *entity = (CPhysical *)m_asAudioEntities[id].m_pEntity; if(entity) { - switch(entity->m_type) { + switch(entity->GetType()) { case ENTITY_TYPE_VEHICLE: ProcessVehicle((CVehicle *)m_asAudioEntities[id].m_pEntity); break; @@ -8069,7 +8069,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh) if(handling) params.m_pTransmission = &handling->Transmission; params.m_nIndex = veh->m_modelIndex - 90; - if(params.m_pVehicle->m_status == STATUS_SIMPLE) + if(params.m_pVehicle->GetStatus() == STATUS_SIMPLE) velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f; else velChange = @@ -8215,7 +8215,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) if(params->m_fDistance < SQR(50.f)) { playerVeh = FindPlayerVehicle(); veh = params->m_pVehicle; - if(playerVeh == veh && veh->m_status == STATUS_WRECKED) { + if(playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) { SampleManager.StopChannel(m_nActiveSamples); return; } @@ -8237,7 +8237,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) if(automobile->bIsHandbrakeOn) { if(params->m_fVelocityChange == 0.0f) traction = 0.9f; - } else if(params->m_pVehicle->m_status == STATUS_SIMPLE) { + } else if(params->m_pVehicle->GetStatus() == STATUS_SIMPLE) { traction = 0.0f; } else { switch(transmission->nDriveType) { @@ -8265,7 +8265,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) relativeChange = 0.f; } else if(currentGear) { relativeGearChange = Min(1.0f, (params->m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f); - if(traction == 0.0f && automobile->m_status != STATUS_SIMPLE && params->m_fVelocityChange >= transmission->Gears[1].fShiftUpVelocity) { + if(traction == 0.0f && automobile->GetStatus() != STATUS_SIMPLE && params->m_fVelocityChange >= transmission->Gears[1].fShiftUpVelocity) { traction = 0.7f; } relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + (1.0f - traction) * relativeGearChange; @@ -8296,7 +8296,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) } m_sQueueSample.m_nVolume = volume; if(m_sQueueSample.m_nVolume) { - if(automobile->m_status == STATUS_SIMPLE) { + if(automobile->GetStatus() == STATUS_SIMPLE) { if(modificator < 0.02f) { m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType + SFX_CAR_REV_10; freq = 10000.f * modificator + 22050; @@ -8388,7 +8388,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params) if((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && automobile->m_modelIndex != MI_MRWHOOP) { if(automobile->m_nCarHornTimer) { - if(params->m_pVehicle->m_status) { + if(params->m_pVehicle->GetStatus() != STATUS_PLAYER) { if(automobile->m_nCarHornTimer > 44) automobile->m_nCarHornTimer = 44; if(automobile->m_nCarHornTimer == 44) @@ -8946,14 +8946,14 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params) if(veh->m_bSirenOrAlarm == 0 && veh->m_nAlarmState <= 0) return; #ifdef FIX_BUGS - if (params->m_pVehicle->m_status == STATUS_WRECKED) return; + if (params->m_pVehicle->GetStatus() == STATUS_WRECKED) return; #endif CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, 110.f, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_nVolume) { m_sQueueSample.m_nCounter = 5; if(UsesSiren(params->m_nIndex)) { - if(params->m_pVehicle->m_status == STATUS_ABANDONED) return; + if(params->m_pVehicle->GetStatus() == STATUS_ABANDONED) return; if(veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) { m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST; if(params->m_nIndex == FBICAR) diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 9cab45b4..5f6dc1c3 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -55,7 +55,7 @@ cMusicManager::PlayerInCar() if (!FindPlayerVehicle()) return true; - if (FindPlayerVehicle()->m_status == STATUS_WRECKED) + if (FindPlayerVehicle()->GetStatus() == STATUS_WRECKED) return false; switch(FindPlayerVehicle()->m_modelIndex) { diff --git a/src/control/CarAI.cpp b/src/control/CarAI.cpp index a8e77fc2..f0df1ed2 100644 --- a/src/control/CarAI.cpp +++ b/src/control/CarAI.cpp @@ -41,7 +41,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle) pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE) pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle); } - switch (pVehicle->m_status){ + switch (pVehicle->GetStatus()){ case STATUS_PLAYER: case STATUS_PLAYER_PLAYBACKFROMBUFFER: case STATUS_TRAIN_MOVING: @@ -330,12 +330,12 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle) if (ABS(FindPlayerCoors().x - pVehicle->GetPosition().x) > 10.0f || ABS(FindPlayerCoors().y - pVehicle->GetPosition().y) > 10.0f){ pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle); - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); pVehicle->AutoPilot.m_nCarMission = FindPoliceCarMissionForWantedLevel(); pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE; pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; }else if (pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE){ - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); TellOccupantsToLeaveCar(pVehicle); pVehicle->AutoPilot.m_nCruiseSpeed = 0; pVehicle->AutoPilot.m_nCarMission = MISSION_NONE; @@ -357,7 +357,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle) pVehicle->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds(); pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); } - if (pVehicle->m_status == STATUS_PHYSICS && pVehicle->AutoPilot.m_nTempAction == TEMPACT_NONE){ + if (pVehicle->GetStatus() == STATUS_PHYSICS && pVehicle->AutoPilot.m_nTempAction == TEMPACT_NONE){ if (pVehicle->AutoPilot.m_nCarMission != MISSION_NONE){ if (pVehicle->AutoPilot.m_nCarMission != MISSION_STOP_FOREVER && pVehicle->AutoPilot.m_nCruiseSpeed != 0 && @@ -386,7 +386,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle) CTimer::GetPreviousTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeToStartMission <= 30000 && pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE && !CTrafficLights::ShouldCarStopForBridge(pVehicle)){ - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); CCarCtrl::SwitchVehicleToRealPhysics(pVehicle); pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; pVehicle->AutoPilot.m_nTempAction = TEMPACT_REVERSE; @@ -446,7 +446,7 @@ float CCarAI::GetCarToGoToCoors(CVehicle* pVehicle, CVector* pTarget) pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE; pVehicle->AutoPilot.m_nCruiseSpeed = 20; pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); pVehicle->AutoPilot.m_nCarMission = (CCarCtrl::JoinCarWithRoadSystemGotoCoors(pVehicle, *pTarget, false)) ? MISSION_GOTOCOORDS_STRAIGHT : MISSION_GOTOCOORDS; }else if (Abs(pTarget->x - pVehicle->AutoPilot.m_vecDestinationCoors.x) > 2.0f || @@ -603,7 +603,7 @@ void CCarAI::MakeWayForCarWithSiren(CVehicle *pVehicle) continue; if (vehicle->m_vehType != VEHICLE_TYPE_CAR && vehicle->m_vehType != VEHICLE_TYPE_BIKE) continue; - if (vehicle->m_status != STATUS_SIMPLE && vehicle->m_status != STATUS_PHYSICS) + if (vehicle->GetStatus() != STATUS_SIMPLE && vehicle->GetStatus() != STATUS_PHYSICS) continue; if (vehicle->VehicleCreatedBy != RANDOM_VEHICLE) continue; @@ -627,7 +627,7 @@ void CCarAI::MakeWayForCarWithSiren(CVehicle *pVehicle) TEMPACT_SWERVELEFT : TEMPACT_SWERVERIGHT; vehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000; } - vehicle->m_status = STATUS_PHYSICS; + vehicle->SetStatus(STATUS_PHYSICS); }else{ if (DotProduct2D(vehicle->GetMoveSpeed(), distance) < 0.0f && vehicle->AutoPilot.m_nTempAction != TEMPACT_WAIT){ vehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT; diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index f347b2c9..bb70be8c 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -482,10 +482,10 @@ CCarCtrl::GenerateOneRandomCar() case NINES: case GANG8: case GANG9: - pCar->m_status = STATUS_SIMPLE; + pCar->SetStatus(STATUS_SIMPLE); break; case COPS: - pCar->m_status = (pCar->AutoPilot.m_nCarMission == MISSION_CRUISE) ? STATUS_SIMPLE : STATUS_PHYSICS; + pCar->SetStatus((pCar->AutoPilot.m_nCarMission == MISSION_CRUISE) ? STATUS_SIMPLE : STATUS_PHYSICS); pCar->ChangeLawEnforcerState(1); break; default: @@ -532,7 +532,7 @@ CCarCtrl::GenerateOneRandomCar() else pCar->SetUpDriver(); if ((CGeneral::GetRandomNumber() & 0x3F) == 0){ /* 1/64 probability */ - pCar->m_status = STATUS_PHYSICS; + pCar->SetStatus(STATUS_PHYSICS); pCar->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; pCar->AutoPilot.m_nCruiseSpeed += 10; } @@ -702,7 +702,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle) return; } } - if ((pVehicle->m_status == STATUS_SIMPLE || pVehicle->m_status == STATUS_PHYSICS && pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_STOP_FOR_CARS) && + if ((pVehicle->GetStatus() == STATUS_SIMPLE || pVehicle->GetStatus() == STATUS_PHYSICS && pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_STOP_FOR_CARS) && CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeToStartMission > 5000 && !pVehicle->GetIsOnScreen() && (pVehicle->GetPosition() - vecPlayerPos).Magnitude2D() > 25.0f && @@ -716,7 +716,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle) delete pVehicle; return; } - if (pVehicle->m_status != STATUS_WRECKED || pVehicle->m_nTimeOfDeath == 0) + if (pVehicle->GetStatus() != STATUS_WRECKED || pVehicle->m_nTimeOfDeath == 0) return; if (CTimer::GetTimeInMilliseconds() > pVehicle->m_nTimeOfDeath + 60000 && (!pVehicle->GetIsOnScreen() || !CRenderer::IsEntityCullZoneVisible(pVehicle))){ @@ -759,7 +759,7 @@ CCarCtrl::UpdateCarOnRails(CVehicle* pVehicle) SlowCarOnRailsDownForTrafficAndLights(pVehicle); if (pVehicle->AutoPilot.m_nTimeEnteredCurve + pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve <= CTimer::GetTimeInMilliseconds()) PickNextNodeAccordingStrategy(pVehicle); - if (pVehicle->m_status == STATUS_PHYSICS) + if (pVehicle->GetStatus() == STATUS_PHYSICS) return; CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo]; CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo]; @@ -917,7 +917,7 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f if (sideLength + 0.5f < sidewaysDistance) /* If car is far enough taking side into account, don't care */ continue; - if (pPed->m_type == ENTITY_TYPE_PED){ /* ...how can it not be? */ + if (pPed->IsPed()){ /* ...how can it not be? */ if (pPed->GetPedState() != PED_STEP_AWAY && pPed->GetPedState() != PED_DIVE_AWAY){ if (distanceUntilHit < movementTowardsPedPerSecond){ /* Very close. Time to evade. */ @@ -937,7 +937,7 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f } }else{ /* Relatively safe but annoying. */ - if (pVehicle->m_status == STATUS_PLAYER && + if (pVehicle->GetStatus() == STATUS_PLAYER && pPed->GetPedState() != PED_FLEE_ENTITY && pPed->CharCreatedBy == RANDOM_CHAR){ float angleCarToPed = CGeneral::GetRadianAngleBetweenPoints( @@ -1042,8 +1042,8 @@ void CCarCtrl::SlowCarDownForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, DotProduct2D(pVehicle->GetForward(), pOtherVehicle->GetForward()) < 0.5f && pVehicle < pOtherVehicle){ /* that comparasion though... */ *pSpeed = Max(curSpeed / 5, *pSpeed); - if (pVehicle->m_status == STATUS_SIMPLE){ - pVehicle->m_status = STATUS_PHYSICS; + if (pVehicle->GetStatus() == STATUS_SIMPLE){ + pVehicle->SetStatus(STATUS_PHYSICS); SwitchVehicleToRealPhysics(pVehicle); } pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; @@ -1535,7 +1535,7 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle) pNextLink = &ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[nextLink + pCurPathNode->firstLink]]; if (prevNode == pVehicle->AutoPilot.m_nNextRouteNode){ /* We can no longer shift vehicle without physics if we have to turn it around. */ - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); SwitchVehicleToRealPhysics(pVehicle); } pVehicle->AutoPilot.m_nTimeEnteredCurve += pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve; @@ -1640,7 +1640,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t float distanceToTargetNode; #ifndef REMOVE_TREADABLE_PATHFIND if (pTarget && pTarget->m_pCurGroundEntity && - pTarget->m_pCurGroundEntity->m_type == ENTITY_TYPE_BUILDING && + pTarget->m_pCurGroundEntity->IsBuilding() && ((CBuilding*)pTarget->m_pCurGroundEntity)->GetIsATreadable() && ((CTreadable*)pTarget->m_pCurGroundEntity)->m_nodeIndices[0][0] >= 0){ CTreadable* pCurrentMapObject = (CTreadable*)pTarget->m_pCurGroundEntity; @@ -2674,7 +2674,7 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos) spawnPos.z = groundZ + pVehicle->GetDistanceFromCentreOfMassToBaseOfModel(); pVehicle->GetPosition() = spawnPos; pVehicle->SetMoveSpeed(CVector(0.0f, 0.0f, 0.0f)); - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); switch (mi){ case MI_FIRETRUCK: pVehicle->bIsFireTruckOnDuty = true; diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index f8c8fa69..abb5c5f3 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -102,8 +102,8 @@ CGameLogic::Update() if (pVehicle != nil) { if (pVehicle->pDriver == pPlayerInfo.m_pPed) { pVehicle->pDriver = nil; - if (pVehicle->m_status != STATUS_WRECKED) - pVehicle->m_status = STATUS_ABANDONED; + if (pVehicle->GetStatus() != STATUS_WRECKED) + pVehicle->SetStatus(STATUS_ABANDONED); } else pVehicle->RemovePassenger(pPlayerInfo.m_pPed); } @@ -172,8 +172,8 @@ CGameLogic::Update() if (pVehicle != nil) { if (pVehicle->pDriver == pPlayerInfo.m_pPed) { pVehicle->pDriver = nil; - if (pVehicle->m_status != STATUS_WRECKED) - pVehicle->m_status = STATUS_ABANDONED; + if (pVehicle->GetStatus() != STATUS_WRECKED) + pVehicle->SetStatus(STATUS_ABANDONED); } else pVehicle->RemovePassenger(pPlayerInfo.m_pPed); @@ -214,8 +214,8 @@ CGameLogic::Update() if (pVehicle != nil) { if (pVehicle->pDriver == pPlayerInfo.m_pPed) { pVehicle->pDriver = nil; - if (pVehicle->m_status != STATUS_WRECKED) - pVehicle->m_status = STATUS_ABANDONED; + if (pVehicle->GetStatus() != STATUS_WRECKED) + pVehicle->SetStatus(STATUS_ABANDONED); } else pVehicle->RemovePassenger(pPlayerInfo.m_pPed); } diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 0367e9bc..fd18f4cf 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -749,7 +749,7 @@ void CGarage::Update() if (((CAutomobile*)(m_pTarget))->Damage.GetEngineStatus() <= ENGINE_STATUS_ON_FIRE && ((CAutomobile*)(m_pTarget))->m_fFireBlowUpTimer == 0.0f) { #endif - if (m_pTarget->m_status != STATUS_WRECKED) { + if (m_pTarget->GetStatus() != STATUS_WRECKED) { CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_GARAGE); FindPlayerPed()->m_pWanted->m_bIgnoredByCops = true; m_eGarageState = GS_CLOSING; @@ -1855,7 +1855,7 @@ CVehicle* CStoredCar::RestoreCar() CVehicle* pVehicle = new CAutomobile(m_nModelIndex, RANDOM_VEHICLE); #endif pVehicle->GetPosition() = m_vecPos; - pVehicle->m_status = STATUS_ABANDONED; + pVehicle->SetStatus(STATUS_ABANDONED); pVehicle->GetForward() = m_vecAngle; pVehicle->GetRight() = CVector(m_vecAngle.y, -m_vecAngle.x, 0.0f); pVehicle->GetUp() = CVector(0.0f, 0.0f, 1.0f); @@ -1975,7 +1975,7 @@ void CGarage::TidyUpGarage() if (pVehicle->GetPosition().x > m_fX1 && pVehicle->GetPosition().x < m_fX2 && pVehicle->GetPosition().y > m_fY1 && pVehicle->GetPosition().y < m_fY2 && pVehicle->GetPosition().z > m_fZ1 && pVehicle->GetPosition().z < m_fZ2) { - if (pVehicle->m_status == STATUS_WRECKED || pVehicle->GetUp().z < 0.5f) { + if (pVehicle->GetStatus() == STATUS_WRECKED || pVehicle->GetUp().z < 0.5f) { CWorld::Remove(pVehicle); delete pVehicle; } @@ -1990,7 +1990,7 @@ void CGarage::TidyUpGarageClose() CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); if (!pVehicle || !pVehicle->IsCar()) continue; - if (!pVehicle->IsCar() || pVehicle->m_status != STATUS_WRECKED || !IsEntityTouching3D(pVehicle)) + if (!pVehicle->IsCar() || pVehicle->GetStatus() != STATUS_WRECKED || !IsEntityTouching3D(pVehicle)) continue; bool bRemove = false; if (m_eGarageState != GS_FULLYCLOSED) { diff --git a/src/control/Record.cpp b/src/control/Record.cpp index b9e8f8da..bba9a45d 100644 --- a/src/control/Record.cpp +++ b/src/control/Record.cpp @@ -286,7 +286,7 @@ void CRecordDataForChase::SaveOrRetrieveCarPositions(void) } if (Status == STATE_PLAYBACK_BEFORE_RECORDING) { Status = STATE_RECORD; - pChaseCars[CurrentCar]->m_status = STATUS_PLAYER; + pChaseCars[CurrentCar]->SetStatus(STATUS_PLAYER); } } break; @@ -408,7 +408,7 @@ void CRecordDataForChase::GiveUsACar(int32 mi, CVector pos, float angle, CAutomo return; CAutomobile* pCar = new CAutomobile(mi, MISSION_VEHICLE); pCar->GetPosition() = pos; - pCar->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER; + pCar->SetStatus(STATUS_PLAYER_PLAYBACKFROMBUFFER); pCar->GetMatrix().SetRotateZOnly(DEGTORAD(angle)); pCar->pDriver = nil; pCar->m_currentColour1 = colour1; @@ -517,7 +517,7 @@ CVehicle* CRecordDataForChase::TurnChaseCarIntoScriptCar(int32 i) { CVehicle* pVehicle = pChaseCars[i]; pChaseCars[i] = nil; - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); return pVehicle; } diff --git a/src/control/Remote.cpp b/src/control/Remote.cpp index 9c749bd9..ee729d7e 100644 --- a/src/control/Remote.cpp +++ b/src/control/Remote.cpp @@ -19,7 +19,7 @@ CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uin car->GetMatrix().SetRotateZOnly(rot); car->GetPosition() = CVector(x, y, z); - car->m_status = STATUS_PLAYER_REMOTE; + car->SetStatus(STATUS_PLAYER_REMOTE); car->bIsLocked = true; CCarCtrl::JoinCarWithRoadSystem(car); @@ -31,7 +31,7 @@ CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uin car->bEngineOn = true; CWorld::Add(car); if (FindPlayerVehicle() != nil) - FindPlayerVehicle()->m_status = STATUS_PLAYER_DISABLED; + FindPlayerVehicle()->SetStatus(STATUS_PLAYER_DISABLED); CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = car; CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->RegisterReference((CEntity**)&CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle); diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index da350660..f9e894b6 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -850,7 +850,7 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo else{ new_v = new(vp->index << 8) CAutomobile(mi, 2); } - new_v->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER; + new_v->SetStatus(STATUS_PLAYER_PLAYBACKFROMBUFFER); vp->matrix.DecompressIntoFullMatrix(new_v->GetMatrix()); new_v->m_currentColour1 = vp->primary_color; new_v->m_currentColour2 = vp->secondary_color; @@ -870,7 +870,7 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo } else { CPed* new_p = new(ph->index << 8) CCivilianPed((ePedType)ph->pedtype, ph->mi); - new_p->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER; + new_p->SetStatus(STATUS_PLAYER_PLAYBACKFROMBUFFER); new_p->GetMatrix().SetUnity(); CWorld::Add(new_p); } diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index 7fb0c211..65625d8c 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -156,7 +156,7 @@ CRoadBlocks::GenerateRoadBlocks(void) CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false); if (!colliding) { CAutomobile *pVehicle = new CAutomobile(vehicleId, RANDOM_VEHICLE); - pVehicle->m_status = STATUS_ABANDONED; + pVehicle->SetStatus(STATUS_ABANDONED); // pVehicle->GetHeightAboveRoad(); // called but return value is ignored? vehicleMatrix.GetPosition().z += fModelRadius - 0.6f; pVehicle->m_matrix = vehicleMatrix; diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp index 7f914a76..8e9fc754 100644 --- a/src/control/SceneEdit.cpp +++ b/src/control/SceneEdit.cpp @@ -450,7 +450,7 @@ void CSceneEdit::ProcessCommand(void) break; } CVehicle* pVehicle = new CAutomobile(m_nVehiclemodelId, MISSION_VEHICLE); - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); pVehicle->GetPosition() = m_vecCurrentPosition; pVehicle->SetOrientation(0.0f, 0.0f, 0.0f); CWorld::Add(pVehicle); @@ -567,7 +567,7 @@ void CSceneEdit::ProcessCommand(void) pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT; else pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS; - pActors[m_nActor]->m_pMyVehicle->m_status = STATUS_PHYSICS; + pActors[m_nActor]->m_pMyVehicle->SetStatus(STATUS_PHYSICS); pActors[m_nActor]->m_pMyVehicle->bEngineOn = true; pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = Max(16, pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed); pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); @@ -810,7 +810,7 @@ void CSceneEdit::PlayBack(void) break; } CVehicle* pVehicle = new CAutomobile(m_nVehiclemodelId, MISSION_VEHICLE); - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); pVehicle->GetPosition() = m_vecCurrentPosition; pVehicle->SetOrientation(0.0f, 0.0f, 0.0f); CWorld::Add(pVehicle); @@ -845,7 +845,7 @@ void CSceneEdit::PlayBack(void) pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT; else pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS; - pActors[m_nActor]->m_pMyVehicle->m_status = STATUS_PHYSICS; + pActors[m_nActor]->m_pMyVehicle->SetStatus(STATUS_PHYSICS); pActors[m_nActor]->m_pMyVehicle->bEngineOn = true; pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = Max(16, pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed); pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 1f65ce6e..4b3ed3bd 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1737,7 +1737,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) if (ped->InVehicle()) { if (ped->m_pMyVehicle->pDriver == ped) { ped->m_pMyVehicle->RemoveDriver(); - ped->m_pMyVehicle->m_status = STATUS_ABANDONED; + ped->m_pMyVehicle->SetStatus(STATUS_ABANDONED); if (ped->m_pMyVehicle->m_nDoorLock == CARLOCK_LOCKED_INITIALLY) ped->m_pMyVehicle->m_nDoorLock = CARLOCK_UNLOCKED; if (ped->m_nPedType == PEDTYPE_COP && ped->m_pMyVehicle->IsLawEnforcementVehicle()) @@ -1933,7 +1933,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) pos.z += boat->GetDistanceFromCentreOfMassToBaseOfModel(); boat->GetPosition() = pos; CTheScripts::ClearSpaceForMissionEntity(pos, boat); - boat->m_status = STATUS_ABANDONED; + boat->SetStatus(STATUS_ABANDONED); boat->bIsLocked = true; boat->AutoPilot.m_nCarMission = MISSION_NONE; boat->AutoPilot.m_nTempAction = TEMPACT_NONE; /* Animation ID? */ @@ -1951,7 +1951,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); car->GetPosition() = pos; CTheScripts::ClearSpaceForMissionEntity(pos, car); - car->m_status = STATUS_ABANDONED; + car->SetStatus(STATUS_ABANDONED); car->bIsLocked = true; CCarCtrl::JoinCarWithRoadSystem(car); car->AutoPilot.m_nCarMission = MISSION_NONE; @@ -1997,7 +1997,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT; else car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS; - car->m_status = STATUS_PHYSICS; + car->SetStatus(STATUS_PHYSICS); car->bEngineOn = true; car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6); car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); @@ -2087,7 +2087,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - UpdateCompareFlag(car && car->m_status != STATUS_WRECKED && (car->IsBoat() || !car->bIsInWater)); + UpdateCompareFlag(car && car->GetStatus() != STATUS_WRECKED && (car->IsBoat() || !car->bIsInWater)); return 0; } case COMMAND_SET_CAR_CRUISE_SPEED: @@ -2626,7 +2626,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) { CollectParameters(&m_nIp, 1); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - UpdateCompareFlag(!pVehicle || pVehicle->m_status == STATUS_WRECKED || !pVehicle->IsBoat() && pVehicle->bIsInWater); + UpdateCompareFlag(!pVehicle || pVehicle->GetStatus() == STATUS_WRECKED || !pVehicle->IsBoat() && pVehicle->bIsInWater); return 0; } case COMMAND_SET_CHAR_THREAT_SEARCH: @@ -2753,7 +2753,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) pPed->m_pMyVehicle = pVehicle; pPed->m_pMyVehicle->RegisterReference((CEntity**)&pPed->m_pMyVehicle); pPed->bInVehicle = true; - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); if (!pVehicle->IsBoat()) pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE; pVehicle->bEngineOn = true; @@ -2786,7 +2786,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) pPlayer->m_pPed->bRenderPedInCar = true; if (pPlayer->m_pPed->m_pMyVehicle->pDriver == pPlayer->m_pPed){ pPlayer->m_pPed->m_pMyVehicle->RemoveDriver(); - pPlayer->m_pPed->m_pMyVehicle->m_status = STATUS_ABANDONED; + pPlayer->m_pPed->m_pMyVehicle->SetStatus(STATUS_ABANDONED); pPlayer->m_pPed->m_pMyVehicle->bEngineOn = false; pPlayer->m_pPed->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0; }else{ @@ -2878,7 +2878,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) float y1 = *(float*)&ScriptParams[2]; float x2 = *(float*)&ScriptParams[3]; float y2 = *(float*)&ScriptParams[4]; - UpdateCompareFlag(pVehicle->m_status == STATUS_WRECKED && + UpdateCompareFlag(pVehicle->GetStatus() == STATUS_WRECKED && pVehicle->IsWithinArea(x1, y1, x2, y2)); if (!ScriptParams[5]) return 0; @@ -2898,7 +2898,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) float x2 = *(float*)&ScriptParams[4]; float y2 = *(float*)&ScriptParams[5]; float z2 = *(float*)&ScriptParams[6]; - UpdateCompareFlag(pVehicle->m_status == STATUS_WRECKED && + UpdateCompareFlag(pVehicle->GetStatus() == STATUS_WRECKED && pVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2)); if (!ScriptParams[7]) return 0; @@ -3947,7 +3947,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->m_pMyVehicle->RegisterReference((CEntity**)&pPed->m_pMyVehicle); pPed->bInVehicle = true; pPed->SetPedState(PED_DRIVING); - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); pPed->bUsesCollision = false; #ifdef FIX_BUGS AnimationId anim = pVehicle->GetDriverAnim(); @@ -5583,7 +5583,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) pVehicle->AutoPilot.m_nCarMission = MISSION_GOTO_COORDS_STRAIGHT_ACCURATE; else pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ACCURATE; - pVehicle->m_status = STATUS_PHYSICS; + pVehicle->SetStatus(STATUS_PHYSICS); pVehicle->bEngineOn = true; pVehicle->AutoPilot.m_nCruiseSpeed = Max(6, pVehicle->AutoPilot.m_nCruiseSpeed); pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); @@ -5699,7 +5699,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) CWaterLevel::GetWaterLevel(pos.x, pos.y, pos.z, &pos.z, false); pBoat->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ASTHECROWSWIMS; pBoat->AutoPilot.m_vecDestinationCoors = pos; - pBoat->m_status = STATUS_PHYSICS; + pBoat->SetStatus(STATUS_PHYSICS); pBoat->AutoPilot.m_nCruiseSpeed = Max(6, pBoat->AutoPilot.m_nCruiseSpeed); pBoat->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); return 0; @@ -5712,7 +5712,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); CBoat* pBoat = (CBoat*)pVehicle; pBoat->AutoPilot.m_nCarMission = MISSION_NONE; - pBoat->m_status = STATUS_PHYSICS; + pBoat->SetStatus(STATUS_PHYSICS); pBoat->bEngineOn = false; pBoat->AutoPilot.m_nCruiseSpeed = 0; return 0; @@ -6911,7 +6911,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) if (pPed->m_pMyVehicle){ if (pPed == pPed->m_pMyVehicle->pDriver){ pPed->m_pMyVehicle->RemoveDriver(); - pPed->m_pMyVehicle->m_status = STATUS_ABANDONED; + pPed->m_pMyVehicle->SetStatus(STATUS_ABANDONED); if (pPed->m_pMyVehicle->m_nDoorLock == CARLOCK_LOCKED_INITIALLY) pPed->m_pMyVehicle->m_nDoorLock = CARLOCK_UNLOCKED; if (pPed->m_nPedType == PEDTYPE_COP && pPed->m_pMyVehicle->IsLawEnforcementVehicle()) @@ -7108,7 +7108,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pPed->bRenderPedInCar = true; if (pPed->m_pMyVehicle->pDriver == pPed){ pPed->m_pMyVehicle->RemoveDriver(); - pPed->m_pMyVehicle->m_status = STATUS_ABANDONED; + pPed->m_pMyVehicle->SetStatus(STATUS_ABANDONED); pPed->m_pMyVehicle->bEngineOn = false; pPed->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0; }else{ @@ -7779,7 +7779,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); assert(pVehicle); - pVehicle->m_status = ScriptParams[1]; + pVehicle->SetStatus((eEntityStatus)ScriptParams[1]); return 0; } case COMMAND_IS_CHAR_MALE: @@ -8156,7 +8156,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) car->GetPosition() = pos; car->SetHeading(DEGTORAD(*(float*)&ScriptParams[3])); CTheScripts::ClearSpaceForMissionEntity(pos, car); - car->m_status = STATUS_ABANDONED; + car->SetStatus(STATUS_ABANDONED); car->bIsLocked = true; car->bIsCarParkVehicle = true; CCarCtrl::JoinCarWithRoadSystem(car); @@ -11229,7 +11229,7 @@ INITSAVEBUF type = 0; handle = 0; } else { - switch (pEntity->m_type) { + switch (pEntity->GetType()) { case ENTITY_TYPE_BUILDING: if (((CBuilding*)pEntity)->GetIsATreadable()) { type = 1; @@ -11371,7 +11371,7 @@ void CTheScripts::ClearSpaceForMissionEntity(const CVector& pos, CEntity* pEntit } if (cols <= 0) continue; - switch (pFound->m_type) { + switch (pFound->GetType()) { case ENTITY_TYPE_VEHICLE: { printf("Will try to delete a vehicle where a mission entity should be\n"); diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp index c8d3f79f..44e14bdc 100644 --- a/src/control/TrafficLights.cpp +++ b/src/control/TrafficLights.cpp @@ -245,7 +245,7 @@ CTrafficLights::ShouldCarStopForLight(CVehicle *vehicle, bool alwaysStop) } } - if(vehicle->m_status == STATUS_PHYSICS){ + if(vehicle->GetStatus() == STATUS_PHYSICS){ node = vehicle->AutoPilot.m_nPreviousPathNodeInfo; type = ThePaths.m_carPathLinks[node].trafficLightType; if(type){ diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index 36ea20b7..7afda509 100644 --- a/src/core/AnimViewer.cpp +++ b/src/core/AnimViewer.cpp @@ -278,7 +278,7 @@ CAnimViewer::Update(void) // } } else { newEntity = pTarget = new CAutomobile(modelId, RANDOM_VEHICLE); - newEntity->m_status = STATUS_ABANDONED; + newEntity->SetStatus(STATUS_ABANDONED); } newEntity->bIsStuck = true; } else if (modelInfo->m_type == MITYPE_PED) { @@ -296,7 +296,7 @@ CAnimViewer::Update(void) CWorld::Add(newEntity); TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT); } - if (pTarget->m_type == ENTITY_TYPE_VEHICLE || pTarget->m_type == ENTITY_TYPE_PED || pTarget->m_type == ENTITY_TYPE_OBJECT) { + if (pTarget->IsVehicle() || pTarget->IsPed() || pTarget->IsObject()) { ((CPhysical*)pTarget)->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); } pTarget->GetPosition().z = 0.0f; diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 801652cb..43d817b7 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -4683,7 +4683,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, static float ZmTwoAlphaOffsetLCS[] = { 0.1f, 0.08f, 0.3f, 0.08f, 0.08f }; static float ZmThreeAlphaOffsetLCS[] = { 0.065f, 0.05f, 0.15f, 0.06f, 0.08f }; - if (isHeli && car->m_status == STATUS_PLAYER_REMOTE) + if (isHeli && car->GetStatus() == STATUS_PLAYER_REMOTE) zoomModeAlphaOffset = ZmTwoAlphaOffsetLCS[alphaArrPos]; else { switch ((int)TheCamera.CarZoomIndicator) { @@ -4712,7 +4712,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, float minDistForThisCar = approxCarLength * CARCAM_SET[camSetArrPos][3]; - if (!isHeli || car->m_status == STATUS_PLAYER_REMOTE) { + if (!isHeli || car->GetStatus() == STATUS_PLAYER_REMOTE) { float radiusToStayOutside = colMaxZ * CARCAM_SET[camSetArrPos][0] - CARCAM_SET[camSetArrPos][2]; if (radiusToStayOutside > 0.0f) { TargetCoors.z += radiusToStayOutside; diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index a72f51c0..7dbadd74 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -107,7 +107,7 @@ void TankCheat() tank->GetPosition() = pos; tank->SetOrientation(0.0f, 0.0f, DEGTORAD(200.0f)); - tank->m_status = STATUS_ABANDONED; + tank->SetStatus(STATUS_ABANDONED); tank->m_nDoorLock = CARLOCK_UNLOCKED; CWorld::Add(tank); } diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index e92f7568..7dadbf28 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -328,7 +328,7 @@ CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, continue; car->m_scanCode = CWorld::GetCurrentScanCode(); - if (car->m_status != STATUS_WRECKED && car->m_status != STATUS_TRAIN_MOVING + if (car->GetStatus() != STATUS_WRECKED && car->GetStatus() != STATUS_TRAIN_MOVING && (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) { CVector carCentre = car->GetBoundCentre(); @@ -413,7 +413,7 @@ CPlayerInfo::Process(void) // This condition will always return true, else block was probably WIP Miami code. if (veh->m_vehType != VEHICLE_TYPE_BIKE || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) { - if (veh->m_status != STATUS_WRECKED && veh->m_status != STATUS_TRAIN_MOVING && veh->m_nDoorLock != CARLOCK_LOCKED_PLAYER_INSIDE) { + if (veh->GetStatus() != STATUS_WRECKED && veh->GetStatus() != STATUS_TRAIN_MOVING && veh->m_nDoorLock != CARLOCK_LOCKED_PLAYER_INSIDE) { if (veh->m_vecMoveSpeed.Magnitude() < 0.17f && CTimer::GetTimeScale() >= 0.5f && !veh->bIsInWater) { m_pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); } @@ -454,7 +454,7 @@ CPlayerInfo::Process(void) weAreOnBoat = true; m_pPed->bOnBoat = true; #ifdef VC_PED_PORTS - if (carBelow->m_status != STATUS_WRECKED && carBelow->GetUp().z > 0.3f) + if (carBelow->GetStatus() != STATUS_WRECKED && carBelow->GetUp().z > 0.3f) #else if (carBelow->m_status != STATUS_WRECKED) #endif @@ -491,7 +491,7 @@ CPlayerInfo::Process(void) } // carBelow is now closest vehicle if (carBelow && !weAreOnBoat) { - if (carBelow->m_status == STATUS_TRAIN_NOT_MOVING) { + if (carBelow->GetStatus() == STATUS_TRAIN_NOT_MOVING) { m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow); } else if (carBelow->IsBoat()) { if (!carBelow->pDriver) { @@ -526,7 +526,7 @@ CPlayerInfo::Process(void) m_bInRemoteMode = false; CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = nil; if (FindPlayerVehicle()) { - FindPlayerVehicle()->m_status = STATUS_PLAYER; + FindPlayerVehicle()->SetStatus(STATUS_PLAYER); } } } diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp index 4f4588da..b9a78b0b 100644 --- a/src/core/Pools.cpp +++ b/src/core/Pools.cpp @@ -161,8 +161,8 @@ INITSAVEBUF pVehicle->m_nTimeOfDeath = pBufferVehicle->m_nTimeOfDeath; #endif pVehicle->m_nDoorLock = pBufferVehicle->m_nDoorLock; - pVehicle->m_status = pBufferVehicle->m_status; - pVehicle->m_type = pBufferVehicle->m_type; + pVehicle->SetStatus(pBufferVehicle->GetStatus()); + pVehicle->SetType(pBufferVehicle->GetType()); (pVehicle->GetAddressOfEntityProperties())[0] = (pBufferVehicle->GetAddressOfEntityProperties())[0]; (pVehicle->GetAddressOfEntityProperties())[1] = (pBufferVehicle->GetAddressOfEntityProperties())[1]; pVehicle->AutoPilot = pBufferVehicle->AutoPilot; diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp index 6f5fdf06..7508c9f4 100644 --- a/src/core/Wanted.cpp +++ b/src/core/Wanted.cpp @@ -352,7 +352,7 @@ CWanted::WorkOutPolicePresence(CVector posn, float radius) vehicle->bIsLawEnforcer && IsPoliceVehicleModel(vehicle->GetModelIndex()) && vehicle != FindPlayerVehicle() && - vehicle->m_status != STATUS_ABANDONED && vehicle->m_status != STATUS_WRECKED && + vehicle->GetStatus() != STATUS_ABANDONED && vehicle->GetStatus() != STATUS_WRECKED && (posn - vehicle->GetPosition()).Magnitude() < radius) numPolice++; } diff --git a/src/core/World.cpp b/src/core/World.cpp index b2a01b80..4b2ca76e 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1867,7 +1867,7 @@ CWorld::SetCarsOnFire(float x, float y, float z, float radius, CEntity *reason) int poolSize = CPools::GetVehiclePool()->GetSize(); for(int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) { CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex); - if(veh && veh->m_status != STATUS_WRECKED && !veh->m_pCarFire && !veh->bFireProof) { + if(veh && veh->GetStatus() != STATUS_WRECKED && !veh->m_pCarFire && !veh->bFireProof) { if(Abs(veh->GetPosition().z - z) < 5.0f && Abs(veh->GetPosition().x - x) < radius && Abs(veh->GetPosition().y - y) < radius) gFireManager.StartFire(veh, reason, 0.8f, true); @@ -1928,7 +1928,7 @@ CWorld::Process(void) if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP && RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) { RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), - 0.02f * (csObj->m_type == ENTITY_TYPE_OBJECT + 0.02f * (csObj->IsObject() ? CTimer::GetTimeStepNonClipped() : CTimer::GetTimeStep())); } @@ -1946,7 +1946,7 @@ CWorld::Process(void) if(movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP && RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) { RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), - 0.02f * (movingEnt->m_type == ENTITY_TYPE_OBJECT + 0.02f * (movingEnt->IsObject() ? CTimer::GetTimeStepNonClipped() : CTimer::GetTimeStep())); } @@ -2030,7 +2030,7 @@ CWorld::Process(void) movingEnt->UpdateRwFrame(); if(!movingEnt->bIsInSafePosition) { movingEnt->bIsStuck = true; - if(movingEnt->m_status == STATUS_PLAYER) { + if(movingEnt->GetStatus() == STATUS_PLAYER) { printf("STUCK: Final Step: Player Entity %d Is Stuck\n", movingEnt->m_modelIndex); movingEnt->m_vecMoveSpeed *= 0.3f; @@ -2178,10 +2178,10 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa pEntity->ApplyTurnForce(vecForceDir.x, vecForceDir.y, vecForceDir.z, 0.0f, 0.0f, fPointZ); } - switch(pEntity->m_type) { + switch(pEntity->GetType()) { case ENTITY_TYPE_VEHICLE: - if(pEntity->m_status == STATUS_SIMPLE) { - pEntity->m_status = STATUS_PHYSICS; + if(pEntity->GetStatus() == STATUS_SIMPLE) { + pEntity->SetStatus(STATUS_PHYSICS); CCarCtrl::SwitchVehicleToRealPhysics(pVehicle); } pVehicle->InflictDamage(pCreator, WEAPONTYPE_EXPLOSION, diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 2a9cbc77..7bb18688 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -121,7 +121,7 @@ SpawnCar(int id) v->GetPosition().z += 4.0f; v->SetOrientation(0.0f, 0.0f, 3.49f); - v->m_status = STATUS_ABANDONED; + v->SetStatus(STATUS_ABANDONED); v->m_nDoorLock = CARLOCK_UNLOCKED; CWorld::Add(v); } diff --git a/src/entities/Entity.h b/src/entities/Entity.h index ee9e6490..15a7a602 100644 --- a/src/entities/Entity.h +++ b/src/entities/Entity.h @@ -6,7 +6,7 @@ struct CReference; class CPtrList; -enum eEntityType +enum eEntityType : uint8 { ENTITY_TYPE_NOTHING = 0, ENTITY_TYPE_BUILDING, @@ -16,7 +16,7 @@ enum eEntityType ENTITY_TYPE_DUMMY, }; -enum eEntityStatus +enum eEntityStatus : uint8 { STATUS_PLAYER, STATUS_PLAYER_PLAYBACKFROMBUFFER, @@ -36,9 +36,11 @@ class CEntity : public CPlaceable { public: RwObject *m_rwObject; +protected: uint32 m_type : 3; +private: uint32 m_status : 5; - +public: // flagsA uint32 bUsesCollision : 1; // does entity use collision uint32 bCollisionProcessed : 1; // has object been processed by a ProcessEntityCollision function @@ -90,6 +92,11 @@ public: uint16 m_level; // int16 CReference *m_pFirstReference; +public: + eEntityType GetType() const { return (eEntityType)m_type; } + void SetType(eEntityType type) { m_type = type; } + eEntityStatus GetStatus() const { return (eEntityStatus)m_status; } + void SetStatus(eEntityStatus status) { m_status = status; } CColModel *GetColModel(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); } uint32* GetAddressOfEntityProperties() { /* AWFUL */ return (uint32*)((char*)&m_rwObject + sizeof(m_rwObject)); } diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index d37405ec..16070dc4 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -350,7 +350,7 @@ CPhysical::ProcessControl(void) bWasPostponed = false; bHasHitWall = false; - if(m_status == STATUS_SIMPLE) + if(GetStatus() == STATUS_SIMPLE) return; m_nCollisionRecords = 0; @@ -538,7 +538,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl float timestepB; if(A->bPedPhysics){ if(A->IsPed() && ((CPed*)A)->IsPlayer() && B->IsVehicle() && - (B->m_status == STATUS_ABANDONED || B->m_status == STATUS_WRECKED || A->bHasHitWall)) + (B->GetStatus() == STATUS_ABANDONED || B->GetStatus() == STATUS_WRECKED || A->bHasHitWall)) timestepB = 2200.0f / B->m_fMass; else timestepB = 10.0f; @@ -757,7 +757,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl fA.y *= 1.4f; if(colpoint.normal.z < 0.7f) fA.z *= 0.3f; - if(A->m_status == STATUS_PLAYER) + if(A->GetStatus() == STATUS_PLAYER) pointposA *= 0.8f; if(CWorld::bNoMoreCollisionTorque){ A->ApplyFrictionMoveForce(fA*-0.3f); @@ -769,7 +769,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl fB.y *= 1.4f; if(colpoint.normal.z < 0.7f) fB.z *= 0.3f; - if(B->m_status == STATUS_PLAYER) + if(B->GetStatus() == STATUS_PLAYER) pointposB *= 0.8f; if(CWorld::bNoMoreCollisionTorque){ // BUG: the game actually uses A here, but this can't be right @@ -815,7 +815,7 @@ CPhysical::ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CV if(normalSpeed < 0.0f){ float minspeed = 0.0104f * CTimer::GetTimeStep(); #ifdef GTA3_1_1_PATCH - if ((IsObject() || IsVehicle() && (GetUp().z < -0.3f || ((CVehicle*)this)->IsBike() && (m_status == STATUS_ABANDONED || m_status == STATUS_WRECKED))) && + if ((IsObject() || IsVehicle() && (GetUp().z < -0.3f || ((CVehicle*)this)->IsBike() && (GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED))) && #else if((IsObject() || IsVehicle() && GetUp().z < -0.3f) && #endif @@ -1341,8 +1341,8 @@ collision: } } - if(B->m_status == STATUS_SIMPLE){ - B->m_status = STATUS_PHYSICS; + if(B->GetStatus() == STATUS_SIMPLE){ + B->SetStatus(STATUS_PHYSICS); if(B->IsVehicle()) CCarCtrl::SwitchVehicleToRealPhysics((CVehicle*)B); } @@ -1544,7 +1544,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) }else adhesion = 0.0f; }else if(A->IsVehicle()){ - if(A->m_status == STATUS_WRECKED) + if(A->GetStatus() == STATUS_WRECKED) adhesion *= 3.0f; else if(A->GetUp().z > 0.3f) adhesion = 0.0f; @@ -1561,7 +1561,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) m_vecMoveSpeed += moveSpeed / numResponses; m_vecTurnSpeed += turnSpeed / numResponses; if(!CWorld::bNoMoreCollisionTorque && - A->m_status == STATUS_PLAYER && A->IsVehicle() && + A->GetStatus() == STATUS_PLAYER && A->IsVehicle() && Abs(A->m_vecMoveSpeed.x) > 0.2f && Abs(A->m_vecMoveSpeed.y) > 0.2f){ A->m_vecMoveFriction.x += moveSpeed.x * -0.3f / numCollisions; @@ -1713,8 +1713,8 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) Aobj->ObjectDamage(maxImpulseB); } - if(B->m_status == STATUS_SIMPLE){ - B->m_status = STATUS_PHYSICS; + if(B->GetStatus() == STATUS_SIMPLE){ + B->SetStatus(STATUS_PHYSICS); if(B->IsVehicle()) CCarCtrl::SwitchVehicleToRealPhysics((CVehicle*)B); } @@ -1758,7 +1758,7 @@ void CPhysical::ProcessShift(void) { m_fDistanceTravelled = 0.0f; - if(m_status == STATUS_SIMPLE){ + if(GetStatus() == STATUS_SIMPLE){ bIsStuck = false; bIsInSafePosition = true; RemoveAndAdd(); @@ -1813,9 +1813,9 @@ CPhysical::ProcessCollision(void) return; } - if(m_status == STATUS_SIMPLE){ - if(CheckCollision_SimpleCar() && m_status == STATUS_SIMPLE){ - m_status = STATUS_PHYSICS; + if(GetStatus() == STATUS_SIMPLE){ + if(CheckCollision_SimpleCar() && GetStatus() == STATUS_SIMPLE){ + SetStatus(STATUS_PHYSICS); if(IsVehicle()) CCarCtrl::SwitchVehicleToRealPhysics((CVehicle*)this); } @@ -1840,7 +1840,7 @@ CPhysical::ProcessCollision(void) n = NUMSTEPS(0.3f); step = savedTimeStep / n; }else if(IsVehicle() && distSq >= sq(0.4f)){ - if(m_status == STATUS_PLAYER) + if(GetStatus() == STATUS_PLAYER) n = NUMSTEPS(0.2f); else n = distSq > 0.32f ? NUMSTEPS(0.3f) : NUMSTEPS(0.4f); @@ -1921,7 +1921,7 @@ CPhysical::ProcessCollision(void) if(!m_vecMoveSpeed.IsZero() || !m_vecTurnSpeed.IsZero() || bHitByTrain || - m_status == STATUS_PLAYER || IsPed() && ped->IsPlayer()){ + GetStatus() == STATUS_PLAYER || IsPed() && ped->IsPlayer()){ if(IsVehicle()) ((CVehicle*)this)->bVehicleColProcessed = true; if(CheckCollision()){ diff --git a/src/objects/CutsceneObject.cpp b/src/objects/CutsceneObject.cpp index 7b4ae02b..492d5416 100644 --- a/src/objects/CutsceneObject.cpp +++ b/src/objects/CutsceneObject.cpp @@ -15,7 +15,7 @@ CCutsceneObject::CCutsceneObject(void) { - m_status = STATUS_SIMPLE; + SetStatus(STATUS_SIMPLE); bUsesCollision = false; bStreamingDontDelete = true; ObjectCreatedBy = CUTSCENE_OBJECT; diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index c0ce38f8..1ae5e9b0 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -309,7 +309,7 @@ CObject::RefModelInfo(int32 modelId) void CObject::Init(void) { - m_type = ENTITY_TYPE_OBJECT;; + m_type = ENTITY_TYPE_OBJECT; CObjectData::SetObjectData(m_modelIndex, *this); m_nEndOfLifeTime = 0; ObjectCreatedBy = GAME_OBJECT; diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp index 3fc8b8ca..7cea902d 100644 --- a/src/peds/CopPed.cpp +++ b/src/peds/CopPed.cpp @@ -132,7 +132,7 @@ CCopPed::SetArrestPlayer(CPed *player) player->m_pMyVehicle->m_nNumGettingIn = 0; player->m_pMyVehicle->m_nGettingInFlags = 0; player->m_pMyVehicle->bIsHandbrakeOn = true; - player->m_pMyVehicle->m_status = STATUS_PLAYER_DISABLED; + player->m_pMyVehicle->SetStatus(STATUS_PLAYER_DISABLED); } if (GetWeapon()->m_eWeaponType == WEAPONTYPE_UNARMED) SetCurrentWeapon(WEAPONTYPE_COLT45); diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index dcb167f0..06585238 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -414,8 +414,8 @@ CPed::FlagToDestroyWhenNextProcessed(void) return; if (m_pMyVehicle->pDriver == this){ m_pMyVehicle->pDriver = nil; - if (IsPlayer() && m_pMyVehicle->m_status != STATUS_WRECKED) - m_pMyVehicle->m_status = STATUS_ABANDONED; + if (IsPlayer() && m_pMyVehicle->GetStatus() != STATUS_WRECKED) + m_pMyVehicle->SetStatus(STATUS_ABANDONED); }else{ m_pMyVehicle->RemovePassenger(this); } @@ -2919,7 +2919,7 @@ CPed::SetObjective(eObjective newObj, void *entity) if (newObj == OBJECTIVE_SOLICIT) { m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 10000; } else if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == MISSION_CHAR && - (m_carInObjective->m_status == STATUS_PLAYER_DISABLED || CPad::GetPad(CWorld::PlayerInFocus)->ArePlayerControlsDisabled())) { + (m_carInObjective->GetStatus() == STATUS_PLAYER_DISABLED || CPad::GetPad(CWorld::PlayerInFocus)->ArePlayerControlsDisabled())) { SetObjectiveTimer(14000); } else { m_objectiveTimer = 0; @@ -3166,13 +3166,13 @@ CPed::ReactToAttack(CEntity *attacker) && (m_pMyVehicle->pDriver == this || m_pMyVehicle->pDriver && m_pMyVehicle->pDriver->m_nPedState == PED_DRIVING)) { if (m_pMyVehicle->VehicleCreatedBy == RANDOM_VEHICLE - && (m_pMyVehicle->m_status == STATUS_SIMPLE || m_pMyVehicle->m_status == STATUS_PHYSICS) + && (m_pMyVehicle->GetStatus() == STATUS_SIMPLE || m_pMyVehicle->GetStatus() == STATUS_PHYSICS) && m_pMyVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE) { CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle); m_pMyVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; m_pMyVehicle->AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * m_pMyVehicle->pHandling->Transmission.fUnkMaxVelocity; - m_pMyVehicle->m_status = STATUS_PHYSICS; + m_pMyVehicle->SetStatus(STATUS_PHYSICS); } } else #endif @@ -4136,8 +4136,8 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi #ifdef VC_PED_PORTS if (m_pMyVehicle) { if (m_pMyVehicle->IsCar() && m_pMyVehicle->pDriver == this) { - if (m_pMyVehicle->m_status == STATUS_SIMPLE) { - m_pMyVehicle->m_status = STATUS_PHYSICS; + if (m_pMyVehicle->GetStatus() == STATUS_SIMPLE) { + m_pMyVehicle->SetStatus(STATUS_PHYSICS); CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle); } m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE; @@ -4151,7 +4151,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi m_fHealth = 0.0f; if (m_pMyVehicle && m_pMyVehicle->pDriver == this) { SetRadioStation(); - m_pMyVehicle->m_status = STATUS_ABANDONED; + m_pMyVehicle->SetStatus(STATUS_ABANDONED); } SetDie(dieAnim, dieDelta, dieSpeed); /* @@ -4183,7 +4183,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi } m_fHealth = 0.0f; if (player == this) - m_pMyVehicle->m_status = STATUS_PLAYER_DISABLED; + m_pMyVehicle->SetStatus(STATUS_PLAYER_DISABLED); SetDie(NUM_ANIMS, 4.0f, 0.0f); return true; @@ -6013,9 +6013,9 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack) m_vehEnterType = vehEnterType; if (m_vehEnterType == CAR_DOOR_LF) { if (veh->pDriver && veh->pDriver->IsPlayer()) - veh->m_status = STATUS_PLAYER_DISABLED; + veh->SetStatus(STATUS_PLAYER_DISABLED); else - veh->m_status = STATUS_ABANDONED; + veh->SetStatus(STATUS_ABANDONED); } RemoveInCarAnims(); SetMoveState(PEDMOVE_NONE); @@ -8584,7 +8584,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse) eWeaponType killMethod; if (m_nPedState == PED_FALL || m_nPedState == PED_DIE) { - if (!this->m_pCollidingEntity || car->m_status == STATUS_PLAYER) + if (!this->m_pCollidingEntity || car->GetStatus() == STATUS_PLAYER) this->m_pCollidingEntity = car; return; } @@ -9544,7 +9544,7 @@ CPed::ProcessControl(void) #else } else if (collidingEnt) { #endif - switch (collidingEnt->m_type) + switch (collidingEnt->GetType()) { case ENTITY_TYPE_BUILDING: case ENTITY_TYPE_OBJECT: @@ -9773,7 +9773,7 @@ CPed::ProcessControl(void) if (collidingVeh != m_pCurrentPhysSurface || IsPlayer()) { if (!bVehEnterDoorIsBlocked) { - if (collidingVeh->m_status != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) { + if (collidingVeh->GetStatus() != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) { // VC calls SetDirectionToWalkAroundVehicle instead if ped is in PED_SEEK_CAR. SetDirectionToWalkAroundObject(collidingVeh); @@ -10126,7 +10126,7 @@ CPed::ProcessControl(void) if ((m_nPedStateTimer <= 50.0f / (4.0f * adjustedTs) || m_nPedStateTimer * 0.01f <= forceDir.MagnitudeSqr()) && (m_nCollisionRecords <= 1 || m_nPedStateTimer <= 50.0f / (2.0f * adjustedTs) || m_nPedStateTimer * 1.0f / 250.0f <= Abs(forceDir.z))) { - if (m_nCollisionRecords == 1 && m_aCollisionRecords[0] != nil && m_aCollisionRecords[0]->m_type == ENTITY_TYPE_BUILDING + if (m_nCollisionRecords == 1 && m_aCollisionRecords[0] != nil && m_aCollisionRecords[0]->IsBuilding() && m_nPedStateTimer > 50.0f / (2.0f * adjustedTs) && m_nPedStateTimer * 1.0f / 250.0f > Abs(forceDir.z)) { offsetToCheck.x = -forceDir.y; #ifdef VC_PED_PORTS @@ -10994,7 +10994,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) } else if (ped->m_nPedType == PEDTYPE_COP) { ped->QuitEnteringCar(); if (ped->m_pedInObjective && ped->m_pedInObjective->m_nPedState == PED_DRIVING) { - veh->m_status = STATUS_PLAYER_DISABLED; + veh->SetStatus(STATUS_PLAYER_DISABLED); ((CCopPed*)ped)->SetArrestPlayer(ped->m_pedInObjective); } else if (!veh->IsDoorMissing(DOOR_FRONT_RIGHT)) { ((CAutomobile*)veh)->Damage.SetDoorStatus(DOOR_FRONT_RIGHT, DOOR_STATUS_SWINGING); @@ -11145,7 +11145,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg) veh->m_nNumGettingIn = 0; veh->m_nGettingInFlags = 0; veh->bIsHandbrakeOn = true; - veh->m_status = STATUS_PLAYER_DISABLED; + veh->SetStatus(STATUS_PLAYER_DISABLED); } return; } @@ -11190,7 +11190,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg) driver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); if (driver->IsPlayer()) { veh->bIsHandbrakeOn = true; - veh->m_status = STATUS_PLAYER_DISABLED; + veh->SetStatus(STATUS_PLAYER_DISABLED); } driver->bBusJacked = true; veh->bIsBeingCarJacked = false; @@ -11704,11 +11704,11 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg) #if defined(FIX_BUGS) || defined(VC_PED_PORTS) CCarCtrl::RegisterVehicleOfInterest(veh); #endif - if (veh->m_status == STATUS_SIMPLE) { + if (veh->GetStatus() == STATUS_SIMPLE) { veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.00001f); veh->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); } - veh->m_status = STATUS_PLAYER; + veh->SetStatus(STATUS_PLAYER); AudioManager.PlayerJustGotInCar(); } veh->SetDriver(ped); @@ -11729,19 +11729,19 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg) if (ped->IsPlayer()) { if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) { - if (veh->m_status == STATUS_SIMPLE) { + if (veh->GetStatus() == STATUS_SIMPLE) { veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); veh->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); } - veh->m_status = STATUS_PLAYER; + veh->SetStatus(STATUS_PLAYER); } AudioManager.PlayerJustGotInCar(); } else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) { - if (veh->m_status == STATUS_SIMPLE) { + if (veh->GetStatus() == STATUS_SIMPLE) { veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); veh->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); } - veh->m_status = STATUS_PHYSICS; + veh->SetStatus(STATUS_PHYSICS); } if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) { @@ -11998,7 +11998,7 @@ CPed::RegisterThreatWithGangPeds(CEntity *attacker) if (nearVeh->IsVehicleNormal() && nearVeh->IsCar()) { nearVeh->AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * nearVeh->pHandling->Transmission.fUnkMaxVelocity * 0.8f; nearVeh->AutoPilot.m_nCarMission = MISSION_RAMPLAYER_FARAWAY; - nearVeh->m_status = STATUS_PHYSICS; + nearVeh->SetStatus(STATUS_PHYSICS); nearVeh->AutoPilot.m_nTempAction = TEMPACT_NONE; nearVeh->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; } @@ -12205,7 +12205,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg) veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType); if (veh->pDriver == ped) { veh->RemoveDriver(); - veh->m_status = STATUS_ABANDONED; + veh->SetStatus(STATUS_ABANDONED); if (veh->m_nDoorLock == CARLOCK_LOCKED_INITIALLY) veh->m_nDoorLock = CARLOCK_UNLOCKED; if (ped->m_nPedType == PEDTYPE_COP && veh->IsLawEnforcementVehicle()) @@ -12846,7 +12846,7 @@ CPed::ProcessObjective(void) || m_pMyVehicle->m_vecMoveSpeed.MagnitudeSqr() >= sq(0.02f)) { if (m_pMyVehicle->pDriver == this && !m_pMyVehicle->m_nGettingInFlags) { - m_pMyVehicle->m_status = STATUS_PHYSICS; + m_pMyVehicle->SetStatus(STATUS_PHYSICS); m_pMyVehicle->AutoPilot.m_nPrevRouteNode = 0; if (m_nPedType == PEDTYPE_COP) { m_pMyVehicle->AutoPilot.m_nCruiseSpeed = (FindPlayerPed()->m_pWanted->m_nWantedLevel * 0.1f + 0.6f) * (GAME_SPEED_TO_CARAI_SPEED * m_pMyVehicle->pHandling->Transmission.fUnkMaxVelocity); @@ -12915,7 +12915,7 @@ CPed::ProcessObjective(void) newVeh->GetPosition() = ThePaths.m_pathNodes[closestNode].pos; newVeh->GetPosition().z += 4.0f; newVeh->SetHeading(DEGTORAD(200.0f)); - newVeh->m_status = STATUS_ABANDONED; + newVeh->SetStatus(STATUS_ABANDONED); newVeh->m_nDoorLock = CARLOCK_UNLOCKED; CWorld::Add(newVeh); m_pMyVehicle = newVeh; @@ -13017,7 +13017,7 @@ CPed::ProcessObjective(void) float distWithTargetSc = distWithTarget.Magnitude(); if (m_pedInObjective->bInVehicle && m_pedInObjective->m_nPedState != PED_DRAG_FROM_CAR) { CVehicle *vehOfTarget = m_pedInObjective->m_pMyVehicle; - if (vehOfTarget->bIsInWater || vehOfTarget->m_status == STATUS_PLAYER_DISABLED + if (vehOfTarget->bIsInWater || vehOfTarget->GetStatus() == STATUS_PLAYER_DISABLED || m_pedInObjective->IsPlayer() && CPad::GetPad(0)->ArePlayerControlsDisabled()) { SetIdle(); return; @@ -14033,7 +14033,7 @@ CPed::SetSeekBoatPosition(CVehicle *boat) void CPed::SetExitTrain(CVehicle* train) { - if (m_nPedState == PED_EXIT_TRAIN || train->m_status != STATUS_TRAIN_NOT_MOVING || !((CTrain*)train)->Doors[0].IsFullyOpen()) + if (m_nPedState == PED_EXIT_TRAIN || train->GetStatus() != STATUS_TRAIN_NOT_MOVING || !((CTrain*)train)->Doors[0].IsFullyOpen()) return; /* @@ -15137,7 +15137,7 @@ CPed::SetRadioStation(void) inline bool CPed::IsNotInWreckedVehicle() { - return m_pMyVehicle != nil && m_pMyVehicle->m_status != STATUS_WRECKED; + return m_pMyVehicle != nil && m_pMyVehicle->GetStatus() != STATUS_WRECKED; } void @@ -15759,9 +15759,9 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) SetRadioStation(); if (veh->pDriver == this) { if (IsPlayer()) - veh->m_status = STATUS_PLAYER_DISABLED; + veh->SetStatus(STATUS_PLAYER_DISABLED); else - veh->m_status = STATUS_ABANDONED; + veh->SetStatus(STATUS_ABANDONED); } } } @@ -15916,7 +15916,7 @@ CPed::ScanForInterestingStuff(void) CVehicle* veh = (CVehicle*)vehicles[i]; if (veh->m_modelIndex == MI_MRWHOOP) { - if (veh->m_status != STATUS_ABANDONED && veh->m_status != STATUS_WRECKED) { + if (veh->GetStatus() != STATUS_ABANDONED && veh->GetStatus() != STATUS_WRECKED) { if ((GetPosition() - veh->GetPosition()).Magnitude() < 5.0f) { SetObjective(OBJECTIVE_BUY_ICE_CREAM, veh); return; @@ -16136,7 +16136,7 @@ CPed::SeekCar(void) GetNearestDoor(vehToSeek, dest); } else { if (vehToSeek->IsTrain()) { - if (vehToSeek->m_status != STATUS_TRAIN_NOT_MOVING) { + if (vehToSeek->GetStatus() != STATUS_TRAIN_NOT_MOVING) { RestorePreviousObjective(); RestorePreviousState(); return; @@ -16222,7 +16222,7 @@ CPed::SeekCar(void) } else if (vehToSeek->m_nNumGettingIn < vehToSeek->m_nNumMaxPassengers + 1 && vehToSeek->CanPedEnterCar()) { - switch (vehToSeek->m_status) { + switch (vehToSeek->GetStatus()) { case STATUS_PLAYER: case STATUS_SIMPLE: case STATUS_PHYSICS: @@ -16994,11 +16994,11 @@ CPed::WarpPedIntoCar(CVehicle *car) return; if (IsPlayer()) { - car->m_status = STATUS_PLAYER; + car->SetStatus(STATUS_PLAYER); AudioManager.PlayerJustGotInCar(); CCarCtrl::RegisterVehicleOfInterest(car); } else { - car->m_status = STATUS_PHYSICS; + car->SetStatus(STATUS_PHYSICS); } CWorld::Remove(this); diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 664fff18..dc44983d 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -771,7 +771,7 @@ CPlayerPed::KeepAreaAroundPlayerClear(void) for (int i = 0; i < lastVehicle; i++) { CVehicle *veh = (CVehicle*)vehicles[i]; if (veh->VehicleCreatedBy != MISSION_VEHICLE) { - if (veh->m_status != STATUS_PLAYER && veh->m_status != STATUS_PLAYER_DISABLED) { + if (veh->GetStatus() != STATUS_PLAYER && veh->GetStatus() != STATUS_PLAYER_DISABLED) { if ((veh->GetPosition() - playerPos).MagnitudeSqr() > 25.0f) { veh->AutoPilot.m_nTempAction = TEMPACT_WAIT; veh->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 5000; diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index cd89a05d..d5d0d78a 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -869,8 +869,8 @@ CPopulation::MoveCarsAndPedsOutOfAbandonedZones() CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex); if (veh && veh->m_nZoneLevel == LEVEL_NONE && veh->IsCar()) { - if(veh->m_status != STATUS_ABANDONED && veh->m_status != STATUS_WRECKED && veh->m_status != STATUS_PLAYER && - veh->m_status != STATUS_PLAYER_REMOTE) { + if(veh->GetStatus() != STATUS_ABANDONED && veh->GetStatus() != STATUS_WRECKED && veh->GetStatus() != STATUS_PLAYER && + veh->GetStatus() != STATUS_PLAYER_REMOTE) { CVector vehPos(veh->GetPosition()); CPopulation::FindCollisionZoneForCoors(&vehPos, &zone, &level); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 3d308c52..2617e801 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -382,7 +382,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent) } return VIS_INVISIBLE; } - if(ent->m_type == ENTITY_TYPE_OBJECT && + if(ent->IsObject() && ((CObject*)ent)->ObjectCreatedBy == TEMP_OBJECT){ if(ent->m_rwObject == nil || !ent->bIsVisible) return VIS_INVISIBLE; @@ -399,7 +399,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent) if(LOD_DISTANCE + STREAM_DISTANCE < dist && dist < mi->GetLargestLodDistance()) dist = mi->GetLargestLodDistance(); - if(ent->m_type == ENTITY_TYPE_OBJECT && ent->bRenderDamaged) + if(ent->IsObject() && ent->bRenderDamaged) mi->m_isDamaged = true; RpAtomic *a = mi->GetAtomicFromDistance(dist); @@ -1162,7 +1162,7 @@ CRenderer::IsEntityCullZoneVisible(CEntity *ent) if(ent->bZoneCulled) return false; - switch(ent->m_type){ + switch(ent->GetType()){ case ENTITY_TYPE_VEHICLE: return IsVehicleCullZoneVisible(ent); case ENTITY_TYPE_PED: @@ -1187,7 +1187,7 @@ bool CRenderer::IsVehicleCullZoneVisible(CEntity *ent) { CVehicle *v = (CVehicle*)ent; - switch(v->m_status) + switch(v->GetStatus()) case STATUS_SIMPLE: case STATUS_PHYSICS: case STATUS_ABANDONED: diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index bfb215d2..87c270c1 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -162,7 +162,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) SetupSuspensionLines(); - m_status = STATUS_SIMPLE; + SetStatus(STATUS_SIMPLE); bUseCollisionRecords = true; m_nNumPassengers = 0; @@ -254,8 +254,8 @@ CAutomobile::ProcessControl(void) ProcessCarAlarm(); // Scan if this car sees the player committing any crimes - if(m_status != STATUS_ABANDONED && m_status != STATUS_WRECKED && - m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE && m_status != STATUS_PLAYER_DISABLED){ + if(GetStatus() != STATUS_ABANDONED && GetStatus() != STATUS_WRECKED && + GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && GetStatus() != STATUS_PLAYER_DISABLED){ switch(GetModelIndex()) case MI_FBICAR: case MI_POLICE: @@ -318,7 +318,7 @@ CAutomobile::ProcessControl(void) // Set Center of Mass to make car more stable if(strongGrip1 || bCheat3) m_vecCentreOfMass.z = 0.3f*m_aSuspensionSpringLength[0] + -1.0f*m_fHeightAboveRoad; - else if(pHandling->Flags & HANDLING_NONPLAYER_STABILISER && m_status == STATUS_PHYSICS) + else if(pHandling->Flags & HANDLING_NONPLAYER_STABILISER && GetStatus() == STATUS_PHYSICS) m_vecCentreOfMass.z = pHandling->CentreOfMass.z - 0.2f*pHandling->Dimension.z; else m_vecCentreOfMass.z = pHandling->CentreOfMass.z; @@ -326,7 +326,7 @@ CAutomobile::ProcessControl(void) // Process depending on status bool playerRemote = false; - switch(m_status){ + switch(GetStatus()){ case STATUS_PLAYER_REMOTE: if(CPad::GetPad(0)->WeaponJustDown()){ BlowUpCar(FindPlayerPed()); @@ -356,7 +356,7 @@ CAutomobile::ProcessControl(void) PruneReferences(); - if(m_status == STATUS_PLAYER && !CRecordDataForChase::IsRecording()) + if(GetStatus() == STATUS_PLAYER && !CRecordDataForChase::IsRecording()) DoDriveByShootings(); } break; @@ -426,7 +426,7 @@ CAutomobile::ProcessControl(void) // Skip physics if object is found to have been static recently bool skipPhysics = false; - if(!bIsStuck && (m_status == STATUS_ABANDONED || m_status == STATUS_WRECKED)){ + if(!bIsStuck && (GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED)){ bool makeStatic = false; float moveSpeedLimit, turnSpeedLimit, distanceLimit; @@ -436,7 +436,7 @@ CAutomobile::ProcessControl(void) m_aSuspensionSpringRatioPrev[3] != 1.0f) makeStatic = true; - if(m_status == STATUS_WRECKED){ + if(GetStatus() == STATUS_WRECKED){ moveSpeedLimit = 0.006f; turnSpeedLimit = 0.0015f; distanceLimit = 0.015f; @@ -494,7 +494,7 @@ CAutomobile::ProcessControl(void) default: if(CVehicle::bCheat3){ // Make vehicle jump when horn is sounded - if(m_status == STATUS_PLAYER && m_vecMoveSpeed.MagnitudeSqr() > sq(0.2f) && + if(GetStatus() == STATUS_PLAYER && m_vecMoveSpeed.MagnitudeSqr() > sq(0.2f) && // BUG: game checks [0] four times, instead of all wheels m_aSuspensionSpringRatio[0] < 1.0f && CPad::GetPad(0)->HornJustDown()){ @@ -713,7 +713,7 @@ CAutomobile::ProcessControl(void) } float traction; - if(m_status == STATUS_PHYSICS) + if(GetStatus() == STATUS_PHYSICS) traction = 0.004f * m_fTraction; else traction = 0.004f; @@ -764,7 +764,7 @@ CAutomobile::ProcessControl(void) m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceA = SURFACE_RUBBER29; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_LEFT])*traction; - if(m_status == STATUS_PLAYER) + if(GetStatus() == STATUS_PLAYER) adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceB); WheelState[CARWHEEL_FRONT_LEFT] = m_aWheelState[CARWHEEL_FRONT_LEFT]; @@ -798,7 +798,7 @@ CAutomobile::ProcessControl(void) m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceA = SURFACE_RUBBER29; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT])*traction; - if(m_status == STATUS_PLAYER) + if(GetStatus() == STATUS_PLAYER) adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceB); WheelState[CARWHEEL_FRONT_RIGHT] = m_aWheelState[CARWHEEL_FRONT_RIGHT]; @@ -873,7 +873,7 @@ CAutomobile::ProcessControl(void) m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceA = SURFACE_RUBBER29; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_LEFT])*traction; - if(m_status == STATUS_PLAYER) + if(GetStatus() == STATUS_PLAYER) adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceB); WheelState[CARWHEEL_REAR_LEFT] = m_aWheelState[CARWHEEL_REAR_LEFT]; @@ -907,7 +907,7 @@ CAutomobile::ProcessControl(void) m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceA = SURFACE_RUBBER29; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_RIGHT])*traction; - if(m_status == STATUS_PLAYER) + if(GetStatus() == STATUS_PLAYER) adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceB); WheelState[CARWHEEL_REAR_RIGHT] = m_aWheelState[CARWHEEL_REAR_RIGHT]; @@ -976,7 +976,7 @@ CAutomobile::ProcessControl(void) // Process horn - if(m_status != STATUS_PLAYER){ + if(GetStatus() != STATUS_PLAYER){ ReduceHornCounter(); }else{ if(GetModelIndex() == MI_MRWHOOP){ @@ -1008,7 +1008,7 @@ CAutomobile::ProcessControl(void) // Flying - if(m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE && m_status != STATUS_PHYSICS){ + if(GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && GetStatus() != STATUS_PHYSICS){ if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW) m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.0005f, 0.0f); }else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) && @@ -1061,7 +1061,7 @@ CAutomobile::ProcessControl(void) // move fire forward if in first person if(this == FindPlayerVehicle() && TheCamera.GetLookingForwardFirstPerson()) - if(m_fHealth < 250.0f && m_status != STATUS_WRECKED){ + if(m_fHealth < 250.0f && GetStatus() != STATUS_WRECKED){ if(GetModelIndex() == MI_FIRETRUCK) damagePos += CVector(0.0f, 3.0f, -0.2f); else @@ -1071,7 +1071,7 @@ CAutomobile::ProcessControl(void) damagePos = GetMatrix()*damagePos; damagePos.z += 0.15f; - if(m_fHealth < 250.0f && m_status != STATUS_WRECKED){ + if(m_fHealth < 250.0f && GetStatus() != STATUS_WRECKED){ // Car is on fire CParticle::AddParticle(PARTICLE_CARFLAME, damagePos, @@ -1137,7 +1137,7 @@ CAutomobile::ProcessControl(void) // Shake pad - if((suspShake > 0.0f || surfShake > 0.0f) && m_status == STATUS_PLAYER){ + if((suspShake > 0.0f || surfShake > 0.0f) && GetStatus() == STATUS_PLAYER){ float speed = m_vecMoveSpeed.MagnitudeSqr(); if(speed > sq(0.1f)){ speed = Sqrt(speed); @@ -1198,7 +1198,7 @@ CAutomobile::ProcessControl(void) m_vecMoveFriction = CVector(0.0f, 0.0f, 0.0f); m_vecTurnFriction = CVector(0.0f, 0.0f, 0.0f); }else if(!skipPhysics && - (m_fGasPedal == 0.0f && brake == 0.0f || m_status == STATUS_WRECKED)){ + (m_fGasPedal == 0.0f && brake == 0.0f || GetStatus() == STATUS_WRECKED)){ if(Abs(m_vecMoveSpeed.x) < 0.005f && Abs(m_vecMoveSpeed.y) < 0.005f && Abs(m_vecMoveSpeed.z) < 0.005f){ @@ -1255,7 +1255,7 @@ CAutomobile::PreRender(void) } } }else{ - if(m_status == STATUS_SIMPLE){ + if(GetStatus() == STATUS_SIMPLE){ CMatrix mat; CVector pos; @@ -1285,8 +1285,8 @@ CAutomobile::PreRender(void) } int drawParticles = Abs(fwdSpeed) < 90.0f; - if(m_status == STATUS_SIMPLE || m_status == STATUS_PHYSICS || - m_status == STATUS_PLAYER || m_status == STATUS_PLAYER_PLAYBACKFROMBUFFER){ + if(GetStatus() == STATUS_SIMPLE || GetStatus() == STATUS_PHYSICS || + GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_PLAYER_PLAYBACKFROMBUFFER){ bool rearSkidding = false; if(m_aWheelState[CARWHEEL_REAR_LEFT] == WHEEL_STATE_SKIDDING || m_aWheelState[CARWHEEL_REAR_RIGHT] == WHEEL_STATE_SKIDDING) @@ -1618,8 +1618,8 @@ CAutomobile::PreRender(void) CClock::GetHours() < 8 && CClock::GetMinutes() < (m_randomSeed & 0x3F) || m_randomSeed/50000.0f < CWeather::Foggyness || m_randomSeed/50000.0f < CWeather::WetRoads; - if(shouldLightsBeOn != bLightsOn && m_status != STATUS_WRECKED){ - if(m_status == STATUS_ABANDONED){ + if(shouldLightsBeOn != bLightsOn && GetStatus() != STATUS_WRECKED){ + if(GetStatus() == STATUS_ABANDONED){ // Turn off lights on abandoned vehicles only when we they're far away if(bLightsOn && Abs(TheCamera.GetPosition().x - GetPosition().x) + Abs(TheCamera.GetPosition().y - GetPosition().y) > 100.0f) @@ -1857,7 +1857,7 @@ CAutomobile::PreRender(void) }else{ // Lights off - if(m_status == STATUS_ABANDONED || m_status == STATUS_WRECKED) { + if(GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED) { CShadows::StoreShadowForCar(this); return; } @@ -2139,7 +2139,7 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints) int i; CColModel *colModel; - if(m_status != STATUS_SIMPLE) + if(GetStatus() != STATUS_SIMPLE) bVehicleColProcessed = true; if(bUsingSpecialColModel) @@ -2178,7 +2178,7 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints) phys->RegisterReference((CEntity**)&m_aGroundPhysical[i]); m_aGroundOffset[i] = m_aWheelColPoints[i].point - phys->GetPosition(); - if(phys->GetModelIndex() == MI_BODYCAST && m_status == STATUS_PLAYER){ + if(phys->GetModelIndex() == MI_BODYCAST && GetStatus() == STATUS_PLAYER){ // damage body cast float speed = m_vecMoveSpeed.MagnitudeSqr(); if(speed > 0.1f){ @@ -2370,7 +2370,7 @@ CAutomobile::FireTruckControl(void) cannonDir = Multiply3x3(GetMatrix(), cannonDir); cannonDir.z += (CGeneral::GetRandomNumber()&0xF)/1000.0f; CWaterCannons::UpdateOne((uintptr)this, &cannonPos, &cannonDir); - }else if(m_status == STATUS_PHYSICS){ + }else if(GetStatus() == STATUS_PHYSICS){ CFire *fire = gFireManager.FindFurthestFire_NeverMindFireMen(GetPosition(), 10.0f, 35.0f); if(fire == nil) return; @@ -2531,7 +2531,7 @@ CAutomobile::HydraulicControl(void) CPlayerInfo *playerInfo = &CWorld::Players[CWorld::PlayerInFocus]; CColModel *specialColModel = &playerInfo->m_ColModel; - if(m_status != STATUS_PLAYER){ + if(GetStatus() != STATUS_PLAYER){ // reset hydraulics for non-player cars if(!bUsingSpecialColModel) @@ -3123,7 +3123,7 @@ CAutomobile::RcbanditCheck1CarWheels(CPtrList &list) mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(car->GetModelIndex()); for(i = 0; i < 4; i++){ - if(car->m_aSuspensionSpringRatioPrev[i] < 1.0f || car->m_status == STATUS_SIMPLE){ + if(car->m_aSuspensionSpringRatioPrev[i] < 1.0f || car->GetStatus() == STATUS_SIMPLE){ CVector wheelPos; CColSphere sph; mi->GetWheelPosn(i, wheelPos); @@ -3205,20 +3205,20 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) // damage flipped over car if(GetUp().z < 0.0f && this != FindPlayerVehicle()){ - if(bNotDamagedUpsideDown || m_status == STATUS_PLAYER_REMOTE || bIsInWater) + if(bNotDamagedUpsideDown || GetStatus() == STATUS_PLAYER_REMOTE || bIsInWater) return; m_fHealth -= 4.0f*CTimer::GetTimeStep(); } - if(impulse > 25.0f && m_status != STATUS_WRECKED){ + if(impulse > 25.0f && GetStatus() != STATUS_WRECKED){ if(bIsLawEnforcer && FindPlayerVehicle() && FindPlayerVehicle() == m_pDamageEntity && - m_status != STATUS_ABANDONED && + GetStatus() != STATUS_ABANDONED && FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() >= m_vecMoveSpeed.Magnitude() && FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() > 0.1f) FindPlayerPed()->SetWantedLevelNoDrop(1); - if(m_status == STATUS_PLAYER && impulse > 50.0f){ + if(GetStatus() == STATUS_PLAYER && impulse > 50.0f){ uint8 freq = Min(0.4f*impulse*2000.0f/m_fMass + 100.0f, 250.0f); CPad::GetPad(0)->StartShake(40000/freq, freq); } @@ -3382,7 +3382,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) float damage = (impulse-25.0f)*pHandling->fCollisionDamageMultiplier*0.6f*damageMultiplier; - if(GetModelIndex() == MI_SECURICA && m_pDamageEntity && m_pDamageEntity->m_status == STATUS_PLAYER) + if(GetModelIndex() == MI_SECURICA && m_pDamageEntity && m_pDamageEntity->GetStatus() == STATUS_PLAYER) damage *= 7.0f; if(damage > 0.0f){ @@ -3816,7 +3816,7 @@ CAutomobile::BlowUpCar(CEntity *culprit) // explosion pushes vehicle up m_vecMoveSpeed.z += 0.13f; - m_status = STATUS_WRECKED; + SetStatus(STATUS_WRECKED); bRenderScorched = true; m_nTimeOfDeath = CTimer::GetTimeInMilliseconds(); Damage.FuckCarCompletely(); @@ -3933,8 +3933,8 @@ CAutomobile::BurstTyre(uint8 wheel) if(status == WHEEL_STATUS_OK){ Damage.SetWheelStatus(wheel, WHEEL_STATUS_BURST); - if(m_status == STATUS_SIMPLE){ - m_status = STATUS_PHYSICS; + if(GetStatus() == STATUS_SIMPLE){ + SetStatus(STATUS_PHYSICS); CCarCtrl::SwitchVehicleToRealPhysics(this); } @@ -4133,7 +4133,7 @@ CAutomobile::HasCarStoppedBecauseOfLight(void) { int i; - if(m_status != STATUS_SIMPLE && m_status != STATUS_PHYSICS) + if(GetStatus() != STATUS_SIMPLE && GetStatus() != STATUS_PHYSICS) return false; if(AutoPilot.m_nCurrentRouteNode && AutoPilot.m_nNextRouteNode){ diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 14eb2f05..615511bd 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -137,7 +137,7 @@ CBoat::ProcessControl(void) ProcessCarAlarm(); - switch(m_status){ + switch(GetStatus()){ case STATUS_PLAYER: m_bIsAnchored = false; m_fOrientation = INVALID_ORIENTATION; @@ -176,7 +176,7 @@ CBoat::ProcessControl(void) } float collisionDamage = pHandling->fCollisionDamageMultiplier * m_fDamageImpulse; - if(collisionDamage > 25.0f && m_status != STATUS_WRECKED && m_fHealth >= 150.0f){ + if(collisionDamage > 25.0f && GetStatus() != STATUS_WRECKED && m_fHealth >= 150.0f){ float prevHealth = m_fHealth; if(this == FindPlayerVehicle()){ if(bTakeLessDamage) @@ -199,7 +199,7 @@ CBoat::ProcessControl(void) } // Damage particles - if(m_fHealth <= 600.0f && m_status != STATUS_WRECKED && + if(m_fHealth <= 600.0f && GetStatus() != STATUS_WRECKED && Abs(GetPosition().x - TheCamera.GetPosition().x) < 200.0f && Abs(GetPosition().y - TheCamera.GetPosition().y) < 200.0f){ float speedSq = m_vecMoveSpeed.MagnitudeSqr(); @@ -326,7 +326,7 @@ CBoat::ProcessControl(void) // Spray some particles CVector jetDir = -0.04f * force; if(m_fGasPedal > 0.0f){ - if(m_status == STATUS_PLAYER){ + if(GetStatus() == STATUS_PLAYER){ bool cameraHack = TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.WhoIsInControlOfTheCamera == CAMCONTROL_OBBE; CVector sternPos = GetColModel()->boundingBox.min; @@ -597,7 +597,7 @@ CBoat::BlowUpCar(CEntity *culprit) // explosion pushes vehicle up m_vecMoveSpeed.z += 0.13f; - m_status = STATUS_WRECKED; + SetStatus(STATUS_WRECKED); bRenderScorched = true; m_fHealth = 0.0; diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp index 64743929..c04e8c35 100644 --- a/src/vehicles/CarGen.cpp +++ b/src/vehicles/CarGen.cpp @@ -61,7 +61,7 @@ void CCarGenerator::DoInternalProcessing() pos.z += pBoat->GetDistanceFromCentreOfMassToBaseOfModel(); pBoat->GetPosition() = pos; pBoat->SetOrientation(0.0f, 0.0f, DEGTORAD(m_fAngle)); - pBoat->m_status = STATUS_ABANDONED; + pBoat->SetStatus(STATUS_ABANDONED); pBoat->m_nDoorLock = CARLOCK_UNLOCKED; CWorld::Add(pBoat); if (CGeneral::GetRandomNumberInRange(0, 100) < m_nAlarm) @@ -95,7 +95,7 @@ void CCarGenerator::DoInternalProcessing() pos.z += pCar->GetDistanceFromCentreOfMassToBaseOfModel(); pCar->GetPosition() = pos; pCar->SetOrientation(0.0f, 0.0f, DEGTORAD(m_fAngle)); - pCar->m_status = STATUS_ABANDONED; + pCar->SetStatus(STATUS_ABANDONED); pCar->bLightsOn = false; pCar->m_nDoorLock = CARLOCK_UNLOCKED; CWorld::Add(pCar); @@ -130,7 +130,7 @@ void CCarGenerator::Process() m_nVehicleHandle = -1; return; } - if (pVehicle->m_status != STATUS_PLAYER) + if (pVehicle->GetStatus() != STATUS_PLAYER) return; m_nTimer += 60000; m_nVehicleHandle = -1; diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp index 7d2160d9..725c9e87 100644 --- a/src/vehicles/Cranes.cpp +++ b/src/vehicles/Cranes.cpp @@ -416,7 +416,7 @@ void CCrane::FindCarInSectorList(CPtrList* pList) Abs(pVehicle->GetMoveSpeed().y) >= CAR_MOVING_SPEED_THRESHOLD || Abs(pVehicle->GetMoveSpeed().z) >= CAR_MOVING_SPEED_THRESHOLD) continue; - if (!pVehicle->IsCar() || pVehicle->m_status == STATUS_WRECKED || pVehicle->m_fHealth < 250.0f) + if (!pVehicle->IsCar() || pVehicle->GetStatus() == STATUS_WRECKED || pVehicle->m_fHealth < 250.0f) continue; if (!DoesCranePickUpThisCarType(pVehicle->GetModelIndex()) || m_bIsMilitaryCrane && CCranes::DoesMilitaryCraneHaveThisOneAlready(pVehicle->GetModelIndex())) { diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index 0073a5ad..dd2c4e57 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -77,7 +77,7 @@ CHeli::CHeli(int32 id, uint8 CreatedBy) m_fHeliDustZ[i] = -50.0f; m_nPoliceShoutTimer = CTimer::GetTimeInMilliseconds(); - m_status = STATUS_HELI; + SetStatus(STATUS_HELI); m_bTestRight = true; m_fTargetOffset = 0.0f; m_fSearchLightX = m_fSearchLightY = 0.0f; @@ -810,7 +810,7 @@ GenerateHeli(bool catalina) if(catalina) heli->GetMatrix().SetRotateZOnly(DEGTORAD(270.0f)); // game actually uses 3.14 here - heli->m_status = STATUS_ABANDONED; + heli->SetStatus(STATUS_ABANDONED); int id = -1; bool found = false; diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp index 273ac54a..10ce225a 100644 --- a/src/vehicles/Plane.cpp +++ b/src/vehicles/Plane.cpp @@ -81,7 +81,7 @@ CPlane::CPlane(int32 id, uint8 CreatedBy) m_bIsDrugRunCesna = false; m_bIsDropOffCesna = false; - m_status = STATUS_PLANE; + SetStatus(STATUS_PLANE); bIsBIGBuilding = true; m_level = LEVEL_NONE; } @@ -754,7 +754,7 @@ CPlane::InitPlanes(void) for(i = 0; i < 3; i++){ CPlane *plane = new CPlane(MI_AIRTRAIN, PERMANENT_VEHICLE); plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); - plane->m_status = STATUS_ABANDONED; + plane->SetStatus(STATUS_ABANDONED); plane->bIsLocked = true; plane->m_nPlaneId = i; plane->m_nCurPathNode = 0; @@ -768,7 +768,7 @@ CPlane::InitPlanes(void) for(i = 0; i < 3; i++){ CPlane *plane = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE); plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); - plane->m_status = STATUS_ABANDONED; + plane->SetStatus(STATUS_ABANDONED); plane->bIsLocked = true; plane->m_nPlaneId = i; plane->m_nCurPathNode = 0; @@ -926,7 +926,7 @@ CPlane::CreateIncomingCesna(void) } pDrugRunCesna = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE); pDrugRunCesna->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); - pDrugRunCesna->m_status = STATUS_ABANDONED; + pDrugRunCesna->SetStatus(STATUS_ABANDONED); pDrugRunCesna->bIsLocked = true; pDrugRunCesna->m_nPlaneId = 0; pDrugRunCesna->m_nCurPathNode = 0; @@ -948,7 +948,7 @@ CPlane::CreateDropOffCesna(void) } pDropOffCesna = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE); pDropOffCesna->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); - pDropOffCesna->m_status = STATUS_ABANDONED; + pDropOffCesna->SetStatus(STATUS_ABANDONED); pDropOffCesna->bIsLocked = true; pDropOffCesna->m_nPlaneId = 0; pDropOffCesna->m_nCurPathNode = 0; diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp index 0d1ff9b0..07d81501 100644 --- a/src/vehicles/Train.cpp +++ b/src/vehicles/Train.cpp @@ -59,7 +59,7 @@ CTrain::CTrain(int32 id, uint8 CreatedBy) m_nDoorState = TRAIN_DOOR_CLOSED; bUsesCollision = true; - m_status = STATUS_TRAIN_MOVING; + SetStatus(STATUS_TRAIN_MOVING); } void @@ -177,11 +177,11 @@ CTrain::ProcessControl(void) m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); if(engineTrackSpeed[m_nWagonGroup] > 0.001f){ - m_status = STATUS_TRAIN_MOVING; + SetStatus(STATUS_TRAIN_MOVING); m_bTrainStopping = false; m_bProcessDoor = true; }else{ - m_status = STATUS_TRAIN_NOT_MOVING; + SetStatus(STATUS_TRAIN_NOT_MOVING); m_bTrainStopping = true; } @@ -252,7 +252,7 @@ CTrain::ProcessControl(void) } // Hit stuff - if(m_bIsFirstWagon && m_status == STATUS_TRAIN_MOVING){ + if(m_bIsFirstWagon && GetStatus()== STATUS_TRAIN_MOVING){ CVector front = GetPosition() + GetForward()*GetColModel()->boundingBox.max.y + m_vecMoveSpeed*CTimer::GetTimeStep(); int x, xmin, xmax; @@ -440,7 +440,7 @@ CTrain::InitTrains(void) for(i = 0; i < 5; i++){ train = new CTrain(MI_TRAIN, PERMANENT_VEHICLE); train->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); - train->m_status = STATUS_ABANDONED; + train->SetStatus(STATUS_ABANDONED); train->bIsLocked = true; train->m_fWagonPosition = wagonPositions[i]; train->m_bIsFirstWagon = firstWagon[i]; @@ -459,7 +459,7 @@ CTrain::InitTrains(void) for(i = 0; i < 8; i++){ train = new CTrain(MI_TRAIN, PERMANENT_VEHICLE); train->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); - train->m_status = STATUS_ABANDONED; + train->SetStatus(STATUS_ABANDONED); train->bIsLocked = true; train->m_fWagonPosition = wagonPositions_S[i]; train->m_bIsFirstWagon = firstWagon_S[i]; diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index d0ccd31b..590e68f2 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -393,7 +393,7 @@ CVehicle::FlyingControl(eFlightModel flightModel) m_vecMoveSpeed.x *= rmX; m_vecMoveSpeed.y *= rmY; m_vecMoveSpeed.z *= rmZ; - if (m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE) + if (GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE) return; float fThrust; if (bCheat5) @@ -623,13 +623,13 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage } if (m_fHealth > 0.0f) { if (VehicleCreatedBy == RANDOM_VEHICLE && pDriver && - (m_status == STATUS_SIMPLE || m_status == STATUS_PHYSICS) && + (GetStatus() == STATUS_SIMPLE || GetStatus() == STATUS_PHYSICS) && AutoPilot.m_nCarMission == MISSION_CRUISE) { if (m_randomSeed < DAMAGE_FLEE_IN_CAR_PROBABILITY_VALUE) { CCarCtrl::SwitchVehicleToRealPhysics(this); AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * pHandling->Transmission.fUnkMaxVelocity; - m_status = STATUS_PHYSICS; + SetStatus(STATUS_PHYSICS); } } m_nLastWeaponDamage = weaponType; @@ -639,11 +639,11 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage if (VehicleCreatedBy == RANDOM_VEHICLE && (m_fHealth < DAMAGE_HEALTH_TO_FLEE_ALWAYS || bFrightensDriver && m_randomSeed > DAMAGE_FLEE_ON_FOOT_PROBABILITY_VALUE)) { - switch (m_status) { + switch (GetStatus()) { case STATUS_SIMPLE: case STATUS_PHYSICS: if (pDriver) { - m_status = STATUS_ABANDONED; + SetStatus(STATUS_ABANDONED); pDriver->bFleeAfterExitingCar = true; pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this); } @@ -871,7 +871,7 @@ CVehicle::UsesSiren(uint32 id) bool CVehicle::IsVehicleNormal(void) { - if (!pDriver || m_nNumPassengers != 0 || m_status == STATUS_WRECKED) + if (!pDriver || m_nNumPassengers != 0 || GetStatus() == STATUS_WRECKED) return false; switch (GetModelIndex()){ case MI_FIRETRUCK: @@ -1141,7 +1141,7 @@ CVehicle::AddPassenger(CPed *passenger, uint8 n) void CVehicle::RemoveDriver(void) { - m_status = STATUS_ABANDONED; + SetStatus(STATUS_ABANDONED); pDriver = nil; } diff --git a/src/weapons/BulletInfo.cpp b/src/weapons/BulletInfo.cpp index 7fa32ca7..b7270f4b 100644 --- a/src/weapons/BulletInfo.cpp +++ b/src/weapons/BulletInfo.cpp @@ -171,7 +171,7 @@ void CBulletInfo::Update(void) } if (pBullet->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE && bAddSound) { cAudioScriptObject* pAudio; - switch (pHitEntity->m_type) { + switch (pHitEntity->GetType()) { case ENTITY_TYPE_BUILDING: pAudio = new cAudioScriptObject(); pAudio->Posn = pHitEntity->GetPosition(); diff --git a/src/weapons/ProjectileInfo.cpp b/src/weapons/ProjectileInfo.cpp index c174305c..2fba42e3 100644 --- a/src/weapons/ProjectileInfo.cpp +++ b/src/weapons/ProjectileInfo.cpp @@ -193,7 +193,7 @@ CProjectileInfo::Update() if (!gaProjectileInfo[i].m_bInUse) continue; CPed *ped = (CPed*)gaProjectileInfo[i].m_pSource; - if (ped != nil && ped->m_type == ENTITY_TYPE_PED && !ped->IsPointerValid()) + if (ped != nil && ped->IsPed() && !ped->IsPointerValid()) gaProjectileInfo[i].m_pSource = nil; if (ms_apProjectile[i] == nil) { diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index a3d52f69..9897e73f 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -990,7 +990,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim, } else { - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_BUILDING: { @@ -1065,7 +1065,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim, } } - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_BUILDING: { @@ -1256,7 +1256,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) } else { - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_VEHICLE: { @@ -1315,7 +1315,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) } } - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_BUILDING: { @@ -1724,7 +1724,7 @@ CWeapon::FireInstantHitFromCar(CAutomobile *shooter, bool left) else CGlass::WasGlassHitByBullet(victim, point.point); - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_BUILDING: { @@ -1796,10 +1796,10 @@ CWeapon::DoDoomAiming(CEntity *shooter, CVector *source, CVector *target) if ( (CEntity*)shooterPed != victim && shooterPed->CanSeeEntity(victim, DEGTORAD(22.5f)) ) { - if ( !(victim->m_status == STATUS_TRAIN_MOVING - || victim->m_status == STATUS_TRAIN_NOT_MOVING - || victim->m_status == STATUS_HELI - || victim->m_status == STATUS_PLANE) ) + if ( !(victim->GetStatus() == STATUS_TRAIN_MOVING + || victim->GetStatus() == STATUS_TRAIN_NOT_MOVING + || victim->GetStatus() == STATUS_HELI + || victim->GetStatus() == STATUS_PLANE) ) { float distToVictim = (shooterPed->GetPosition()-victim->GetPosition()).Magnitude2D(); float distToVictimZ = Abs(shooterPed->GetPosition().z-victim->GetPosition().z); @@ -1866,10 +1866,10 @@ CWeapon::DoTankDoomAiming(CEntity *shooter, CEntity *driver, CVector *source, CV if ( shooter != victim && driver != victim ) { - if ( !(victim->m_status == STATUS_TRAIN_MOVING - || victim->m_status == STATUS_TRAIN_NOT_MOVING - || victim->m_status == STATUS_HELI - || victim->m_status == STATUS_PLANE) ) + if ( !(victim->GetStatus() == STATUS_TRAIN_MOVING + || victim->GetStatus() == STATUS_TRAIN_NOT_MOVING + || victim->GetStatus() == STATUS_HELI + || victim->GetStatus() == STATUS_PLANE) ) { if ( !(victim->IsVehicle() && victim->bRenderScorched) ) { @@ -2086,7 +2086,7 @@ FireOneInstantHitRound(CVector *source, CVector *target, int32 damage) ((CVehicle *)victim)->InflictDamage(nil, WEAPONTYPE_UZI, damage); //BUG ? no CGlass::WasGlassHitByBullet - switch ( victim->m_type ) + switch ( victim->GetType() ) { case ENTITY_TYPE_BUILDING: {