diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-07-03 10:08:19 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-07-03 10:08:19 +0200 |
commit | 48ebbb72924bf5afbf7518bd1534521e1aa43bcc (patch) | |
tree | 3c35f91c2cde87e4b334b01f576ba368262fb27d /src/peds/Ped.cpp | |
parent | fix (diff) | |
download | re3-48ebbb72924bf5afbf7518bd1534521e1aa43bcc.tar re3-48ebbb72924bf5afbf7518bd1534521e1aa43bcc.tar.gz re3-48ebbb72924bf5afbf7518bd1534521e1aa43bcc.tar.bz2 re3-48ebbb72924bf5afbf7518bd1534521e1aa43bcc.tar.lz re3-48ebbb72924bf5afbf7518bd1534521e1aa43bcc.tar.xz re3-48ebbb72924bf5afbf7518bd1534521e1aa43bcc.tar.zst re3-48ebbb72924bf5afbf7518bd1534521e1aa43bcc.zip |
Diffstat (limited to 'src/peds/Ped.cpp')
-rw-r--r-- | src/peds/Ped.cpp | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 2fe2ce02..bfaf6ea4 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -405,6 +405,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) bReachedAttractorHeadingTarget = false; bTurnedAroundOnAttractor = false; + bHasAlreadyUsedAttractor = false; bCarPassenger = false; bMiamiViceCop = false; bMoneyHasBeenGivenByScript = false; @@ -8170,6 +8171,10 @@ CPed::Wait(void) animAssoc->blendDelta = -4.0f; animAssoc->flags |= ASSOC_DELETEFADEDOUT; } + if (m_attractor && m_objective == OBJECTIVE_WAIT_ON_FOOT_AT_ICE_CREAM_VAN) { + GetPedAttractorManager()->BroadcastDeparture(this, m_attractor); + bBoughtIceCream = true; + } ClearWaitState(); } #ifdef VC_PED_PORTS @@ -15111,6 +15116,38 @@ CPed::ProcessObjective(void) } } break; + case OBJECTIVE_WAIT_ON_FOOT_AT_ICE_CREAM_VAN: + { + SetIdle(); + CVehicle* pIceCreamVan = GetPedAttractorManager()->GetIceCreamVanForEffect(m_attractor->GetEffect()); + if (m_attractor && m_nWaitState != WAITSTATE_PLAYANIM_CHAT && pIceCreamVan && pIceCreamVan->pDriver && pIceCreamVan->pDriver->IsPlayer()) { + int time = 5000; + SetWaitState(WAITSTATE_PLAYANIM_CHAT, &time); + break; + } + if (!m_attractor) + break; + CVehicle* pVan = GetPedAttractorManager()->GetIceCreamVanForEffect(m_attractor->GetEffect()); + if (!pVan) + break; + if (0.01f * CTimer::GetTimeStep() * 5.0f < pVan->m_fDistanceTravelled) { + GetPedAttractorManager()->DeRegisterPed(this, m_attractor); + break; + } + if (!pVan->pDriver || !pVan->pDriver->IsPlayer() || pVan->pDriver->GetPedState() == PED_ARRESTED || pVan->pDriver->GetPedState() == PED_DEAD) { + GetPedAttractorManager()->DeRegisterPed(this, m_attractor); + break; + } + if (!pVan->m_bSirenOrAlarm) { + GetPedAttractorManager()->DeRegisterPed(this, m_attractor); + return; // ??? + } + if (pVan->GetStatus() == STATUS_WRECKED) { + GetPedAttractorManager()->DeRegisterPed(this, m_attractor); + return; // ??? + } + break; + } #endif } if (bObjectiveCompleted @@ -18761,28 +18798,28 @@ CPed::SetObjective(eObjective newObj, CVector dest) m_nextRoutePointPos = dest; m_vecSeekPos = m_nextRoutePointPos; m_distanceToCountSeekDone = 0.5f; - if (m_objective == OBJECTIVE_GOTO_ATM_ON_FOOT) { + if (newObj == OBJECTIVE_GOTO_ATM_ON_FOOT) { m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); } - if (m_objective == OBJECTIVE_GOTO_SEAT_ON_FOOT) { + if (newObj == OBJECTIVE_GOTO_SEAT_ON_FOOT) { m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); } - if (m_objective == OBJECTIVE_GOTO_BUS_STOP_ON_FOOT) { + if (newObj == OBJECTIVE_GOTO_BUS_STOP_ON_FOOT) { m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); } - if (m_objective == OBJECTIVE_GOTO_PIZZA_ON_FOOT) { + if (newObj == OBJECTIVE_GOTO_PIZZA_ON_FOOT) { m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); } - if (m_objective == OBJECTIVE_GOTO_SHELTER_ON_FOOT) { + if (newObj == OBJECTIVE_GOTO_SHELTER_ON_FOOT) { bIsRunning = true; m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); } - if (m_objective == OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT) { + if (newObj == OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT) { bIsRunning = true; m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); |