summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-02-22 13:36:22 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2020-02-22 13:36:22 +0100
commita312e1ff81df0f00f528f237d4014bd5b24dae12 (patch)
tree910dc04b4158a47cdd3b8f6512db84a17cd010f9 /src/control
parentfixes (diff)
parentMerge pull request #329 from erorcun/erorcun (diff)
downloadre3-a312e1ff81df0f00f528f237d4014bd5b24dae12.tar
re3-a312e1ff81df0f00f528f237d4014bd5b24dae12.tar.gz
re3-a312e1ff81df0f00f528f237d4014bd5b24dae12.tar.bz2
re3-a312e1ff81df0f00f528f237d4014bd5b24dae12.tar.lz
re3-a312e1ff81df0f00f528f237d4014bd5b24dae12.tar.xz
re3-a312e1ff81df0f00f528f237d4014bd5b24dae12.tar.zst
re3-a312e1ff81df0f00f528f237d4014bd5b24dae12.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Gangs.h5
-rw-r--r--src/control/Population.cpp92
-rw-r--r--src/control/Population.h53
-rw-r--r--src/control/Replay.cpp4
-rw-r--r--src/control/Script.cpp8
5 files changed, 10 insertions, 152 deletions
diff --git a/src/control/Gangs.h b/src/control/Gangs.h
index dd24ddcb..93ebe663 100644
--- a/src/control/Gangs.h
+++ b/src/control/Gangs.h
@@ -34,12 +34,15 @@ class CGangs
public:
static void Initialize(void);
static void SetGangVehicleModel(int16, int32);
- static int32 GetGangVehicleModel(int16 gang) { return Gang[gang].m_nVehicleMI; }
static void SetGangWeapons(int16, eWeaponType, eWeaponType);
static void SetGangPedModelOverride(int16, int8);
static int8 GetGangPedModelOverride(int16);
static void SaveAllGangData(uint8 *, uint32 *);
static void LoadAllGangData(uint8 *, uint32);
+
+ static int32 GetGangVehicleModel(int16 gang) { return Gang[gang].m_nVehicleMI; }
+ static eWeaponType GetGangWeapon1(int16 gang) { return Gang[gang].m_Weapon1; }
+ static eWeaponType GetGangWeapon2(int16 gang) { return Gang[gang].m_Weapon2; }
static CGangInfo* GetGangInfo(int16 gang) { return &Gang[gang]; }
private:
diff --git a/src/control/Population.cpp b/src/control/Population.cpp
deleted file mode 100644
index 46831d7e..00000000
--- a/src/control/Population.cpp
+++ /dev/null
@@ -1,92 +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); }
-WRAPPER void CPopulation::ConvertToRealObject(CDummyObject* obj) { EAXJMP(0x4F45A0); }
-
-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 d3bc3e39..00000000
--- a/src/control/Population.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#pragma once
-
-#include "Game.h"
-
-class CPed;
-class CVehicle;
-class CDummyObject;
-
-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);
- static void ConvertToRealObject(CDummyObject*);
-};
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 d31958f3..5cd2a4d3 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1757,7 +1757,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;
@@ -2796,7 +2796,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;
@@ -3991,7 +3991,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;
@@ -7388,7 +7388,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);