Adding getters and setters for type and status

This commit is contained in:
Sergeanur 2020-04-30 16:45:45 +03:00
parent cf5a404f6b
commit 7d758f3a9f
41 changed files with 256 additions and 249 deletions

View File

@ -4461,7 +4461,7 @@ void cAudioManager::ProcessFires(int32)
if(gFireManager.m_aFires[i].m_bIsOngoing && gFireManager.m_aFires[i].m_bAudioSet) { if(gFireManager.m_aFires[i].m_bIsOngoing && gFireManager.m_aFires[i].m_bAudioSet) {
entity = gFireManager.m_aFires[i].m_pEntity; entity = gFireManager.m_aFires[i].m_pEntity;
if(entity) { if(entity) {
switch(entity->m_type & 7) { switch(entity->GetType()) {
case ENTITY_TYPE_BUILDING: case ENTITY_TYPE_BUILDING:
m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_fSoundIntensity = 50.0f;
m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE;
@ -7097,7 +7097,7 @@ cAudioManager::ProcessPhysical(int32 id)
{ {
CPhysical *entity = (CPhysical *)m_asAudioEntities[id].m_pEntity; CPhysical *entity = (CPhysical *)m_asAudioEntities[id].m_pEntity;
if(entity) { if(entity) {
switch(entity->m_type) { switch(entity->GetType()) {
case ENTITY_TYPE_VEHICLE: case ENTITY_TYPE_VEHICLE:
ProcessVehicle((CVehicle *)m_asAudioEntities[id].m_pEntity); ProcessVehicle((CVehicle *)m_asAudioEntities[id].m_pEntity);
break; break;
@ -8069,7 +8069,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh)
if(handling) params.m_pTransmission = &handling->Transmission; if(handling) params.m_pTransmission = &handling->Transmission;
params.m_nIndex = veh->m_modelIndex - 90; 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; velChange = params.m_pVehicle->AutoPilot.m_fMaxTrafficSpeed * 0.02f;
else else
velChange = velChange =
@ -8215,7 +8215,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
if(params->m_fDistance < SQR(50.f)) { if(params->m_fDistance < SQR(50.f)) {
playerVeh = FindPlayerVehicle(); playerVeh = FindPlayerVehicle();
veh = params->m_pVehicle; veh = params->m_pVehicle;
if(playerVeh == veh && veh->m_status == STATUS_WRECKED) { if(playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) {
SampleManager.StopChannel(m_nActiveSamples); SampleManager.StopChannel(m_nActiveSamples);
return; return;
} }
@ -8237,7 +8237,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
if(automobile->bIsHandbrakeOn) { if(automobile->bIsHandbrakeOn) {
if(params->m_fVelocityChange == 0.0f) if(params->m_fVelocityChange == 0.0f)
traction = 0.9f; traction = 0.9f;
} else if(params->m_pVehicle->m_status == STATUS_SIMPLE) { } else if(params->m_pVehicle->GetStatus() == STATUS_SIMPLE) {
traction = 0.0f; traction = 0.0f;
} else { } else {
switch(transmission->nDriveType) { switch(transmission->nDriveType) {
@ -8265,7 +8265,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
relativeChange = 0.f; relativeChange = 0.f;
} else if(currentGear) { } else if(currentGear) {
relativeGearChange = Min(1.0f, (params->m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f); 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; traction = 0.7f;
} }
relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + (1.0f - traction) * relativeGearChange; relativeChange = traction * automobile->m_fGasPedalAudio * 0.95f + (1.0f - traction) * relativeGearChange;
@ -8296,7 +8296,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
} }
m_sQueueSample.m_nVolume = volume; m_sQueueSample.m_nVolume = volume;
if(m_sQueueSample.m_nVolume) { if(m_sQueueSample.m_nVolume) {
if(automobile->m_status == STATUS_SIMPLE) { if(automobile->GetStatus() == STATUS_SIMPLE) {
if(modificator < 0.02f) { if(modificator < 0.02f) {
m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType + SFX_CAR_REV_10; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params->m_nIndex].m_bEngineSoundType + SFX_CAR_REV_10;
freq = 10000.f * modificator + 22050; freq = 10000.f * modificator + 22050;
@ -8388,7 +8388,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams *params)
if((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) && if((!automobile->m_bSirenOrAlarm || !UsesSirenSwitching(params->m_nIndex)) &&
automobile->m_modelIndex != MI_MRWHOOP) { automobile->m_modelIndex != MI_MRWHOOP) {
if(automobile->m_nCarHornTimer) { if(automobile->m_nCarHornTimer) {
if(params->m_pVehicle->m_status) { if(params->m_pVehicle->GetStatus() != STATUS_PLAYER) {
if(automobile->m_nCarHornTimer > 44) if(automobile->m_nCarHornTimer > 44)
automobile->m_nCarHornTimer = 44; automobile->m_nCarHornTimer = 44;
if(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; if(veh->m_bSirenOrAlarm == 0 && veh->m_nAlarmState <= 0) return;
#ifdef FIX_BUGS #ifdef FIX_BUGS
if (params->m_pVehicle->m_status == STATUS_WRECKED) return; if (params->m_pVehicle->GetStatus() == STATUS_WRECKED) return;
#endif #endif
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_nVolume = ComputeVolume(80, 110.f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(80, 110.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_nVolume) { if(m_sQueueSample.m_nVolume) {
m_sQueueSample.m_nCounter = 5; m_sQueueSample.m_nCounter = 5;
if(UsesSiren(params->m_nIndex)) { 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) { if(veh->m_nCarHornTimer && params->m_nIndex != FIRETRUK) {
m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST; m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST;
if(params->m_nIndex == FBICAR) if(params->m_nIndex == FBICAR)

View File

@ -55,7 +55,7 @@ cMusicManager::PlayerInCar()
if (!FindPlayerVehicle()) if (!FindPlayerVehicle())
return true; return true;
if (FindPlayerVehicle()->m_status == STATUS_WRECKED) if (FindPlayerVehicle()->GetStatus() == STATUS_WRECKED)
return false; return false;
switch(FindPlayerVehicle()->m_modelIndex) { switch(FindPlayerVehicle()->m_modelIndex) {

View File

@ -41,7 +41,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE) pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE)
pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle); pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle);
} }
switch (pVehicle->m_status){ switch (pVehicle->GetStatus()){
case STATUS_PLAYER: case STATUS_PLAYER:
case STATUS_PLAYER_PLAYBACKFROMBUFFER: case STATUS_PLAYER_PLAYBACKFROMBUFFER:
case STATUS_TRAIN_MOVING: case STATUS_TRAIN_MOVING:
@ -330,12 +330,12 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
if (ABS(FindPlayerCoors().x - pVehicle->GetPosition().x) > 10.0f || if (ABS(FindPlayerCoors().x - pVehicle->GetPosition().x) > 10.0f ||
ABS(FindPlayerCoors().y - pVehicle->GetPosition().y) > 10.0f){ ABS(FindPlayerCoors().y - pVehicle->GetPosition().y) > 10.0f){
pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle); pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle);
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
pVehicle->AutoPilot.m_nCarMission = FindPoliceCarMissionForWantedLevel(); pVehicle->AutoPilot.m_nCarMission = FindPoliceCarMissionForWantedLevel();
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE; pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
}else if (pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE){ }else if (pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE){
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
TellOccupantsToLeaveCar(pVehicle); TellOccupantsToLeaveCar(pVehicle);
pVehicle->AutoPilot.m_nCruiseSpeed = 0; pVehicle->AutoPilot.m_nCruiseSpeed = 0;
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE; pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
@ -357,7 +357,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds(); pVehicle->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
pVehicle->AutoPilot.m_nAntiReverseTimer = 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_NONE){
if (pVehicle->AutoPilot.m_nCarMission != MISSION_STOP_FOREVER && if (pVehicle->AutoPilot.m_nCarMission != MISSION_STOP_FOREVER &&
pVehicle->AutoPilot.m_nCruiseSpeed != 0 && pVehicle->AutoPilot.m_nCruiseSpeed != 0 &&
@ -386,7 +386,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
CTimer::GetPreviousTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeToStartMission <= 30000 && CTimer::GetPreviousTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeToStartMission <= 30000 &&
pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE && pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE &&
!CTrafficLights::ShouldCarStopForBridge(pVehicle)){ !CTrafficLights::ShouldCarStopForBridge(pVehicle)){
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
CCarCtrl::SwitchVehicleToRealPhysics(pVehicle); CCarCtrl::SwitchVehicleToRealPhysics(pVehicle);
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
pVehicle->AutoPilot.m_nTempAction = TEMPACT_REVERSE; 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_nTempAction = TEMPACT_NONE;
pVehicle->AutoPilot.m_nCruiseSpeed = 20; pVehicle->AutoPilot.m_nCruiseSpeed = 20;
pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
pVehicle->AutoPilot.m_nCarMission = (CCarCtrl::JoinCarWithRoadSystemGotoCoors(pVehicle, *pTarget, false)) ? pVehicle->AutoPilot.m_nCarMission = (CCarCtrl::JoinCarWithRoadSystemGotoCoors(pVehicle, *pTarget, false)) ?
MISSION_GOTOCOORDS_STRAIGHT : MISSION_GOTOCOORDS; MISSION_GOTOCOORDS_STRAIGHT : MISSION_GOTOCOORDS;
}else if (Abs(pTarget->x - pVehicle->AutoPilot.m_vecDestinationCoors.x) > 2.0f || }else if (Abs(pTarget->x - pVehicle->AutoPilot.m_vecDestinationCoors.x) > 2.0f ||
@ -603,7 +603,7 @@ void CCarAI::MakeWayForCarWithSiren(CVehicle *pVehicle)
continue; continue;
if (vehicle->m_vehType != VEHICLE_TYPE_CAR && vehicle->m_vehType != VEHICLE_TYPE_BIKE) if (vehicle->m_vehType != VEHICLE_TYPE_CAR && vehicle->m_vehType != VEHICLE_TYPE_BIKE)
continue; continue;
if (vehicle->m_status != STATUS_SIMPLE && vehicle->m_status != STATUS_PHYSICS) if (vehicle->GetStatus() != STATUS_SIMPLE && vehicle->GetStatus() != STATUS_PHYSICS)
continue; continue;
if (vehicle->VehicleCreatedBy != RANDOM_VEHICLE) if (vehicle->VehicleCreatedBy != RANDOM_VEHICLE)
continue; continue;
@ -627,7 +627,7 @@ void CCarAI::MakeWayForCarWithSiren(CVehicle *pVehicle)
TEMPACT_SWERVELEFT : TEMPACT_SWERVERIGHT; TEMPACT_SWERVELEFT : TEMPACT_SWERVERIGHT;
vehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000; vehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000;
} }
vehicle->m_status = STATUS_PHYSICS; vehicle->SetStatus(STATUS_PHYSICS);
}else{ }else{
if (DotProduct2D(vehicle->GetMoveSpeed(), distance) < 0.0f && vehicle->AutoPilot.m_nTempAction != TEMPACT_WAIT){ if (DotProduct2D(vehicle->GetMoveSpeed(), distance) < 0.0f && vehicle->AutoPilot.m_nTempAction != TEMPACT_WAIT){
vehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT; vehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT;

View File

@ -482,10 +482,10 @@ CCarCtrl::GenerateOneRandomCar()
case NINES: case NINES:
case GANG8: case GANG8:
case GANG9: case GANG9:
pCar->m_status = STATUS_SIMPLE; pCar->SetStatus(STATUS_SIMPLE);
break; break;
case COPS: 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); pCar->ChangeLawEnforcerState(1);
break; break;
default: default:
@ -532,7 +532,7 @@ CCarCtrl::GenerateOneRandomCar()
else else
pCar->SetUpDriver(); pCar->SetUpDriver();
if ((CGeneral::GetRandomNumber() & 0x3F) == 0){ /* 1/64 probability */ 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_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
pCar->AutoPilot.m_nCruiseSpeed += 10; pCar->AutoPilot.m_nCruiseSpeed += 10;
} }
@ -702,7 +702,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
return; 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 && CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeToStartMission > 5000 &&
!pVehicle->GetIsOnScreen() && !pVehicle->GetIsOnScreen() &&
(pVehicle->GetPosition() - vecPlayerPos).Magnitude2D() > 25.0f && (pVehicle->GetPosition() - vecPlayerPos).Magnitude2D() > 25.0f &&
@ -716,7 +716,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
delete pVehicle; delete pVehicle;
return; return;
} }
if (pVehicle->m_status != STATUS_WRECKED || pVehicle->m_nTimeOfDeath == 0) if (pVehicle->GetStatus() != STATUS_WRECKED || pVehicle->m_nTimeOfDeath == 0)
return; return;
if (CTimer::GetTimeInMilliseconds() > pVehicle->m_nTimeOfDeath + 60000 && if (CTimer::GetTimeInMilliseconds() > pVehicle->m_nTimeOfDeath + 60000 &&
(!pVehicle->GetIsOnScreen() || !CRenderer::IsEntityCullZoneVisible(pVehicle))){ (!pVehicle->GetIsOnScreen() || !CRenderer::IsEntityCullZoneVisible(pVehicle))){
@ -759,7 +759,7 @@ CCarCtrl::UpdateCarOnRails(CVehicle* pVehicle)
SlowCarOnRailsDownForTrafficAndLights(pVehicle); SlowCarOnRailsDownForTrafficAndLights(pVehicle);
if (pVehicle->AutoPilot.m_nTimeEnteredCurve + pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve <= CTimer::GetTimeInMilliseconds()) if (pVehicle->AutoPilot.m_nTimeEnteredCurve + pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve <= CTimer::GetTimeInMilliseconds())
PickNextNodeAccordingStrategy(pVehicle); PickNextNodeAccordingStrategy(pVehicle);
if (pVehicle->m_status == STATUS_PHYSICS) if (pVehicle->GetStatus() == STATUS_PHYSICS)
return; return;
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo]; CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo]; 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 (sideLength + 0.5f < sidewaysDistance)
/* If car is far enough taking side into account, don't care */ /* If car is far enough taking side into account, don't care */
continue; 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 (pPed->GetPedState() != PED_STEP_AWAY && pPed->GetPedState() != PED_DIVE_AWAY){
if (distanceUntilHit < movementTowardsPedPerSecond){ if (distanceUntilHit < movementTowardsPedPerSecond){
/* Very close. Time to evade. */ /* Very close. Time to evade. */
@ -937,7 +937,7 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
} }
}else{ }else{
/* Relatively safe but annoying. */ /* Relatively safe but annoying. */
if (pVehicle->m_status == STATUS_PLAYER && if (pVehicle->GetStatus() == STATUS_PLAYER &&
pPed->GetPedState() != PED_FLEE_ENTITY && pPed->GetPedState() != PED_FLEE_ENTITY &&
pPed->CharCreatedBy == RANDOM_CHAR){ pPed->CharCreatedBy == RANDOM_CHAR){
float angleCarToPed = CGeneral::GetRadianAngleBetweenPoints( float angleCarToPed = CGeneral::GetRadianAngleBetweenPoints(
@ -1042,8 +1042,8 @@ void CCarCtrl::SlowCarDownForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle,
DotProduct2D(pVehicle->GetForward(), pOtherVehicle->GetForward()) < 0.5f && DotProduct2D(pVehicle->GetForward(), pOtherVehicle->GetForward()) < 0.5f &&
pVehicle < pOtherVehicle){ /* that comparasion though... */ pVehicle < pOtherVehicle){ /* that comparasion though... */
*pSpeed = Max(curSpeed / 5, *pSpeed); *pSpeed = Max(curSpeed / 5, *pSpeed);
if (pVehicle->m_status == STATUS_SIMPLE){ if (pVehicle->GetStatus() == STATUS_SIMPLE){
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
SwitchVehicleToRealPhysics(pVehicle); SwitchVehicleToRealPhysics(pVehicle);
} }
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; 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]]; pNextLink = &ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[nextLink + pCurPathNode->firstLink]];
if (prevNode == pVehicle->AutoPilot.m_nNextRouteNode){ if (prevNode == pVehicle->AutoPilot.m_nNextRouteNode){
/* We can no longer shift vehicle without physics if we have to turn it around. */ /* 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); SwitchVehicleToRealPhysics(pVehicle);
} }
pVehicle->AutoPilot.m_nTimeEnteredCurve += pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve; pVehicle->AutoPilot.m_nTimeEnteredCurve += pVehicle->AutoPilot.m_nTimeToSpendOnCurrentCurve;
@ -1640,7 +1640,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
float distanceToTargetNode; float distanceToTargetNode;
#ifndef REMOVE_TREADABLE_PATHFIND #ifndef REMOVE_TREADABLE_PATHFIND
if (pTarget && pTarget->m_pCurGroundEntity && if (pTarget && pTarget->m_pCurGroundEntity &&
pTarget->m_pCurGroundEntity->m_type == ENTITY_TYPE_BUILDING && pTarget->m_pCurGroundEntity->IsBuilding() &&
((CBuilding*)pTarget->m_pCurGroundEntity)->GetIsATreadable() && ((CBuilding*)pTarget->m_pCurGroundEntity)->GetIsATreadable() &&
((CTreadable*)pTarget->m_pCurGroundEntity)->m_nodeIndices[0][0] >= 0){ ((CTreadable*)pTarget->m_pCurGroundEntity)->m_nodeIndices[0][0] >= 0){
CTreadable* pCurrentMapObject = (CTreadable*)pTarget->m_pCurGroundEntity; CTreadable* pCurrentMapObject = (CTreadable*)pTarget->m_pCurGroundEntity;
@ -2674,7 +2674,7 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos)
spawnPos.z = groundZ + pVehicle->GetDistanceFromCentreOfMassToBaseOfModel(); spawnPos.z = groundZ + pVehicle->GetDistanceFromCentreOfMassToBaseOfModel();
pVehicle->GetPosition() = spawnPos; pVehicle->GetPosition() = spawnPos;
pVehicle->SetMoveSpeed(CVector(0.0f, 0.0f, 0.0f)); pVehicle->SetMoveSpeed(CVector(0.0f, 0.0f, 0.0f));
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
switch (mi){ switch (mi){
case MI_FIRETRUCK: case MI_FIRETRUCK:
pVehicle->bIsFireTruckOnDuty = true; pVehicle->bIsFireTruckOnDuty = true;

View File

@ -102,8 +102,8 @@ CGameLogic::Update()
if (pVehicle != nil) { if (pVehicle != nil) {
if (pVehicle->pDriver == pPlayerInfo.m_pPed) { if (pVehicle->pDriver == pPlayerInfo.m_pPed) {
pVehicle->pDriver = nil; pVehicle->pDriver = nil;
if (pVehicle->m_status != STATUS_WRECKED) if (pVehicle->GetStatus() != STATUS_WRECKED)
pVehicle->m_status = STATUS_ABANDONED; pVehicle->SetStatus(STATUS_ABANDONED);
} else } else
pVehicle->RemovePassenger(pPlayerInfo.m_pPed); pVehicle->RemovePassenger(pPlayerInfo.m_pPed);
} }
@ -172,8 +172,8 @@ CGameLogic::Update()
if (pVehicle != nil) { if (pVehicle != nil) {
if (pVehicle->pDriver == pPlayerInfo.m_pPed) { if (pVehicle->pDriver == pPlayerInfo.m_pPed) {
pVehicle->pDriver = nil; pVehicle->pDriver = nil;
if (pVehicle->m_status != STATUS_WRECKED) if (pVehicle->GetStatus() != STATUS_WRECKED)
pVehicle->m_status = STATUS_ABANDONED; pVehicle->SetStatus(STATUS_ABANDONED);
} }
else else
pVehicle->RemovePassenger(pPlayerInfo.m_pPed); pVehicle->RemovePassenger(pPlayerInfo.m_pPed);
@ -214,8 +214,8 @@ CGameLogic::Update()
if (pVehicle != nil) { if (pVehicle != nil) {
if (pVehicle->pDriver == pPlayerInfo.m_pPed) { if (pVehicle->pDriver == pPlayerInfo.m_pPed) {
pVehicle->pDriver = nil; pVehicle->pDriver = nil;
if (pVehicle->m_status != STATUS_WRECKED) if (pVehicle->GetStatus() != STATUS_WRECKED)
pVehicle->m_status = STATUS_ABANDONED; pVehicle->SetStatus(STATUS_ABANDONED);
} else } else
pVehicle->RemovePassenger(pPlayerInfo.m_pPed); pVehicle->RemovePassenger(pPlayerInfo.m_pPed);
} }

View File

@ -749,7 +749,7 @@ void CGarage::Update()
if (((CAutomobile*)(m_pTarget))->Damage.GetEngineStatus() <= ENGINE_STATUS_ON_FIRE && if (((CAutomobile*)(m_pTarget))->Damage.GetEngineStatus() <= ENGINE_STATUS_ON_FIRE &&
((CAutomobile*)(m_pTarget))->m_fFireBlowUpTimer == 0.0f) { ((CAutomobile*)(m_pTarget))->m_fFireBlowUpTimer == 0.0f) {
#endif #endif
if (m_pTarget->m_status != STATUS_WRECKED) { if (m_pTarget->GetStatus() != STATUS_WRECKED) {
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_GARAGE); CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_GARAGE);
FindPlayerPed()->m_pWanted->m_bIgnoredByCops = true; FindPlayerPed()->m_pWanted->m_bIgnoredByCops = true;
m_eGarageState = GS_CLOSING; m_eGarageState = GS_CLOSING;
@ -1855,7 +1855,7 @@ CVehicle* CStoredCar::RestoreCar()
CVehicle* pVehicle = new CAutomobile(m_nModelIndex, RANDOM_VEHICLE); CVehicle* pVehicle = new CAutomobile(m_nModelIndex, RANDOM_VEHICLE);
#endif #endif
pVehicle->GetPosition() = m_vecPos; pVehicle->GetPosition() = m_vecPos;
pVehicle->m_status = STATUS_ABANDONED; pVehicle->SetStatus(STATUS_ABANDONED);
pVehicle->GetForward() = m_vecAngle; pVehicle->GetForward() = m_vecAngle;
pVehicle->GetRight() = CVector(m_vecAngle.y, -m_vecAngle.x, 0.0f); pVehicle->GetRight() = CVector(m_vecAngle.y, -m_vecAngle.x, 0.0f);
pVehicle->GetUp() = CVector(0.0f, 0.0f, 1.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 && if (pVehicle->GetPosition().x > m_fX1 && pVehicle->GetPosition().x < m_fX2 &&
pVehicle->GetPosition().y > m_fY1 && pVehicle->GetPosition().y < m_fY2 && pVehicle->GetPosition().y > m_fY1 && pVehicle->GetPosition().y < m_fY2 &&
pVehicle->GetPosition().z > m_fZ1 && pVehicle->GetPosition().z < m_fZ2) { 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); CWorld::Remove(pVehicle);
delete pVehicle; delete pVehicle;
} }
@ -1990,7 +1990,7 @@ void CGarage::TidyUpGarageClose()
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
if (!pVehicle || !pVehicle->IsCar()) if (!pVehicle || !pVehicle->IsCar())
continue; continue;
if (!pVehicle->IsCar() || pVehicle->m_status != STATUS_WRECKED || !IsEntityTouching3D(pVehicle)) if (!pVehicle->IsCar() || pVehicle->GetStatus() != STATUS_WRECKED || !IsEntityTouching3D(pVehicle))
continue; continue;
bool bRemove = false; bool bRemove = false;
if (m_eGarageState != GS_FULLYCLOSED) { if (m_eGarageState != GS_FULLYCLOSED) {

View File

@ -286,7 +286,7 @@ void CRecordDataForChase::SaveOrRetrieveCarPositions(void)
} }
if (Status == STATE_PLAYBACK_BEFORE_RECORDING) { if (Status == STATE_PLAYBACK_BEFORE_RECORDING) {
Status = STATE_RECORD; Status = STATE_RECORD;
pChaseCars[CurrentCar]->m_status = STATUS_PLAYER; pChaseCars[CurrentCar]->SetStatus(STATUS_PLAYER);
} }
} }
break; break;
@ -408,7 +408,7 @@ void CRecordDataForChase::GiveUsACar(int32 mi, CVector pos, float angle, CAutomo
return; return;
CAutomobile* pCar = new CAutomobile(mi, MISSION_VEHICLE); CAutomobile* pCar = new CAutomobile(mi, MISSION_VEHICLE);
pCar->GetPosition() = pos; pCar->GetPosition() = pos;
pCar->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER; pCar->SetStatus(STATUS_PLAYER_PLAYBACKFROMBUFFER);
pCar->GetMatrix().SetRotateZOnly(DEGTORAD(angle)); pCar->GetMatrix().SetRotateZOnly(DEGTORAD(angle));
pCar->pDriver = nil; pCar->pDriver = nil;
pCar->m_currentColour1 = colour1; pCar->m_currentColour1 = colour1;
@ -517,7 +517,7 @@ CVehicle* CRecordDataForChase::TurnChaseCarIntoScriptCar(int32 i)
{ {
CVehicle* pVehicle = pChaseCars[i]; CVehicle* pVehicle = pChaseCars[i];
pChaseCars[i] = nil; pChaseCars[i] = nil;
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
return pVehicle; return pVehicle;
} }

View File

@ -19,7 +19,7 @@ CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uin
car->GetMatrix().SetRotateZOnly(rot); car->GetMatrix().SetRotateZOnly(rot);
car->GetPosition() = CVector(x, y, z); car->GetPosition() = CVector(x, y, z);
car->m_status = STATUS_PLAYER_REMOTE; car->SetStatus(STATUS_PLAYER_REMOTE);
car->bIsLocked = true; car->bIsLocked = true;
CCarCtrl::JoinCarWithRoadSystem(car); CCarCtrl::JoinCarWithRoadSystem(car);
@ -31,7 +31,7 @@ CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uin
car->bEngineOn = true; car->bEngineOn = true;
CWorld::Add(car); CWorld::Add(car);
if (FindPlayerVehicle() != nil) 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 = car;
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->RegisterReference((CEntity**)&CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle); CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->RegisterReference((CEntity**)&CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle);

View File

@ -850,7 +850,7 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
else{ else{
new_v = new(vp->index << 8) CAutomobile(mi, 2); 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()); vp->matrix.DecompressIntoFullMatrix(new_v->GetMatrix());
new_v->m_currentColour1 = vp->primary_color; new_v->m_currentColour1 = vp->primary_color;
new_v->m_currentColour2 = vp->secondary_color; new_v->m_currentColour2 = vp->secondary_color;
@ -870,7 +870,7 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
} }
else { else {
CPed* new_p = new(ph->index << 8) CCivilianPed((ePedType)ph->pedtype, ph->mi); 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(); new_p->GetMatrix().SetUnity();
CWorld::Add(new_p); CWorld::Add(new_p);
} }

View File

@ -156,7 +156,7 @@ CRoadBlocks::GenerateRoadBlocks(void)
CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false); CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false);
if (!colliding) { if (!colliding) {
CAutomobile *pVehicle = new CAutomobile(vehicleId, RANDOM_VEHICLE); CAutomobile *pVehicle = new CAutomobile(vehicleId, RANDOM_VEHICLE);
pVehicle->m_status = STATUS_ABANDONED; pVehicle->SetStatus(STATUS_ABANDONED);
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored? // pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
vehicleMatrix.GetPosition().z += fModelRadius - 0.6f; vehicleMatrix.GetPosition().z += fModelRadius - 0.6f;
pVehicle->m_matrix = vehicleMatrix; pVehicle->m_matrix = vehicleMatrix;

View File

@ -450,7 +450,7 @@ void CSceneEdit::ProcessCommand(void)
break; break;
} }
CVehicle* pVehicle = new CAutomobile(m_nVehiclemodelId, MISSION_VEHICLE); CVehicle* pVehicle = new CAutomobile(m_nVehiclemodelId, MISSION_VEHICLE);
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
pVehicle->GetPosition() = m_vecCurrentPosition; pVehicle->GetPosition() = m_vecCurrentPosition;
pVehicle->SetOrientation(0.0f, 0.0f, 0.0f); pVehicle->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(pVehicle); CWorld::Add(pVehicle);
@ -567,7 +567,7 @@ void CSceneEdit::ProcessCommand(void)
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT; pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
else else
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS; 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->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_nCruiseSpeed = Max(16, pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed);
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
@ -810,7 +810,7 @@ void CSceneEdit::PlayBack(void)
break; break;
} }
CVehicle* pVehicle = new CAutomobile(m_nVehiclemodelId, MISSION_VEHICLE); CVehicle* pVehicle = new CAutomobile(m_nVehiclemodelId, MISSION_VEHICLE);
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
pVehicle->GetPosition() = m_vecCurrentPosition; pVehicle->GetPosition() = m_vecCurrentPosition;
pVehicle->SetOrientation(0.0f, 0.0f, 0.0f); pVehicle->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(pVehicle); CWorld::Add(pVehicle);
@ -845,7 +845,7 @@ void CSceneEdit::PlayBack(void)
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT; pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
else else
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS; 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->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_nCruiseSpeed = Max(16, pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nCruiseSpeed);
pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); pActors[m_nActor]->m_pMyVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();

View File

@ -1737,7 +1737,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
if (ped->InVehicle()) { if (ped->InVehicle()) {
if (ped->m_pMyVehicle->pDriver == ped) { if (ped->m_pMyVehicle->pDriver == ped) {
ped->m_pMyVehicle->RemoveDriver(); 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) if (ped->m_pMyVehicle->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
ped->m_pMyVehicle->m_nDoorLock = CARLOCK_UNLOCKED; ped->m_pMyVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
if (ped->m_nPedType == PEDTYPE_COP && ped->m_pMyVehicle->IsLawEnforcementVehicle()) if (ped->m_nPedType == PEDTYPE_COP && ped->m_pMyVehicle->IsLawEnforcementVehicle())
@ -1933,7 +1933,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
pos.z += boat->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += boat->GetDistanceFromCentreOfMassToBaseOfModel();
boat->GetPosition() = pos; boat->GetPosition() = pos;
CTheScripts::ClearSpaceForMissionEntity(pos, boat); CTheScripts::ClearSpaceForMissionEntity(pos, boat);
boat->m_status = STATUS_ABANDONED; boat->SetStatus(STATUS_ABANDONED);
boat->bIsLocked = true; boat->bIsLocked = true;
boat->AutoPilot.m_nCarMission = MISSION_NONE; boat->AutoPilot.m_nCarMission = MISSION_NONE;
boat->AutoPilot.m_nTempAction = TEMPACT_NONE; /* Animation ID? */ boat->AutoPilot.m_nTempAction = TEMPACT_NONE; /* Animation ID? */
@ -1951,7 +1951,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
car->GetPosition() = pos; car->GetPosition() = pos;
CTheScripts::ClearSpaceForMissionEntity(pos, car); CTheScripts::ClearSpaceForMissionEntity(pos, car);
car->m_status = STATUS_ABANDONED; car->SetStatus(STATUS_ABANDONED);
car->bIsLocked = true; car->bIsLocked = true;
CCarCtrl::JoinCarWithRoadSystem(car); CCarCtrl::JoinCarWithRoadSystem(car);
car->AutoPilot.m_nCarMission = MISSION_NONE; car->AutoPilot.m_nCarMission = MISSION_NONE;
@ -1997,7 +1997,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT; car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
else else
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS; car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
car->m_status = STATUS_PHYSICS; car->SetStatus(STATUS_PHYSICS);
car->bEngineOn = true; car->bEngineOn = true;
car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6); car->AutoPilot.m_nCruiseSpeed = Max(car->AutoPilot.m_nCruiseSpeed, 6);
car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
@ -2087,7 +2087,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); 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; return 0;
} }
case COMMAND_SET_CAR_CRUISE_SPEED: case COMMAND_SET_CAR_CRUISE_SPEED:
@ -2626,7 +2626,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); 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; return 0;
} }
case COMMAND_SET_CHAR_THREAT_SEARCH: case COMMAND_SET_CHAR_THREAT_SEARCH:
@ -2753,7 +2753,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pPed->m_pMyVehicle = pVehicle; pPed->m_pMyVehicle = pVehicle;
pPed->m_pMyVehicle->RegisterReference((CEntity**)&pPed->m_pMyVehicle); pPed->m_pMyVehicle->RegisterReference((CEntity**)&pPed->m_pMyVehicle);
pPed->bInVehicle = true; pPed->bInVehicle = true;
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
if (!pVehicle->IsBoat()) if (!pVehicle->IsBoat())
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE; pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
pVehicle->bEngineOn = true; pVehicle->bEngineOn = true;
@ -2786,7 +2786,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pPlayer->m_pPed->bRenderPedInCar = true; pPlayer->m_pPed->bRenderPedInCar = true;
if (pPlayer->m_pPed->m_pMyVehicle->pDriver == pPlayer->m_pPed){ if (pPlayer->m_pPed->m_pMyVehicle->pDriver == pPlayer->m_pPed){
pPlayer->m_pPed->m_pMyVehicle->RemoveDriver(); 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->bEngineOn = false;
pPlayer->m_pPed->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0; pPlayer->m_pPed->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0;
}else{ }else{
@ -2878,7 +2878,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
float y1 = *(float*)&ScriptParams[2]; float y1 = *(float*)&ScriptParams[2];
float x2 = *(float*)&ScriptParams[3]; float x2 = *(float*)&ScriptParams[3];
float y2 = *(float*)&ScriptParams[4]; float y2 = *(float*)&ScriptParams[4];
UpdateCompareFlag(pVehicle->m_status == STATUS_WRECKED && UpdateCompareFlag(pVehicle->GetStatus() == STATUS_WRECKED &&
pVehicle->IsWithinArea(x1, y1, x2, y2)); pVehicle->IsWithinArea(x1, y1, x2, y2));
if (!ScriptParams[5]) if (!ScriptParams[5])
return 0; return 0;
@ -2898,7 +2898,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
float x2 = *(float*)&ScriptParams[4]; float x2 = *(float*)&ScriptParams[4];
float y2 = *(float*)&ScriptParams[5]; float y2 = *(float*)&ScriptParams[5];
float z2 = *(float*)&ScriptParams[6]; float z2 = *(float*)&ScriptParams[6];
UpdateCompareFlag(pVehicle->m_status == STATUS_WRECKED && UpdateCompareFlag(pVehicle->GetStatus() == STATUS_WRECKED &&
pVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2)); pVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
if (!ScriptParams[7]) if (!ScriptParams[7])
return 0; return 0;
@ -3947,7 +3947,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
pPed->m_pMyVehicle->RegisterReference((CEntity**)&pPed->m_pMyVehicle); pPed->m_pMyVehicle->RegisterReference((CEntity**)&pPed->m_pMyVehicle);
pPed->bInVehicle = true; pPed->bInVehicle = true;
pPed->SetPedState(PED_DRIVING); pPed->SetPedState(PED_DRIVING);
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
pPed->bUsesCollision = false; pPed->bUsesCollision = false;
#ifdef FIX_BUGS #ifdef FIX_BUGS
AnimationId anim = pVehicle->GetDriverAnim(); AnimationId anim = pVehicle->GetDriverAnim();
@ -5583,7 +5583,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTO_COORDS_STRAIGHT_ACCURATE; pVehicle->AutoPilot.m_nCarMission = MISSION_GOTO_COORDS_STRAIGHT_ACCURATE;
else else
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ACCURATE; pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ACCURATE;
pVehicle->m_status = STATUS_PHYSICS; pVehicle->SetStatus(STATUS_PHYSICS);
pVehicle->bEngineOn = true; pVehicle->bEngineOn = true;
pVehicle->AutoPilot.m_nCruiseSpeed = Max(6, pVehicle->AutoPilot.m_nCruiseSpeed); pVehicle->AutoPilot.m_nCruiseSpeed = Max(6, pVehicle->AutoPilot.m_nCruiseSpeed);
pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); 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); CWaterLevel::GetWaterLevel(pos.x, pos.y, pos.z, &pos.z, false);
pBoat->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ASTHECROWSWIMS; pBoat->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ASTHECROWSWIMS;
pBoat->AutoPilot.m_vecDestinationCoors = pos; 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_nCruiseSpeed = Max(6, pBoat->AutoPilot.m_nCruiseSpeed);
pBoat->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); pBoat->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
return 0; return 0;
@ -5712,7 +5712,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT);
CBoat* pBoat = (CBoat*)pVehicle; CBoat* pBoat = (CBoat*)pVehicle;
pBoat->AutoPilot.m_nCarMission = MISSION_NONE; pBoat->AutoPilot.m_nCarMission = MISSION_NONE;
pBoat->m_status = STATUS_PHYSICS; pBoat->SetStatus(STATUS_PHYSICS);
pBoat->bEngineOn = false; pBoat->bEngineOn = false;
pBoat->AutoPilot.m_nCruiseSpeed = 0; pBoat->AutoPilot.m_nCruiseSpeed = 0;
return 0; return 0;
@ -6911,7 +6911,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
if (pPed->m_pMyVehicle){ if (pPed->m_pMyVehicle){
if (pPed == pPed->m_pMyVehicle->pDriver){ if (pPed == pPed->m_pMyVehicle->pDriver){
pPed->m_pMyVehicle->RemoveDriver(); 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) if (pPed->m_pMyVehicle->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
pPed->m_pMyVehicle->m_nDoorLock = CARLOCK_UNLOCKED; pPed->m_pMyVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
if (pPed->m_nPedType == PEDTYPE_COP && pPed->m_pMyVehicle->IsLawEnforcementVehicle()) if (pPed->m_nPedType == PEDTYPE_COP && pPed->m_pMyVehicle->IsLawEnforcementVehicle())
@ -7108,7 +7108,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
pPed->bRenderPedInCar = true; pPed->bRenderPedInCar = true;
if (pPed->m_pMyVehicle->pDriver == pPed){ if (pPed->m_pMyVehicle->pDriver == pPed){
pPed->m_pMyVehicle->RemoveDriver(); 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->bEngineOn = false;
pPed->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0; pPed->m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0;
}else{ }else{
@ -7779,7 +7779,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); assert(pVehicle);
pVehicle->m_status = ScriptParams[1]; pVehicle->SetStatus((eEntityStatus)ScriptParams[1]);
return 0; return 0;
} }
case COMMAND_IS_CHAR_MALE: case COMMAND_IS_CHAR_MALE:
@ -8156,7 +8156,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
car->GetPosition() = pos; car->GetPosition() = pos;
car->SetHeading(DEGTORAD(*(float*)&ScriptParams[3])); car->SetHeading(DEGTORAD(*(float*)&ScriptParams[3]));
CTheScripts::ClearSpaceForMissionEntity(pos, car); CTheScripts::ClearSpaceForMissionEntity(pos, car);
car->m_status = STATUS_ABANDONED; car->SetStatus(STATUS_ABANDONED);
car->bIsLocked = true; car->bIsLocked = true;
car->bIsCarParkVehicle = true; car->bIsCarParkVehicle = true;
CCarCtrl::JoinCarWithRoadSystem(car); CCarCtrl::JoinCarWithRoadSystem(car);
@ -11229,7 +11229,7 @@ INITSAVEBUF
type = 0; type = 0;
handle = 0; handle = 0;
} else { } else {
switch (pEntity->m_type) { switch (pEntity->GetType()) {
case ENTITY_TYPE_BUILDING: case ENTITY_TYPE_BUILDING:
if (((CBuilding*)pEntity)->GetIsATreadable()) { if (((CBuilding*)pEntity)->GetIsATreadable()) {
type = 1; type = 1;
@ -11371,7 +11371,7 @@ void CTheScripts::ClearSpaceForMissionEntity(const CVector& pos, CEntity* pEntit
} }
if (cols <= 0) if (cols <= 0)
continue; continue;
switch (pFound->m_type) { switch (pFound->GetType()) {
case ENTITY_TYPE_VEHICLE: case ENTITY_TYPE_VEHICLE:
{ {
printf("Will try to delete a vehicle where a mission entity should be\n"); printf("Will try to delete a vehicle where a mission entity should be\n");

View File

@ -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; node = vehicle->AutoPilot.m_nPreviousPathNodeInfo;
type = ThePaths.m_carPathLinks[node].trafficLightType; type = ThePaths.m_carPathLinks[node].trafficLightType;
if(type){ if(type){

View File

@ -278,7 +278,7 @@ CAnimViewer::Update(void)
// } // }
} else { } else {
newEntity = pTarget = new CAutomobile(modelId, RANDOM_VEHICLE); newEntity = pTarget = new CAutomobile(modelId, RANDOM_VEHICLE);
newEntity->m_status = STATUS_ABANDONED; newEntity->SetStatus(STATUS_ABANDONED);
} }
newEntity->bIsStuck = true; newEntity->bIsStuck = true;
} else if (modelInfo->m_type == MITYPE_PED) { } else if (modelInfo->m_type == MITYPE_PED) {
@ -296,7 +296,7 @@ CAnimViewer::Update(void)
CWorld::Add(newEntity); CWorld::Add(newEntity);
TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT); 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); ((CPhysical*)pTarget)->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
} }
pTarget->GetPosition().z = 0.0f; pTarget->GetPosition().z = 0.0f;

View File

@ -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 ZmTwoAlphaOffsetLCS[] = { 0.1f, 0.08f, 0.3f, 0.08f, 0.08f };
static float ZmThreeAlphaOffsetLCS[] = { 0.065f, 0.05f, 0.15f, 0.06f, 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]; zoomModeAlphaOffset = ZmTwoAlphaOffsetLCS[alphaArrPos];
else { else {
switch ((int)TheCamera.CarZoomIndicator) { switch ((int)TheCamera.CarZoomIndicator) {
@ -4712,7 +4712,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
float minDistForThisCar = approxCarLength * CARCAM_SET[camSetArrPos][3]; 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]; float radiusToStayOutside = colMaxZ * CARCAM_SET[camSetArrPos][0] - CARCAM_SET[camSetArrPos][2];
if (radiusToStayOutside > 0.0f) { if (radiusToStayOutside > 0.0f) {
TargetCoors.z += radiusToStayOutside; TargetCoors.z += radiusToStayOutside;

View File

@ -107,7 +107,7 @@ void TankCheat()
tank->GetPosition() = pos; tank->GetPosition() = pos;
tank->SetOrientation(0.0f, 0.0f, DEGTORAD(200.0f)); tank->SetOrientation(0.0f, 0.0f, DEGTORAD(200.0f));
tank->m_status = STATUS_ABANDONED; tank->SetStatus(STATUS_ABANDONED);
tank->m_nDoorLock = CARLOCK_UNLOCKED; tank->m_nDoorLock = CARLOCK_UNLOCKED;
CWorld::Add(tank); CWorld::Add(tank);
} }

View File

@ -328,7 +328,7 @@ CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1,
continue; continue;
car->m_scanCode = CWorld::GetCurrentScanCode(); 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))) { && (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) {
CVector carCentre = car->GetBoundCentre(); CVector carCentre = car->GetBoundCentre();
@ -413,7 +413,7 @@ CPlayerInfo::Process(void)
// This condition will always return true, else block was probably WIP Miami code. // 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_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) { if (veh->m_vecMoveSpeed.Magnitude() < 0.17f && CTimer::GetTimeScale() >= 0.5f && !veh->bIsInWater) {
m_pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); m_pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh);
} }
@ -454,7 +454,7 @@ CPlayerInfo::Process(void)
weAreOnBoat = true; weAreOnBoat = true;
m_pPed->bOnBoat = true; m_pPed->bOnBoat = true;
#ifdef VC_PED_PORTS #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 #else
if (carBelow->m_status != STATUS_WRECKED) if (carBelow->m_status != STATUS_WRECKED)
#endif #endif
@ -491,7 +491,7 @@ CPlayerInfo::Process(void)
} }
// carBelow is now closest vehicle // carBelow is now closest vehicle
if (carBelow && !weAreOnBoat) { 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); m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow);
} else if (carBelow->IsBoat()) { } else if (carBelow->IsBoat()) {
if (!carBelow->pDriver) { if (!carBelow->pDriver) {
@ -526,7 +526,7 @@ CPlayerInfo::Process(void)
m_bInRemoteMode = false; m_bInRemoteMode = false;
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = nil; CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = nil;
if (FindPlayerVehicle()) { if (FindPlayerVehicle()) {
FindPlayerVehicle()->m_status = STATUS_PLAYER; FindPlayerVehicle()->SetStatus(STATUS_PLAYER);
} }
} }
} }

View File

@ -161,8 +161,8 @@ INITSAVEBUF
pVehicle->m_nTimeOfDeath = pBufferVehicle->m_nTimeOfDeath; pVehicle->m_nTimeOfDeath = pBufferVehicle->m_nTimeOfDeath;
#endif #endif
pVehicle->m_nDoorLock = pBufferVehicle->m_nDoorLock; pVehicle->m_nDoorLock = pBufferVehicle->m_nDoorLock;
pVehicle->m_status = pBufferVehicle->m_status; pVehicle->SetStatus(pBufferVehicle->GetStatus());
pVehicle->m_type = pBufferVehicle->m_type; pVehicle->SetType(pBufferVehicle->GetType());
(pVehicle->GetAddressOfEntityProperties())[0] = (pBufferVehicle->GetAddressOfEntityProperties())[0]; (pVehicle->GetAddressOfEntityProperties())[0] = (pBufferVehicle->GetAddressOfEntityProperties())[0];
(pVehicle->GetAddressOfEntityProperties())[1] = (pBufferVehicle->GetAddressOfEntityProperties())[1]; (pVehicle->GetAddressOfEntityProperties())[1] = (pBufferVehicle->GetAddressOfEntityProperties())[1];
pVehicle->AutoPilot = pBufferVehicle->AutoPilot; pVehicle->AutoPilot = pBufferVehicle->AutoPilot;

View File

@ -352,7 +352,7 @@ CWanted::WorkOutPolicePresence(CVector posn, float radius)
vehicle->bIsLawEnforcer && vehicle->bIsLawEnforcer &&
IsPoliceVehicleModel(vehicle->GetModelIndex()) && IsPoliceVehicleModel(vehicle->GetModelIndex()) &&
vehicle != FindPlayerVehicle() && 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) (posn - vehicle->GetPosition()).Magnitude() < radius)
numPolice++; numPolice++;
} }

View File

@ -1867,7 +1867,7 @@ CWorld::SetCarsOnFire(float x, float y, float z, float radius, CEntity *reason)
int poolSize = CPools::GetVehiclePool()->GetSize(); int poolSize = CPools::GetVehiclePool()->GetSize();
for(int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) { for(int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) {
CVehicle *veh = CPools::GetVehiclePool()->GetSlot(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 && if(Abs(veh->GetPosition().z - z) < 5.0f && Abs(veh->GetPosition().x - x) < radius &&
Abs(veh->GetPosition().y - y) < radius) Abs(veh->GetPosition().y - y) < radius)
gFireManager.StartFire(veh, reason, 0.8f, true); gFireManager.StartFire(veh, reason, 0.8f, true);
@ -1928,7 +1928,7 @@ CWorld::Process(void)
if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP && if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP &&
RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) { RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) {
RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), RpAnimBlendClumpUpdateAnimations(csObj->GetClump(),
0.02f * (csObj->m_type == ENTITY_TYPE_OBJECT 0.02f * (csObj->IsObject()
? CTimer::GetTimeStepNonClipped() ? CTimer::GetTimeStepNonClipped()
: CTimer::GetTimeStep())); : CTimer::GetTimeStep()));
} }
@ -1946,7 +1946,7 @@ CWorld::Process(void)
if(movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP && if(movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP &&
RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) { RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(),
0.02f * (movingEnt->m_type == ENTITY_TYPE_OBJECT 0.02f * (movingEnt->IsObject()
? CTimer::GetTimeStepNonClipped() ? CTimer::GetTimeStepNonClipped()
: CTimer::GetTimeStep())); : CTimer::GetTimeStep()));
} }
@ -2030,7 +2030,7 @@ CWorld::Process(void)
movingEnt->UpdateRwFrame(); movingEnt->UpdateRwFrame();
if(!movingEnt->bIsInSafePosition) { if(!movingEnt->bIsInSafePosition) {
movingEnt->bIsStuck = true; movingEnt->bIsStuck = true;
if(movingEnt->m_status == STATUS_PLAYER) { if(movingEnt->GetStatus() == STATUS_PLAYER) {
printf("STUCK: Final Step: Player Entity %d Is Stuck\n", printf("STUCK: Final Step: Player Entity %d Is Stuck\n",
movingEnt->m_modelIndex); movingEnt->m_modelIndex);
movingEnt->m_vecMoveSpeed *= 0.3f; 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, pEntity->ApplyTurnForce(vecForceDir.x, vecForceDir.y, vecForceDir.z,
0.0f, 0.0f, fPointZ); 0.0f, 0.0f, fPointZ);
} }
switch(pEntity->m_type) { switch(pEntity->GetType()) {
case ENTITY_TYPE_VEHICLE: case ENTITY_TYPE_VEHICLE:
if(pEntity->m_status == STATUS_SIMPLE) { if(pEntity->GetStatus() == STATUS_SIMPLE) {
pEntity->m_status = STATUS_PHYSICS; pEntity->SetStatus(STATUS_PHYSICS);
CCarCtrl::SwitchVehicleToRealPhysics(pVehicle); CCarCtrl::SwitchVehicleToRealPhysics(pVehicle);
} }
pVehicle->InflictDamage(pCreator, WEAPONTYPE_EXPLOSION, pVehicle->InflictDamage(pCreator, WEAPONTYPE_EXPLOSION,

View File

@ -121,7 +121,7 @@ SpawnCar(int id)
v->GetPosition().z += 4.0f; v->GetPosition().z += 4.0f;
v->SetOrientation(0.0f, 0.0f, 3.49f); v->SetOrientation(0.0f, 0.0f, 3.49f);
v->m_status = STATUS_ABANDONED; v->SetStatus(STATUS_ABANDONED);
v->m_nDoorLock = CARLOCK_UNLOCKED; v->m_nDoorLock = CARLOCK_UNLOCKED;
CWorld::Add(v); CWorld::Add(v);
} }

View File

@ -6,7 +6,7 @@
struct CReference; struct CReference;
class CPtrList; class CPtrList;
enum eEntityType enum eEntityType : uint8
{ {
ENTITY_TYPE_NOTHING = 0, ENTITY_TYPE_NOTHING = 0,
ENTITY_TYPE_BUILDING, ENTITY_TYPE_BUILDING,
@ -16,7 +16,7 @@ enum eEntityType
ENTITY_TYPE_DUMMY, ENTITY_TYPE_DUMMY,
}; };
enum eEntityStatus enum eEntityStatus : uint8
{ {
STATUS_PLAYER, STATUS_PLAYER,
STATUS_PLAYER_PLAYBACKFROMBUFFER, STATUS_PLAYER_PLAYBACKFROMBUFFER,
@ -36,9 +36,11 @@ class CEntity : public CPlaceable
{ {
public: public:
RwObject *m_rwObject; RwObject *m_rwObject;
protected:
uint32 m_type : 3; uint32 m_type : 3;
private:
uint32 m_status : 5; uint32 m_status : 5;
public:
// flagsA // flagsA
uint32 bUsesCollision : 1; // does entity use collision uint32 bUsesCollision : 1; // does entity use collision
uint32 bCollisionProcessed : 1; // has object been processed by a ProcessEntityCollision function uint32 bCollisionProcessed : 1; // has object been processed by a ProcessEntityCollision function
@ -90,6 +92,11 @@ public:
uint16 m_level; // int16 uint16 m_level; // int16
CReference *m_pFirstReference; 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(); } CColModel *GetColModel(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); }
uint32* GetAddressOfEntityProperties() { /* AWFUL */ return (uint32*)((char*)&m_rwObject + sizeof(m_rwObject)); } uint32* GetAddressOfEntityProperties() { /* AWFUL */ return (uint32*)((char*)&m_rwObject + sizeof(m_rwObject)); }

View File

@ -350,7 +350,7 @@ CPhysical::ProcessControl(void)
bWasPostponed = false; bWasPostponed = false;
bHasHitWall = false; bHasHitWall = false;
if(m_status == STATUS_SIMPLE) if(GetStatus() == STATUS_SIMPLE)
return; return;
m_nCollisionRecords = 0; m_nCollisionRecords = 0;
@ -538,7 +538,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
float timestepB; float timestepB;
if(A->bPedPhysics){ if(A->bPedPhysics){
if(A->IsPed() && ((CPed*)A)->IsPlayer() && B->IsVehicle() && 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; timestepB = 2200.0f / B->m_fMass;
else else
timestepB = 10.0f; timestepB = 10.0f;
@ -757,7 +757,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
fA.y *= 1.4f; fA.y *= 1.4f;
if(colpoint.normal.z < 0.7f) if(colpoint.normal.z < 0.7f)
fA.z *= 0.3f; fA.z *= 0.3f;
if(A->m_status == STATUS_PLAYER) if(A->GetStatus() == STATUS_PLAYER)
pointposA *= 0.8f; pointposA *= 0.8f;
if(CWorld::bNoMoreCollisionTorque){ if(CWorld::bNoMoreCollisionTorque){
A->ApplyFrictionMoveForce(fA*-0.3f); A->ApplyFrictionMoveForce(fA*-0.3f);
@ -769,7 +769,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
fB.y *= 1.4f; fB.y *= 1.4f;
if(colpoint.normal.z < 0.7f) if(colpoint.normal.z < 0.7f)
fB.z *= 0.3f; fB.z *= 0.3f;
if(B->m_status == STATUS_PLAYER) if(B->GetStatus() == STATUS_PLAYER)
pointposB *= 0.8f; pointposB *= 0.8f;
if(CWorld::bNoMoreCollisionTorque){ if(CWorld::bNoMoreCollisionTorque){
// BUG: the game actually uses A here, but this can't be right // 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){ if(normalSpeed < 0.0f){
float minspeed = 0.0104f * CTimer::GetTimeStep(); float minspeed = 0.0104f * CTimer::GetTimeStep();
#ifdef GTA3_1_1_PATCH #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 #else
if((IsObject() || IsVehicle() && GetUp().z < -0.3f) && if((IsObject() || IsVehicle() && GetUp().z < -0.3f) &&
#endif #endif
@ -1341,8 +1341,8 @@ collision:
} }
} }
if(B->m_status == STATUS_SIMPLE){ if(B->GetStatus() == STATUS_SIMPLE){
B->m_status = STATUS_PHYSICS; B->SetStatus(STATUS_PHYSICS);
if(B->IsVehicle()) if(B->IsVehicle())
CCarCtrl::SwitchVehicleToRealPhysics((CVehicle*)B); CCarCtrl::SwitchVehicleToRealPhysics((CVehicle*)B);
} }
@ -1544,7 +1544,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
}else }else
adhesion = 0.0f; adhesion = 0.0f;
}else if(A->IsVehicle()){ }else if(A->IsVehicle()){
if(A->m_status == STATUS_WRECKED) if(A->GetStatus() == STATUS_WRECKED)
adhesion *= 3.0f; adhesion *= 3.0f;
else if(A->GetUp().z > 0.3f) else if(A->GetUp().z > 0.3f)
adhesion = 0.0f; adhesion = 0.0f;
@ -1561,7 +1561,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
m_vecMoveSpeed += moveSpeed / numResponses; m_vecMoveSpeed += moveSpeed / numResponses;
m_vecTurnSpeed += turnSpeed / numResponses; m_vecTurnSpeed += turnSpeed / numResponses;
if(!CWorld::bNoMoreCollisionTorque && 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.x) > 0.2f &&
Abs(A->m_vecMoveSpeed.y) > 0.2f){ Abs(A->m_vecMoveSpeed.y) > 0.2f){
A->m_vecMoveFriction.x += moveSpeed.x * -0.3f / numCollisions; A->m_vecMoveFriction.x += moveSpeed.x * -0.3f / numCollisions;
@ -1713,8 +1713,8 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
Aobj->ObjectDamage(maxImpulseB); Aobj->ObjectDamage(maxImpulseB);
} }
if(B->m_status == STATUS_SIMPLE){ if(B->GetStatus() == STATUS_SIMPLE){
B->m_status = STATUS_PHYSICS; B->SetStatus(STATUS_PHYSICS);
if(B->IsVehicle()) if(B->IsVehicle())
CCarCtrl::SwitchVehicleToRealPhysics((CVehicle*)B); CCarCtrl::SwitchVehicleToRealPhysics((CVehicle*)B);
} }
@ -1758,7 +1758,7 @@ void
CPhysical::ProcessShift(void) CPhysical::ProcessShift(void)
{ {
m_fDistanceTravelled = 0.0f; m_fDistanceTravelled = 0.0f;
if(m_status == STATUS_SIMPLE){ if(GetStatus() == STATUS_SIMPLE){
bIsStuck = false; bIsStuck = false;
bIsInSafePosition = true; bIsInSafePosition = true;
RemoveAndAdd(); RemoveAndAdd();
@ -1813,9 +1813,9 @@ CPhysical::ProcessCollision(void)
return; return;
} }
if(m_status == STATUS_SIMPLE){ if(GetStatus() == STATUS_SIMPLE){
if(CheckCollision_SimpleCar() && m_status == STATUS_SIMPLE){ if(CheckCollision_SimpleCar() && GetStatus() == STATUS_SIMPLE){
m_status = STATUS_PHYSICS; SetStatus(STATUS_PHYSICS);
if(IsVehicle()) if(IsVehicle())
CCarCtrl::SwitchVehicleToRealPhysics((CVehicle*)this); CCarCtrl::SwitchVehicleToRealPhysics((CVehicle*)this);
} }
@ -1840,7 +1840,7 @@ CPhysical::ProcessCollision(void)
n = NUMSTEPS(0.3f); n = NUMSTEPS(0.3f);
step = savedTimeStep / n; step = savedTimeStep / n;
}else if(IsVehicle() && distSq >= sq(0.4f)){ }else if(IsVehicle() && distSq >= sq(0.4f)){
if(m_status == STATUS_PLAYER) if(GetStatus() == STATUS_PLAYER)
n = NUMSTEPS(0.2f); n = NUMSTEPS(0.2f);
else else
n = distSq > 0.32f ? NUMSTEPS(0.3f) : NUMSTEPS(0.4f); n = distSq > 0.32f ? NUMSTEPS(0.3f) : NUMSTEPS(0.4f);
@ -1921,7 +1921,7 @@ CPhysical::ProcessCollision(void)
if(!m_vecMoveSpeed.IsZero() || if(!m_vecMoveSpeed.IsZero() ||
!m_vecTurnSpeed.IsZero() || !m_vecTurnSpeed.IsZero() ||
bHitByTrain || bHitByTrain ||
m_status == STATUS_PLAYER || IsPed() && ped->IsPlayer()){ GetStatus() == STATUS_PLAYER || IsPed() && ped->IsPlayer()){
if(IsVehicle()) if(IsVehicle())
((CVehicle*)this)->bVehicleColProcessed = true; ((CVehicle*)this)->bVehicleColProcessed = true;
if(CheckCollision()){ if(CheckCollision()){

View File

@ -15,7 +15,7 @@
CCutsceneObject::CCutsceneObject(void) CCutsceneObject::CCutsceneObject(void)
{ {
m_status = STATUS_SIMPLE; SetStatus(STATUS_SIMPLE);
bUsesCollision = false; bUsesCollision = false;
bStreamingDontDelete = true; bStreamingDontDelete = true;
ObjectCreatedBy = CUTSCENE_OBJECT; ObjectCreatedBy = CUTSCENE_OBJECT;

View File

@ -309,7 +309,7 @@ CObject::RefModelInfo(int32 modelId)
void void
CObject::Init(void) CObject::Init(void)
{ {
m_type = ENTITY_TYPE_OBJECT;; m_type = ENTITY_TYPE_OBJECT;
CObjectData::SetObjectData(m_modelIndex, *this); CObjectData::SetObjectData(m_modelIndex, *this);
m_nEndOfLifeTime = 0; m_nEndOfLifeTime = 0;
ObjectCreatedBy = GAME_OBJECT; ObjectCreatedBy = GAME_OBJECT;

View File

@ -132,7 +132,7 @@ CCopPed::SetArrestPlayer(CPed *player)
player->m_pMyVehicle->m_nNumGettingIn = 0; player->m_pMyVehicle->m_nNumGettingIn = 0;
player->m_pMyVehicle->m_nGettingInFlags = 0; player->m_pMyVehicle->m_nGettingInFlags = 0;
player->m_pMyVehicle->bIsHandbrakeOn = true; 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) if (GetWeapon()->m_eWeaponType == WEAPONTYPE_UNARMED)
SetCurrentWeapon(WEAPONTYPE_COLT45); SetCurrentWeapon(WEAPONTYPE_COLT45);

View File

@ -414,8 +414,8 @@ CPed::FlagToDestroyWhenNextProcessed(void)
return; return;
if (m_pMyVehicle->pDriver == this){ if (m_pMyVehicle->pDriver == this){
m_pMyVehicle->pDriver = nil; m_pMyVehicle->pDriver = nil;
if (IsPlayer() && m_pMyVehicle->m_status != STATUS_WRECKED) if (IsPlayer() && m_pMyVehicle->GetStatus() != STATUS_WRECKED)
m_pMyVehicle->m_status = STATUS_ABANDONED; m_pMyVehicle->SetStatus(STATUS_ABANDONED);
}else{ }else{
m_pMyVehicle->RemovePassenger(this); m_pMyVehicle->RemovePassenger(this);
} }
@ -2919,7 +2919,7 @@ CPed::SetObjective(eObjective newObj, void *entity)
if (newObj == OBJECTIVE_SOLICIT) { if (newObj == OBJECTIVE_SOLICIT) {
m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 10000; m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 10000;
} else if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == MISSION_CHAR && } 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); SetObjectiveTimer(14000);
} else { } else {
m_objectiveTimer = 0; 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)) { && (m_pMyVehicle->pDriver == this || m_pMyVehicle->pDriver && m_pMyVehicle->pDriver->m_nPedState == PED_DRIVING)) {
if (m_pMyVehicle->VehicleCreatedBy == RANDOM_VEHICLE 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) { && m_pMyVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE) {
CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle); CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle);
m_pMyVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; 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->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 } else
#endif #endif
@ -4136,8 +4136,8 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
if (m_pMyVehicle) { if (m_pMyVehicle) {
if (m_pMyVehicle->IsCar() && m_pMyVehicle->pDriver == this) { if (m_pMyVehicle->IsCar() && m_pMyVehicle->pDriver == this) {
if (m_pMyVehicle->m_status == STATUS_SIMPLE) { if (m_pMyVehicle->GetStatus() == STATUS_SIMPLE) {
m_pMyVehicle->m_status = STATUS_PHYSICS; m_pMyVehicle->SetStatus(STATUS_PHYSICS);
CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle); CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle);
} }
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE; m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
@ -4151,7 +4151,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
m_fHealth = 0.0f; m_fHealth = 0.0f;
if (m_pMyVehicle && m_pMyVehicle->pDriver == this) { if (m_pMyVehicle && m_pMyVehicle->pDriver == this) {
SetRadioStation(); SetRadioStation();
m_pMyVehicle->m_status = STATUS_ABANDONED; m_pMyVehicle->SetStatus(STATUS_ABANDONED);
} }
SetDie(dieAnim, dieDelta, dieSpeed); SetDie(dieAnim, dieDelta, dieSpeed);
/* /*
@ -4183,7 +4183,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
} }
m_fHealth = 0.0f; m_fHealth = 0.0f;
if (player == this) if (player == this)
m_pMyVehicle->m_status = STATUS_PLAYER_DISABLED; m_pMyVehicle->SetStatus(STATUS_PLAYER_DISABLED);
SetDie(NUM_ANIMS, 4.0f, 0.0f); SetDie(NUM_ANIMS, 4.0f, 0.0f);
return true; return true;
@ -6013,9 +6013,9 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack)
m_vehEnterType = vehEnterType; m_vehEnterType = vehEnterType;
if (m_vehEnterType == CAR_DOOR_LF) { if (m_vehEnterType == CAR_DOOR_LF) {
if (veh->pDriver && veh->pDriver->IsPlayer()) if (veh->pDriver && veh->pDriver->IsPlayer())
veh->m_status = STATUS_PLAYER_DISABLED; veh->SetStatus(STATUS_PLAYER_DISABLED);
else else
veh->m_status = STATUS_ABANDONED; veh->SetStatus(STATUS_ABANDONED);
} }
RemoveInCarAnims(); RemoveInCarAnims();
SetMoveState(PEDMOVE_NONE); SetMoveState(PEDMOVE_NONE);
@ -8584,7 +8584,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
eWeaponType killMethod; eWeaponType killMethod;
if (m_nPedState == PED_FALL || m_nPedState == PED_DIE) { 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; this->m_pCollidingEntity = car;
return; return;
} }
@ -9544,7 +9544,7 @@ CPed::ProcessControl(void)
#else #else
} else if (collidingEnt) { } else if (collidingEnt) {
#endif #endif
switch (collidingEnt->m_type) switch (collidingEnt->GetType())
{ {
case ENTITY_TYPE_BUILDING: case ENTITY_TYPE_BUILDING:
case ENTITY_TYPE_OBJECT: case ENTITY_TYPE_OBJECT:
@ -9773,7 +9773,7 @@ CPed::ProcessControl(void)
if (collidingVeh != m_pCurrentPhysSurface || IsPlayer()) { if (collidingVeh != m_pCurrentPhysSurface || IsPlayer()) {
if (!bVehEnterDoorIsBlocked) { 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. // VC calls SetDirectionToWalkAroundVehicle instead if ped is in PED_SEEK_CAR.
SetDirectionToWalkAroundObject(collidingVeh); SetDirectionToWalkAroundObject(collidingVeh);
@ -10126,7 +10126,7 @@ CPed::ProcessControl(void)
if ((m_nPedStateTimer <= 50.0f / (4.0f * adjustedTs) || m_nPedStateTimer * 0.01f <= forceDir.MagnitudeSqr()) 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))) { && (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)) { && m_nPedStateTimer > 50.0f / (2.0f * adjustedTs) && m_nPedStateTimer * 1.0f / 250.0f > Abs(forceDir.z)) {
offsetToCheck.x = -forceDir.y; offsetToCheck.x = -forceDir.y;
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
@ -10994,7 +10994,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
} else if (ped->m_nPedType == PEDTYPE_COP) { } else if (ped->m_nPedType == PEDTYPE_COP) {
ped->QuitEnteringCar(); ped->QuitEnteringCar();
if (ped->m_pedInObjective && ped->m_pedInObjective->m_nPedState == PED_DRIVING) { 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); ((CCopPed*)ped)->SetArrestPlayer(ped->m_pedInObjective);
} else if (!veh->IsDoorMissing(DOOR_FRONT_RIGHT)) { } else if (!veh->IsDoorMissing(DOOR_FRONT_RIGHT)) {
((CAutomobile*)veh)->Damage.SetDoorStatus(DOOR_FRONT_RIGHT, DOOR_STATUS_SWINGING); ((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_nNumGettingIn = 0;
veh->m_nGettingInFlags = 0; veh->m_nGettingInFlags = 0;
veh->bIsHandbrakeOn = true; veh->bIsHandbrakeOn = true;
veh->m_status = STATUS_PLAYER_DISABLED; veh->SetStatus(STATUS_PLAYER_DISABLED);
} }
return; return;
} }
@ -11190,7 +11190,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
driver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); driver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh);
if (driver->IsPlayer()) { if (driver->IsPlayer()) {
veh->bIsHandbrakeOn = true; veh->bIsHandbrakeOn = true;
veh->m_status = STATUS_PLAYER_DISABLED; veh->SetStatus(STATUS_PLAYER_DISABLED);
} }
driver->bBusJacked = true; driver->bBusJacked = true;
veh->bIsBeingCarJacked = false; veh->bIsBeingCarJacked = false;
@ -11704,11 +11704,11 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
#if defined(FIX_BUGS) || defined(VC_PED_PORTS) #if defined(FIX_BUGS) || defined(VC_PED_PORTS)
CCarCtrl::RegisterVehicleOfInterest(veh); CCarCtrl::RegisterVehicleOfInterest(veh);
#endif #endif
if (veh->m_status == STATUS_SIMPLE) { if (veh->GetStatus() == STATUS_SIMPLE) {
veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.00001f); veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.00001f);
veh->m_vecTurnSpeed = 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(); AudioManager.PlayerJustGotInCar();
} }
veh->SetDriver(ped); veh->SetDriver(ped);
@ -11729,19 +11729,19 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (ped->IsPlayer()) { if (ped->IsPlayer()) {
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) { 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_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
veh->m_vecTurnSpeed = 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(); AudioManager.PlayerJustGotInCar();
} else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) { } 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_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
veh->m_vecTurnSpeed = 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) { if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) {
@ -11998,7 +11998,7 @@ CPed::RegisterThreatWithGangPeds(CEntity *attacker)
if (nearVeh->IsVehicleNormal() && nearVeh->IsCar()) { if (nearVeh->IsVehicleNormal() && nearVeh->IsCar()) {
nearVeh->AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * nearVeh->pHandling->Transmission.fUnkMaxVelocity * 0.8f; nearVeh->AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * nearVeh->pHandling->Transmission.fUnkMaxVelocity * 0.8f;
nearVeh->AutoPilot.m_nCarMission = MISSION_RAMPLAYER_FARAWAY; 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_nTempAction = TEMPACT_NONE;
nearVeh->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; nearVeh->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
} }
@ -12205,7 +12205,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType); veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType);
if (veh->pDriver == ped) { if (veh->pDriver == ped) {
veh->RemoveDriver(); veh->RemoveDriver();
veh->m_status = STATUS_ABANDONED; veh->SetStatus(STATUS_ABANDONED);
if (veh->m_nDoorLock == CARLOCK_LOCKED_INITIALLY) if (veh->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
veh->m_nDoorLock = CARLOCK_UNLOCKED; veh->m_nDoorLock = CARLOCK_UNLOCKED;
if (ped->m_nPedType == PEDTYPE_COP && veh->IsLawEnforcementVehicle()) if (ped->m_nPedType == PEDTYPE_COP && veh->IsLawEnforcementVehicle())
@ -12846,7 +12846,7 @@ CPed::ProcessObjective(void)
|| m_pMyVehicle->m_vecMoveSpeed.MagnitudeSqr() >= sq(0.02f)) { || m_pMyVehicle->m_vecMoveSpeed.MagnitudeSqr() >= sq(0.02f)) {
if (m_pMyVehicle->pDriver == this if (m_pMyVehicle->pDriver == this
&& !m_pMyVehicle->m_nGettingInFlags) { && !m_pMyVehicle->m_nGettingInFlags) {
m_pMyVehicle->m_status = STATUS_PHYSICS; m_pMyVehicle->SetStatus(STATUS_PHYSICS);
m_pMyVehicle->AutoPilot.m_nPrevRouteNode = 0; m_pMyVehicle->AutoPilot.m_nPrevRouteNode = 0;
if (m_nPedType == PEDTYPE_COP) { 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); 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() = ThePaths.m_pathNodes[closestNode].pos;
newVeh->GetPosition().z += 4.0f; newVeh->GetPosition().z += 4.0f;
newVeh->SetHeading(DEGTORAD(200.0f)); newVeh->SetHeading(DEGTORAD(200.0f));
newVeh->m_status = STATUS_ABANDONED; newVeh->SetStatus(STATUS_ABANDONED);
newVeh->m_nDoorLock = CARLOCK_UNLOCKED; newVeh->m_nDoorLock = CARLOCK_UNLOCKED;
CWorld::Add(newVeh); CWorld::Add(newVeh);
m_pMyVehicle = newVeh; m_pMyVehicle = newVeh;
@ -13017,7 +13017,7 @@ CPed::ProcessObjective(void)
float distWithTargetSc = distWithTarget.Magnitude(); float distWithTargetSc = distWithTarget.Magnitude();
if (m_pedInObjective->bInVehicle && m_pedInObjective->m_nPedState != PED_DRAG_FROM_CAR) { if (m_pedInObjective->bInVehicle && m_pedInObjective->m_nPedState != PED_DRAG_FROM_CAR) {
CVehicle *vehOfTarget = m_pedInObjective->m_pMyVehicle; 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()) { || m_pedInObjective->IsPlayer() && CPad::GetPad(0)->ArePlayerControlsDisabled()) {
SetIdle(); SetIdle();
return; return;
@ -14033,7 +14033,7 @@ CPed::SetSeekBoatPosition(CVehicle *boat)
void void
CPed::SetExitTrain(CVehicle* train) 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; return;
/* /*
@ -15137,7 +15137,7 @@ CPed::SetRadioStation(void)
inline bool inline bool
CPed::IsNotInWreckedVehicle() CPed::IsNotInWreckedVehicle()
{ {
return m_pMyVehicle != nil && m_pMyVehicle->m_status != STATUS_WRECKED; return m_pMyVehicle != nil && m_pMyVehicle->GetStatus() != STATUS_WRECKED;
} }
void void
@ -15759,9 +15759,9 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
SetRadioStation(); SetRadioStation();
if (veh->pDriver == this) { if (veh->pDriver == this) {
if (IsPlayer()) if (IsPlayer())
veh->m_status = STATUS_PLAYER_DISABLED; veh->SetStatus(STATUS_PLAYER_DISABLED);
else else
veh->m_status = STATUS_ABANDONED; veh->SetStatus(STATUS_ABANDONED);
} }
} }
} }
@ -15916,7 +15916,7 @@ CPed::ScanForInterestingStuff(void)
CVehicle* veh = (CVehicle*)vehicles[i]; CVehicle* veh = (CVehicle*)vehicles[i];
if (veh->m_modelIndex == MI_MRWHOOP) { 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) { if ((GetPosition() - veh->GetPosition()).Magnitude() < 5.0f) {
SetObjective(OBJECTIVE_BUY_ICE_CREAM, veh); SetObjective(OBJECTIVE_BUY_ICE_CREAM, veh);
return; return;
@ -16136,7 +16136,7 @@ CPed::SeekCar(void)
GetNearestDoor(vehToSeek, dest); GetNearestDoor(vehToSeek, dest);
} else { } else {
if (vehToSeek->IsTrain()) { if (vehToSeek->IsTrain()) {
if (vehToSeek->m_status != STATUS_TRAIN_NOT_MOVING) { if (vehToSeek->GetStatus() != STATUS_TRAIN_NOT_MOVING) {
RestorePreviousObjective(); RestorePreviousObjective();
RestorePreviousState(); RestorePreviousState();
return; return;
@ -16222,7 +16222,7 @@ CPed::SeekCar(void)
} else if (vehToSeek->m_nNumGettingIn < vehToSeek->m_nNumMaxPassengers + 1 } else if (vehToSeek->m_nNumGettingIn < vehToSeek->m_nNumMaxPassengers + 1
&& vehToSeek->CanPedEnterCar()) { && vehToSeek->CanPedEnterCar()) {
switch (vehToSeek->m_status) { switch (vehToSeek->GetStatus()) {
case STATUS_PLAYER: case STATUS_PLAYER:
case STATUS_SIMPLE: case STATUS_SIMPLE:
case STATUS_PHYSICS: case STATUS_PHYSICS:
@ -16994,11 +16994,11 @@ CPed::WarpPedIntoCar(CVehicle *car)
return; return;
if (IsPlayer()) { if (IsPlayer()) {
car->m_status = STATUS_PLAYER; car->SetStatus(STATUS_PLAYER);
AudioManager.PlayerJustGotInCar(); AudioManager.PlayerJustGotInCar();
CCarCtrl::RegisterVehicleOfInterest(car); CCarCtrl::RegisterVehicleOfInterest(car);
} else { } else {
car->m_status = STATUS_PHYSICS; car->SetStatus(STATUS_PHYSICS);
} }
CWorld::Remove(this); CWorld::Remove(this);

View File

@ -771,7 +771,7 @@ CPlayerPed::KeepAreaAroundPlayerClear(void)
for (int i = 0; i < lastVehicle; i++) { for (int i = 0; i < lastVehicle; i++) {
CVehicle *veh = (CVehicle*)vehicles[i]; CVehicle *veh = (CVehicle*)vehicles[i];
if (veh->VehicleCreatedBy != MISSION_VEHICLE) { 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) { if ((veh->GetPosition() - playerPos).MagnitudeSqr() > 25.0f) {
veh->AutoPilot.m_nTempAction = TEMPACT_WAIT; veh->AutoPilot.m_nTempAction = TEMPACT_WAIT;
veh->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 5000; veh->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 5000;

View File

@ -869,8 +869,8 @@ CPopulation::MoveCarsAndPedsOutOfAbandonedZones()
CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex); CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
if (veh && veh->m_nZoneLevel == LEVEL_NONE && veh->IsCar()) { 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 && if(veh->GetStatus() != STATUS_ABANDONED && veh->GetStatus() != STATUS_WRECKED && veh->GetStatus() != STATUS_PLAYER &&
veh->m_status != STATUS_PLAYER_REMOTE) { veh->GetStatus() != STATUS_PLAYER_REMOTE) {
CVector vehPos(veh->GetPosition()); CVector vehPos(veh->GetPosition());
CPopulation::FindCollisionZoneForCoors(&vehPos, &zone, &level); CPopulation::FindCollisionZoneForCoors(&vehPos, &zone, &level);

View File

@ -382,7 +382,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
} }
return VIS_INVISIBLE; return VIS_INVISIBLE;
} }
if(ent->m_type == ENTITY_TYPE_OBJECT && if(ent->IsObject() &&
((CObject*)ent)->ObjectCreatedBy == TEMP_OBJECT){ ((CObject*)ent)->ObjectCreatedBy == TEMP_OBJECT){
if(ent->m_rwObject == nil || !ent->bIsVisible) if(ent->m_rwObject == nil || !ent->bIsVisible)
return VIS_INVISIBLE; return VIS_INVISIBLE;
@ -399,7 +399,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
if(LOD_DISTANCE + STREAM_DISTANCE < dist && dist < mi->GetLargestLodDistance()) if(LOD_DISTANCE + STREAM_DISTANCE < dist && dist < mi->GetLargestLodDistance())
dist = mi->GetLargestLodDistance(); dist = mi->GetLargestLodDistance();
if(ent->m_type == ENTITY_TYPE_OBJECT && ent->bRenderDamaged) if(ent->IsObject() && ent->bRenderDamaged)
mi->m_isDamaged = true; mi->m_isDamaged = true;
RpAtomic *a = mi->GetAtomicFromDistance(dist); RpAtomic *a = mi->GetAtomicFromDistance(dist);
@ -1162,7 +1162,7 @@ CRenderer::IsEntityCullZoneVisible(CEntity *ent)
if(ent->bZoneCulled) if(ent->bZoneCulled)
return false; return false;
switch(ent->m_type){ switch(ent->GetType()){
case ENTITY_TYPE_VEHICLE: case ENTITY_TYPE_VEHICLE:
return IsVehicleCullZoneVisible(ent); return IsVehicleCullZoneVisible(ent);
case ENTITY_TYPE_PED: case ENTITY_TYPE_PED:
@ -1187,7 +1187,7 @@ bool
CRenderer::IsVehicleCullZoneVisible(CEntity *ent) CRenderer::IsVehicleCullZoneVisible(CEntity *ent)
{ {
CVehicle *v = (CVehicle*)ent; CVehicle *v = (CVehicle*)ent;
switch(v->m_status) switch(v->GetStatus())
case STATUS_SIMPLE: case STATUS_SIMPLE:
case STATUS_PHYSICS: case STATUS_PHYSICS:
case STATUS_ABANDONED: case STATUS_ABANDONED:

View File

@ -162,7 +162,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
SetupSuspensionLines(); SetupSuspensionLines();
m_status = STATUS_SIMPLE; SetStatus(STATUS_SIMPLE);
bUseCollisionRecords = true; bUseCollisionRecords = true;
m_nNumPassengers = 0; m_nNumPassengers = 0;
@ -254,8 +254,8 @@ CAutomobile::ProcessControl(void)
ProcessCarAlarm(); ProcessCarAlarm();
// Scan if this car sees the player committing any crimes // Scan if this car sees the player committing any crimes
if(m_status != STATUS_ABANDONED && m_status != STATUS_WRECKED && if(GetStatus() != STATUS_ABANDONED && GetStatus() != STATUS_WRECKED &&
m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE && m_status != STATUS_PLAYER_DISABLED){ GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && GetStatus() != STATUS_PLAYER_DISABLED){
switch(GetModelIndex()) switch(GetModelIndex())
case MI_FBICAR: case MI_FBICAR:
case MI_POLICE: case MI_POLICE:
@ -318,7 +318,7 @@ CAutomobile::ProcessControl(void)
// Set Center of Mass to make car more stable // Set Center of Mass to make car more stable
if(strongGrip1 || bCheat3) if(strongGrip1 || bCheat3)
m_vecCentreOfMass.z = 0.3f*m_aSuspensionSpringLength[0] + -1.0f*m_fHeightAboveRoad; 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; m_vecCentreOfMass.z = pHandling->CentreOfMass.z - 0.2f*pHandling->Dimension.z;
else else
m_vecCentreOfMass.z = pHandling->CentreOfMass.z; m_vecCentreOfMass.z = pHandling->CentreOfMass.z;
@ -326,7 +326,7 @@ CAutomobile::ProcessControl(void)
// Process depending on status // Process depending on status
bool playerRemote = false; bool playerRemote = false;
switch(m_status){ switch(GetStatus()){
case STATUS_PLAYER_REMOTE: case STATUS_PLAYER_REMOTE:
if(CPad::GetPad(0)->WeaponJustDown()){ if(CPad::GetPad(0)->WeaponJustDown()){
BlowUpCar(FindPlayerPed()); BlowUpCar(FindPlayerPed());
@ -356,7 +356,7 @@ CAutomobile::ProcessControl(void)
PruneReferences(); PruneReferences();
if(m_status == STATUS_PLAYER && !CRecordDataForChase::IsRecording()) if(GetStatus() == STATUS_PLAYER && !CRecordDataForChase::IsRecording())
DoDriveByShootings(); DoDriveByShootings();
} }
break; break;
@ -426,7 +426,7 @@ CAutomobile::ProcessControl(void)
// Skip physics if object is found to have been static recently // Skip physics if object is found to have been static recently
bool skipPhysics = false; bool skipPhysics = false;
if(!bIsStuck && (m_status == STATUS_ABANDONED || m_status == STATUS_WRECKED)){ if(!bIsStuck && (GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED)){
bool makeStatic = false; bool makeStatic = false;
float moveSpeedLimit, turnSpeedLimit, distanceLimit; float moveSpeedLimit, turnSpeedLimit, distanceLimit;
@ -436,7 +436,7 @@ CAutomobile::ProcessControl(void)
m_aSuspensionSpringRatioPrev[3] != 1.0f) m_aSuspensionSpringRatioPrev[3] != 1.0f)
makeStatic = true; makeStatic = true;
if(m_status == STATUS_WRECKED){ if(GetStatus() == STATUS_WRECKED){
moveSpeedLimit = 0.006f; moveSpeedLimit = 0.006f;
turnSpeedLimit = 0.0015f; turnSpeedLimit = 0.0015f;
distanceLimit = 0.015f; distanceLimit = 0.015f;
@ -494,7 +494,7 @@ CAutomobile::ProcessControl(void)
default: default:
if(CVehicle::bCheat3){ if(CVehicle::bCheat3){
// Make vehicle jump when horn is sounded // 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 // BUG: game checks [0] four times, instead of all wheels
m_aSuspensionSpringRatio[0] < 1.0f && m_aSuspensionSpringRatio[0] < 1.0f &&
CPad::GetPad(0)->HornJustDown()){ CPad::GetPad(0)->HornJustDown()){
@ -713,7 +713,7 @@ CAutomobile::ProcessControl(void)
} }
float traction; float traction;
if(m_status == STATUS_PHYSICS) if(GetStatus() == STATUS_PHYSICS)
traction = 0.004f * m_fTraction; traction = 0.004f * m_fTraction;
else else
traction = 0.004f; traction = 0.004f;
@ -764,7 +764,7 @@ CAutomobile::ProcessControl(void)
m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceA = SURFACE_RUBBER29; m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceA = SURFACE_RUBBER29;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_LEFT])*traction; 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); adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceB);
WheelState[CARWHEEL_FRONT_LEFT] = m_aWheelState[CARWHEEL_FRONT_LEFT]; WheelState[CARWHEEL_FRONT_LEFT] = m_aWheelState[CARWHEEL_FRONT_LEFT];
@ -798,7 +798,7 @@ CAutomobile::ProcessControl(void)
m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceA = SURFACE_RUBBER29; m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceA = SURFACE_RUBBER29;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT])*traction; 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); adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceB);
WheelState[CARWHEEL_FRONT_RIGHT] = m_aWheelState[CARWHEEL_FRONT_RIGHT]; WheelState[CARWHEEL_FRONT_RIGHT] = m_aWheelState[CARWHEEL_FRONT_RIGHT];
@ -873,7 +873,7 @@ CAutomobile::ProcessControl(void)
m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceA = SURFACE_RUBBER29; m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceA = SURFACE_RUBBER29;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_LEFT])*traction; 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); adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceB);
WheelState[CARWHEEL_REAR_LEFT] = m_aWheelState[CARWHEEL_REAR_LEFT]; WheelState[CARWHEEL_REAR_LEFT] = m_aWheelState[CARWHEEL_REAR_LEFT];
@ -907,7 +907,7 @@ CAutomobile::ProcessControl(void)
m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceA = SURFACE_RUBBER29; m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceA = SURFACE_RUBBER29;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_RIGHT])*traction; 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); adhesion *= CSurfaceTable::GetWetMultiplier(m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceB);
WheelState[CARWHEEL_REAR_RIGHT] = m_aWheelState[CARWHEEL_REAR_RIGHT]; WheelState[CARWHEEL_REAR_RIGHT] = m_aWheelState[CARWHEEL_REAR_RIGHT];
@ -976,7 +976,7 @@ CAutomobile::ProcessControl(void)
// Process horn // Process horn
if(m_status != STATUS_PLAYER){ if(GetStatus() != STATUS_PLAYER){
ReduceHornCounter(); ReduceHornCounter();
}else{ }else{
if(GetModelIndex() == MI_MRWHOOP){ if(GetModelIndex() == MI_MRWHOOP){
@ -1008,7 +1008,7 @@ CAutomobile::ProcessControl(void)
// Flying // 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) if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW)
m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.0005f, 0.0f); m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.0005f, 0.0f);
}else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) && }else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) &&
@ -1061,7 +1061,7 @@ CAutomobile::ProcessControl(void)
// move fire forward if in first person // move fire forward if in first person
if(this == FindPlayerVehicle() && TheCamera.GetLookingForwardFirstPerson()) 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) if(GetModelIndex() == MI_FIRETRUCK)
damagePos += CVector(0.0f, 3.0f, -0.2f); damagePos += CVector(0.0f, 3.0f, -0.2f);
else else
@ -1071,7 +1071,7 @@ CAutomobile::ProcessControl(void)
damagePos = GetMatrix()*damagePos; damagePos = GetMatrix()*damagePos;
damagePos.z += 0.15f; 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 // Car is on fire
CParticle::AddParticle(PARTICLE_CARFLAME, damagePos, CParticle::AddParticle(PARTICLE_CARFLAME, damagePos,
@ -1137,7 +1137,7 @@ CAutomobile::ProcessControl(void)
// Shake pad // 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(); float speed = m_vecMoveSpeed.MagnitudeSqr();
if(speed > sq(0.1f)){ if(speed > sq(0.1f)){
speed = Sqrt(speed); speed = Sqrt(speed);
@ -1198,7 +1198,7 @@ CAutomobile::ProcessControl(void)
m_vecMoveFriction = CVector(0.0f, 0.0f, 0.0f); m_vecMoveFriction = CVector(0.0f, 0.0f, 0.0f);
m_vecTurnFriction = CVector(0.0f, 0.0f, 0.0f); m_vecTurnFriction = CVector(0.0f, 0.0f, 0.0f);
}else if(!skipPhysics && }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 && if(Abs(m_vecMoveSpeed.x) < 0.005f &&
Abs(m_vecMoveSpeed.y) < 0.005f && Abs(m_vecMoveSpeed.y) < 0.005f &&
Abs(m_vecMoveSpeed.z) < 0.005f){ Abs(m_vecMoveSpeed.z) < 0.005f){
@ -1255,7 +1255,7 @@ CAutomobile::PreRender(void)
} }
} }
}else{ }else{
if(m_status == STATUS_SIMPLE){ if(GetStatus() == STATUS_SIMPLE){
CMatrix mat; CMatrix mat;
CVector pos; CVector pos;
@ -1285,8 +1285,8 @@ CAutomobile::PreRender(void)
} }
int drawParticles = Abs(fwdSpeed) < 90.0f; int drawParticles = Abs(fwdSpeed) < 90.0f;
if(m_status == STATUS_SIMPLE || m_status == STATUS_PHYSICS || if(GetStatus() == STATUS_SIMPLE || GetStatus() == STATUS_PHYSICS ||
m_status == STATUS_PLAYER || m_status == STATUS_PLAYER_PLAYBACKFROMBUFFER){ GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_PLAYER_PLAYBACKFROMBUFFER){
bool rearSkidding = false; bool rearSkidding = false;
if(m_aWheelState[CARWHEEL_REAR_LEFT] == WHEEL_STATE_SKIDDING || if(m_aWheelState[CARWHEEL_REAR_LEFT] == WHEEL_STATE_SKIDDING ||
m_aWheelState[CARWHEEL_REAR_RIGHT] == 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) || CClock::GetHours() < 8 && CClock::GetMinutes() < (m_randomSeed & 0x3F) ||
m_randomSeed/50000.0f < CWeather::Foggyness || m_randomSeed/50000.0f < CWeather::Foggyness ||
m_randomSeed/50000.0f < CWeather::WetRoads; m_randomSeed/50000.0f < CWeather::WetRoads;
if(shouldLightsBeOn != bLightsOn && m_status != STATUS_WRECKED){ if(shouldLightsBeOn != bLightsOn && GetStatus() != STATUS_WRECKED){
if(m_status == STATUS_ABANDONED){ if(GetStatus() == STATUS_ABANDONED){
// Turn off lights on abandoned vehicles only when we they're far away // Turn off lights on abandoned vehicles only when we they're far away
if(bLightsOn && if(bLightsOn &&
Abs(TheCamera.GetPosition().x - GetPosition().x) + Abs(TheCamera.GetPosition().y - GetPosition().y) > 100.0f) Abs(TheCamera.GetPosition().x - GetPosition().x) + Abs(TheCamera.GetPosition().y - GetPosition().y) > 100.0f)
@ -1857,7 +1857,7 @@ CAutomobile::PreRender(void)
}else{ }else{
// Lights off // Lights off
if(m_status == STATUS_ABANDONED || m_status == STATUS_WRECKED) { if(GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED) {
CShadows::StoreShadowForCar(this); CShadows::StoreShadowForCar(this);
return; return;
} }
@ -2139,7 +2139,7 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
int i; int i;
CColModel *colModel; CColModel *colModel;
if(m_status != STATUS_SIMPLE) if(GetStatus() != STATUS_SIMPLE)
bVehicleColProcessed = true; bVehicleColProcessed = true;
if(bUsingSpecialColModel) if(bUsingSpecialColModel)
@ -2178,7 +2178,7 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
phys->RegisterReference((CEntity**)&m_aGroundPhysical[i]); phys->RegisterReference((CEntity**)&m_aGroundPhysical[i]);
m_aGroundOffset[i] = m_aWheelColPoints[i].point - phys->GetPosition(); 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 // damage body cast
float speed = m_vecMoveSpeed.MagnitudeSqr(); float speed = m_vecMoveSpeed.MagnitudeSqr();
if(speed > 0.1f){ if(speed > 0.1f){
@ -2370,7 +2370,7 @@ CAutomobile::FireTruckControl(void)
cannonDir = Multiply3x3(GetMatrix(), cannonDir); cannonDir = Multiply3x3(GetMatrix(), cannonDir);
cannonDir.z += (CGeneral::GetRandomNumber()&0xF)/1000.0f; cannonDir.z += (CGeneral::GetRandomNumber()&0xF)/1000.0f;
CWaterCannons::UpdateOne((uintptr)this, &cannonPos, &cannonDir); 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); CFire *fire = gFireManager.FindFurthestFire_NeverMindFireMen(GetPosition(), 10.0f, 35.0f);
if(fire == nil) if(fire == nil)
return; return;
@ -2531,7 +2531,7 @@ CAutomobile::HydraulicControl(void)
CPlayerInfo *playerInfo = &CWorld::Players[CWorld::PlayerInFocus]; CPlayerInfo *playerInfo = &CWorld::Players[CWorld::PlayerInFocus];
CColModel *specialColModel = &playerInfo->m_ColModel; CColModel *specialColModel = &playerInfo->m_ColModel;
if(m_status != STATUS_PLAYER){ if(GetStatus() != STATUS_PLAYER){
// reset hydraulics for non-player cars // reset hydraulics for non-player cars
if(!bUsingSpecialColModel) if(!bUsingSpecialColModel)
@ -3123,7 +3123,7 @@ CAutomobile::RcbanditCheck1CarWheels(CPtrList &list)
mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(car->GetModelIndex()); mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(car->GetModelIndex());
for(i = 0; i < 4; i++){ 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; CVector wheelPos;
CColSphere sph; CColSphere sph;
mi->GetWheelPosn(i, wheelPos); mi->GetWheelPosn(i, wheelPos);
@ -3205,20 +3205,20 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece)
// damage flipped over car // damage flipped over car
if(GetUp().z < 0.0f && this != FindPlayerVehicle()){ if(GetUp().z < 0.0f && this != FindPlayerVehicle()){
if(bNotDamagedUpsideDown || m_status == STATUS_PLAYER_REMOTE || bIsInWater) if(bNotDamagedUpsideDown || GetStatus() == STATUS_PLAYER_REMOTE || bIsInWater)
return; return;
m_fHealth -= 4.0f*CTimer::GetTimeStep(); m_fHealth -= 4.0f*CTimer::GetTimeStep();
} }
if(impulse > 25.0f && m_status != STATUS_WRECKED){ if(impulse > 25.0f && GetStatus() != STATUS_WRECKED){
if(bIsLawEnforcer && if(bIsLawEnforcer &&
FindPlayerVehicle() && FindPlayerVehicle() == m_pDamageEntity && FindPlayerVehicle() && FindPlayerVehicle() == m_pDamageEntity &&
m_status != STATUS_ABANDONED && GetStatus() != STATUS_ABANDONED &&
FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() >= m_vecMoveSpeed.Magnitude() && FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() >= m_vecMoveSpeed.Magnitude() &&
FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() > 0.1f) FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() > 0.1f)
FindPlayerPed()->SetWantedLevelNoDrop(1); 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); uint8 freq = Min(0.4f*impulse*2000.0f/m_fMass + 100.0f, 250.0f);
CPad::GetPad(0)->StartShake(40000/freq, freq); 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; 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; damage *= 7.0f;
if(damage > 0.0f){ if(damage > 0.0f){
@ -3816,7 +3816,7 @@ CAutomobile::BlowUpCar(CEntity *culprit)
// explosion pushes vehicle up // explosion pushes vehicle up
m_vecMoveSpeed.z += 0.13f; m_vecMoveSpeed.z += 0.13f;
m_status = STATUS_WRECKED; SetStatus(STATUS_WRECKED);
bRenderScorched = true; bRenderScorched = true;
m_nTimeOfDeath = CTimer::GetTimeInMilliseconds(); m_nTimeOfDeath = CTimer::GetTimeInMilliseconds();
Damage.FuckCarCompletely(); Damage.FuckCarCompletely();
@ -3933,8 +3933,8 @@ CAutomobile::BurstTyre(uint8 wheel)
if(status == WHEEL_STATUS_OK){ if(status == WHEEL_STATUS_OK){
Damage.SetWheelStatus(wheel, WHEEL_STATUS_BURST); Damage.SetWheelStatus(wheel, WHEEL_STATUS_BURST);
if(m_status == STATUS_SIMPLE){ if(GetStatus() == STATUS_SIMPLE){
m_status = STATUS_PHYSICS; SetStatus(STATUS_PHYSICS);
CCarCtrl::SwitchVehicleToRealPhysics(this); CCarCtrl::SwitchVehicleToRealPhysics(this);
} }
@ -4133,7 +4133,7 @@ CAutomobile::HasCarStoppedBecauseOfLight(void)
{ {
int i; int i;
if(m_status != STATUS_SIMPLE && m_status != STATUS_PHYSICS) if(GetStatus() != STATUS_SIMPLE && GetStatus() != STATUS_PHYSICS)
return false; return false;
if(AutoPilot.m_nCurrentRouteNode && AutoPilot.m_nNextRouteNode){ if(AutoPilot.m_nCurrentRouteNode && AutoPilot.m_nNextRouteNode){

View File

@ -137,7 +137,7 @@ CBoat::ProcessControl(void)
ProcessCarAlarm(); ProcessCarAlarm();
switch(m_status){ switch(GetStatus()){
case STATUS_PLAYER: case STATUS_PLAYER:
m_bIsAnchored = false; m_bIsAnchored = false;
m_fOrientation = INVALID_ORIENTATION; m_fOrientation = INVALID_ORIENTATION;
@ -176,7 +176,7 @@ CBoat::ProcessControl(void)
} }
float collisionDamage = pHandling->fCollisionDamageMultiplier * m_fDamageImpulse; 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; float prevHealth = m_fHealth;
if(this == FindPlayerVehicle()){ if(this == FindPlayerVehicle()){
if(bTakeLessDamage) if(bTakeLessDamage)
@ -199,7 +199,7 @@ CBoat::ProcessControl(void)
} }
// Damage particles // 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().x - TheCamera.GetPosition().x) < 200.0f &&
Abs(GetPosition().y - TheCamera.GetPosition().y) < 200.0f){ Abs(GetPosition().y - TheCamera.GetPosition().y) < 200.0f){
float speedSq = m_vecMoveSpeed.MagnitudeSqr(); float speedSq = m_vecMoveSpeed.MagnitudeSqr();
@ -326,7 +326,7 @@ CBoat::ProcessControl(void)
// Spray some particles // Spray some particles
CVector jetDir = -0.04f * force; CVector jetDir = -0.04f * force;
if(m_fGasPedal > 0.0f){ if(m_fGasPedal > 0.0f){
if(m_status == STATUS_PLAYER){ if(GetStatus() == STATUS_PLAYER){
bool cameraHack = TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || bool cameraHack = TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
TheCamera.WhoIsInControlOfTheCamera == CAMCONTROL_OBBE; TheCamera.WhoIsInControlOfTheCamera == CAMCONTROL_OBBE;
CVector sternPos = GetColModel()->boundingBox.min; CVector sternPos = GetColModel()->boundingBox.min;
@ -597,7 +597,7 @@ CBoat::BlowUpCar(CEntity *culprit)
// explosion pushes vehicle up // explosion pushes vehicle up
m_vecMoveSpeed.z += 0.13f; m_vecMoveSpeed.z += 0.13f;
m_status = STATUS_WRECKED; SetStatus(STATUS_WRECKED);
bRenderScorched = true; bRenderScorched = true;
m_fHealth = 0.0; m_fHealth = 0.0;

View File

@ -61,7 +61,7 @@ void CCarGenerator::DoInternalProcessing()
pos.z += pBoat->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += pBoat->GetDistanceFromCentreOfMassToBaseOfModel();
pBoat->GetPosition() = pos; pBoat->GetPosition() = pos;
pBoat->SetOrientation(0.0f, 0.0f, DEGTORAD(m_fAngle)); pBoat->SetOrientation(0.0f, 0.0f, DEGTORAD(m_fAngle));
pBoat->m_status = STATUS_ABANDONED; pBoat->SetStatus(STATUS_ABANDONED);
pBoat->m_nDoorLock = CARLOCK_UNLOCKED; pBoat->m_nDoorLock = CARLOCK_UNLOCKED;
CWorld::Add(pBoat); CWorld::Add(pBoat);
if (CGeneral::GetRandomNumberInRange(0, 100) < m_nAlarm) if (CGeneral::GetRandomNumberInRange(0, 100) < m_nAlarm)
@ -95,7 +95,7 @@ void CCarGenerator::DoInternalProcessing()
pos.z += pCar->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += pCar->GetDistanceFromCentreOfMassToBaseOfModel();
pCar->GetPosition() = pos; pCar->GetPosition() = pos;
pCar->SetOrientation(0.0f, 0.0f, DEGTORAD(m_fAngle)); pCar->SetOrientation(0.0f, 0.0f, DEGTORAD(m_fAngle));
pCar->m_status = STATUS_ABANDONED; pCar->SetStatus(STATUS_ABANDONED);
pCar->bLightsOn = false; pCar->bLightsOn = false;
pCar->m_nDoorLock = CARLOCK_UNLOCKED; pCar->m_nDoorLock = CARLOCK_UNLOCKED;
CWorld::Add(pCar); CWorld::Add(pCar);
@ -130,7 +130,7 @@ void CCarGenerator::Process()
m_nVehicleHandle = -1; m_nVehicleHandle = -1;
return; return;
} }
if (pVehicle->m_status != STATUS_PLAYER) if (pVehicle->GetStatus() != STATUS_PLAYER)
return; return;
m_nTimer += 60000; m_nTimer += 60000;
m_nVehicleHandle = -1; m_nVehicleHandle = -1;

View File

@ -416,7 +416,7 @@ void CCrane::FindCarInSectorList(CPtrList* pList)
Abs(pVehicle->GetMoveSpeed().y) >= CAR_MOVING_SPEED_THRESHOLD || Abs(pVehicle->GetMoveSpeed().y) >= CAR_MOVING_SPEED_THRESHOLD ||
Abs(pVehicle->GetMoveSpeed().z) >= CAR_MOVING_SPEED_THRESHOLD) Abs(pVehicle->GetMoveSpeed().z) >= CAR_MOVING_SPEED_THRESHOLD)
continue; 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; continue;
if (!DoesCranePickUpThisCarType(pVehicle->GetModelIndex()) || if (!DoesCranePickUpThisCarType(pVehicle->GetModelIndex()) ||
m_bIsMilitaryCrane && CCranes::DoesMilitaryCraneHaveThisOneAlready(pVehicle->GetModelIndex())) { m_bIsMilitaryCrane && CCranes::DoesMilitaryCraneHaveThisOneAlready(pVehicle->GetModelIndex())) {

View File

@ -77,7 +77,7 @@ CHeli::CHeli(int32 id, uint8 CreatedBy)
m_fHeliDustZ[i] = -50.0f; m_fHeliDustZ[i] = -50.0f;
m_nPoliceShoutTimer = CTimer::GetTimeInMilliseconds(); m_nPoliceShoutTimer = CTimer::GetTimeInMilliseconds();
m_status = STATUS_HELI; SetStatus(STATUS_HELI);
m_bTestRight = true; m_bTestRight = true;
m_fTargetOffset = 0.0f; m_fTargetOffset = 0.0f;
m_fSearchLightX = m_fSearchLightY = 0.0f; m_fSearchLightX = m_fSearchLightY = 0.0f;
@ -810,7 +810,7 @@ GenerateHeli(bool catalina)
if(catalina) if(catalina)
heli->GetMatrix().SetRotateZOnly(DEGTORAD(270.0f)); // game actually uses 3.14 here heli->GetMatrix().SetRotateZOnly(DEGTORAD(270.0f)); // game actually uses 3.14 here
heli->m_status = STATUS_ABANDONED; heli->SetStatus(STATUS_ABANDONED);
int id = -1; int id = -1;
bool found = false; bool found = false;

View File

@ -81,7 +81,7 @@ CPlane::CPlane(int32 id, uint8 CreatedBy)
m_bIsDrugRunCesna = false; m_bIsDrugRunCesna = false;
m_bIsDropOffCesna = false; m_bIsDropOffCesna = false;
m_status = STATUS_PLANE; SetStatus(STATUS_PLANE);
bIsBIGBuilding = true; bIsBIGBuilding = true;
m_level = LEVEL_NONE; m_level = LEVEL_NONE;
} }
@ -754,7 +754,7 @@ CPlane::InitPlanes(void)
for(i = 0; i < 3; i++){ for(i = 0; i < 3; i++){
CPlane *plane = new CPlane(MI_AIRTRAIN, PERMANENT_VEHICLE); CPlane *plane = new CPlane(MI_AIRTRAIN, PERMANENT_VEHICLE);
plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
plane->m_status = STATUS_ABANDONED; plane->SetStatus(STATUS_ABANDONED);
plane->bIsLocked = true; plane->bIsLocked = true;
plane->m_nPlaneId = i; plane->m_nPlaneId = i;
plane->m_nCurPathNode = 0; plane->m_nCurPathNode = 0;
@ -768,7 +768,7 @@ CPlane::InitPlanes(void)
for(i = 0; i < 3; i++){ for(i = 0; i < 3; i++){
CPlane *plane = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE); CPlane *plane = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE);
plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
plane->m_status = STATUS_ABANDONED; plane->SetStatus(STATUS_ABANDONED);
plane->bIsLocked = true; plane->bIsLocked = true;
plane->m_nPlaneId = i; plane->m_nPlaneId = i;
plane->m_nCurPathNode = 0; plane->m_nCurPathNode = 0;
@ -926,7 +926,7 @@ CPlane::CreateIncomingCesna(void)
} }
pDrugRunCesna = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE); pDrugRunCesna = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE);
pDrugRunCesna->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); pDrugRunCesna->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
pDrugRunCesna->m_status = STATUS_ABANDONED; pDrugRunCesna->SetStatus(STATUS_ABANDONED);
pDrugRunCesna->bIsLocked = true; pDrugRunCesna->bIsLocked = true;
pDrugRunCesna->m_nPlaneId = 0; pDrugRunCesna->m_nPlaneId = 0;
pDrugRunCesna->m_nCurPathNode = 0; pDrugRunCesna->m_nCurPathNode = 0;
@ -948,7 +948,7 @@ CPlane::CreateDropOffCesna(void)
} }
pDropOffCesna = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE); pDropOffCesna = new CPlane(MI_DEADDODO, PERMANENT_VEHICLE);
pDropOffCesna->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); pDropOffCesna->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
pDropOffCesna->m_status = STATUS_ABANDONED; pDropOffCesna->SetStatus(STATUS_ABANDONED);
pDropOffCesna->bIsLocked = true; pDropOffCesna->bIsLocked = true;
pDropOffCesna->m_nPlaneId = 0; pDropOffCesna->m_nPlaneId = 0;
pDropOffCesna->m_nCurPathNode = 0; pDropOffCesna->m_nCurPathNode = 0;

View File

@ -59,7 +59,7 @@ CTrain::CTrain(int32 id, uint8 CreatedBy)
m_nDoorState = TRAIN_DOOR_CLOSED; m_nDoorState = TRAIN_DOOR_CLOSED;
bUsesCollision = true; bUsesCollision = true;
m_status = STATUS_TRAIN_MOVING; SetStatus(STATUS_TRAIN_MOVING);
} }
void void
@ -177,11 +177,11 @@ CTrain::ProcessControl(void)
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
if(engineTrackSpeed[m_nWagonGroup] > 0.001f){ if(engineTrackSpeed[m_nWagonGroup] > 0.001f){
m_status = STATUS_TRAIN_MOVING; SetStatus(STATUS_TRAIN_MOVING);
m_bTrainStopping = false; m_bTrainStopping = false;
m_bProcessDoor = true; m_bProcessDoor = true;
}else{ }else{
m_status = STATUS_TRAIN_NOT_MOVING; SetStatus(STATUS_TRAIN_NOT_MOVING);
m_bTrainStopping = true; m_bTrainStopping = true;
} }
@ -252,7 +252,7 @@ CTrain::ProcessControl(void)
} }
// Hit stuff // 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(); CVector front = GetPosition() + GetForward()*GetColModel()->boundingBox.max.y + m_vecMoveSpeed*CTimer::GetTimeStep();
int x, xmin, xmax; int x, xmin, xmax;
@ -440,7 +440,7 @@ CTrain::InitTrains(void)
for(i = 0; i < 5; i++){ for(i = 0; i < 5; i++){
train = new CTrain(MI_TRAIN, PERMANENT_VEHICLE); train = new CTrain(MI_TRAIN, PERMANENT_VEHICLE);
train->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); train->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
train->m_status = STATUS_ABANDONED; train->SetStatus(STATUS_ABANDONED);
train->bIsLocked = true; train->bIsLocked = true;
train->m_fWagonPosition = wagonPositions[i]; train->m_fWagonPosition = wagonPositions[i];
train->m_bIsFirstWagon = firstWagon[i]; train->m_bIsFirstWagon = firstWagon[i];
@ -459,7 +459,7 @@ CTrain::InitTrains(void)
for(i = 0; i < 8; i++){ for(i = 0; i < 8; i++){
train = new CTrain(MI_TRAIN, PERMANENT_VEHICLE); train = new CTrain(MI_TRAIN, PERMANENT_VEHICLE);
train->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); train->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
train->m_status = STATUS_ABANDONED; train->SetStatus(STATUS_ABANDONED);
train->bIsLocked = true; train->bIsLocked = true;
train->m_fWagonPosition = wagonPositions_S[i]; train->m_fWagonPosition = wagonPositions_S[i];
train->m_bIsFirstWagon = firstWagon_S[i]; train->m_bIsFirstWagon = firstWagon_S[i];

View File

@ -393,7 +393,7 @@ CVehicle::FlyingControl(eFlightModel flightModel)
m_vecMoveSpeed.x *= rmX; m_vecMoveSpeed.x *= rmX;
m_vecMoveSpeed.y *= rmY; m_vecMoveSpeed.y *= rmY;
m_vecMoveSpeed.z *= rmZ; m_vecMoveSpeed.z *= rmZ;
if (m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE) if (GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE)
return; return;
float fThrust; float fThrust;
if (bCheat5) if (bCheat5)
@ -623,13 +623,13 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage
} }
if (m_fHealth > 0.0f) { if (m_fHealth > 0.0f) {
if (VehicleCreatedBy == RANDOM_VEHICLE && pDriver && if (VehicleCreatedBy == RANDOM_VEHICLE && pDriver &&
(m_status == STATUS_SIMPLE || m_status == STATUS_PHYSICS) && (GetStatus() == STATUS_SIMPLE || GetStatus() == STATUS_PHYSICS) &&
AutoPilot.m_nCarMission == MISSION_CRUISE) { AutoPilot.m_nCarMission == MISSION_CRUISE) {
if (m_randomSeed < DAMAGE_FLEE_IN_CAR_PROBABILITY_VALUE) { if (m_randomSeed < DAMAGE_FLEE_IN_CAR_PROBABILITY_VALUE) {
CCarCtrl::SwitchVehicleToRealPhysics(this); CCarCtrl::SwitchVehicleToRealPhysics(this);
AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * pHandling->Transmission.fUnkMaxVelocity; AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * pHandling->Transmission.fUnkMaxVelocity;
m_status = STATUS_PHYSICS; SetStatus(STATUS_PHYSICS);
} }
} }
m_nLastWeaponDamage = weaponType; m_nLastWeaponDamage = weaponType;
@ -639,11 +639,11 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage
if (VehicleCreatedBy == RANDOM_VEHICLE && if (VehicleCreatedBy == RANDOM_VEHICLE &&
(m_fHealth < DAMAGE_HEALTH_TO_FLEE_ALWAYS || (m_fHealth < DAMAGE_HEALTH_TO_FLEE_ALWAYS ||
bFrightensDriver && m_randomSeed > DAMAGE_FLEE_ON_FOOT_PROBABILITY_VALUE)) { bFrightensDriver && m_randomSeed > DAMAGE_FLEE_ON_FOOT_PROBABILITY_VALUE)) {
switch (m_status) { switch (GetStatus()) {
case STATUS_SIMPLE: case STATUS_SIMPLE:
case STATUS_PHYSICS: case STATUS_PHYSICS:
if (pDriver) { if (pDriver) {
m_status = STATUS_ABANDONED; SetStatus(STATUS_ABANDONED);
pDriver->bFleeAfterExitingCar = true; pDriver->bFleeAfterExitingCar = true;
pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this); pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this);
} }
@ -871,7 +871,7 @@ CVehicle::UsesSiren(uint32 id)
bool bool
CVehicle::IsVehicleNormal(void) CVehicle::IsVehicleNormal(void)
{ {
if (!pDriver || m_nNumPassengers != 0 || m_status == STATUS_WRECKED) if (!pDriver || m_nNumPassengers != 0 || GetStatus() == STATUS_WRECKED)
return false; return false;
switch (GetModelIndex()){ switch (GetModelIndex()){
case MI_FIRETRUCK: case MI_FIRETRUCK:
@ -1141,7 +1141,7 @@ CVehicle::AddPassenger(CPed *passenger, uint8 n)
void void
CVehicle::RemoveDriver(void) CVehicle::RemoveDriver(void)
{ {
m_status = STATUS_ABANDONED; SetStatus(STATUS_ABANDONED);
pDriver = nil; pDriver = nil;
} }

View File

@ -171,7 +171,7 @@ void CBulletInfo::Update(void)
} }
if (pBullet->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE && bAddSound) { if (pBullet->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE && bAddSound) {
cAudioScriptObject* pAudio; cAudioScriptObject* pAudio;
switch (pHitEntity->m_type) { switch (pHitEntity->GetType()) {
case ENTITY_TYPE_BUILDING: case ENTITY_TYPE_BUILDING:
pAudio = new cAudioScriptObject(); pAudio = new cAudioScriptObject();
pAudio->Posn = pHitEntity->GetPosition(); pAudio->Posn = pHitEntity->GetPosition();

View File

@ -193,7 +193,7 @@ CProjectileInfo::Update()
if (!gaProjectileInfo[i].m_bInUse) continue; if (!gaProjectileInfo[i].m_bInUse) continue;
CPed *ped = (CPed*)gaProjectileInfo[i].m_pSource; 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; gaProjectileInfo[i].m_pSource = nil;
if (ms_apProjectile[i] == nil) { if (ms_apProjectile[i] == nil) {

View File

@ -990,7 +990,7 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
} }
else else
{ {
switch ( victim->m_type ) switch ( victim->GetType() )
{ {
case ENTITY_TYPE_BUILDING: 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: case ENTITY_TYPE_BUILDING:
{ {
@ -1256,7 +1256,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
} }
else else
{ {
switch ( victim->m_type ) switch ( victim->GetType() )
{ {
case ENTITY_TYPE_VEHICLE: 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: case ENTITY_TYPE_BUILDING:
{ {
@ -1724,7 +1724,7 @@ CWeapon::FireInstantHitFromCar(CAutomobile *shooter, bool left)
else else
CGlass::WasGlassHitByBullet(victim, point.point); CGlass::WasGlassHitByBullet(victim, point.point);
switch ( victim->m_type ) switch ( victim->GetType() )
{ {
case ENTITY_TYPE_BUILDING: 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 ( (CEntity*)shooterPed != victim && shooterPed->CanSeeEntity(victim, DEGTORAD(22.5f)) )
{ {
if ( !(victim->m_status == STATUS_TRAIN_MOVING if ( !(victim->GetStatus() == STATUS_TRAIN_MOVING
|| victim->m_status == STATUS_TRAIN_NOT_MOVING || victim->GetStatus() == STATUS_TRAIN_NOT_MOVING
|| victim->m_status == STATUS_HELI || victim->GetStatus() == STATUS_HELI
|| victim->m_status == STATUS_PLANE) ) || victim->GetStatus() == STATUS_PLANE) )
{ {
float distToVictim = (shooterPed->GetPosition()-victim->GetPosition()).Magnitude2D(); float distToVictim = (shooterPed->GetPosition()-victim->GetPosition()).Magnitude2D();
float distToVictimZ = Abs(shooterPed->GetPosition().z-victim->GetPosition().z); 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 ( shooter != victim && driver != victim )
{ {
if ( !(victim->m_status == STATUS_TRAIN_MOVING if ( !(victim->GetStatus() == STATUS_TRAIN_MOVING
|| victim->m_status == STATUS_TRAIN_NOT_MOVING || victim->GetStatus() == STATUS_TRAIN_NOT_MOVING
|| victim->m_status == STATUS_HELI || victim->GetStatus() == STATUS_HELI
|| victim->m_status == STATUS_PLANE) ) || victim->GetStatus() == STATUS_PLANE) )
{ {
if ( !(victim->IsVehicle() && victim->bRenderScorched) ) if ( !(victim->IsVehicle() && victim->bRenderScorched) )
{ {
@ -2086,7 +2086,7 @@ FireOneInstantHitRound(CVector *source, CVector *target, int32 damage)
((CVehicle *)victim)->InflictDamage(nil, WEAPONTYPE_UZI, damage); ((CVehicle *)victim)->InflictDamage(nil, WEAPONTYPE_UZI, damage);
//BUG ? no CGlass::WasGlassHitByBullet //BUG ? no CGlass::WasGlassHitByBullet
switch ( victim->m_type ) switch ( victim->GetType() )
{ {
case ENTITY_TYPE_BUILDING: case ENTITY_TYPE_BUILDING:
{ {