summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-28 12:34:02 +0200
committeraap <aap@papnet.eu>2019-06-28 12:34:02 +0200
commit847720aeae362868d8a3fa2681ef71f2c417399a (patch)
tree7845917dccc4f33b158e64ee458ac143b94efaa9
parentMerge pull request #59 from Nick007J/master (diff)
downloadre3-847720aeae362868d8a3fa2681ef71f2c417399a.tar
re3-847720aeae362868d8a3fa2681ef71f2c417399a.tar.gz
re3-847720aeae362868d8a3fa2681ef71f2c417399a.tar.bz2
re3-847720aeae362868d8a3fa2681ef71f2c417399a.tar.lz
re3-847720aeae362868d8a3fa2681ef71f2c417399a.tar.xz
re3-847720aeae362868d8a3fa2681ef71f2c417399a.tar.zst
re3-847720aeae362868d8a3fa2681ef71f2c417399a.zip
-rw-r--r--src/Streaming.cpp275
-rw-r--r--src/Streaming.h18
-rw-r--r--src/Timer.cpp4
-rw-r--r--src/control/CarCtrl.cpp5
-rw-r--r--src/control/CarCtrl.h3
-rw-r--r--src/control/Gangs.cpp8
-rw-r--r--src/control/Gangs.h36
-rw-r--r--src/control/Population.cpp3
-rw-r--r--src/control/Population.h8
-rw-r--r--src/control/Record.h6
-rw-r--r--src/re3.cpp2
11 files changed, 334 insertions, 34 deletions
diff --git a/src/Streaming.cpp b/src/Streaming.cpp
index 7d633d90..f75f358a 100644
--- a/src/Streaming.cpp
+++ b/src/Streaming.cpp
@@ -19,6 +19,11 @@
#include "CullZones.h"
#include "Radar.h"
#include "Camera.h"
+#include "Record.h"
+#include "CarCtrl.h"
+#include "Population.h"
+#include "Gangs.h"
+#include "CutsceneMgr.h"
#include "CdStream.h"
#include "Streaming.h"
@@ -47,6 +52,7 @@ int32 &CStreaming::ms_currentPedGrp = *(int32*)0x8F2BBC;
int32 CStreaming::ms_currentPedLoading;
int32 CStreaming::ms_lastCullZone;
uint16 &CStreaming::ms_loadedGangs = *(uint16*)0x95CC60;
+uint16 &CStreaming::ms_loadedGangCars = *(uint16*)0x95CC2E;
int32 *CStreaming::ms_imageOffsets = (int32*)0x6E60A0;
int32 &CStreaming::ms_lastImageRead = *(int32*)0x880E2C;
int32 &CStreaming::ms_imageSize = *(int32*)0x8F1A34;
@@ -241,6 +247,53 @@ CStreaming::Shutdown(void)
}
void
+CStreaming::Update(void)
+{
+ CEntity *train;
+ CVector playerPos;
+ CStreamingInfo *si, *prev;
+ bool requestedSubway = false;
+
+ UpdateMemoryUsed();
+
+ if(ms_channelError != -1){
+ RetryLoadFile(ms_channelError);
+ return;
+ }
+
+ if(CTimer::GetIsPaused())
+ return;
+
+ train = FindPlayerTrain();
+ if(train && train->GetPosition().z < 0.0f){
+ RequestSubway();
+ requestedSubway = true;
+ }else if(!ms_disableStreaming)
+ AddModelsToRequestList(TheCamera.GetPosition());
+
+ DeleteFarAwayRwObjects(TheCamera.GetPosition());
+
+ if(!ms_disableStreaming &&
+ !CCutsceneMgr::IsRunning() &&
+ !requestedSubway &&
+ !CGame::playingIntro &&
+ ms_numModelsRequested < 5 &&
+ !CRenderer::m_loadingPriority){
+ StreamVehiclesAndPeds();
+ FindPlayerCoors(playerPos);
+ StreamZoneModels(playerPos);
+ }
+
+ LoadRequestedModels();
+
+ for(si = ms_endRequestedList.m_prev; si != &ms_startRequestedList; si = prev){
+ prev = si->m_prev;
+ if((si->m_flags & (STREAMFLAGS_KEEP_IN_MEMORY|STREAMFLAGS_PRIORITY)) == 0)
+ RemoveModel(si - ms_aInfoForModel);
+ }
+}
+
+void
CStreaming::LoadCdDirectory(void)
{
char dirname[132];
@@ -705,6 +758,18 @@ CStreaming::RequestSpecialChar(int32 charId, const char *modelName, int32 flags)
RequestSpecialModel(charId + MI_SPECIAL01, modelName, flags);
}
+bool
+CStreaming::HasSpecialCharLoaded(int32 id)
+{
+ return HasModelLoaded(id + MI_SPECIAL01);
+}
+
+void
+CStreaming::SetMissionDoesntRequireSpecialChar(int32 id)
+{
+ return SetMissionDoesntRequireModel(id + MI_SPECIAL01);
+}
+
void
CStreaming::DecrementRef(int32 id)
{
@@ -1176,6 +1241,181 @@ CStreaming::LoadInitialVehicles(void)
RequestModel(id, STREAMFLAGS_DONT_REMOVE);
}
+void
+CStreaming::StreamVehiclesAndPeds(void)
+{
+ int i, model;
+ static int timeBeforeNextLoad = 0;
+ static int modelQualityClass = 0;
+
+ if(CRecordDataForGame::RecordingState == RECORDSTATE_1 ||
+ CRecordDataForGame::RecordingState == RECORDSTATE_2)
+ return;
+
+ if(FindPlayerPed()->m_pWanted->AreSwatRequired()){
+ RequestModel(MI_ENFORCER, STREAMFLAGS_DONT_REMOVE);
+ RequestModel(MI_SWAT, STREAMFLAGS_DONT_REMOVE);
+ }else{
+ SetModelIsDeletable(MI_ENFORCER);
+ if(!HasModelLoaded(MI_ENFORCER))
+ SetModelIsDeletable(MI_SWAT);
+ }
+
+ if(FindPlayerPed()->m_pWanted->AreFbiRequired()){
+ RequestModel(MI_FBICAR, STREAMFLAGS_DONT_REMOVE);
+ RequestModel(MI_FBI, STREAMFLAGS_DONT_REMOVE);
+ }else{
+ SetModelIsDeletable(MI_FBICAR);
+ if(!HasModelLoaded(MI_FBICAR))
+ SetModelIsDeletable(MI_FBI);
+ }
+
+ if(FindPlayerPed()->m_pWanted->AreArmyRequired()){
+ RequestModel(MI_RHINO, STREAMFLAGS_DONT_REMOVE);
+ RequestModel(MI_BARRACKS, STREAMFLAGS_DONT_REMOVE);
+ RequestModel(MI_ARMY, STREAMFLAGS_DONT_REMOVE);
+ }else{
+ SetModelIsDeletable(MI_RHINO);
+ SetModelIsDeletable(MI_BARRACKS);
+ if(!HasModelLoaded(MI_RHINO) && !HasModelLoaded(MI_BARRACKS))
+ SetModelIsDeletable(MI_ARMY);
+ }
+
+ if(FindPlayerPed()->m_pWanted->NumOfHelisRequired() > 0)
+ RequestModel(MI_CHOPPER, STREAMFLAGS_DONT_REMOVE);
+ else
+ SetModelIsDeletable(MI_CHOPPER);
+
+ if(timeBeforeNextLoad >= 0)
+ timeBeforeNextLoad--;
+ else if(ms_numVehiclesLoaded <= desiredNumVehiclesLoaded){
+ for(i = 0; i <= 10; i++){
+ model = CCarCtrl::ChooseCarModel(modelQualityClass);
+ modelQualityClass++;
+ if(modelQualityClass >= NUM_VEHICLE_CLASSES)
+ modelQualityClass = 0;
+
+ // check if we want to load this model
+ if(ms_aInfoForModel[model].m_loadState == STREAMSTATE_NOTLOADED &&
+ ((CVehicleModelInfo*)CModelInfo::GetModelInfo(model))->m_level & (1 << (CGame::currLevel-1)))
+ break;
+ }
+
+ if(i <= 10){
+ RequestModel(model, STREAMFLAGS_DEPENDENCY);
+ timeBeforeNextLoad = 500;
+ }
+ }
+}
+
+void
+CStreaming::StreamZoneModels(const CVector &pos)
+{
+ int i;
+ uint16 gangsToLoad, gangCarsToLoad, bit;
+ CZoneInfo info;
+
+ CTheZones::GetZoneInfoForTimeOfDay(&pos, &info);
+
+ if(info.pedGroup != ms_currentPedGrp){
+
+ // unload pevious group
+ if(ms_currentPedGrp != -1)
+ for(i = 0; i < 8; i++){
+ if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
+ break;
+ SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
+ SetModelTxdIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
+ }
+
+ ms_currentPedGrp = info.pedGroup;
+
+ for(i = 0; i < 8; i++){
+ if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
+ break;
+ RequestModel(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i], STREAMFLAGS_DONT_REMOVE);
+ }
+ }
+ RequestModel(MI_MALE01, STREAMFLAGS_DONT_REMOVE);
+
+ gangsToLoad = 0;
+ gangCarsToLoad = 0;
+ if(info.gangDensity[0] != 0) gangsToLoad |= 1<<0;
+ if(info.gangDensity[1] != 0) gangsToLoad |= 1<<1;
+ if(info.gangDensity[2] != 0) gangsToLoad |= 1<<2;
+ if(info.gangDensity[3] != 0) gangsToLoad |= 1<<3;
+ if(info.gangDensity[4] != 0) gangsToLoad |= 1<<4;
+ if(info.gangDensity[5] != 0) gangsToLoad |= 1<<5;
+ if(info.gangDensity[6] != 0) gangsToLoad |= 1<<6;
+ if(info.gangDensity[7] != 0) gangsToLoad |= 1<<7;
+ if(info.gangDensity[8] != 0) gangsToLoad |= 1<<8;
+ if(info.gangThreshold[0] != info.copDensity) gangCarsToLoad |= 1<<0;
+ if(info.gangThreshold[1] != info.gangThreshold[0]) gangCarsToLoad |= 1<<1;
+ if(info.gangThreshold[2] != info.gangThreshold[1]) gangCarsToLoad |= 1<<2;
+ if(info.gangThreshold[3] != info.gangThreshold[2]) gangCarsToLoad |= 1<<3;
+ if(info.gangThreshold[4] != info.gangThreshold[3]) gangCarsToLoad |= 1<<4;
+ if(info.gangThreshold[5] != info.gangThreshold[4]) gangCarsToLoad |= 1<<5;
+ if(info.gangThreshold[6] != info.gangThreshold[5]) gangCarsToLoad |= 1<<6;
+ if(info.gangThreshold[7] != info.gangThreshold[6]) gangCarsToLoad |= 1<<7;
+ if(info.gangThreshold[8] != info.gangThreshold[7]) gangCarsToLoad |= 1<<8;
+
+ if(gangsToLoad == ms_loadedGangs && gangCarsToLoad == ms_loadedGangCars)
+ return;
+
+ // This makes things simpler than the game does it
+ gangsToLoad |= gangCarsToLoad;
+
+ for(i = 0; i < NUM_GANGS; i++){
+ bit = 1<<i;
+
+ if(gangsToLoad & bit && (ms_loadedGangs & bit) == 0){
+ RequestModel(MI_GANG01 + i*2, STREAMFLAGS_DONT_REMOVE);
+ RequestModel(MI_GANG01 + i*2 + 1, STREAMFLAGS_DONT_REMOVE);
+ ms_loadedGangs |= bit;
+ }else if((gangsToLoad & bit) == 0 && ms_loadedGangs & bit){
+ SetModelIsDeletable(MI_GANG01 + i*2);
+ SetModelIsDeletable(MI_GANG01 + i*2 + 1);
+ SetModelTxdIsDeletable(MI_GANG01 + i*2);
+ SetModelTxdIsDeletable(MI_GANG01 + i*2 + 1);
+ ms_loadedGangs &= ~bit;
+ }
+
+ if(gangCarsToLoad & bit && (ms_loadedGangCars & bit) == 0){
+ RequestModel(CGangs::GetGangInfo(i)->m_nVehicleMI, STREAMFLAGS_DONT_REMOVE);
+ }else if((gangCarsToLoad & bit) == 0 && ms_loadedGangCars & bit){
+ SetModelIsDeletable(CGangs::GetGangInfo(i)->m_nVehicleMI);
+ SetModelTxdIsDeletable(CGangs::GetGangInfo(i)->m_nVehicleMI);
+ }
+ }
+ ms_loadedGangCars = gangCarsToLoad;
+}
+
+void
+CStreaming::RemoveCurrentZonesModels(void)
+{
+ int i;
+
+ if(ms_currentPedGrp != -1)
+ for(i = 0; i < 8; i++){
+ if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
+ break;
+ if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != MI_MALE01)
+ SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
+ }
+
+ for(i = 0; i < NUM_GANGS; i++){
+ SetModelIsDeletable(MI_GANG01 + i*2);
+ SetModelIsDeletable(MI_GANG01 + i*2 + 1);
+ if(CGangs::GetGangInfo(i)->m_nVehicleMI != -1)
+ SetModelIsDeletable(CGangs::GetGangInfo(i)->m_nVehicleMI);
+ }
+
+ ms_currentPedGrp = -1;
+ ms_loadedGangs = 0;
+ ms_loadedGangCars = 0;
+}
+
+
// Find starting offset of the cdimage we next want to read
// Not useful at all on PC...
@@ -2166,9 +2406,35 @@ CStreaming::LoadScene(const CVector &pos)
debug("End load scene\n");
}
+void
+CStreaming::MemoryCardSave(uint8 *buffer, uint32 *length)
+{
+ int i;
+
+ *length = NUM_DEFAULT_MODELS;
+ for(i = 0; i < NUM_DEFAULT_MODELS; i++)
+ if(ms_aInfoForModel[i].m_loadState == STREAMSTATE_LOADED)
+ buffer[i] = ms_aInfoForModel[i].m_flags;
+ else
+ buffer[i] = 0xFF;
+}
+
+void
+CStreaming::MemoryCardLoad(uint8 *buffer, uint32 length)
+{
+ uint32 i;
+
+ assert(length == NUM_DEFAULT_MODELS);
+ for(i = 0; i < length; i++)
+ if(ms_aInfoForModel[i].m_loadState == STREAMSTATE_LOADED)
+ if(buffer[i] != 0xFF)
+ ms_aInfoForModel[i].m_flags = buffer[i];
+}
+
STARTPATCHES
InjectHook(0x406430, CStreaming::Init, PATCH_JUMP);
InjectHook(0x406C80, CStreaming::Shutdown, PATCH_JUMP);
+ InjectHook(0x4076C0, CStreaming::Update, PATCH_JUMP);
InjectHook(0x406CC0, (void (*)(void))CStreaming::LoadCdDirectory, PATCH_JUMP);
InjectHook(0x406DA0, (void (*)(const char*, int))CStreaming::LoadCdDirectory, PATCH_JUMP);
InjectHook(0x409740, CStreaming::ConvertBufferToObject, PATCH_JUMP);
@@ -2179,6 +2445,9 @@ STARTPATCHES
InjectHook(0x408210, CStreaming::RequestIslands, PATCH_JUMP);
InjectHook(0x40A890, CStreaming::RequestSpecialModel, PATCH_JUMP);
InjectHook(0x40ADA0, CStreaming::RequestSpecialChar, PATCH_JUMP);
+ InjectHook(0x54A5F0, CStreaming::HasModelLoaded, PATCH_JUMP);
+ InjectHook(0x40ADC0, CStreaming::HasSpecialCharLoaded, PATCH_JUMP);
+ InjectHook(0x40ADE0, CStreaming::SetMissionDoesntRequireSpecialChar, PATCH_JUMP);
InjectHook(0x408830, CStreaming::RemoveModel, PATCH_JUMP);
InjectHook(0x4083A0, CStreaming::RemoveUnusedBuildings, PATCH_JUMP);
@@ -2202,6 +2471,9 @@ STARTPATCHES
InjectHook(0x40AA00, CStreaming::LoadInitialPeds, PATCH_JUMP);
InjectHook(0x40ADF0, CStreaming::LoadInitialVehicles, PATCH_JUMP);
+ InjectHook(0x40AE60, CStreaming::StreamVehiclesAndPeds, PATCH_JUMP);
+ InjectHook(0x40AA30, CStreaming::StreamZoneModels, PATCH_JUMP);
+ InjectHook(0x40AD00, CStreaming::RemoveCurrentZonesModels, PATCH_JUMP);
InjectHook(0x409BE0, CStreaming::ProcessLoadingChannel, PATCH_JUMP);
InjectHook(0x40A610, CStreaming::FlushChannels, PATCH_JUMP);
@@ -2228,6 +2500,9 @@ STARTPATCHES
InjectHook(0x409B70, CStreaming::MakeSpaceFor, PATCH_JUMP);
InjectHook(0x40A6D0, CStreaming::LoadScene, PATCH_JUMP);
+ InjectHook(0x40B210, CStreaming::MemoryCardSave, PATCH_JUMP);
+ InjectHook(0x40B250, CStreaming::MemoryCardLoad, PATCH_JUMP);
+
InjectHook(0x4063E0, &CStreamingInfo::GetCdPosnAndSize, PATCH_JUMP);
InjectHook(0x406410, &CStreamingInfo::SetCdPosnAndSize, PATCH_JUMP);
InjectHook(0x4063D0, &CStreamingInfo::GetCdSize, PATCH_JUMP);
diff --git a/src/Streaming.h b/src/Streaming.h
index 4caefb6d..d0c6fc68 100644
--- a/src/Streaming.h
+++ b/src/Streaming.h
@@ -10,7 +10,7 @@ enum StreamFlags
{
STREAMFLAGS_DONT_REMOVE = 0x01,
STREAMFLAGS_SCRIPTOWNED = 0x02,
- STREAMFLAGS_DEPENDENCY = 0x04,
+ STREAMFLAGS_DEPENDENCY = 0x04, // Is this right?
STREAMFLAGS_PRIORITY = 0x08,
STREAMFLAGS_NOFADE = 0x10,
@@ -99,6 +99,7 @@ public:
static int32 &ms_currentPedGrp;
static int32 ms_lastCullZone;
static uint16 &ms_loadedGangs;
+ static uint16 &ms_loadedGangCars;
static int32 ms_currentPedLoading;
static int32 *ms_imageOffsets; //[NUMCDIMAGES]
static int32 &ms_lastImageRead;
@@ -107,10 +108,12 @@ public:
static void Init(void);
static void Shutdown(void);
+ static void Update(void);
static void LoadCdDirectory(void);
static void LoadCdDirectory(const char *dirname, int32 n);
static bool ConvertBufferToObject(int8 *buf, int32 streamId);
static bool FinishLoadingLargeFile(int8 *buf, int32 streamId);
+ static bool HasModelLoaded(int32 id) { return ms_aInfoForModel[id].m_loadState == STREAMSTATE_LOADED; }
static void RequestModel(int32 model, int32 flags);
static void ReRequestModel(int32 model) { RequestModel(model, ms_aInfoForModel[model].m_flags); }
static void RequestTxd(int32 txd, int32 flags) { RequestModel(txd + STREAM_OFFSET_TXD, flags); }
@@ -120,6 +123,8 @@ public:
static void RequestIslands(eLevelName level);
static void RequestSpecialModel(int32 modelId, const char *modelName, int32 flags);
static void RequestSpecialChar(int32 charId, const char *modelName, int32 flags);
+ static bool HasSpecialCharLoaded(int32 id);
+ static void SetMissionDoesntRequireSpecialChar(int32 id);
static void DecrementRef(int32 id);
static void RemoveModel(int32 id);
static void RemoveTxd(int32 id) { RemoveModel(id + STREAM_OFFSET_TXD); }
@@ -141,6 +146,11 @@ public:
static void SetModelIsDeletable(int32 id);
static void SetModelTxdIsDeletable(int32 id);
static void SetMissionDoesntRequireModel(int32 id);
+ static void LoadInitialPeds(void);
+ static void LoadInitialVehicles(void);
+ static void StreamVehiclesAndPeds(void);
+ static void StreamZoneModels(const CVector &pos);
+ static void RemoveCurrentZonesModels(void);
static int32 GetCdImageOffset(int32 lastPosn);
static int32 GetNextFileOnCd(int32 position, bool priority);
@@ -169,10 +179,8 @@ public:
static bool DeleteRwObjectsBehindCameraInSectorList(CPtrList &list, int32 mem);
static bool DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, int32 mem);
- static void LoadInitialPeds(void);
- static void LoadInitialVehicles(void);
-
static void LoadScene(const CVector &pos);
- static bool IsModelLoaded(int32 id) { return ms_aInfoForModel[id].m_loadState == STREAMSTATE_LOADED; }
+ static void MemoryCardSave(uint8 *buffer, uint32 *length);
+ static void MemoryCardLoad(uint8 *buffer, uint32 length);
};
diff --git a/src/Timer.cpp b/src/Timer.cpp
index 62f1ed55..2f7dc38d 100644
--- a/src/Timer.cpp
+++ b/src/Timer.cpp
@@ -133,7 +133,7 @@ void CTimer::Update(void)
ms_fTimeStepNonClipped = ms_fTimeStep;
- if ( CRecordDataForGame::RecordingState != _TODOCONST(2) )
+ if ( CRecordDataForGame::RecordingState != RECORDSTATE_2 )
{
ms_fTimeStep = min(3.0f, ms_fTimeStep);
@@ -141,7 +141,7 @@ void CTimer::Update(void)
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 60;
}
- if ( CRecordDataForChase::Status == _TODOCONST(1) )
+ if ( CRecordDataForChase::Status == RECORDSTATE_1 )
{
ms_fTimeStep = 1.0f;
m_snTimeInMilliseconds = m_snPreviousTimeInMilliseconds + 16;
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 4ce856f7..fe5b6dab 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -5,5 +5,6 @@
int &CCarCtrl::NumLawEnforcerCars = *(int*)0x8F1B38;
WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }
-WRAPPER void CCarCtrl::AddToCarArray(int id, int vehclass) { EAXJMP(0x4182F0); }
-WRAPPER void CCarCtrl::UpdateCarCount(CVehicle*, bool) { EAXJMP(0x4202E0); } \ No newline at end of file
+WRAPPER void CCarCtrl::AddToCarArray(int32 id, int32 vehclass) { EAXJMP(0x4182F0); }
+WRAPPER void CCarCtrl::UpdateCarCount(CVehicle*, bool) { EAXJMP(0x4202E0); }
+WRAPPER int32 CCarCtrl::ChooseCarModel(int32 vehclass) { EAXJMP(0x418110); }
diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h
index cc9327ee..27ea6293 100644
--- a/src/control/CarCtrl.h
+++ b/src/control/CarCtrl.h
@@ -6,8 +6,9 @@ class CCarCtrl
{
public:
static void SwitchVehicleToRealPhysics(CVehicle*);
- static void AddToCarArray(int id, int vehclass);
+ static void AddToCarArray(int32 id, int32 vehclass);
static void UpdateCarCount(CVehicle*, bool);
+ static int32 ChooseCarModel(int32 vehclass);
static int32 &NumLawEnforcerCars;
};
diff --git a/src/control/Gangs.cpp b/src/control/Gangs.cpp
index 80ecd816..fc77ad72 100644
--- a/src/control/Gangs.cpp
+++ b/src/control/Gangs.cpp
@@ -1,9 +1,17 @@
#include "common.h"
#include "patcher.h"
+#include "ModelIndices.h"
#include "Gangs.h"
CGangInfo(&CGangs::Gang)[NUM_GANGS] = *(CGangInfo(*)[9])*(uintptr*)0x6EDF78;
+CGangInfo::CGangInfo() :
+ m_nVehicleMI(MI_BUS),
+ m_nPedModelOverride(-1),
+ m_Weapon1(WEAPONTYPE_UNARMED),
+ m_Weapon2(WEAPONTYPE_UNARMED)
+{}
+
void CGangs::Initialize(void)
{
Gang[GANG_MAFIA].m_nVehicleMI = MI_MAFIA;
diff --git a/src/control/Gangs.h b/src/control/Gangs.h
index db14ca64..2366614b 100644
--- a/src/control/Gangs.h
+++ b/src/control/Gangs.h
@@ -1,8 +1,6 @@
#pragma once
-#include "common.h"
#include "Weapon.h"
-#include "ModelIndices.h"
struct CGangInfo
{
@@ -13,31 +11,27 @@ struct CGangInfo
eWeaponType m_Weapon1;
eWeaponType m_Weapon2;
- CGangInfo() :
- m_nVehicleMI(MI_BUS),
- m_nPedModelOverride(-1),
- m_Weapon1(WEAPONTYPE_UNARMED),
- m_Weapon2(WEAPONTYPE_UNARMED)
- {}
+ CGangInfo();
};
static_assert(sizeof(CGangInfo) == 0x10, "CGangInfo: error");
+enum {
+ GANG_MAFIA = 0,
+ GANG_TRIAD,
+ GANG_DIABLOS,
+ GANG_YAKUZA,
+ GANG_YARDIE,
+ GANG_COLUMB,
+ GANG_HOODS,
+ GANG_7,
+ GANG_8,
+ NUM_GANGS
+};
+
class CGangs
{
public:
- enum {
- GANG_MAFIA = 0,
- GANG_TRIAD,
- GANG_DIABLOS,
- GANG_YAKUZA,
- GANG_YARDIE,
- GANG_COLUMB,
- GANG_HOODS,
- GANG_7,
- GANG_8,
- NUM_GANGS
- };
static void Initialize(void);
static void SetGangVehicleModel(int16, int);
static void SetGangWeapons(int16, eWeaponType, eWeaponType);
@@ -45,9 +39,9 @@ public:
static int8 GetGangPedModelOverride(int16);
static void SaveAllGangData(uint8 *, uint32 *);
static void LoadAllGangData(uint8 *, uint32);
+ static CGangInfo* GetGangInfo(int16 gang) { return &Gang[gang]; }
private:
- static CGangInfo* GetGangInfo(int16 gang) { return &Gang[gang]; }
static CGangInfo(&Gang)[NUM_GANGS];
};
diff --git a/src/control/Population.cpp b/src/control/Population.cpp
index ebb48a93..fd1a89f5 100644
--- a/src/control/Population.cpp
+++ b/src/control/Population.cpp
@@ -2,6 +2,7 @@
#include "patcher.h"
#include "Population.h"
+PedGroup *CPopulation::ms_pPedGroups = (PedGroup*)0x6E9248;
bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6;
-WRAPPER void CPopulation::UpdatePedCount(uint32, bool) { EAXJMP(0x4F5A60); } \ No newline at end of file
+WRAPPER void CPopulation::UpdatePedCount(uint32, bool) { EAXJMP(0x4F5A60); }
diff --git a/src/control/Population.h b/src/control/Population.h
index a5572cdb..76442442 100644
--- a/src/control/Population.h
+++ b/src/control/Population.h
@@ -2,10 +2,16 @@
#include "PedType.h"
+struct PedGroup
+{
+ int32 models[8];
+};
+
class CPopulation
{
public:
+ static PedGroup *ms_pPedGroups; //[31]
static bool &ms_bGivePedsWeapons;
static void UpdatePedCount(uint32, bool);
-}; \ No newline at end of file
+};
diff --git a/src/control/Record.h b/src/control/Record.h
index 2b904d1d..2705a955 100644
--- a/src/control/Record.h
+++ b/src/control/Record.h
@@ -1,5 +1,11 @@
#pragma once
+enum {
+ RECORDSTATE_0,
+ RECORDSTATE_1,
+ RECORDSTATE_2,
+};
+
class CRecordDataForGame
{
public:
diff --git a/src/re3.cpp b/src/re3.cpp
index 284b88de..ec4f4439 100644
--- a/src/re3.cpp
+++ b/src/re3.cpp
@@ -126,7 +126,7 @@ spawnCar(int id)
CVector playerpos;
CStreaming::RequestModel(id, 0);
CStreaming::LoadAllRequestedModels(false);
- if(CStreaming::IsModelLoaded(id)){
+ if(CStreaming::HasModelLoaded(id)){
FindPlayerCoors(playerpos);
int node = ThePaths.FindNodeClosestToCoors(playerpos, 0, 100.0f, false, false);
if(node < 0)