summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-01-16 16:16:35 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2021-01-16 16:16:35 +0100
commitc28ed42617c60f8d43ac61de865cd80967057d59 (patch)
treef161e72c029f6e68c1218866a32ff6868c0ecb01 /src/peds
parentconsistency fix (diff)
downloadre3-c28ed42617c60f8d43ac61de865cd80967057d59.tar
re3-c28ed42617c60f8d43ac61de865cd80967057d59.tar.gz
re3-c28ed42617c60f8d43ac61de865cd80967057d59.tar.bz2
re3-c28ed42617c60f8d43ac61de865cd80967057d59.tar.lz
re3-c28ed42617c60f8d43ac61de865cd80967057d59.tar.xz
re3-c28ed42617c60f8d43ac61de865cd80967057d59.tar.zst
re3-c28ed42617c60f8d43ac61de865cd80967057d59.zip
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/Ped.cpp75
-rw-r--r--src/peds/Ped.h11
2 files changed, 85 insertions, 1 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index f5123b39..8be58d66 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -9447,8 +9447,10 @@ CPed::SetRadioStation(void)
// --MIAMI: Done
void
-CPed::WarpPedIntoCar(CVehicle *car)
+CPed::WarpPedIntoCar(CVehicle *car) // LCS TODO: remove passenger logic
{
+ if (GetPedState() == PED_FACE_PHONE)
+ QuitEnteringCar();
bInVehicle = true;
m_pMyVehicle = car;
m_pMyVehicle->RegisterReference((CEntity **) &m_pMyVehicle);
@@ -9513,6 +9515,77 @@ CPed::WarpPedIntoCar(CVehicle *car)
bChangedSeat = true;
}
+void
+CPed::WarpPedIntoCarAsPassenger(CVehicle* pVehicle, int32 position)
+{
+ if (GetPedState() == PED_FACE_PHONE)
+ QuitEnteringCar();
+ bInVehicle = true;
+ m_pMyVehicle = pVehicle;
+ m_pMyVehicle->RegisterReference((CEntity**)&m_pMyVehicle);
+ m_carInObjective = pVehicle;
+ m_carInObjective->RegisterReference((CEntity**)&m_carInObjective);
+ SetPedState(PED_DRIVING); // TODO: this is PED_PASSENGER, but it needs to have some logic applied first
+ bUsesCollision = false;
+ bIsInTheAir = false;
+ bVehExitWillBeInstant = true;
+ if (pVehicle->IsBike() && !pVehicle->pPassengers[0]) {
+ pVehicle->pPassengers[0] = this;
+ pVehicle->pPassengers[0]->RegisterReference((CEntity**)&pVehicle->pPassengers[0]);
+ }
+ if (position >= 0) {
+ if (!pVehicle->pPassengers[position]) {
+ pVehicle->pPassengers[position] = this;
+ pVehicle->pPassengers[position]->RegisterReference((CEntity**)&pVehicle->pPassengers[position]);
+ }
+ }
+ else {
+ for (int i = 0; i < 4; i++) {
+ if (!pVehicle->pPassengers[i]) {
+ pVehicle->pPassengers[i] = this;
+ pVehicle->pPassengers[i]->RegisterReference((CEntity**)&pVehicle->pPassengers[i]);
+ break;
+ }
+ }
+ }
+
+ if (IsPlayer()) {
+ pVehicle->SetStatus(STATUS_PLAYER);
+ AudioManager.PlayerJustGotInCar();
+ CCarCtrl::RegisterVehicleOfInterest(pVehicle);
+ }
+ else {
+ pVehicle->SetStatus(STATUS_PHYSICS);
+ }
+
+ CWorld::Remove(this);
+ SetPosition(pVehicle->GetPosition());
+ CWorld::Add(this);
+
+ if (pVehicle->bIsAmbulanceOnDuty) {
+ pVehicle->bIsAmbulanceOnDuty = false;
+ --CCarCtrl::NumAmbulancesOnDuty;
+ }
+ if (pVehicle->bIsFireTruckOnDuty) {
+ pVehicle->bIsFireTruckOnDuty = false;
+ --CCarCtrl::NumFiretrucksOnDuty;
+ }
+ if (!pVehicle->bEngineOn) {
+ pVehicle->bEngineOn = true;
+ DMAudio.PlayOneShot(pVehicle->m_audioEntityId, SOUND_CAR_ENGINE_START, 1.0f);
+ }
+
+ RpAnimBlendClumpSetBlendDeltas(GetClump(), ASSOC_PARTIAL, -1000.0f);
+
+ AddInCarAnims(pVehicle, pVehicle->pDriver == this);
+ RemoveWeaponWhenEnteringVehicle();
+
+ if (pVehicle->bIsBus)
+ bRenderPedInCar = false;
+
+ bChangedSeat = true;
+}
+
// --MIAMI: Done
bool
CPed::HasAttractor(void)
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 5d8383eb..9ed6f2ff 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -888,6 +888,7 @@ public:
void SetSolicit(uint32 time);
void ScanForInterestingStuff(void);
void WarpPedIntoCar(CVehicle*);
+ void WarpPedIntoCarAsPassenger(CVehicle*, int32);
void SetCarJack(CVehicle*);
bool WarpPedToNearLeaderOffScreen(void);
void Solicit(void);
@@ -1042,6 +1043,16 @@ public:
{
return m_pMyVehicle != nil && ((CEntity*)m_pMyVehicle)->GetStatus() != STATUS_WRECKED;
}
+ bool CanStartMission() // used in CAN_PLAYER_START_MISSION and can looks like inlined function
+ {
+ if (m_nPedState >= PED_WANDER_RANGE && m_nPedState < PED_STATES_NO_AI && m_nPedState != PED_ANSWER_MOBILE)
+ return false;
+ if (m_nPedState >= PED_JUMP && m_nPedState < PED_STATES_NO_ST)
+ return false;
+ if (m_nPedState >= PED_ENTER_TRAIN && m_nPedState < PED_DEPLOY_STINGER)
+ return false;
+ return !bIsInTheAir && !bIsLanding && m_fHealth > 0.0f;
+ }
// My names. Inlined in VC
AnimationId GetFireAnimNotDucking(CWeaponInfo* weapon) {