summaryrefslogtreecommitdiff
path: root/src/peds
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-04-30 16:45:45 +0300
committerSergeanur <s.anureev@yandex.ua>2020-04-30 16:45:45 +0300
commit7d758f3a9f7ad9b46cc9ab296166365597898bf5 (patch)
tree906b8d3f86c6ee6969bc553b1ea73ed6386409f0 /src/peds
parentcf5a404f6be036fc95692c5b50b277e0f15a8299 (diff)
Adding getters and setters for type and status
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/CopPed.cpp2
-rw-r--r--src/peds/Ped.cpp76
-rw-r--r--src/peds/PlayerPed.cpp2
-rw-r--r--src/peds/Population.cpp4
4 files changed, 42 insertions, 42 deletions
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index 3fc8b8ca..7cea902d 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -132,7 +132,7 @@ CCopPed::SetArrestPlayer(CPed *player)
player->m_pMyVehicle->m_nNumGettingIn = 0;
player->m_pMyVehicle->m_nGettingInFlags = 0;
player->m_pMyVehicle->bIsHandbrakeOn = true;
- player->m_pMyVehicle->m_status = STATUS_PLAYER_DISABLED;
+ player->m_pMyVehicle->SetStatus(STATUS_PLAYER_DISABLED);
}
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_UNARMED)
SetCurrentWeapon(WEAPONTYPE_COLT45);
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index dcb167f0..06585238 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -414,8 +414,8 @@ CPed::FlagToDestroyWhenNextProcessed(void)
return;
if (m_pMyVehicle->pDriver == this){
m_pMyVehicle->pDriver = nil;
- if (IsPlayer() && m_pMyVehicle->m_status != STATUS_WRECKED)
- m_pMyVehicle->m_status = STATUS_ABANDONED;
+ if (IsPlayer() && m_pMyVehicle->GetStatus() != STATUS_WRECKED)
+ m_pMyVehicle->SetStatus(STATUS_ABANDONED);
}else{
m_pMyVehicle->RemovePassenger(this);
}
@@ -2919,7 +2919,7 @@ CPed::SetObjective(eObjective newObj, void *entity)
if (newObj == OBJECTIVE_SOLICIT) {
m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 10000;
} else if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == MISSION_CHAR &&
- (m_carInObjective->m_status == STATUS_PLAYER_DISABLED || CPad::GetPad(CWorld::PlayerInFocus)->ArePlayerControlsDisabled())) {
+ (m_carInObjective->GetStatus() == STATUS_PLAYER_DISABLED || CPad::GetPad(CWorld::PlayerInFocus)->ArePlayerControlsDisabled())) {
SetObjectiveTimer(14000);
} else {
m_objectiveTimer = 0;
@@ -3166,13 +3166,13 @@ CPed::ReactToAttack(CEntity *attacker)
&& (m_pMyVehicle->pDriver == this || m_pMyVehicle->pDriver && m_pMyVehicle->pDriver->m_nPedState == PED_DRIVING)) {
if (m_pMyVehicle->VehicleCreatedBy == RANDOM_VEHICLE
- && (m_pMyVehicle->m_status == STATUS_SIMPLE || m_pMyVehicle->m_status == STATUS_PHYSICS)
+ && (m_pMyVehicle->GetStatus() == STATUS_SIMPLE || m_pMyVehicle->GetStatus() == STATUS_PHYSICS)
&& m_pMyVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE) {
CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle);
m_pMyVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * m_pMyVehicle->pHandling->Transmission.fUnkMaxVelocity;
- m_pMyVehicle->m_status = STATUS_PHYSICS;
+ m_pMyVehicle->SetStatus(STATUS_PHYSICS);
}
} else
#endif
@@ -4136,8 +4136,8 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
#ifdef VC_PED_PORTS
if (m_pMyVehicle) {
if (m_pMyVehicle->IsCar() && m_pMyVehicle->pDriver == this) {
- if (m_pMyVehicle->m_status == STATUS_SIMPLE) {
- m_pMyVehicle->m_status = STATUS_PHYSICS;
+ if (m_pMyVehicle->GetStatus() == STATUS_SIMPLE) {
+ m_pMyVehicle->SetStatus(STATUS_PHYSICS);
CCarCtrl::SwitchVehicleToRealPhysics(m_pMyVehicle);
}
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
@@ -4151,7 +4151,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
m_fHealth = 0.0f;
if (m_pMyVehicle && m_pMyVehicle->pDriver == this) {
SetRadioStation();
- m_pMyVehicle->m_status = STATUS_ABANDONED;
+ m_pMyVehicle->SetStatus(STATUS_ABANDONED);
}
SetDie(dieAnim, dieDelta, dieSpeed);
/*
@@ -4183,7 +4183,7 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi
}
m_fHealth = 0.0f;
if (player == this)
- m_pMyVehicle->m_status = STATUS_PLAYER_DISABLED;
+ m_pMyVehicle->SetStatus(STATUS_PLAYER_DISABLED);
SetDie(NUM_ANIMS, 4.0f, 0.0f);
return true;
@@ -6013,9 +6013,9 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack)
m_vehEnterType = vehEnterType;
if (m_vehEnterType == CAR_DOOR_LF) {
if (veh->pDriver && veh->pDriver->IsPlayer())
- veh->m_status = STATUS_PLAYER_DISABLED;
+ veh->SetStatus(STATUS_PLAYER_DISABLED);
else
- veh->m_status = STATUS_ABANDONED;
+ veh->SetStatus(STATUS_ABANDONED);
}
RemoveInCarAnims();
SetMoveState(PEDMOVE_NONE);
@@ -8584,7 +8584,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
eWeaponType killMethod;
if (m_nPedState == PED_FALL || m_nPedState == PED_DIE) {
- if (!this->m_pCollidingEntity || car->m_status == STATUS_PLAYER)
+ if (!this->m_pCollidingEntity || car->GetStatus() == STATUS_PLAYER)
this->m_pCollidingEntity = car;
return;
}
@@ -9544,7 +9544,7 @@ CPed::ProcessControl(void)
#else
} else if (collidingEnt) {
#endif
- switch (collidingEnt->m_type)
+ switch (collidingEnt->GetType())
{
case ENTITY_TYPE_BUILDING:
case ENTITY_TYPE_OBJECT:
@@ -9773,7 +9773,7 @@ CPed::ProcessControl(void)
if (collidingVeh != m_pCurrentPhysSurface || IsPlayer()) {
if (!bVehEnterDoorIsBlocked) {
- if (collidingVeh->m_status != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) {
+ if (collidingVeh->GetStatus() != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) {
// VC calls SetDirectionToWalkAroundVehicle instead if ped is in PED_SEEK_CAR.
SetDirectionToWalkAroundObject(collidingVeh);
@@ -10126,7 +10126,7 @@ CPed::ProcessControl(void)
if ((m_nPedStateTimer <= 50.0f / (4.0f * adjustedTs) || m_nPedStateTimer * 0.01f <= forceDir.MagnitudeSqr())
&& (m_nCollisionRecords <= 1 || m_nPedStateTimer <= 50.0f / (2.0f * adjustedTs) || m_nPedStateTimer * 1.0f / 250.0f <= Abs(forceDir.z))) {
- if (m_nCollisionRecords == 1 && m_aCollisionRecords[0] != nil && m_aCollisionRecords[0]->m_type == ENTITY_TYPE_BUILDING
+ if (m_nCollisionRecords == 1 && m_aCollisionRecords[0] != nil && m_aCollisionRecords[0]->IsBuilding()
&& m_nPedStateTimer > 50.0f / (2.0f * adjustedTs) && m_nPedStateTimer * 1.0f / 250.0f > Abs(forceDir.z)) {
offsetToCheck.x = -forceDir.y;
#ifdef VC_PED_PORTS
@@ -10994,7 +10994,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
} else if (ped->m_nPedType == PEDTYPE_COP) {
ped->QuitEnteringCar();
if (ped->m_pedInObjective && ped->m_pedInObjective->m_nPedState == PED_DRIVING) {
- veh->m_status = STATUS_PLAYER_DISABLED;
+ veh->SetStatus(STATUS_PLAYER_DISABLED);
((CCopPed*)ped)->SetArrestPlayer(ped->m_pedInObjective);
} else if (!veh->IsDoorMissing(DOOR_FRONT_RIGHT)) {
((CAutomobile*)veh)->Damage.SetDoorStatus(DOOR_FRONT_RIGHT, DOOR_STATUS_SWINGING);
@@ -11145,7 +11145,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
veh->m_nNumGettingIn = 0;
veh->m_nGettingInFlags = 0;
veh->bIsHandbrakeOn = true;
- veh->m_status = STATUS_PLAYER_DISABLED;
+ veh->SetStatus(STATUS_PLAYER_DISABLED);
}
return;
}
@@ -11190,7 +11190,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
driver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh);
if (driver->IsPlayer()) {
veh->bIsHandbrakeOn = true;
- veh->m_status = STATUS_PLAYER_DISABLED;
+ veh->SetStatus(STATUS_PLAYER_DISABLED);
}
driver->bBusJacked = true;
veh->bIsBeingCarJacked = false;
@@ -11704,11 +11704,11 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
#if defined(FIX_BUGS) || defined(VC_PED_PORTS)
CCarCtrl::RegisterVehicleOfInterest(veh);
#endif
- if (veh->m_status == STATUS_SIMPLE) {
+ if (veh->GetStatus() == STATUS_SIMPLE) {
veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.00001f);
veh->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
}
- veh->m_status = STATUS_PLAYER;
+ veh->SetStatus(STATUS_PLAYER);
AudioManager.PlayerJustGotInCar();
}
veh->SetDriver(ped);
@@ -11729,19 +11729,19 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (ped->IsPlayer()) {
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) {
- if (veh->m_status == STATUS_SIMPLE) {
+ if (veh->GetStatus() == STATUS_SIMPLE) {
veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
veh->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
}
- veh->m_status = STATUS_PLAYER;
+ veh->SetStatus(STATUS_PLAYER);
}
AudioManager.PlayerJustGotInCar();
} else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) {
- if (veh->m_status == STATUS_SIMPLE) {
+ if (veh->GetStatus() == STATUS_SIMPLE) {
veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
veh->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
}
- veh->m_status = STATUS_PHYSICS;
+ veh->SetStatus(STATUS_PHYSICS);
}
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) {
@@ -11998,7 +11998,7 @@ CPed::RegisterThreatWithGangPeds(CEntity *attacker)
if (nearVeh->IsVehicleNormal() && nearVeh->IsCar()) {
nearVeh->AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * nearVeh->pHandling->Transmission.fUnkMaxVelocity * 0.8f;
nearVeh->AutoPilot.m_nCarMission = MISSION_RAMPLAYER_FARAWAY;
- nearVeh->m_status = STATUS_PHYSICS;
+ nearVeh->SetStatus(STATUS_PHYSICS);
nearVeh->AutoPilot.m_nTempAction = TEMPACT_NONE;
nearVeh->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
}
@@ -12205,7 +12205,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType);
if (veh->pDriver == ped) {
veh->RemoveDriver();
- veh->m_status = STATUS_ABANDONED;
+ veh->SetStatus(STATUS_ABANDONED);
if (veh->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
veh->m_nDoorLock = CARLOCK_UNLOCKED;
if (ped->m_nPedType == PEDTYPE_COP && veh->IsLawEnforcementVehicle())
@@ -12846,7 +12846,7 @@ CPed::ProcessObjective(void)
|| m_pMyVehicle->m_vecMoveSpeed.MagnitudeSqr() >= sq(0.02f)) {
if (m_pMyVehicle->pDriver == this
&& !m_pMyVehicle->m_nGettingInFlags) {
- m_pMyVehicle->m_status = STATUS_PHYSICS;
+ m_pMyVehicle->SetStatus(STATUS_PHYSICS);
m_pMyVehicle->AutoPilot.m_nPrevRouteNode = 0;
if (m_nPedType == PEDTYPE_COP) {
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = (FindPlayerPed()->m_pWanted->m_nWantedLevel * 0.1f + 0.6f) * (GAME_SPEED_TO_CARAI_SPEED * m_pMyVehicle->pHandling->Transmission.fUnkMaxVelocity);
@@ -12915,7 +12915,7 @@ CPed::ProcessObjective(void)
newVeh->GetPosition() = ThePaths.m_pathNodes[closestNode].pos;
newVeh->GetPosition().z += 4.0f;
newVeh->SetHeading(DEGTORAD(200.0f));
- newVeh->m_status = STATUS_ABANDONED;
+ newVeh->SetStatus(STATUS_ABANDONED);
newVeh->m_nDoorLock = CARLOCK_UNLOCKED;
CWorld::Add(newVeh);
m_pMyVehicle = newVeh;
@@ -13017,7 +13017,7 @@ CPed::ProcessObjective(void)
float distWithTargetSc = distWithTarget.Magnitude();
if (m_pedInObjective->bInVehicle && m_pedInObjective->m_nPedState != PED_DRAG_FROM_CAR) {
CVehicle *vehOfTarget = m_pedInObjective->m_pMyVehicle;
- if (vehOfTarget->bIsInWater || vehOfTarget->m_status == STATUS_PLAYER_DISABLED
+ if (vehOfTarget->bIsInWater || vehOfTarget->GetStatus() == STATUS_PLAYER_DISABLED
|| m_pedInObjective->IsPlayer() && CPad::GetPad(0)->ArePlayerControlsDisabled()) {
SetIdle();
return;
@@ -14033,7 +14033,7 @@ CPed::SetSeekBoatPosition(CVehicle *boat)
void
CPed::SetExitTrain(CVehicle* train)
{
- if (m_nPedState == PED_EXIT_TRAIN || train->m_status != STATUS_TRAIN_NOT_MOVING || !((CTrain*)train)->Doors[0].IsFullyOpen())
+ if (m_nPedState == PED_EXIT_TRAIN || train->GetStatus() != STATUS_TRAIN_NOT_MOVING || !((CTrain*)train)->Doors[0].IsFullyOpen())
return;
/*
@@ -15137,7 +15137,7 @@ CPed::SetRadioStation(void)
inline bool
CPed::IsNotInWreckedVehicle()
{
- return m_pMyVehicle != nil && m_pMyVehicle->m_status != STATUS_WRECKED;
+ return m_pMyVehicle != nil && m_pMyVehicle->GetStatus() != STATUS_WRECKED;
}
void
@@ -15759,9 +15759,9 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
SetRadioStation();
if (veh->pDriver == this) {
if (IsPlayer())
- veh->m_status = STATUS_PLAYER_DISABLED;
+ veh->SetStatus(STATUS_PLAYER_DISABLED);
else
- veh->m_status = STATUS_ABANDONED;
+ veh->SetStatus(STATUS_ABANDONED);
}
}
}
@@ -15916,7 +15916,7 @@ CPed::ScanForInterestingStuff(void)
CVehicle* veh = (CVehicle*)vehicles[i];
if (veh->m_modelIndex == MI_MRWHOOP) {
- if (veh->m_status != STATUS_ABANDONED && veh->m_status != STATUS_WRECKED) {
+ if (veh->GetStatus() != STATUS_ABANDONED && veh->GetStatus() != STATUS_WRECKED) {
if ((GetPosition() - veh->GetPosition()).Magnitude() < 5.0f) {
SetObjective(OBJECTIVE_BUY_ICE_CREAM, veh);
return;
@@ -16136,7 +16136,7 @@ CPed::SeekCar(void)
GetNearestDoor(vehToSeek, dest);
} else {
if (vehToSeek->IsTrain()) {
- if (vehToSeek->m_status != STATUS_TRAIN_NOT_MOVING) {
+ if (vehToSeek->GetStatus() != STATUS_TRAIN_NOT_MOVING) {
RestorePreviousObjective();
RestorePreviousState();
return;
@@ -16222,7 +16222,7 @@ CPed::SeekCar(void)
} else if (vehToSeek->m_nNumGettingIn < vehToSeek->m_nNumMaxPassengers + 1
&& vehToSeek->CanPedEnterCar()) {
- switch (vehToSeek->m_status) {
+ switch (vehToSeek->GetStatus()) {
case STATUS_PLAYER:
case STATUS_SIMPLE:
case STATUS_PHYSICS:
@@ -16994,11 +16994,11 @@ CPed::WarpPedIntoCar(CVehicle *car)
return;
if (IsPlayer()) {
- car->m_status = STATUS_PLAYER;
+ car->SetStatus(STATUS_PLAYER);
AudioManager.PlayerJustGotInCar();
CCarCtrl::RegisterVehicleOfInterest(car);
} else {
- car->m_status = STATUS_PHYSICS;
+ car->SetStatus(STATUS_PHYSICS);
}
CWorld::Remove(this);
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 664fff18..dc44983d 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -771,7 +771,7 @@ CPlayerPed::KeepAreaAroundPlayerClear(void)
for (int i = 0; i < lastVehicle; i++) {
CVehicle *veh = (CVehicle*)vehicles[i];
if (veh->VehicleCreatedBy != MISSION_VEHICLE) {
- if (veh->m_status != STATUS_PLAYER && veh->m_status != STATUS_PLAYER_DISABLED) {
+ if (veh->GetStatus() != STATUS_PLAYER && veh->GetStatus() != STATUS_PLAYER_DISABLED) {
if ((veh->GetPosition() - playerPos).MagnitudeSqr() > 25.0f) {
veh->AutoPilot.m_nTempAction = TEMPACT_WAIT;
veh->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 5000;
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index cd89a05d..d5d0d78a 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -869,8 +869,8 @@ CPopulation::MoveCarsAndPedsOutOfAbandonedZones()
CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
if (veh && veh->m_nZoneLevel == LEVEL_NONE && veh->IsCar()) {
- if(veh->m_status != STATUS_ABANDONED && veh->m_status != STATUS_WRECKED && veh->m_status != STATUS_PLAYER &&
- veh->m_status != STATUS_PLAYER_REMOTE) {
+ if(veh->GetStatus() != STATUS_ABANDONED && veh->GetStatus() != STATUS_WRECKED && veh->GetStatus() != STATUS_PLAYER &&
+ veh->GetStatus() != STATUS_PLAYER_REMOTE) {
CVector vehPos(veh->GetPosition());
CPopulation::FindCollisionZoneForCoors(&vehPos, &zone, &level);