summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Population.cpp91
-rw-r--r--src/control/Population.h51
-rw-r--r--src/control/Replay.cpp4
-rw-r--r--src/control/Script.cpp8
4 files changed, 6 insertions, 148 deletions
diff --git a/src/control/Population.cpp b/src/control/Population.cpp
deleted file mode 100644
index d7e32dbf..00000000
--- a/src/control/Population.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-#include "common.h"
-#include "patcher.h"
-#include "Game.h"
-#include "General.h"
-#include "World.h"
-#include "Entity.h"
-#include "Population.h"
-
-PedGroup *CPopulation::ms_pPedGroups = (PedGroup*)0x6E9248;
-bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6;
-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::Update(void) { EAXJMP(0x4F39A0); }
-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;
-}
-
-int32
-CPopulation::ChooseCivilianOccupation(int32 group)
-{
- return ms_pPedGroups[group].models[CGeneral::GetRandomNumberInRange(0, 8)];
-}
-
-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
deleted file mode 100644
index 572d6f58..00000000
--- a/src/control/Population.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#pragma once
-
-#include "Game.h"
-
-class CPed;
-class CVehicle;
-
-struct PedGroup
-{
- int32 models[8];
-};
-
-class CPopulation
-{
-public:
- static PedGroup *ms_pPedGroups; //[31]
- static bool &ms_bGivePedsWeapons;
- static int32 &m_AllRandomPedsThisType;
- 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 Update(void);
- static void LoadPedGroups();
- static void UpdatePedCount(uint32, bool);
- static void DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool);
- static CPed *AddPedInCar(CVehicle *vehicle);
- static bool IsPointInSafeZone(CVector *coors);
- static void RemovePed(CEntity* ent);
- static int32 ChooseCivilianOccupation(int32);
-};
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index f36ef932..495c3840 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -819,7 +819,7 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
CStreaming::RequestModel(ph->mi, 0);
}
else {
- CPed* new_p = new(ph->index << 8) CCivilianPed(ph->pedtype, ph->mi);
+ CPed* new_p = new(ph->index << 8) CCivilianPed((ePedType)ph->pedtype, ph->mi);
new_p->m_status = STATUS_PLAYER_PLAYBACKFROMBUFFER;
new_p->GetMatrix().SetUnity();
CWorld::Add(new_p);
@@ -1169,7 +1169,7 @@ void CReplay::RestoreStuffFromMem(void)
ped->m_pVehicleAnim = 0;
ped->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, ped);
DMAudio.SetEntityStatus(ped->m_audioEntityId, true);
- CPopulation::UpdatePedCount(ped->m_nPedType, false);
+ CPopulation::UpdatePedCount((ePedType)ped->m_nPedType, false);
if (ped->m_wepModelID >= 0)
ped->AddWeaponModel(ped->m_wepModelID);
}
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 84d4f179..ab22cc7b 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1729,7 +1729,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
else if (ScriptParams[0] == PEDTYPE_EMERGENCY || ScriptParams[0] == PEDTYPE_FIREMAN)
ped = new CEmergencyPed(ScriptParams[1]);
else
- ped = new CCivilianPed(ScriptParams[0], ScriptParams[1]);
+ ped = new CCivilianPed((ePedType)ScriptParams[0], ScriptParams[1]);
ped->CharCreatedBy = MISSION_CHAR;
ped->bRespondsToThreats = false;
ped->bAllowMedicsToReviveMe = false;
@@ -2768,7 +2768,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
else if (ScriptParams[1] == PEDTYPE_EMERGENCY || ScriptParams[1] == PEDTYPE_FIREMAN)
pPed = new CEmergencyPed(ScriptParams[2]);
else
- pPed = new CCivilianPed(ScriptParams[1], ScriptParams[2]);
+ pPed = new CCivilianPed((ePedType)ScriptParams[1], ScriptParams[2]);
pPed->CharCreatedBy = MISSION_CHAR;
pPed->bRespondsToThreats = false;
pPed->bAllowMedicsToReviveMe = false;
@@ -3963,7 +3963,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
else if (ScriptParams[1] == PEDTYPE_EMERGENCY || ScriptParams[1] == PEDTYPE_FIREMAN)
pPed = new CEmergencyPed(ScriptParams[2]);
else
- pPed = new CCivilianPed(ScriptParams[1], ScriptParams[2]);
+ pPed = new CCivilianPed((ePedType)ScriptParams[1], ScriptParams[2]);
pPed->CharCreatedBy = MISSION_CHAR;
pPed->bRespondsToThreats = false;
pPed->bAllowMedicsToReviveMe = false;
@@ -7360,7 +7360,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
CZoneInfo zoneinfo;
CTheZones::GetZoneInfoForTimeOfDay(&CWorld::Players[CWorld::PlayerInFocus].GetPos(), &zoneinfo);
int mi;
- int pedtype = PEDTYPE_COP;
+ ePedType pedtype = PEDTYPE_COP;
int attempt = 0;
while (pedtype != PEDTYPE_CIVMALE && pedtype != PEDTYPE_CIVFEMALE && attempt < 5) {
mi = CPopulation::ChooseCivilianOccupation(zoneinfo.pedGroup);