more attractor fixes

This commit is contained in:
Nikolay Korolev 2020-05-16 11:30:58 +03:00
parent cf5db73117
commit 9067469f7c
3 changed files with 36 additions and 23 deletions

View file

@ -12,6 +12,8 @@ const int gcMaxSizeOfPizzaQueue = 5;
const int gcMaxSizeOfShelterQueue = 5; const int gcMaxSizeOfShelterQueue = 5;
const int gcMaxSizeOfIceCreamQueue = 1; const int gcMaxSizeOfIceCreamQueue = 1;
//--MIAMI: file done, except TODO(MIAMI)
std::vector<CVector> CPedShelterAttractor::ms_displacements; std::vector<CVector> CPedShelterAttractor::ms_displacements;
CPedAttractorManager* GetPedAttractorManager() CPedAttractorManager* GetPedAttractorManager()
@ -163,6 +165,23 @@ CPedAttractor::CPedAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 ma
CPedAttractorManager::ComputeEffectUseDir(pEffect, matrix, vecUseDir); CPedAttractorManager::ComputeEffectUseDir(pEffect, matrix, vecUseDir);
} }
void CPedPizzaAttractor::UpdatePedStateOnDeparture(CPed* pPed) const
{
/* TODO(MIAMI): uncomment
if (pPed->m_nPedMoney > 10)
pPed->m_nPedMoney -= 10;
else
pPed->m_nPedMoney = 0;
*/
}
void CPedAtmAttractor::UpdatePedStateOnDeparture(CPed* pPed) const
{
/* TODO(MIAMI): uncomment
pPed->m_nPedMoney += 20 * CGeneral::GetRandomNumberInRange(1, 51);
*/
};
float CPedAttractor::ComputeDeltaHeading() const float CPedAttractor::ComputeDeltaHeading() const
{ {
return CGeneral::GetRandomNumberInRange(-m_fMaxHeadingDisplacement, m_fMaxHeadingDisplacement); return CGeneral::GetRandomNumberInRange(-m_fMaxHeadingDisplacement, m_fMaxHeadingDisplacement);

View file

@ -114,7 +114,7 @@ public:
bool RegisterPed(CPed*); bool RegisterPed(CPed*);
bool BroadcastArrival(CPed*); bool BroadcastArrival(CPed*);
CPedAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float unk8, float unk9, float posdisp, float headdisp); CPedAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp);
C2dEffect* GetEffect() const { return p2dEffect; } C2dEffect* GetEffect() const { return p2dEffect; }
const CVector& GetEffectPos() const { return vecEffectPos; } const CVector& GetEffectPos() const { return vecEffectPos; }
@ -127,9 +127,9 @@ class CPedAtmAttractor : public CPedAttractor
{ {
public: public:
virtual ePedAttractorType GetType() const override { return ATTRACTOR_ATM; }; virtual ePedAttractorType GetType() const override { return ATTRACTOR_ATM; };
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override { /* pPed->m_money += 20 * CGeneral::GetRandomNumberInRange(1, 51); */ }; virtual void UpdatePedStateOnDeparture(CPed* pPed) const override;
CPedAtmAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float unk8, float unk9, float posdisp, float headdisp) : CPedAtmAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, unk8, unk9, posdisp, headdisp) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{}; {};
}; };
@ -139,8 +139,8 @@ public:
virtual ~CPedIceCreamAttractor() override { GetPedAttractorManager()->RemoveIceCreamVanEffects(p2dEffect); } virtual ~CPedIceCreamAttractor() override { GetPedAttractorManager()->RemoveIceCreamVanEffects(p2dEffect); }
virtual ePedAttractorType GetType() const override { return ATTRACTOR_ICECREAM; } virtual ePedAttractorType GetType() const override { return ATTRACTOR_ICECREAM; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {}; virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {};
CPedIceCreamAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float unk8, float unk9, float posdisp, float headdisp) : CPedIceCreamAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, unk8, unk9, posdisp, headdisp) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{}; {};
}; };
@ -149,16 +149,9 @@ class CPedPizzaAttractor : public CPedAttractor
public: public:
virtual float GetHeadOfQueueWaitTime() override { return 2000.0f; } virtual float GetHeadOfQueueWaitTime() override { return 2000.0f; }
virtual ePedAttractorType GetType() const override { return ATTRACTOR_PIZZA; } virtual ePedAttractorType GetType() const override { return ATTRACTOR_PIZZA; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override virtual void UpdatePedStateOnDeparture(CPed* pPed) const override;
{ /* CPedPizzaAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
if (pPed->m_money > 10) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
pPed->m_money -= 10;
else
pPed->m_money = 0;
*/
}
CPedPizzaAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float unk8, float unk9, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, unk8, unk9, posdisp, headdisp)
{}; {};
}; };
@ -167,8 +160,8 @@ class CPedSeatAttractor : public CPedAttractor
public: public:
virtual ePedAttractorType GetType() const override { return ATTRACTOR_SEAT; } virtual ePedAttractorType GetType() const override { return ATTRACTOR_SEAT; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {}; virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {};
CPedSeatAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float unk8, float unk9, float posdisp, float headdisp) : CPedSeatAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, unk8, unk9, posdisp, headdisp) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{}; {};
}; };
@ -183,8 +176,8 @@ public:
virtual void ComputeAttractPos(int qid, CVector& pos) const override; virtual void ComputeAttractPos(int qid, CVector& pos) const override;
virtual void ComputeAttractHeading(int qid, float& heading) const override; virtual void ComputeAttractHeading(int qid, float& heading) const override;
CPedShelterAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float unk8, float unk9, float posdisp, float headdisp) : CPedShelterAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, unk8, unk9, posdisp, headdisp) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{}; {};
@ -197,7 +190,7 @@ public:
virtual ePedAttractorType GetType() const override { return ATTRACTOR_STOP; } virtual ePedAttractorType GetType() const override { return ATTRACTOR_STOP; }
virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {}; virtual void UpdatePedStateOnDeparture(CPed* pPed) const override {};
CPedStopAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float unk8, float unk9, float posdisp, float headdisp) : CPedStopAttractor(C2dEffect* pEffect, const CMatrix& matrix, int32 maxpeds, float qdist, float waitTime, float approachTime, float distance, float headingdiff, float posdisp, float headdisp) :
CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, unk8, unk9, posdisp, headdisp) CPedAttractor(pEffect, matrix, maxpeds, qdist, waitTime, approachTime, distance, headingdiff, posdisp, headdisp)
{}; {};
}; };

View file

@ -1123,7 +1123,8 @@ CPopulation::AddDeadPedInFrontOfCar(const CVector& pos, CVehicle* pCulprit)
return nil; return nil;
CPed* pPed = CPopulation::AddPed(PEDTYPE_CIVMALE, MI_MALE01, pos); // TODO(MIAMI): 4th parameter CPed* pPed = CPopulation::AddPed(PEDTYPE_CIVMALE, MI_MALE01, pos); // TODO(MIAMI): 4th parameter
pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f); pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
//TODO(MIAMI): set money == 0 //TODO(MIAMI): uncomment
//pPed->m_nPedMoney = 0;
pPed->bDeadPedInFrontOfCar = true; pPed->bDeadPedInFrontOfCar = true;
pPed->m_vehicleInAccident = pCulprit; pPed->m_vehicleInAccident = pCulprit;
pCulprit->RegisterReference((CEntity**)&pPed->m_vehicleInAccident); pCulprit->RegisterReference((CEntity**)&pPed->m_vehicleInAccident);