diff options
Diffstat (limited to 'src/peds')
-rw-r--r-- | src/peds/Ped.cpp | 49 | ||||
-rw-r--r-- | src/peds/PedAttractor.cpp | 8 |
2 files changed, 47 insertions, 10 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 807fd53e..a3672186 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -403,6 +403,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) bReachedAttractorHeadingTarget = false; bTurnedAroundOnAttractor = false; + bHasAlreadyUsedAttractor = false; bCarPassenger = false; bMiamiViceCop = false; bMoneyHasBeenGivenByScript = false; @@ -8209,6 +8210,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 @@ -15064,6 +15069,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 @@ -18714,28 +18751,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(); diff --git a/src/peds/PedAttractor.cpp b/src/peds/PedAttractor.cpp index 659a522b..db5f9e52 100644 --- a/src/peds/PedAttractor.cpp +++ b/src/peds/PedAttractor.cpp @@ -71,15 +71,15 @@ const C2dEffect* CVehicleToEffect::ChooseEffect(const CVector& pos) const return nil; if (DotProduct(pos - m_pVehicle->GetPosition(), m_pVehicle->GetRight()) > 0.0f) { if (DotProduct(pos - m_pVehicle->GetPosition(), m_pVehicle->GetForward()) > 0.0f) - return &m_effects[0]; + return &m_effects[1]; else - return &m_effects[2]; + return &m_effects[3]; } else { if (DotProduct(pos - m_pVehicle->GetPosition(), m_pVehicle->GetForward()) > 0.0f) - return &m_effects[1]; + return &m_effects[0]; else - return &m_effects[3]; + return &m_effects[2]; } } |