From 32f2f3511c1a6d74c1347542f8c1b76f40677e01 Mon Sep 17 00:00:00 2001 From: nmzik Date: Fri, 18 Oct 2019 15:36:40 +0300 Subject: CPopulation::Initialise() --- src/control/Population.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++ src/control/Population.h | 21 +++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/src/control/Population.cpp b/src/control/Population.cpp index 3e7ab427..39c2b57d 100644 --- a/src/control/Population.cpp +++ b/src/control/Population.cpp @@ -11,15 +11,73 @@ int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570; float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C; uint32 &CPopulation::ms_nTotalMissionPeds = *(uint32*)0x8F5F70; int32 &CPopulation::MaxNumberOfPedsInUse = *(int32*)0x5FA574; +uint32& CPopulation::ms_nNumCivMale = *(uint32*)0x8F2548; +uint32& CPopulation::ms_nNumCivFemale = *(uint32*)0x8F5F44; +uint32& CPopulation::ms_nNumCop = *(uint32*)0x885AFC; +bool& CPopulation::bZoneChangeHasHappened = *(bool*)0x95CD79; +uint32& CPopulation::ms_nNumEmergency = *(uint32*)0x94071C; +uint32& CPopulation::m_CountDownToPedsAtStart = *(uint32*)0x95CD4F; +uint32& CPopulation::ms_nNumGang1 = *(uint32*)0x8F1B1C; +uint32& CPopulation::ms_nNumGang2 = *(uint32*)0x8F1B14; +uint32& CPopulation::ms_nTotalPeds = *(uint32*)0x95CB50; +uint32& CPopulation::ms_nNumGang3 = *(uint32*)0x8F2548; +uint32& CPopulation::ms_nTotalGangPeds = *(uint32*)0x885AF0; +uint32& CPopulation::ms_nNumGang4 = *(uint32*)0x8F1B2C; +uint32& CPopulation::ms_nTotalCivPeds = *(uint32*)0x8F2C3C; +uint32& CPopulation::ms_nNumGang5 = *(uint32*)0x8F1B30; +uint32& CPopulation::ms_nNumDummy = *(uint32*)0x8F1A98; +uint32& CPopulation::ms_nNumGang6 = *(uint32*)0x8F1B20; +uint32& CPopulation::ms_nNumGang9 = *(uint32*)0x8F1B10; +uint32& CPopulation::ms_nNumGang7 = *(uint32*)0x8F1B28; +uint32& CPopulation::ms_nNumGang8 = *(uint32*)0x8F1B0C; +WRAPPER void CPopulation::LoadPedGroups() { EAXJMP(0x4F3870); } WRAPPER void CPopulation::UpdatePedCount(uint32, bool) { EAXJMP(0x4F5A60); } WRAPPER void CPopulation::DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool) { EAXJMP(0x4F6200); } WRAPPER CPed *CPopulation::AddPedInCar(CVehicle *vehicle) { EAXJMP(0x4F5800); } WRAPPER bool CPopulation::IsPointInSafeZone(CVector *coors) { EAXJMP(0x4F60C0); } +void +CPopulation::Initialise() +{ + debug("Initialising CPopulation...\n"); + + ms_nNumCivMale = 0; + m_AllRandomPedsThisType = -1; + ms_nNumCivFemale = 0; + PedDensityMultiplier = 1.0; + ms_nNumCop = 0; + bZoneChangeHasHappened = 0; + ms_nNumEmergency = 0; + m_CountDownToPedsAtStart = 2; + ms_nNumGang1 = 0; + ms_nTotalMissionPeds = 0; + ms_nNumGang2 = 0; + ms_nTotalPeds = 0; + ms_nNumGang3 = 0; + ms_nTotalGangPeds = 0; + ms_nNumGang4 = 0; + ms_nTotalCivPeds = 0; + ms_nNumGang5 = 0; + ms_nNumDummy = 0; + ms_nNumGang6 = 0; + ms_nNumGang9 = 0; + ms_nNumGang7 = 0; + ms_nNumGang8 = 0; + + LoadPedGroups(); + DealWithZoneChange(LEVEL_COMMERCIAL, LEVEL_INDUSTRIAL, true); + + debug("CPopulation ready\n"); +} + void CPopulation::RemovePed(CEntity* ent) { CWorld::Remove(ent); delete ent; } + +STARTPATCHES +InjectHook(0x4F3770, CPopulation::Initialise, PATCH_JUMP); +ENDPATCHES \ No newline at end of file diff --git a/src/control/Population.h b/src/control/Population.h index 7757a7a6..09218f1b 100644 --- a/src/control/Population.h +++ b/src/control/Population.h @@ -19,7 +19,28 @@ public: static float &PedDensityMultiplier; static uint32 &ms_nTotalMissionPeds; static int32 &MaxNumberOfPedsInUse; + static uint32& ms_nNumCivMale; + static uint32 &ms_nNumCivFemale; + static uint32 &ms_nNumCop; + static bool &bZoneChangeHasHappened; + static uint32 &ms_nNumEmergency; + static uint32& m_CountDownToPedsAtStart; + static uint32& ms_nNumGang1; + static uint32& ms_nNumGang2; + static uint32& ms_nTotalPeds; + static uint32& ms_nNumGang3; + static uint32& ms_nTotalGangPeds; + static uint32& ms_nNumGang4; + static uint32& ms_nTotalCivPeds; + static uint32& ms_nNumGang5; + static uint32& ms_nNumDummy; + static uint32& ms_nNumGang6; + static uint32& ms_nNumGang9; + static uint32& ms_nNumGang7; + static uint32& ms_nNumGang8; + static void Initialise(); + static void LoadPedGroups(); static void UpdatePedCount(uint32, bool); static void DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool); static CPed *AddPedInCar(CVehicle *vehicle); -- cgit v1.2.3