summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-16 00:49:30 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-16 00:49:30 +0200
commit08b2138c7e59ce3350d333832ceca5c24799a34c (patch)
treee1630132472fc19fa20805e5bb65394a03a49ea5 /src/peds
parentMerge remote-tracking branch 'upstream/miami' into miami (diff)
downloadre3-08b2138c7e59ce3350d333832ceca5c24799a34c.tar
re3-08b2138c7e59ce3350d333832ceca5c24799a34c.tar.gz
re3-08b2138c7e59ce3350d333832ceca5c24799a34c.tar.bz2
re3-08b2138c7e59ce3350d333832ceca5c24799a34c.tar.lz
re3-08b2138c7e59ce3350d333832ceca5c24799a34c.tar.xz
re3-08b2138c7e59ce3350d333832ceca5c24799a34c.tar.zst
re3-08b2138c7e59ce3350d333832ceca5c24799a34c.zip
Diffstat (limited to '')
-rw-r--r--src/peds/CivilianPed.cpp22
-rw-r--r--src/peds/Ped.cpp22
-rw-r--r--src/peds/PedAttactor.cpp12
3 files changed, 28 insertions, 28 deletions
diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp
index 7d4f4d12..f90dffa8 100644
--- a/src/peds/CivilianPed.cpp
+++ b/src/peds/CivilianPed.cpp
@@ -216,7 +216,7 @@ CCivilianPed::ProcessControl(void)
// fall through
case PED_SEEK_POS:
if (Seek()) {
- if ((m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA) && m_pNextPathNode) {
+ if ((m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA || IsUseAttractorObjective(m_objective)) && m_pNextPathNode) {
m_pNextPathNode = nil;
#ifdef TOGGLEABLE_BETA_FEATURES
} else if (bRunningToPhone && m_objective < OBJECTIVE_FLEE_TILL_SAFE) {
@@ -248,7 +248,7 @@ CCivilianPed::ProcessControl(void)
} else if (m_objective == OBJECTIVE_GOTO_CHAR_ON_FOOT
&& m_pedInObjective && m_pedInObjective->m_nMoveState != PEDMOVE_STILL) {
SetMoveState(m_pedInObjective->m_nMoveState);
- } else if (m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA) {
+ } else if (m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA || IsUseAttractorObjective(m_objective)) {
SetIdle();
} else {
RestorePreviousState();
@@ -422,9 +422,8 @@ void CCivilianPed::UseNearbyAttractors()
CSector* s = CWorld::GetSector(x, y);
for (CPtrNode* pNode = s->m_lists[ENTITYLIST_BUILDINGS].first; pNode != nil; pNode = pNode->next) {
CEntity* pEntity = (CEntity*)pNode->item;
- if (!pEntity->IsObject())
- continue;
- // TODO: some flag check
+ //if (pEntity->IsObject() && (CObject*)(pEntity)->IsBroken())
+ //continue;
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(pEntity->GetModelIndex());
for (int i = 0; i < pModelInfo->GetNum2dEffects(); i++) {
C2dEffect* pEffect = pModelInfo->Get2dEffect(i);
@@ -433,7 +432,7 @@ void CCivilianPed::UseNearbyAttractors()
if (!IsAttractedTo(pEffect->pedattr.type))
continue;
CVector pos;
- CPedAttractorManager::ComputeEffectPos(pEffect, GetMatrix(), pos);
+ CPedAttractorManager::ComputeEffectPos(pEffect, pEntity->GetMatrix(), pos);
if ((pos - GetPosition()).MagnitudeSqr() < minDistance) {
CPedAttractorManager* pManager = GetPedAttractorManager();
if (pManager->HasEmptySlot(pEffect) && pManager->IsApproachable(pEffect, pEntity->GetMatrix(), 0, this)) {
@@ -446,9 +445,10 @@ void CCivilianPed::UseNearbyAttractors()
}
for (CPtrNode* pNode = s->m_lists[ENTITYLIST_OBJECTS].first; pNode != nil; pNode = pNode->next) {
CEntity* pEntity = (CEntity*)pNode->item;
- if (!pEntity->IsObject())
- continue;
- // TODO: some flag check
+ //if (pEntity->IsObject() && (CObject*)(pEntity)->IsBroken())
+ //continue;
+ if (pEntity->GetModelIndex() == 3181)
+ debug("get2\n");
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(pEntity->GetModelIndex());
for (int i = 0; i < pModelInfo->GetNum2dEffects(); i++) {
C2dEffect* pEffect = pModelInfo->Get2dEffect(i);
@@ -457,7 +457,7 @@ void CCivilianPed::UseNearbyAttractors()
if (!IsAttractedTo(pEffect->pedattr.type))
continue;
CVector pos;
- CPedAttractorManager::ComputeEffectPos(pEffect, GetMatrix(), pos);
+ CPedAttractorManager::ComputeEffectPos(pEffect, pEntity->GetMatrix(), pos);
if ((pos - GetPosition()).MagnitudeSqr() < minDistance) {
CPedAttractorManager* pManager = GetPedAttractorManager();
if (pManager->HasEmptySlot(pEffect) && pManager->IsApproachable(pEffect, pEntity->GetMatrix(), 0, this)) {
@@ -482,7 +482,7 @@ bool CCivilianPed::IsAttractedTo(int8 type)
case ATTRACTOR_STOP: return true;
case ATTRACTOR_PIZZA: return true;
case ATTRACTOR_SHELTER: return CWeather::Rain >= 0.2f;
- case ATTRACTOR_ICECREAM: return true;
+ case ATTRACTOR_ICECREAM: return false;
}
return false;
}
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 1441e1d5..6cc16ad2 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -5529,17 +5529,17 @@ CPed::SetWaitState(eWaitState state, void *time)
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
break;
case WAITSTATE_SIT_DOWN:
- animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_XPRESS_SCRATCH, 4.0f); // TODO(MIAMI): proper anim!
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_HANDSUP, 4.0f); // TODO(MIAMI): proper anim!
animAssoc->SetFinishCallback(FinishedWaitCB, this);
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 10000;
break;
case WAITSTATE_SIT_UP:
- animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_XPRESS_SCRATCH, 4.0f); // TODO(MIAMI): proper anim!
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_HANDSUP, 4.0f); // TODO(MIAMI): proper anim!
animAssoc->SetFinishCallback(FinishedWaitCB, this);
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 100000;
break;
case WAITSTATE_SIT_IDLE:
- animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_XPRESS_SCRATCH, 5000.0f); // TODO(MIAMI): proper anim!
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_HANDSUP, 5000.0f); // TODO(MIAMI): proper anim!
animAssoc->SetFinishCallback(FinishedWaitCB, this);
if (time)
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + *(int*)time;
@@ -5547,7 +5547,7 @@ CPed::SetWaitState(eWaitState state, void *time)
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + CGeneral::GetRandomNumberInRange(25000, 30000);
break;
case WAITSTATE_USE_ATM:
- animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_XPRESS_SCRATCH, 5000.0f); // TODO(MIAMI): proper anim!
+ animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_HANDSUP, 5000.0f); // TODO(MIAMI): proper anim!
animAssoc->SetFinishCallback(FinishedWaitCB, this);
if (time)
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + *(int*)time;
@@ -14046,7 +14046,7 @@ CPed::ProcessObjective(void)
if (GetPedAttractorManager()->IsAtHeadOfQueue(this, m_attractor)) {
switch (m_objective) {
case OBJECTIVE_USE_SEAT_ATTRACTOR:
- if (bTurnedAroundOnAttractor) {
+ if (!bTurnedAroundOnAttractor) {
ClearObjective();
SetWaitState(WAITSTATE_SIT_DOWN, 0);
}
@@ -17998,19 +17998,19 @@ CPed::ClearWaitState(void)
AnimationId id;
switch (m_nWaitState) { // TODO(MIAMI): actual!
case WAITSTATE_PLAYANIM_CHAT: id = ANIM_IDLE_CHAT; break;
- case WAITSTATE_SIT_DOWN: id = ANIM_XPRESS_SCRATCH; break;
- case WAITSTATE_SIT_DOWN_RVRS: id = ANIM_XPRESS_SCRATCH; break;
- case WAITSTATE_SIT_UP: id = ANIM_XPRESS_SCRATCH; break;
- case WAITSTATE_SIT_IDLE: id = ANIM_XPRESS_SCRATCH; break;
- case WAITSTATE_USE_ATM: id = ANIM_XPRESS_SCRATCH; break;
+ case WAITSTATE_SIT_DOWN: id = ANIM_HANDSUP; break;
+ case WAITSTATE_SIT_DOWN_RVRS: id = ANIM_HANDSUP; break;
+ case WAITSTATE_SIT_UP: id = ANIM_HANDSUP; break;
+ case WAITSTATE_SIT_IDLE: id = ANIM_HANDSUP; break;
+ case WAITSTATE_USE_ATM: id = ANIM_HANDSUP; break;
}
CAnimBlendAssociation* pAssoc = RpAnimBlendClumpGetAssociation(GetClump(), id);
if (pAssoc)
pAssoc->blendDelta = -8.0f;
if (m_attractor)
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
- break;
}
+ break;
case WAITSTATE_RIOT:
case WAITSTATE_FAST_FALL:
case WAITSTATE_BOMBER:
diff --git a/src/peds/PedAttactor.cpp b/src/peds/PedAttactor.cpp
index bef14308..a3b93067 100644
--- a/src/peds/PedAttactor.cpp
+++ b/src/peds/PedAttactor.cpp
@@ -485,7 +485,7 @@ bool CPedAttractorManager::BroadcastArrival(CPed* pPed, CPedAttractor* pAttracto
return false;
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
return nil;
- if (IsPedRegisteredWithEffect(pPed))
+ if (!IsPedRegisteredWithEffect(pPed))
return nil;
switch (pAttractor->GetEffect()->pedattr.type) {
case ATTRACTOR_ATM: return BroadcastArrival(pPed, pAttractor, vAtmAttractors);
@@ -504,7 +504,7 @@ bool CPedAttractorManager::BroadcastDeparture(CPed* pPed, CPedAttractor* pAttrac
return false;
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
return nil;
- if (IsPedRegisteredWithEffect(pPed))
+ if (!IsPedRegisteredWithEffect(pPed))
return nil;
switch (pAttractor->GetEffect()->pedattr.type) {
case ATTRACTOR_ATM: return BroadcastDeparture(pPed, pAttractor, vAtmAttractors);
@@ -523,7 +523,7 @@ bool CPedAttractorManager::IsAtHeadOfQueue(CPed* pPed, CPedAttractor* pAttractor
return false;
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
return nil;
- if (IsPedRegisteredWithEffect(pPed))
+ if (!IsPedRegisteredWithEffect(pPed))
return nil;
switch (pAttractor->GetEffect()->pedattr.type) {
case ATTRACTOR_ATM: return IsAtHeadOfQueue(pPed, pAttractor, vAtmAttractors);
@@ -542,7 +542,7 @@ bool CPedAttractorManager::IsInQueue(CPed* pPed, CPedAttractor* pAttractor)
return false;
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
return nil;
- if (IsPedRegisteredWithEffect(pPed))
+ if (!IsPedRegisteredWithEffect(pPed))
return nil;
switch (pAttractor->GetEffect()->pedattr.type) {
case ATTRACTOR_ATM: return IsInQueue(pPed, pAttractor, vAtmAttractors);
@@ -747,13 +747,13 @@ bool CPedAttractorManager::IsApproachable(C2dEffect* pEffect, const CMatrix& mat
ComputeEffectPos(pEffect, matrix, vecEffectPos);
float dp = -DotProduct(vecUseDir, vecEffectPos);
if (pEffect->pedattr.type == ATTRACTOR_ATM || pEffect->pedattr.type == ATTRACTOR_PIZZA || pEffect->pedattr.type == ATTRACTOR_ICECREAM) {
- vecUseDir = vecUseDir;
+ vecUseDir = -vecUseDir;
dp = -dp;
}
if (dp + DotProduct(vecEffectPos, pPed->GetPosition()) > 0.0f) {
CVector vecPedToAttractor = pPed->GetPosition() - vecEffectPos;
vecPedToAttractor.Normalise();
- if (DotProduct(vecPedToAttractor, vecUseDir) > 0.25f /* && CWorld::IsWanderPathClear(pPed, vecEffectPos, 2.0f, 0) */)
+ if (DotProduct(vecPedToAttractor, vecUseDir) > 0.25f && CWorld::IsWanderPathClear(pPed->GetPosition(), vecEffectPos, 2.0f, 0))
return true;
}
return false;