mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 19:20:00 +00:00
ped attractors done
This commit is contained in:
parent
09a0207e55
commit
08b2138c7e
|
@ -1033,12 +1033,12 @@ CFileLoader::Load2dEffect(const char *line)
|
||||||
sscanf(line, "%d %f %f %f %d %d %d %d %d %d %f %f %f %f %f %f",
|
sscanf(line, "%d %f %f %f %d %d %d %d %d %d %f %f %f %f %f %f",
|
||||||
&id, &x, &y, &z, &r, &g, &b, &a, &type,
|
&id, &x, &y, &z, &r, &g, &b, &a, &type,
|
||||||
&ptype,
|
&ptype,
|
||||||
&effect->pedattr.useDir.x,
|
|
||||||
&effect->pedattr.useDir.y,
|
|
||||||
&effect->pedattr.useDir.z,
|
|
||||||
&effect->pedattr.queueDir.x,
|
&effect->pedattr.queueDir.x,
|
||||||
&effect->pedattr.queueDir.y,
|
&effect->pedattr.queueDir.y,
|
||||||
&effect->pedattr.queueDir.z);
|
&effect->pedattr.queueDir.z,
|
||||||
|
&effect->pedattr.useDir.x,
|
||||||
|
&effect->pedattr.useDir.y,
|
||||||
|
&effect->pedattr.useDir.z);
|
||||||
effect->pedattr.type = ptype;
|
effect->pedattr.type = ptype;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2236,3 +2236,58 @@ CWorld::UseDetonator(CEntity *pEntity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CWorld::IsWanderPathClear(CVector const& point1, CVector const& point2, float distance, int maxSteps)
|
||||||
|
{
|
||||||
|
if (Abs(point1.z - point2.z) > distance)
|
||||||
|
return false;
|
||||||
|
if (!GetIsLineOfSightClear(point1, point2, true, false, false, false, false, false, false))
|
||||||
|
return false;
|
||||||
|
CVector vecBetween = point2 - point1;
|
||||||
|
uint32 nSteps = Max(vecBetween.Magnitude(), maxSteps);
|
||||||
|
if (nSteps == 0)
|
||||||
|
return true;
|
||||||
|
vecBetween.Normalise();
|
||||||
|
uint32 step = 1;
|
||||||
|
for (step = 1; step < nSteps; step++) {
|
||||||
|
CVector posThisStep = point1 + vecBetween * step;
|
||||||
|
float level;
|
||||||
|
if (!CWaterLevel::GetWaterLevel(posThisStep, &level, false))
|
||||||
|
continue;
|
||||||
|
posThisStep.z = level;
|
||||||
|
AdvanceCurrentScanCode();
|
||||||
|
|
||||||
|
CVector vecCheckedPos(posThisStep.x, posThisStep.y, Max(point1.z, point2.z));
|
||||||
|
CColPoint colpoint;
|
||||||
|
CEntity* entity;
|
||||||
|
if (!ProcessVerticalLineSector(*GetSector(GetSectorIndexX(posThisStep.x), GetSectorIndexY(posThisStep.y)),
|
||||||
|
CColLine(posThisStep, vecCheckedPos), colpoint, entity, true, false, false, false, false, false, nil))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVector posThisStep = point1;
|
||||||
|
AdvanceCurrentScanCode();
|
||||||
|
CVector vecCheckedPos(posThisStep.x, posThisStep.y, point1.z - 5.0f);
|
||||||
|
|
||||||
|
CColPoint colpoint;
|
||||||
|
CEntity* entity;
|
||||||
|
if (!ProcessVerticalLineSector(*GetSector(GetSectorIndexX(posThisStep.x), GetSectorIndexY(posThisStep.y)),
|
||||||
|
CColLine(posThisStep, vecCheckedPos), colpoint, entity, true, false, false, false, false, false, nil))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
float heightNextStep = colpoint.point.z + 0.5f;
|
||||||
|
for (step = 1; step < nSteps; step++) {
|
||||||
|
CVector posThisStep = point1 + vecBetween * step;
|
||||||
|
posThisStep.z = heightNextStep;
|
||||||
|
AdvanceCurrentScanCode();
|
||||||
|
CVector vecCheckedPos(posThisStep.x, posThisStep.y, heightNextStep - 2.0f);
|
||||||
|
if (!ProcessVerticalLineSector(*GetSector(GetSectorIndexX(posThisStep.x), GetSectorIndexY(posThisStep.y)),
|
||||||
|
CColLine(posThisStep, vecCheckedPos), colpoint, entity, true, false, false, false, false, false, nil))
|
||||||
|
return false;
|
||||||
|
if (Abs(colpoint.point.z - heightNextStep) > 1.0f)
|
||||||
|
return false;
|
||||||
|
heightNextStep = colpoint.point.z + 0.5f;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -125,6 +125,8 @@ public:
|
||||||
static void CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1, float x2, float y2, float fStartX, float fStartY, float fEndX, float fEndY);
|
static void CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1, float x2, float y2, float fStartX, float fStartY, float fEndX, float fEndY);
|
||||||
static void CallOffChaseForAreaSectorListPeds(CPtrList& list, float x1, float y1, float x2, float y2);
|
static void CallOffChaseForAreaSectorListPeds(CPtrList& list, float x1, float y1, float x2, float y2);
|
||||||
|
|
||||||
|
static bool IsWanderPathClear(CVector const&, CVector const&, float, int);
|
||||||
|
|
||||||
static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
|
static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
|
||||||
static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }
|
static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }
|
||||||
static int GetSectorIndexX(float f) { return (int)GetSectorX(f); }
|
static int GetSectorIndexX(float f) { return (int)GetSectorX(f); }
|
||||||
|
|
|
@ -216,7 +216,7 @@ CCivilianPed::ProcessControl(void)
|
||||||
// fall through
|
// fall through
|
||||||
case PED_SEEK_POS:
|
case PED_SEEK_POS:
|
||||||
if (Seek()) {
|
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;
|
m_pNextPathNode = nil;
|
||||||
#ifdef TOGGLEABLE_BETA_FEATURES
|
#ifdef TOGGLEABLE_BETA_FEATURES
|
||||||
} else if (bRunningToPhone && m_objective < OBJECTIVE_FLEE_TILL_SAFE) {
|
} 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
|
} else if (m_objective == OBJECTIVE_GOTO_CHAR_ON_FOOT
|
||||||
&& m_pedInObjective && m_pedInObjective->m_nMoveState != PEDMOVE_STILL) {
|
&& m_pedInObjective && m_pedInObjective->m_nMoveState != PEDMOVE_STILL) {
|
||||||
SetMoveState(m_pedInObjective->m_nMoveState);
|
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();
|
SetIdle();
|
||||||
} else {
|
} else {
|
||||||
RestorePreviousState();
|
RestorePreviousState();
|
||||||
|
@ -422,9 +422,8 @@ void CCivilianPed::UseNearbyAttractors()
|
||||||
CSector* s = CWorld::GetSector(x, y);
|
CSector* s = CWorld::GetSector(x, y);
|
||||||
for (CPtrNode* pNode = s->m_lists[ENTITYLIST_BUILDINGS].first; pNode != nil; pNode = pNode->next) {
|
for (CPtrNode* pNode = s->m_lists[ENTITYLIST_BUILDINGS].first; pNode != nil; pNode = pNode->next) {
|
||||||
CEntity* pEntity = (CEntity*)pNode->item;
|
CEntity* pEntity = (CEntity*)pNode->item;
|
||||||
if (!pEntity->IsObject())
|
//if (pEntity->IsObject() && (CObject*)(pEntity)->IsBroken())
|
||||||
continue;
|
//continue;
|
||||||
// TODO: some flag check
|
|
||||||
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(pEntity->GetModelIndex());
|
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(pEntity->GetModelIndex());
|
||||||
for (int i = 0; i < pModelInfo->GetNum2dEffects(); i++) {
|
for (int i = 0; i < pModelInfo->GetNum2dEffects(); i++) {
|
||||||
C2dEffect* pEffect = pModelInfo->Get2dEffect(i);
|
C2dEffect* pEffect = pModelInfo->Get2dEffect(i);
|
||||||
|
@ -433,7 +432,7 @@ void CCivilianPed::UseNearbyAttractors()
|
||||||
if (!IsAttractedTo(pEffect->pedattr.type))
|
if (!IsAttractedTo(pEffect->pedattr.type))
|
||||||
continue;
|
continue;
|
||||||
CVector pos;
|
CVector pos;
|
||||||
CPedAttractorManager::ComputeEffectPos(pEffect, GetMatrix(), pos);
|
CPedAttractorManager::ComputeEffectPos(pEffect, pEntity->GetMatrix(), pos);
|
||||||
if ((pos - GetPosition()).MagnitudeSqr() < minDistance) {
|
if ((pos - GetPosition()).MagnitudeSqr() < minDistance) {
|
||||||
CPedAttractorManager* pManager = GetPedAttractorManager();
|
CPedAttractorManager* pManager = GetPedAttractorManager();
|
||||||
if (pManager->HasEmptySlot(pEffect) && pManager->IsApproachable(pEffect, pEntity->GetMatrix(), 0, this)) {
|
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) {
|
for (CPtrNode* pNode = s->m_lists[ENTITYLIST_OBJECTS].first; pNode != nil; pNode = pNode->next) {
|
||||||
CEntity* pEntity = (CEntity*)pNode->item;
|
CEntity* pEntity = (CEntity*)pNode->item;
|
||||||
if (!pEntity->IsObject())
|
//if (pEntity->IsObject() && (CObject*)(pEntity)->IsBroken())
|
||||||
continue;
|
//continue;
|
||||||
// TODO: some flag check
|
if (pEntity->GetModelIndex() == 3181)
|
||||||
|
debug("get2\n");
|
||||||
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(pEntity->GetModelIndex());
|
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(pEntity->GetModelIndex());
|
||||||
for (int i = 0; i < pModelInfo->GetNum2dEffects(); i++) {
|
for (int i = 0; i < pModelInfo->GetNum2dEffects(); i++) {
|
||||||
C2dEffect* pEffect = pModelInfo->Get2dEffect(i);
|
C2dEffect* pEffect = pModelInfo->Get2dEffect(i);
|
||||||
|
@ -457,7 +457,7 @@ void CCivilianPed::UseNearbyAttractors()
|
||||||
if (!IsAttractedTo(pEffect->pedattr.type))
|
if (!IsAttractedTo(pEffect->pedattr.type))
|
||||||
continue;
|
continue;
|
||||||
CVector pos;
|
CVector pos;
|
||||||
CPedAttractorManager::ComputeEffectPos(pEffect, GetMatrix(), pos);
|
CPedAttractorManager::ComputeEffectPos(pEffect, pEntity->GetMatrix(), pos);
|
||||||
if ((pos - GetPosition()).MagnitudeSqr() < minDistance) {
|
if ((pos - GetPosition()).MagnitudeSqr() < minDistance) {
|
||||||
CPedAttractorManager* pManager = GetPedAttractorManager();
|
CPedAttractorManager* pManager = GetPedAttractorManager();
|
||||||
if (pManager->HasEmptySlot(pEffect) && pManager->IsApproachable(pEffect, pEntity->GetMatrix(), 0, this)) {
|
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_STOP: return true;
|
||||||
case ATTRACTOR_PIZZA: return true;
|
case ATTRACTOR_PIZZA: return true;
|
||||||
case ATTRACTOR_SHELTER: return CWeather::Rain >= 0.2f;
|
case ATTRACTOR_SHELTER: return CWeather::Rain >= 0.2f;
|
||||||
case ATTRACTOR_ICECREAM: return true;
|
case ATTRACTOR_ICECREAM: return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5529,17 +5529,17 @@ CPed::SetWaitState(eWaitState state, void *time)
|
||||||
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
|
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
|
||||||
break;
|
break;
|
||||||
case WAITSTATE_SIT_DOWN:
|
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);
|
animAssoc->SetFinishCallback(FinishedWaitCB, this);
|
||||||
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 10000;
|
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 10000;
|
||||||
break;
|
break;
|
||||||
case WAITSTATE_SIT_UP:
|
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);
|
animAssoc->SetFinishCallback(FinishedWaitCB, this);
|
||||||
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 100000;
|
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 100000;
|
||||||
break;
|
break;
|
||||||
case WAITSTATE_SIT_IDLE:
|
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);
|
animAssoc->SetFinishCallback(FinishedWaitCB, this);
|
||||||
if (time)
|
if (time)
|
||||||
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + *(int*)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);
|
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + CGeneral::GetRandomNumberInRange(25000, 30000);
|
||||||
break;
|
break;
|
||||||
case WAITSTATE_USE_ATM:
|
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);
|
animAssoc->SetFinishCallback(FinishedWaitCB, this);
|
||||||
if (time)
|
if (time)
|
||||||
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + *(int*)time;
|
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + *(int*)time;
|
||||||
|
@ -14046,7 +14046,7 @@ CPed::ProcessObjective(void)
|
||||||
if (GetPedAttractorManager()->IsAtHeadOfQueue(this, m_attractor)) {
|
if (GetPedAttractorManager()->IsAtHeadOfQueue(this, m_attractor)) {
|
||||||
switch (m_objective) {
|
switch (m_objective) {
|
||||||
case OBJECTIVE_USE_SEAT_ATTRACTOR:
|
case OBJECTIVE_USE_SEAT_ATTRACTOR:
|
||||||
if (bTurnedAroundOnAttractor) {
|
if (!bTurnedAroundOnAttractor) {
|
||||||
ClearObjective();
|
ClearObjective();
|
||||||
SetWaitState(WAITSTATE_SIT_DOWN, 0);
|
SetWaitState(WAITSTATE_SIT_DOWN, 0);
|
||||||
}
|
}
|
||||||
|
@ -17998,19 +17998,19 @@ CPed::ClearWaitState(void)
|
||||||
AnimationId id;
|
AnimationId id;
|
||||||
switch (m_nWaitState) { // TODO(MIAMI): actual!
|
switch (m_nWaitState) { // TODO(MIAMI): actual!
|
||||||
case WAITSTATE_PLAYANIM_CHAT: id = ANIM_IDLE_CHAT; break;
|
case WAITSTATE_PLAYANIM_CHAT: id = ANIM_IDLE_CHAT; break;
|
||||||
case WAITSTATE_SIT_DOWN: id = ANIM_XPRESS_SCRATCH; break;
|
case WAITSTATE_SIT_DOWN: id = ANIM_HANDSUP; break;
|
||||||
case WAITSTATE_SIT_DOWN_RVRS: id = ANIM_XPRESS_SCRATCH; break;
|
case WAITSTATE_SIT_DOWN_RVRS: id = ANIM_HANDSUP; break;
|
||||||
case WAITSTATE_SIT_UP: id = ANIM_XPRESS_SCRATCH; break;
|
case WAITSTATE_SIT_UP: id = ANIM_HANDSUP; break;
|
||||||
case WAITSTATE_SIT_IDLE: id = ANIM_XPRESS_SCRATCH; break;
|
case WAITSTATE_SIT_IDLE: id = ANIM_HANDSUP; break;
|
||||||
case WAITSTATE_USE_ATM: id = ANIM_XPRESS_SCRATCH; break;
|
case WAITSTATE_USE_ATM: id = ANIM_HANDSUP; break;
|
||||||
}
|
}
|
||||||
CAnimBlendAssociation* pAssoc = RpAnimBlendClumpGetAssociation(GetClump(), id);
|
CAnimBlendAssociation* pAssoc = RpAnimBlendClumpGetAssociation(GetClump(), id);
|
||||||
if (pAssoc)
|
if (pAssoc)
|
||||||
pAssoc->blendDelta = -8.0f;
|
pAssoc->blendDelta = -8.0f;
|
||||||
if (m_attractor)
|
if (m_attractor)
|
||||||
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
|
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case WAITSTATE_RIOT:
|
case WAITSTATE_RIOT:
|
||||||
case WAITSTATE_FAST_FALL:
|
case WAITSTATE_FAST_FALL:
|
||||||
case WAITSTATE_BOMBER:
|
case WAITSTATE_BOMBER:
|
||||||
|
|
|
@ -485,7 +485,7 @@ bool CPedAttractorManager::BroadcastArrival(CPed* pPed, CPedAttractor* pAttracto
|
||||||
return false;
|
return false;
|
||||||
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
|
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
|
||||||
return nil;
|
return nil;
|
||||||
if (IsPedRegisteredWithEffect(pPed))
|
if (!IsPedRegisteredWithEffect(pPed))
|
||||||
return nil;
|
return nil;
|
||||||
switch (pAttractor->GetEffect()->pedattr.type) {
|
switch (pAttractor->GetEffect()->pedattr.type) {
|
||||||
case ATTRACTOR_ATM: return BroadcastArrival(pPed, pAttractor, vAtmAttractors);
|
case ATTRACTOR_ATM: return BroadcastArrival(pPed, pAttractor, vAtmAttractors);
|
||||||
|
@ -504,7 +504,7 @@ bool CPedAttractorManager::BroadcastDeparture(CPed* pPed, CPedAttractor* pAttrac
|
||||||
return false;
|
return false;
|
||||||
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
|
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
|
||||||
return nil;
|
return nil;
|
||||||
if (IsPedRegisteredWithEffect(pPed))
|
if (!IsPedRegisteredWithEffect(pPed))
|
||||||
return nil;
|
return nil;
|
||||||
switch (pAttractor->GetEffect()->pedattr.type) {
|
switch (pAttractor->GetEffect()->pedattr.type) {
|
||||||
case ATTRACTOR_ATM: return BroadcastDeparture(pPed, pAttractor, vAtmAttractors);
|
case ATTRACTOR_ATM: return BroadcastDeparture(pPed, pAttractor, vAtmAttractors);
|
||||||
|
@ -523,7 +523,7 @@ bool CPedAttractorManager::IsAtHeadOfQueue(CPed* pPed, CPedAttractor* pAttractor
|
||||||
return false;
|
return false;
|
||||||
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
|
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
|
||||||
return nil;
|
return nil;
|
||||||
if (IsPedRegisteredWithEffect(pPed))
|
if (!IsPedRegisteredWithEffect(pPed))
|
||||||
return nil;
|
return nil;
|
||||||
switch (pAttractor->GetEffect()->pedattr.type) {
|
switch (pAttractor->GetEffect()->pedattr.type) {
|
||||||
case ATTRACTOR_ATM: return IsAtHeadOfQueue(pPed, pAttractor, vAtmAttractors);
|
case ATTRACTOR_ATM: return IsAtHeadOfQueue(pPed, pAttractor, vAtmAttractors);
|
||||||
|
@ -542,7 +542,7 @@ bool CPedAttractorManager::IsInQueue(CPed* pPed, CPedAttractor* pAttractor)
|
||||||
return false;
|
return false;
|
||||||
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
|
if (pAttractor->GetEffect()->type != EFFECT_PED_ATTRACTOR)
|
||||||
return nil;
|
return nil;
|
||||||
if (IsPedRegisteredWithEffect(pPed))
|
if (!IsPedRegisteredWithEffect(pPed))
|
||||||
return nil;
|
return nil;
|
||||||
switch (pAttractor->GetEffect()->pedattr.type) {
|
switch (pAttractor->GetEffect()->pedattr.type) {
|
||||||
case ATTRACTOR_ATM: return IsInQueue(pPed, pAttractor, vAtmAttractors);
|
case ATTRACTOR_ATM: return IsInQueue(pPed, pAttractor, vAtmAttractors);
|
||||||
|
@ -747,13 +747,13 @@ bool CPedAttractorManager::IsApproachable(C2dEffect* pEffect, const CMatrix& mat
|
||||||
ComputeEffectPos(pEffect, matrix, vecEffectPos);
|
ComputeEffectPos(pEffect, matrix, vecEffectPos);
|
||||||
float dp = -DotProduct(vecUseDir, vecEffectPos);
|
float dp = -DotProduct(vecUseDir, vecEffectPos);
|
||||||
if (pEffect->pedattr.type == ATTRACTOR_ATM || pEffect->pedattr.type == ATTRACTOR_PIZZA || pEffect->pedattr.type == ATTRACTOR_ICECREAM) {
|
if (pEffect->pedattr.type == ATTRACTOR_ATM || pEffect->pedattr.type == ATTRACTOR_PIZZA || pEffect->pedattr.type == ATTRACTOR_ICECREAM) {
|
||||||
vecUseDir = vecUseDir;
|
vecUseDir = -vecUseDir;
|
||||||
dp = -dp;
|
dp = -dp;
|
||||||
}
|
}
|
||||||
if (dp + DotProduct(vecEffectPos, pPed->GetPosition()) > 0.0f) {
|
if (dp + DotProduct(vecEffectPos, pPed->GetPosition()) > 0.0f) {
|
||||||
CVector vecPedToAttractor = pPed->GetPosition() - vecEffectPos;
|
CVector vecPedToAttractor = pPed->GetPosition() - vecEffectPos;
|
||||||
vecPedToAttractor.Normalise();
|
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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -65,8 +65,8 @@ public:
|
||||||
uint8 probability;
|
uint8 probability;
|
||||||
};
|
};
|
||||||
struct PedAttractor {
|
struct PedAttractor {
|
||||||
CVector useDir;
|
|
||||||
CVector queueDir;
|
CVector queueDir;
|
||||||
|
CVector useDir;
|
||||||
int8 type;
|
int8 type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue