summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-07-03 10:08:19 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-07-03 10:08:19 +0200
commit48ebbb72924bf5afbf7518bd1534521e1aa43bcc (patch)
tree3c35f91c2cde87e4b334b01f576ba368262fb27d /src/peds
parentfix (diff)
downloadre3-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')
-rw-r--r--src/peds/Ped.cpp49
-rw-r--r--src/peds/PedAttractor.cpp8
2 files changed, 47 insertions, 10 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();
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];
}
}