summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/animation/CutsceneMgr.h1
-rw-r--r--src/animation/RpAnimBlend.cpp2
-rw-r--r--src/animation/RpAnimBlend.h2
-rw-r--r--src/audio/AudioManager.cpp24
-rw-r--r--src/audio/DMAudio.cpp2
-rw-r--r--src/audio/DMAudio.h2
-rw-r--r--src/audio/PoliceRadio.cpp16
-rw-r--r--src/control/CarAI.cpp1
-rw-r--r--src/control/CarCtrl.cpp38
-rw-r--r--src/control/CarCtrl.h36
-rw-r--r--src/control/GameLogic.cpp2
-rw-r--r--src/control/PathFind.cpp10
-rw-r--r--src/control/PathFind.h6
-rw-r--r--src/control/Phones.cpp12
-rw-r--r--src/control/Phones.h12
-rw-r--r--src/control/Pickups.cpp16
-rw-r--r--src/control/Pickups.h10
-rw-r--r--src/control/Record.cpp28
-rw-r--r--src/control/Record.h30
-rw-r--r--src/control/Replay.cpp136
-rw-r--r--src/control/Replay.h124
-rw-r--r--src/control/Restart.cpp32
-rw-r--r--src/control/Restart.h32
-rw-r--r--src/control/RoadBlocks.cpp6
-rw-r--r--src/control/RoadBlocks.h6
-rw-r--r--src/control/Script.cpp82
-rw-r--r--src/control/Script.h80
-rw-r--r--src/core/Accident.cpp2
-rw-r--r--src/core/Accident.h2
-rw-r--r--src/core/Cam.cpp2
-rw-r--r--src/core/Camera.cpp6
-rw-r--r--src/core/Camera.h6
-rw-r--r--src/core/Clock.cpp20
-rw-r--r--src/core/Clock.h18
-rw-r--r--src/core/ControllerConfig.cpp2
-rw-r--r--src/core/ControllerConfig.h2
-rw-r--r--src/core/EventList.cpp1
-rw-r--r--src/core/FileMgr.cpp4
-rw-r--r--src/core/FileMgr.h4
-rw-r--r--src/core/Fire.cpp2
-rw-r--r--src/core/Fire.h2
-rw-r--r--src/core/Frontend.cpp2
-rw-r--r--src/core/Game.cpp22
-rw-r--r--src/core/Game.h16
-rw-r--r--src/core/IniFile.cpp4
-rw-r--r--src/core/Pad.cpp24
-rw-r--r--src/core/Pad.h22
-rw-r--r--src/core/Pools.cpp18
-rw-r--r--src/core/Pools.h18
-rw-r--r--src/core/Radar.cpp44
-rw-r--r--src/core/References.cpp4
-rw-r--r--src/core/References.h4
-rw-r--r--src/core/Stats.cpp106
-rw-r--r--src/core/Stats.h106
-rw-r--r--src/core/Streaming.cpp84
-rw-r--r--src/core/Streaming.h56
-rw-r--r--src/core/SurfaceTable.cpp2
-rw-r--r--src/core/SurfaceTable.h3
-rw-r--r--src/core/TempColModels.cpp26
-rw-r--r--src/core/TempColModels.h26
-rw-r--r--src/core/TimeStep.cpp6
-rw-r--r--src/core/TimeStep.h6
-rw-r--r--src/core/Timer.cpp50
-rw-r--r--src/core/Timer.h20
-rw-r--r--src/core/User.cpp8
-rw-r--r--src/core/User.h8
-rw-r--r--src/core/Wanted.cpp4
-rw-r--r--src/core/Wanted.h4
-rw-r--r--src/core/World.cpp1980
-rw-r--r--src/core/World.h36
-rw-r--r--src/core/ZoneCull.cpp30
-rw-r--r--src/core/ZoneCull.h28
-rw-r--r--src/core/Zones.cpp24
-rw-r--r--src/core/Zones.h22
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/main.cpp17
-rw-r--r--src/core/main.h16
-rw-r--r--src/entities/Entity.cpp12
-rw-r--r--src/entities/Entity.h3
-rw-r--r--src/modelinfo/ModelIndices.h7
-rw-r--r--src/modelinfo/ModelInfo.cpp5
-rw-r--r--src/modelinfo/ModelInfo.h2
-rw-r--r--src/modelinfo/VehicleModelInfo.cpp16
-rw-r--r--src/modelinfo/VehicleModelInfo.h10
-rw-r--r--src/objects/Object.cpp8
-rw-r--r--src/objects/Object.h6
-rw-r--r--src/objects/ParticleObject.cpp8
-rw-r--r--src/objects/ParticleObject.h8
-rw-r--r--src/render/Credits.cpp4
-rw-r--r--src/render/Credits.h4
-rw-r--r--src/render/Draw.cpp16
-rw-r--r--src/render/Draw.h16
-rw-r--r--src/render/Font.cpp10
-rw-r--r--src/render/Font.h11
-rw-r--r--src/render/Hud.cpp78
-rw-r--r--src/render/MBlur.cpp6
-rw-r--r--src/render/MBlur.h6
-rw-r--r--src/render/Particle.cpp15
-rw-r--r--src/render/Particle.h7
-rw-r--r--src/render/PointLights.cpp6
-rw-r--r--src/render/PointLights.h4
-rw-r--r--src/render/RenderBuffer.cpp12
-rw-r--r--src/render/RenderBuffer.h12
-rw-r--r--src/render/Shadows.cpp46
-rw-r--r--src/render/Shadows.h30
-rw-r--r--src/render/Sprite.cpp14
-rw-r--r--src/render/Sprite.h8
-rw-r--r--src/render/Timecycle.cpp190
-rw-r--r--src/render/Timecycle.h184
-rw-r--r--src/render/WaterLevel.cpp4
-rw-r--r--src/render/WaterLevel.h2
-rw-r--r--src/render/Weather.cpp48
-rw-r--r--src/render/Weather.h50
-rw-r--r--src/rw/Lights.cpp24
-rw-r--r--src/rw/NodeName.cpp2
-rw-r--r--src/rw/RwHelper.cpp2
-rw-r--r--src/rw/TexRead.cpp4
-rw-r--r--src/rw/TxdStore.cpp4
-rw-r--r--src/rw/VisibilityPlugins.cpp36
-rw-r--r--src/save/GenericGameStorage.cpp30
-rw-r--r--src/save/PCSave.cpp2
-rw-r--r--src/skel/skeleton.cpp3
-rw-r--r--src/skel/skeleton.h2
-rw-r--r--src/skel/win/win.cpp26
-rw-r--r--src/skel/win/win.h6
-rw-r--r--src/text/Messages.cpp6
-rw-r--r--src/text/Text.cpp2
-rw-r--r--src/vehicles/Automobile.cpp2
-rw-r--r--src/vehicles/Boat.cpp10
-rw-r--r--src/vehicles/Floater.cpp4
-rw-r--r--src/vehicles/HandlingMgr.cpp2
-rw-r--r--src/vehicles/Heli.cpp12
-rw-r--r--src/vehicles/Plane.cpp70
-rw-r--r--src/weapons/ShotInfo.cpp2
-rw-r--r--src/weapons/WeaponInfo.cpp1
135 files changed, 2867 insertions, 1921 deletions
diff --git a/src/animation/CutsceneMgr.h b/src/animation/CutsceneMgr.h
index b025816b..bfdcdb57 100644
--- a/src/animation/CutsceneMgr.h
+++ b/src/animation/CutsceneMgr.h
@@ -28,6 +28,7 @@ public:
static void StartCutsceneProcessing() { ms_cutsceneProcessing = true; }
static bool IsRunning(void) { return ms_running; }
+ static bool HasLoaded(void) { return ms_loaded; }
static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; }
static bool UseLodMultiplier(void) { return ms_useLodMultiplier; }
static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; }
diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp
index 9c847139..07b8e7d8 100644
--- a/src/animation/RpAnimBlend.cpp
+++ b/src/animation/RpAnimBlend.cpp
@@ -8,7 +8,7 @@
#include "AnimBlendAssociation.h"
#include "RpAnimBlend.h"
-RwInt32 &ClumpOffset = *(RwInt32*)0x8F1B84;
+RwInt32 ClumpOffset;
enum
{
diff --git a/src/animation/RpAnimBlend.h b/src/animation/RpAnimBlend.h
index f9e14c42..ccfa5872 100644
--- a/src/animation/RpAnimBlend.h
+++ b/src/animation/RpAnimBlend.h
@@ -11,7 +11,7 @@ struct AnimBlendFrameUpdateData
CAnimBlendNode *nodes[16];
};
-extern RwInt32 &ClumpOffset;
+extern RwInt32 ClumpOffset;
#define RPANIMBLENDCLUMPDATA(o) (RWPLUGINOFFSET(CAnimBlendClumpData*, o, ClumpOffset))
bool RpAnimBlendPluginAttach(void);
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 8a9a81f9..2ee7e602 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -40,18 +40,18 @@
#include "sampman.h"
cAudioManager AudioManager;
-uint32 gPornNextTime; // = *(uint32*)0x6508A0;
-uint32 gSawMillNextTime; // = *(uint32*)0x6508A4;
-uint32 gShopNextTime; // = *(uint32*)0x6508A8;
-uint32 gAirportNextTime; // = *(uint32*)0x6508AC;
-uint32 gCinemaNextTime; //= *(uint32*)0x6508B0;
-uint32 gDocksNextTime; // = *(uint32*)0x6508B4;
-uint32 gHomeNextTime; // = *(uint32*)0x6508B8;
-uint32 gCellNextTime; // = *(uint32*)0x6508BC;
-uint32 gNextCryTime; // = *(uint32*)0x6508C0;
-uint8 gJumboVolOffsetPercentage; // = *(uint8 *)0x6508ED;
-bool bPlayerJustEnteredCar; // = *(bool *)0x6508C4;
-bool g_bMissionAudioLoadFailed; // = *(bool *)0x95CD8E;
+uint32 gPornNextTime;
+uint32 gSawMillNextTime;
+uint32 gShopNextTime;
+uint32 gAirportNextTime;
+uint32 gCinemaNextTime;
+uint32 gDocksNextTime;
+uint32 gHomeNextTime;
+uint32 gCellNextTime;
+uint32 gNextCryTime;
+uint8 gJumboVolOffsetPercentage;
+bool bPlayerJustEnteredCar;
+bool g_bMissionAudioLoadFailed;
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int policeChannel = channels + 1;
diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp
index a01c85ae..e55790ea 100644
--- a/src/audio/DMAudio.cpp
+++ b/src/audio/DMAudio.cpp
@@ -6,7 +6,7 @@
#include "AudioScriptObject.h"
#include "sampman.h"
-cDMAudio &DMAudio = *(cDMAudio*)0x95CDBE;
+cDMAudio DMAudio;
void
cDMAudio::Initialise(void)
diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h
index d2cdf466..9ce073b4 100644
--- a/src/audio/DMAudio.h
+++ b/src/audio/DMAudio.h
@@ -256,4 +256,4 @@ public:
void SetRadioInCar(uint32 radio);
void SetRadioChannel(int8 radio, int32 pos);
};
-extern cDMAudio &DMAudio;
+extern cDMAudio DMAudio;
diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp
index 255d7026..a81fcbe9 100644
--- a/src/audio/PoliceRadio.cpp
+++ b/src/audio/PoliceRadio.cpp
@@ -21,14 +21,14 @@ struct tPoliceRadioZone {
int32 field_12;
};
-tPoliceRadioZone (&ZoneSfx)[NUMAUDIOZONES] = *(tPoliceRadioZone(*)[NUMAUDIOZONES])*(uintptr*)0x880240;
-char *SubZo2Label = (char*)0x6E9918;
-char *SubZo3Label = (char*)0x6E9870;
-
-int32 &g_nMissionAudioSfx = *(int32*)0x60ED84;
-int8 &g_nMissionAudioPlayingStatus = *(int8*)0x60ED88;
-uint8 &gSpecialSuspectLastSeenReport = *(uint8*)0x95CD4D;
-uint32 (&gMinTimeToNextReport)[NUM_CRIME_TYPES] = *(uint32(*)[NUM_CRIME_TYPES])*(uintptr*)0x8E2828;
+tPoliceRadioZone ZoneSfx[NUMAUDIOZONES];
+char SubZo2Label[8];
+char SubZo3Label[8];
+
+int32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
+int8 g_nMissionAudioPlayingStatus = 2;
+uint8 gSpecialSuspectLastSeenReport;
+uint32 gMinTimeToNextReport[NUM_CRIME_TYPES];
void
cAudioManager::InitialisePoliceRadioZones()
diff --git a/src/control/CarAI.cpp b/src/control/CarAI.cpp
index e47e3d5e..f48e4c78 100644
--- a/src/control/CarAI.cpp
+++ b/src/control/CarAI.cpp
@@ -33,7 +33,6 @@ float CCarAI::FindSwitchDistanceFar(CVehicle* pVehicle)
void CCarAI::UpdateCarAI(CVehicle* pVehicle)
{
- //((void(*)(CVehicle*))(0x413E50))(pVehicle);
//return;
if (pVehicle->bIsLawEnforcer){
if (pVehicle->AutoPilot.m_nCarMission == MISSION_BLOCKCAR_FARAWAY ||
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 197fca63..6e47670d 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -67,25 +67,25 @@
#define MIN_ANGLE_TO_APPLY_HANDBRAKE 0.7f
#define MIN_SPEED_TO_APPLY_HANDBRAKE 0.3f
-int &CCarCtrl::NumLawEnforcerCars = *(int*)0x8F1B38;
-int &CCarCtrl::NumAmbulancesOnDuty = *(int*)0x885BB0;
-int &CCarCtrl::NumFiretrucksOnDuty = *(int*)0x9411F0;
-bool &CCarCtrl::bCarsGeneratedAroundCamera = *(bool*)0x95CD8A;
-float& CCarCtrl::CarDensityMultiplier = *(float*)0x5EC8B4;
-int32 &CCarCtrl::NumMissionCars = *(int32*)0x8F1B54;
-int32 &CCarCtrl::NumRandomCars = *(int32*)0x943118;
-int32 &CCarCtrl::NumParkedCars = *(int32*)0x8F29E0;
-int32 &CCarCtrl::NumPermanentCars = *(int32*)0x8F29F0;
-int8 &CCarCtrl::CountDownToCarsAtStart = *(int8*)0x95CD63;
-int32 &CCarCtrl::MaxNumberOfCarsInUse = *(int32*)0x5EC8B8;
-uint32 &CCarCtrl::LastTimeLawEnforcerCreated = *(uint32*)0x8F5FF0;
-uint32 &CCarCtrl::LastTimeFireTruckCreated = *(uint32*)0x880F5C;
-uint32 &CCarCtrl::LastTimeAmbulanceCreated = *(uint32*)0x941450;
-int32 (&CCarCtrl::TotalNumOfCarsOfRating)[TOTAL_CUSTOM_CLASSES] = *(int32(*)[TOTAL_CUSTOM_CLASSES])*(uintptr*)0x8F1A60;
-int32 (&CCarCtrl::NextCarOfRating)[TOTAL_CUSTOM_CLASSES] = *(int32(*)[TOTAL_CUSTOM_CLASSES])*(uintptr*)0x9412AC;
-int32 (&CCarCtrl::CarArrays)[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY] = *(int32(*)[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY])*(uintptr*)0x6EB860;
-CVehicle* (&apCarsToKeep)[MAX_CARS_TO_KEEP] = *(CVehicle*(*)[MAX_CARS_TO_KEEP])*(uintptr*)0x70D830;
-uint32 (&aCarsToKeepTime)[MAX_CARS_TO_KEEP] = *(uint32(*)[MAX_CARS_TO_KEEP])*(uintptr*)0x87F9A8;
+int CCarCtrl::NumLawEnforcerCars;
+int CCarCtrl::NumAmbulancesOnDuty;
+int CCarCtrl::NumFiretrucksOnDuty;
+bool CCarCtrl::bCarsGeneratedAroundCamera;
+float CCarCtrl::CarDensityMultiplier = 1.0f;
+int32 CCarCtrl::NumMissionCars;
+int32 CCarCtrl::NumRandomCars;
+int32 CCarCtrl::NumParkedCars;
+int32 CCarCtrl::NumPermanentCars;
+int8 CCarCtrl::CountDownToCarsAtStart;
+int32 CCarCtrl::MaxNumberOfCarsInUse = 12;
+uint32 CCarCtrl::LastTimeLawEnforcerCreated;
+uint32 CCarCtrl::LastTimeFireTruckCreated;
+uint32 CCarCtrl::LastTimeAmbulanceCreated;
+int32 CCarCtrl::TotalNumOfCarsOfRating[TOTAL_CUSTOM_CLASSES];
+int32 CCarCtrl::NextCarOfRating[TOTAL_CUSTOM_CLASSES];
+int32 CCarCtrl::CarArrays[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY];
+CVehicle* apCarsToKeep[MAX_CARS_TO_KEEP];
+uint32 aCarsToKeepTime[MAX_CARS_TO_KEEP];
void
CCarCtrl::GenerateRandomCars()
diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h
index 925552b5..44ef9ab6 100644
--- a/src/control/CarCtrl.h
+++ b/src/control/CarCtrl.h
@@ -120,23 +120,23 @@ public:
return angle;
}
- static int32 &NumLawEnforcerCars;
- static int32 &NumAmbulancesOnDuty;
- static int32 &NumFiretrucksOnDuty;
- static int32 &NumRandomCars;
- static int32 &NumMissionCars;
- static int32 &NumParkedCars;
- static int32 &NumPermanentCars;
- static bool &bCarsGeneratedAroundCamera;
- static float &CarDensityMultiplier;
- static int8 &CountDownToCarsAtStart;
- static int32 &MaxNumberOfCarsInUse;
- static uint32 &LastTimeLawEnforcerCreated;
- static uint32 &LastTimeFireTruckCreated;
- static uint32 &LastTimeAmbulanceCreated;
- static int32 (&TotalNumOfCarsOfRating)[TOTAL_CUSTOM_CLASSES];
- static int32 (&NextCarOfRating)[TOTAL_CUSTOM_CLASSES];
- static int32 (&CarArrays)[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY];
+ static int32 NumLawEnforcerCars;
+ static int32 NumAmbulancesOnDuty;
+ static int32 NumFiretrucksOnDuty;
+ static int32 NumRandomCars;
+ static int32 NumMissionCars;
+ static int32 NumParkedCars;
+ static int32 NumPermanentCars;
+ static bool bCarsGeneratedAroundCamera;
+ static float CarDensityMultiplier;
+ static int8 CountDownToCarsAtStart;
+ static int32 MaxNumberOfCarsInUse;
+ static uint32 LastTimeLawEnforcerCreated;
+ static uint32 LastTimeFireTruckCreated;
+ static uint32 LastTimeAmbulanceCreated;
+ static int32 TotalNumOfCarsOfRating[TOTAL_CUSTOM_CLASSES];
+ static int32 NextCarOfRating[TOTAL_CUSTOM_CLASSES];
+ static int32 CarArrays[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY];
};
-extern CVehicle* (&apCarsToKeep)[MAX_CARS_TO_KEEP]; \ No newline at end of file
+extern CVehicle* apCarsToKeep[MAX_CARS_TO_KEEP]; \ No newline at end of file
diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp
index 8e0ea02d..0cfaac17 100644
--- a/src/control/GameLogic.cpp
+++ b/src/control/GameLogic.cpp
@@ -20,7 +20,7 @@
#include "Script.h"
#include "Garages.h"
-uint8 CGameLogic::ActivePlayers; // 0x95CD5E
+uint8 CGameLogic::ActivePlayers;
void
CGameLogic::InitAtStartOfGame()
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index 9f45c454..d9594490 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -12,7 +12,7 @@ bool gbShowPedPaths;
bool gbShowCarPaths;
bool gbShowCarPathsLinks;
-CPathFind &ThePaths = *(CPathFind*)0x8F6754;
+CPathFind ThePaths;
#define MAX_DIST INT16_MAX-1
#define MIN_PED_ROUTE_DISTANCE 23.8f
@@ -21,11 +21,11 @@ CPathFind &ThePaths = *(CPathFind*)0x8F6754;
// 1 UseInRoadBlock
// 2 east/west road(?)
-CPathInfoForObject *&InfoForTileCars = *(CPathInfoForObject**)0x8F1A8C;
-CPathInfoForObject *&InfoForTilePeds = *(CPathInfoForObject**)0x8F1AE4;
+CPathInfoForObject *InfoForTileCars;
+CPathInfoForObject *InfoForTilePeds;
// unused
-CTempDetachedNode *&DetachedNodesCars = *(CTempDetachedNode**)0x8E2824;
-CTempDetachedNode *&DetachedNodesPeds = *(CTempDetachedNode**)0x8E28A0;
+CTempDetachedNode *DetachedNodesCars;
+CTempDetachedNode *DetachedNodesPeds;
bool
CPedPath::CalcPedRoute(int8 pathType, CVector position, CVector destination, CVector *pointPoses, int16 *pointsFound, int16 maxPoints)
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index ea88ade6..64c12d5b 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -138,8 +138,8 @@ struct CPathInfoForObject
int8 numRightLanes;
uint8 crossing : 1;
};
-extern CPathInfoForObject *&InfoForTileCars;
-extern CPathInfoForObject *&InfoForTilePeds;
+extern CPathInfoForObject *InfoForTileCars;
+extern CPathInfoForObject *InfoForTilePeds;
struct CTempNode
{
@@ -234,7 +234,7 @@ public:
};
static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error");
-extern CPathFind &ThePaths;
+extern CPathFind ThePaths;
extern bool gbShowPedPaths;
extern bool gbShowCarPaths;
diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp
index 276f02b9..90939f0e 100644
--- a/src/control/Phones.cpp
+++ b/src/control/Phones.cpp
@@ -13,13 +13,13 @@
#include "RpAnimBlend.h"
#include "AnimBlendAssociation.h"
-CPhoneInfo &gPhoneInfo = *(CPhoneInfo*)0x732A20;
+CPhoneInfo gPhoneInfo;
-bool &CPhoneInfo::bDisplayingPhoneMessage = *(bool*)0x6283AC; // is phone picked up
-uint32 &CPhoneInfo::PhoneEnableControlsTimer = *(uint32*)0x6283A8;
-CPhone *&CPhoneInfo::pPhoneDisplayingMessages = *(CPhone**)0x6283B0;
-bool &CPhoneInfo::bPickingUpPhone = *(bool*)0x6283B4;
-CPed *&CPhoneInfo::pCallBackPed = *(CPed**)0x6283B8; // ped who picking up the phone (reset after pickup cb)
+bool CPhoneInfo::bDisplayingPhoneMessage; // is phone picked up
+uint32 CPhoneInfo::PhoneEnableControlsTimer;
+CPhone *CPhoneInfo::pPhoneDisplayingMessages;
+bool CPhoneInfo::bPickingUpPhone;
+CPed *CPhoneInfo::pCallBackPed; // ped who picking up the phone (reset after pickup cb)
/*
Entering phonebooth cutscene, showing messages and triggering these things
diff --git a/src/control/Phones.h b/src/control/Phones.h
index e7e3c9a7..7fbf403f 100644
--- a/src/control/Phones.h
+++ b/src/control/Phones.h
@@ -36,11 +36,11 @@ static_assert(sizeof(CPhone) == 0x34, "CPhone: error");
class CPhoneInfo {
public:
- static bool &bDisplayingPhoneMessage;
- static uint32 &PhoneEnableControlsTimer;
- static CPhone *&pPhoneDisplayingMessages;
- static bool &bPickingUpPhone;
- static CPed *&pCallBackPed;
+ static bool bDisplayingPhoneMessage;
+ static uint32 PhoneEnableControlsTimer;
+ static CPhone *pPhoneDisplayingMessages;
+ static bool bPickingUpPhone;
+ static CPed *pCallBackPed;
int32 m_nMax;
int32 m_nScriptPhonesMax;
@@ -63,7 +63,7 @@ public:
void Update(void);
};
-extern CPhoneInfo &gPhoneInfo;
+extern CPhoneInfo gPhoneInfo;
void PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg);
void PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg);
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index eb561670..d52c386c 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -31,16 +31,16 @@
#include "WaterLevel.h"
#include "World.h"
-CPickup(&CPickups::aPickUps)[NUMPICKUPS] = *(CPickup(*)[NUMPICKUPS])*(uintptr*)0x878C98;
-int16 CPickups::NumMessages;// = *(int16*)0x95CC98;
-int32 CPickups::aPickUpsCollected[NUMCOLLECTEDPICKUPS];// = *(int32(*)[NUMCOLLECTEDPICKUPS])*(uintptr*)0x87C538;
-int16 CPickups::CollectedPickUpIndex;// = *(int16*)0x95CC8A;
+CPickup CPickups::aPickUps[NUMPICKUPS];
+int16 CPickups::NumMessages;
+int32 CPickups::aPickUpsCollected[NUMCOLLECTEDPICKUPS];
+int16 CPickups::CollectedPickUpIndex;
// unused
-bool &CPickups::bPickUpcamActivated = *(bool*)0x95CD71;
-CVehicle *&CPickups::pPlayerVehicle = *(CVehicle**)0x8F29E8;
-CVector &CPickups::StaticCamCoors = *(CVector*)0x9404C8;
-uint32 &CPickups::StaticCamStartTime = *(uint32*)0x8E289C;
+bool CPickups::bPickUpcamActivated;
+CVehicle *CPickups::pPlayerVehicle;
+CVector CPickups::StaticCamCoors;
+uint32 CPickups::StaticCamStartTime;
tPickupMessage CPickups::aMessages[NUMPICKUPMESSAGES];
diff --git a/src/control/Pickups.h b/src/control/Pickups.h
index b5b4f396..11da5f54 100644
--- a/src/control/Pickups.h
+++ b/src/control/Pickups.h
@@ -89,13 +89,13 @@ public:
static void Load(uint8 *buf, uint32 size);
static void Save(uint8 *buf, uint32 *size);
- static CPickup(&aPickUps)[NUMPICKUPS];
+ static CPickup aPickUps[NUMPICKUPS];
// unused
- static bool &bPickUpcamActivated;
- static CVehicle *&pPlayerVehicle;
- static CVector &StaticCamCoors;
- static uint32 &StaticCamStartTime;
+ static bool bPickUpcamActivated;
+ static CVehicle *pPlayerVehicle;
+ static CVector StaticCamCoors;
+ static uint32 StaticCamStartTime;
};
extern uint16 AmmoForWeapon[20];
diff --git a/src/control/Record.cpp b/src/control/Record.cpp
index ca4128e3..08e3c5b9 100644
--- a/src/control/Record.cpp
+++ b/src/control/Record.cpp
@@ -10,11 +10,11 @@
#include "VehicleModelInfo.h"
#include "World.h"
-uint16 &CRecordDataForGame::RecordingState = *(uint16*)0x95CC24;
-uint8*& CRecordDataForGame::pDataBuffer = *(uint8**)0x8F1B70;
-uint8*& CRecordDataForGame::pDataBufferPointer = *(uint8**)0x8F1AB0;
-int& CRecordDataForGame::FId = *(int*)0x885BA4;
-tGameBuffer& CRecordDataForGame::pDataBufferForFrame = *(tGameBuffer*)0x72CED0;
+uint16 CRecordDataForGame::RecordingState;
+uint8* CRecordDataForGame::pDataBuffer;
+uint8* CRecordDataForGame::pDataBufferPointer;
+int CRecordDataForGame::FId;
+tGameBuffer CRecordDataForGame::pDataBufferForFrame;
#define MEMORY_FOR_GAME_RECORD (150000)
@@ -176,15 +176,15 @@ uint16 CRecordDataForGame::CalcGameChecksum(void)
return checksum ^ checksum >> 16;
}
-uint8& CRecordDataForChase::Status = *(uint8*)0x95CDCE;
-int& CRecordDataForChase::PositionChanges = *(int*)0x8F59C8;
-uint8& CRecordDataForChase::CurrentCar = *(uint8*)0x95CDC9;
-CAutomobile* (&CRecordDataForChase::pChaseCars)[NUM_CHASE_CARS] = *(CAutomobile * (*)[NUM_CHASE_CARS])*(uintptr*)0x6F46A8;
-uint32& CRecordDataForChase::AnimStartTime = *(uint32*)0x8F1AEC;
-float& CRecordDataForChase::AnimTime = *(float*)0x880F88;
-CCarStateEachFrame* (&CRecordDataForChase::pBaseMemForCar)[NUM_CHASE_CARS] = *(CCarStateEachFrame * (*)[NUM_CHASE_CARS])*(uintptr*)0x70EA18;
-float& CRecordDataForChase::TimeMultiplier = *(float*)0x8E2A94;
-int& CRecordDataForChase::FId2 = *(int*)0x8E2C18;
+uint8 CRecordDataForChase::Status;
+int CRecordDataForChase::PositionChanges;
+uint8 CRecordDataForChase::CurrentCar;
+CAutomobile* CRecordDataForChase::pChaseCars[NUM_CHASE_CARS];
+uint32 CRecordDataForChase::AnimStartTime;
+float CRecordDataForChase::AnimTime;
+CCarStateEachFrame* CRecordDataForChase::pBaseMemForCar[NUM_CHASE_CARS];
+float CRecordDataForChase::TimeMultiplier;
+int CRecordDataForChase::FId2;
#define CHASE_SCENE_LENGTH_IN_SECONDS (80)
#define CHASE_SCENE_FRAMES_PER_SECOND (15) // skipping every second frame
diff --git a/src/control/Record.h b/src/control/Record.h
index 4abeb68a..7af733ba 100644
--- a/src/control/Record.h
+++ b/src/control/Record.h
@@ -23,7 +23,7 @@ public:
CVector pos;
};
-extern char* gString;
+extern char gString[256];;
class CRecordDataForChase
{
@@ -37,15 +37,15 @@ class CRecordDataForChase
STATE_PLAYBACK = 3,
STATE_PLAYBACK_BEFORE_RECORDING = 4
};
- static uint8 &Status;
- static int &PositionChanges;
- static uint8 &CurrentCar;
- static CAutomobile*(&pChaseCars)[NUM_CHASE_CARS];
- static float &AnimTime;
- static uint32 &AnimStartTime;
- static CCarStateEachFrame* (&pBaseMemForCar)[NUM_CHASE_CARS];
- static float &TimeMultiplier;
- static int &FId2;
+ static uint8 Status;
+ static int PositionChanges;
+ static uint8 CurrentCar;
+ static CAutomobile*pChaseCars[NUM_CHASE_CARS];
+ static float AnimTime;
+ static uint32 AnimStartTime;
+ static CCarStateEachFrame* pBaseMemForCar[NUM_CHASE_CARS];
+ static float TimeMultiplier;
+ static int FId2;
public:
static bool IsRecording(void) { return Status == STATE_RECORD; }
@@ -86,11 +86,11 @@ class CRecordDataForGame
STATE_RECORD = 1,
STATE_PLAYBACK = 2,
};
- static uint16& RecordingState;
- static uint8* &pDataBuffer;
- static uint8* &pDataBufferPointer;
- static int &FId;
- static tGameBuffer &pDataBufferForFrame;
+ static uint16 RecordingState;
+ static uint8* pDataBuffer;
+ static uint8* pDataBufferPointer;
+ static int FId;
+ static tGameBuffer pDataBufferForFrame;
public:
static bool IsRecording() { return RecordingState == STATE_RECORD; }
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 9e0bed66..0570f9a8 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -39,71 +39,70 @@
#include "Camera.h"
#include "Radar.h"
-uint8 &CReplay::Mode = *(uint8*)0x95CD5B;
-CAddressInReplayBuffer &CReplay::Record = *(CAddressInReplayBuffer*)0x942F7C;
-CAddressInReplayBuffer &CReplay::Playback = *(CAddressInReplayBuffer*)0x8F5F48;
-uint8 *&CReplay::pBuf0 = *(uint8**)0x8E2C64;
-CAutomobile *&CReplay::pBuf1 = *(CAutomobile**)0x8E2C68;
-uint8 *&CReplay::pBuf2 = *(uint8**)0x8E2C6C;
-CPlayerPed *&CReplay::pBuf3 = *(CPlayerPed**)0x8E2C70;
-uint8 *&CReplay::pBuf4 = *(uint8**)0x8E2C74;
-CCutsceneHead *&CReplay::pBuf5 = *(CCutsceneHead**)0x8E2C78;
-uint8 *&CReplay::pBuf6 = *(uint8**)0x8E2C80;
-CPtrNode *&CReplay::pBuf7 = *(CPtrNode**)0x8E2C84;
-uint8 *&CReplay::pBuf8 = *(uint8**)0x8E2C54;
-CEntryInfoNode *&CReplay::pBuf9 = *(CEntryInfoNode**)0x8E2C58;
-uint8 *&CReplay::pBuf10 = *(uint8**)0x8F2C28;
-CDummyPed *&CReplay::pBuf11 = *(CDummyPed**)0x8F2C2C;
-uint8 *&CReplay::pRadarBlips = *(uint8**)0x8F29F8;
-uint8 *&CReplay::pStoredCam = *(uint8**)0x8F2C34;
-uint8 *&CReplay::pWorld1 = *(uint8**)0x8E29C4;
-CReference *&CReplay::pEmptyReferences = *(CReference**)0x8F256C;
-CStoredDetailedAnimationState *&CReplay::pPedAnims = *(CStoredDetailedAnimationState**)0x8F6260;
-uint8 *&CReplay::pPickups = *(uint8**)0x8F1A48;
-uint8 *&CReplay::pReferences = *(uint8**)0x880FAC;
-uint8(&CReplay::BufferStatus)[NUM_REPLAYBUFFERS] = *(uint8(*)[NUM_REPLAYBUFFERS])*(uintptr*)0x8804D8;
-uint8(&CReplay::Buffers)[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE] = *(uint8(*)[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE])*(uintptr*)0x779958;
-bool &CReplay::bPlayingBackFromFile = *(bool*)0x95CD58;
-bool &CReplay::bReplayEnabled = *(bool*)0x617CAC;
-uint32 &CReplay::SlowMotion = *(uint32*)0x9414D4;
-uint32 &CReplay::FramesActiveLookAroundCam = *(uint32*)0x880F84;
-bool &CReplay::bDoLoadSceneWhenDone = *(bool*)0x95CD76;
-CPtrList &CReplay::WorldPtrList = *(CPtrList*)0x880F90;
-CPtrList &CReplay::BigBuildingPtrList = *(CPtrList*)0x941284;
-CWanted &CReplay::PlayerWanted = *(CWanted*)0x8F6278;
-CPlayerInfo &CReplay::PlayerInfo = *(CPlayerInfo*)0x8F5840;
-uint32 &CReplay::Time1 = *(uint32*)0x8F29DC;
-uint32 &CReplay::Time2 = *(uint32*)0x8F29D0;
-uint32 &CReplay::Time3 = *(uint32*)0x8F29D4;
-uint32 &CReplay::Time4 = *(uint32*)0x8F29C8;
-uint32 &CReplay::Frame = *(uint32*)0x8F2554;
-uint8 &CReplay::ClockHours = *(uint8*)0x95CDC5;
-uint8 &CReplay::ClockMinutes = *(uint8*)0x95CDA2;
-uint16 &CReplay::OldWeatherType = *(uint16*)0x95CCEA;
-uint16 &CReplay::NewWeatherType = *(uint16*)0x95CC6E;
-float &CReplay::WeatherInterpolationValue = *(float*)0x8F1A28;
-float &CReplay::TimeStepNonClipped = *(float*)0x8F5FF4;
-float &CReplay::TimeStep = *(float*)0x8F2C24;
-float &CReplay::TimeScale = *(float*)0x880E20;
-float &CReplay::CameraFixedX = *(float*)0x943054;
-float &CReplay::CameraFixedY = *(float*)0x943058;
-float &CReplay::CameraFixedZ = *(float*)0x94305C;
-int32 &CReplay::OldRadioStation = *(int32*)0x94151C;
-int8 &CReplay::CameraMode = *(int8*)0x95CD5F;
-bool &CReplay::bAllowLookAroundCam = *(bool*)0x95CDCD;
-float &CReplay::LoadSceneX = *(float*)0x880F9C;
-float &CReplay::LoadSceneY = *(float*)0x880F98;
-float &CReplay::LoadSceneZ = *(float*)0x880F94;
-float &CReplay::CameraFocusX = *(float*)0x942F5C;
-float &CReplay::CameraFocusY = *(float*)0x942F74;
-float &CReplay::CameraFocusZ = *(float*)0x942F58;
-bool &CReplay::bPlayerInRCBuggy = *(bool*)0x95CDC3;
-float &CReplay::fDistanceLookAroundCam = *(float*)0x885B44;
-float &CReplay::fBetaAngleLookAroundCam = *(float*)0x94072C;
-float &CReplay::fAlphaAngleLookAroundCam = *(float*)0x8F2A0C;
+uint8 CReplay::Mode;
+CAddressInReplayBuffer CReplay::Record;
+CAddressInReplayBuffer CReplay::Playback;
+uint8 *CReplay::pBuf0;
+CAutomobile *CReplay::pBuf1;
+uint8 *CReplay::pBuf2;
+CPlayerPed *CReplay::pBuf3;
+uint8 *CReplay::pBuf4;
+CCutsceneHead *CReplay::pBuf5;
+uint8 *CReplay::pBuf6;
+CPtrNode *CReplay::pBuf7;
+uint8 *CReplay::pBuf8;
+CEntryInfoNode *CReplay::pBuf9;
+uint8 *CReplay::pBuf10;
+CDummyPed *CReplay::pBuf11;
+uint8 *CReplay::pRadarBlips;
+uint8 *CReplay::pStoredCam;
+uint8 *CReplay::pWorld1;
+CReference *CReplay::pEmptyReferences;
+CStoredDetailedAnimationState *CReplay::pPedAnims;
+uint8 *CReplay::pPickups;
+uint8 *CReplay::pReferences;
+uint8 CReplay::BufferStatus[NUM_REPLAYBUFFERS];
+uint8 CReplay::Buffers[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE];
+bool CReplay::bPlayingBackFromFile;
+bool CReplay::bReplayEnabled = true;
+uint32 CReplay::SlowMotion;
+uint32 CReplay::FramesActiveLookAroundCam;
+bool CReplay::bDoLoadSceneWhenDone;
+CPtrList CReplay::WorldPtrList;
+CPtrList CReplay::BigBuildingPtrList;
+CWanted CReplay::PlayerWanted;
+CPlayerInfo CReplay::PlayerInfo;
+uint32 CReplay::Time1;
+uint32 CReplay::Time2;
+uint32 CReplay::Time3;
+uint32 CReplay::Time4;
+uint32 CReplay::Frame;
+uint8 CReplay::ClockHours;
+uint8 CReplay::ClockMinutes;
+uint16 CReplay::OldWeatherType;
+uint16 CReplay::NewWeatherType;
+float CReplay::WeatherInterpolationValue;
+float CReplay::TimeStepNonClipped;
+float CReplay::TimeStep;
+float CReplay::TimeScale;
+float CReplay::CameraFixedX;
+float CReplay::CameraFixedY;
+float CReplay::CameraFixedZ;
+int32 CReplay::OldRadioStation;
+int8 CReplay::CameraMode;
+bool CReplay::bAllowLookAroundCam;
+float CReplay::LoadSceneX;
+float CReplay::LoadSceneY;
+float CReplay::LoadSceneZ;
+float CReplay::CameraFocusX;
+float CReplay::CameraFocusY;
+float CReplay::CameraFocusZ;
+bool CReplay::bPlayerInRCBuggy;
+float CReplay::fDistanceLookAroundCam;
+float CReplay::fBetaAngleLookAroundCam;
+float CReplay::fAlphaAngleLookAroundCam;
-static void(*(&CBArray)[30])(CAnimBlendAssociation*, void*) = *(void(*(*)[30])(CAnimBlendAssociation*, void*))*(uintptr*)0x61052C;
-static void(*CBArray_RE3[])(CAnimBlendAssociation*, void*) =
+static void(*CBArray[])(CAnimBlendAssociation*, void*) =
{
nil, &CPed::PedGetupCB, &CPed::PedStaggerCB, &CPed::PedEvadeCB, &CPed::FinishDieAnimCB,
&CPed::FinishedWaitCB, &CPed::FinishLaunchCB, &CPed::FinishHitHeadCB, &CPed::PedAnimGetInCB, &CPed::PedAnimDoorOpenCB,
@@ -119,16 +118,13 @@ static uint8 FindCBFunctionID(void(*f)(CAnimBlendAssociation*, void*))
if (CBArray[i] == f)
return i;
}
- for (int i = 0; i < sizeof(CBArray_RE3) / sizeof(*CBArray_RE3); i++) {
- if (CBArray_RE3[i] == f)
- return i;
- }
+
return 0;
}
static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*)
{
- return CBArray_RE3[id];
+ return CBArray[id];
}
static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flying)
@@ -1087,7 +1083,7 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca
Playback.m_bSlot = first;
Playback.m_nOffset = 0;
Playback.m_pBase = Buffers[first];
- CObject::DeleteAllTempObjectInArea(CVector(0.0f, 0.0f, 0.0f), 1000000.0f);
+ CObject::DeleteAllTempObjectsInArea(CVector(0.0f, 0.0f, 0.0f), 1000000.0f);
StoreStuffInMem();
EmptyPedsAndVehiclePools();
SlowMotion = 1;
diff --git a/src/control/Replay.h b/src/control/Replay.h
index 56de52a3..6f6c2a91 100644
--- a/src/control/Replay.h
+++ b/src/control/Replay.h
@@ -205,68 +205,68 @@ class CReplay
static_assert(sizeof(tVehicleUpdatePacket) == 48, "tVehicleUpdatePacket: error");
private:
- static uint8 &Mode;
- static CAddressInReplayBuffer &Record;
- static CAddressInReplayBuffer &Playback;
- static uint8 *&pBuf0;
- static CAutomobile *&pBuf1;
- static uint8 *&pBuf2;
- static CPlayerPed *&pBuf3;
- static uint8 *&pBuf4;
- static CCutsceneHead *&pBuf5;
- static uint8 *&pBuf6;
- static CPtrNode *&pBuf7;
- static uint8 *&pBuf8;
- static CEntryInfoNode *&pBuf9;
- static uint8 *&pBuf10;
- static CDummyPed *&pBuf11;
- static uint8 *&pRadarBlips;
- static uint8 *&pStoredCam;
- static uint8 *&pWorld1;
- static CReference *&pEmptyReferences;
- static CStoredDetailedAnimationState *&pPedAnims;
- static uint8 *&pPickups;
- static uint8 *&pReferences;
- static uint8 (&BufferStatus)[NUM_REPLAYBUFFERS];
- static uint8 (&Buffers)[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE];
- static bool &bPlayingBackFromFile;
- static bool &bReplayEnabled;
- static uint32 &SlowMotion;
- static uint32 &FramesActiveLookAroundCam;
- static bool &bDoLoadSceneWhenDone;
- static CPtrList &WorldPtrList;
- static CPtrList &BigBuildingPtrList;
- static CWanted &PlayerWanted;
- static CPlayerInfo &PlayerInfo;
- static uint32 &Time1;
- static uint32 &Time2;
- static uint32 &Time3;
- static uint32 &Time4;
- static uint32 &Frame;
- static uint8 &ClockHours;
- static uint8 &ClockMinutes;
- static uint16 &OldWeatherType;
- static uint16 &NewWeatherType;
- static float &WeatherInterpolationValue;
- static float &TimeStepNonClipped;
- static float &TimeStep;
- static float &TimeScale;
- static float &CameraFixedX;
- static float &CameraFixedY;
- static float &CameraFixedZ;
- static int32 &OldRadioStation;
- static int8 &CameraMode;
- static bool &bAllowLookAroundCam;
- static float &LoadSceneX;
- static float &LoadSceneY;
- static float &LoadSceneZ;
- static float &CameraFocusX;
- static float &CameraFocusY;
- static float &CameraFocusZ;
- static bool &bPlayerInRCBuggy;
- static float &fDistanceLookAroundCam;
- static float &fAlphaAngleLookAroundCam;
- static float &fBetaAngleLookAroundCam;
+ static uint8 Mode;
+ static CAddressInReplayBuffer Record;
+ static CAddressInReplayBuffer Playback;
+ static uint8 *pBuf0;
+ static CAutomobile *pBuf1;
+ static uint8 *pBuf2;
+ static CPlayerPed *pBuf3;
+ static uint8 *pBuf4;
+ static CCutsceneHead *pBuf5;
+ static uint8 *pBuf6;
+ static CPtrNode *pBuf7;
+ static uint8 *pBuf8;
+ static CEntryInfoNode *pBuf9;
+ static uint8 *pBuf10;
+ static CDummyPed *pBuf11;
+ static uint8 *pRadarBlips;
+ static uint8 *pStoredCam;
+ static uint8 *pWorld1;
+ static CReference *pEmptyReferences;
+ static CStoredDetailedAnimationState *pPedAnims;
+ static uint8 *pPickups;
+ static uint8 *pReferences;
+ static uint8 BufferStatus[NUM_REPLAYBUFFERS];
+ static uint8 Buffers[NUM_REPLAYBUFFERS][REPLAYBUFFERSIZE];
+ static bool bPlayingBackFromFile;
+ static bool bReplayEnabled;
+ static uint32 SlowMotion;
+ static uint32 FramesActiveLookAroundCam;
+ static bool bDoLoadSceneWhenDone;
+ static CPtrList WorldPtrList;
+ static CPtrList BigBuildingPtrList;
+ static CWanted PlayerWanted;
+ static CPlayerInfo PlayerInfo;
+ static uint32 Time1;
+ static uint32 Time2;
+ static uint32 Time3;
+ static uint32 Time4;
+ static uint32 Frame;
+ static uint8 ClockHours;
+ static uint8 ClockMinutes;
+ static uint16 OldWeatherType;
+ static uint16 NewWeatherType;
+ static float WeatherInterpolationValue;
+ static float TimeStepNonClipped;
+ static float TimeStep;
+ static float TimeScale;
+ static float CameraFixedX;
+ static float CameraFixedY;
+ static float CameraFixedZ;
+ static int32 OldRadioStation;
+ static int8 CameraMode;
+ static bool bAllowLookAroundCam;
+ static float LoadSceneX;
+ static float LoadSceneY;
+ static float LoadSceneZ;
+ static float CameraFocusX;
+ static float CameraFocusY;
+ static float CameraFocusZ;
+ static bool bPlayerInRCBuggy;
+ static float fDistanceLookAroundCam;
+ static float fAlphaAngleLookAroundCam;
+ static float fBetaAngleLookAroundCam;
public:
static void Init(void);
diff --git a/src/control/Restart.cpp b/src/control/Restart.cpp
index 788a054a..2730f5c0 100644
--- a/src/control/Restart.cpp
+++ b/src/control/Restart.cpp
@@ -4,22 +4,22 @@
#include "Zones.h"
#include "PathFind.h"
-uint8 &CRestart::OverrideHospitalLevel = *(uint8*)0x95CD4C;
-uint8 &CRestart::OverridePoliceStationLevel = *(uint8*)0x95CD50;
-bool &CRestart::bFadeInAfterNextArrest = *(bool*)0x95CD69;
-bool &CRestart::bFadeInAfterNextDeath = *(bool*)0x95CD9D;
-
-bool &CRestart::bOverrideRestart = *(bool*)0x95CD5D;
-CVector &CRestart::OverridePosition = *(CVector*)0x8E2C00;
-float &CRestart::OverrideHeading = *(float*)0x8F2A18;
-
-CVector(&CRestart::HospitalRestartPoints)[NUM_RESTART_POINTS] = *(CVector(*)[NUM_RESTART_POINTS])*(uintptr*)0x87F9B0;
-float(&CRestart::HospitalRestartHeadings)[NUM_RESTART_POINTS] = *(float(*)[NUM_RESTART_POINTS])*(uintptr*)0x6F1D40;
-uint16 &CRestart::NumberOfHospitalRestarts = *(uint16*)0x95CC46;
-
-CVector(&CRestart::PoliceRestartPoints)[NUM_RESTART_POINTS] = *(CVector(*)[NUM_RESTART_POINTS])*(uintptr*)0x846228;
-float(&CRestart::PoliceRestartHeadings)[NUM_RESTART_POINTS] = *(float(*)[NUM_RESTART_POINTS])*(uintptr*)0x6F1D20;
-uint16 &CRestart::NumberOfPoliceRestarts = *(uint16*)0x95CC44;
+uint8 CRestart::OverrideHospitalLevel;
+uint8 CRestart::OverridePoliceStationLevel;
+bool CRestart::bFadeInAfterNextArrest;
+bool CRestart::bFadeInAfterNextDeath;
+
+bool CRestart::bOverrideRestart;
+CVector CRestart::OverridePosition;
+float CRestart::OverrideHeading;
+
+CVector CRestart::HospitalRestartPoints[NUM_RESTART_POINTS];
+float CRestart::HospitalRestartHeadings[NUM_RESTART_POINTS];
+uint16 CRestart::NumberOfHospitalRestarts;
+
+CVector CRestart::PoliceRestartPoints[NUM_RESTART_POINTS];
+float CRestart::PoliceRestartHeadings[NUM_RESTART_POINTS];
+uint16 CRestart::NumberOfPoliceRestarts;
void
CRestart::Initialise()
diff --git a/src/control/Restart.h b/src/control/Restart.h
index fb7806db..5d84c723 100644
--- a/src/control/Restart.h
+++ b/src/control/Restart.h
@@ -17,20 +17,20 @@ public:
static void LoadAllRestartPoints(uint8 *buf, uint32 size);
static void SaveAllRestartPoints(uint8 *buf, uint32 *size);
- static uint8 &OverrideHospitalLevel;
- static uint8 &OverridePoliceStationLevel;
- static bool &bFadeInAfterNextArrest;
- static bool &bFadeInAfterNextDeath;
-
- static bool &bOverrideRestart;
- static CVector &OverridePosition;
- static float &OverrideHeading;
-
- static CVector(&HospitalRestartPoints)[NUM_RESTART_POINTS];
- static float (&HospitalRestartHeadings)[NUM_RESTART_POINTS];
- static uint16 &NumberOfHospitalRestarts;
-
- static CVector (&PoliceRestartPoints)[NUM_RESTART_POINTS];
- static float (&PoliceRestartHeadings)[NUM_RESTART_POINTS];
- static uint16 &NumberOfPoliceRestarts;
+ static uint8 OverrideHospitalLevel;
+ static uint8 OverridePoliceStationLevel;
+ static bool bFadeInAfterNextArrest;
+ static bool bFadeInAfterNextDeath;
+
+ static bool bOverrideRestart;
+ static CVector OverridePosition;
+ static float OverrideHeading;
+
+ static CVector HospitalRestartPoints[NUM_RESTART_POINTS];
+ static float HospitalRestartHeadings[NUM_RESTART_POINTS];
+ static uint16 NumberOfHospitalRestarts;
+
+ static CVector PoliceRestartPoints[NUM_RESTART_POINTS];
+ static float PoliceRestartHeadings[NUM_RESTART_POINTS];
+ static uint16 NumberOfPoliceRestarts;
};
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp
index 9548bc0a..fcfa42e3 100644
--- a/src/control/RoadBlocks.cpp
+++ b/src/control/RoadBlocks.cpp
@@ -15,9 +15,9 @@
#include "CarCtrl.h"
#include "General.h"
-int16 &CRoadBlocks::NumRoadBlocks = *(int16*)0x95CC34;
-int16 (&CRoadBlocks::RoadBlockObjects)[NUMROADBLOCKS] = *(int16(*)[NUMROADBLOCKS]) * (uintptr*)0x72B3A8;
-bool (&CRoadBlocks::InOrOut)[NUMROADBLOCKS] = *(bool(*)[NUMROADBLOCKS]) * (uintptr*)0x733810;
+int16 CRoadBlocks::NumRoadBlocks;
+int16 CRoadBlocks::RoadBlockObjects[NUMROADBLOCKS];
+bool CRoadBlocks::InOrOut[NUMROADBLOCKS];
void
CRoadBlocks::Init(void)
diff --git a/src/control/RoadBlocks.h b/src/control/RoadBlocks.h
index 16e3a362..0f0c1882 100644
--- a/src/control/RoadBlocks.h
+++ b/src/control/RoadBlocks.h
@@ -6,9 +6,9 @@ class CVehicle;
class CRoadBlocks
{
public:
- static int16 (&NumRoadBlocks);
- static int16 (&RoadBlockObjects)[NUMROADBLOCKS];
- static bool (&InOrOut)[NUMROADBLOCKS];
+ static int16 NumRoadBlocks;
+ static int16 RoadBlockObjects[NUMROADBLOCKS];
+ static bool InOrOut[NUMROADBLOCKS];
static void Init(void);
static void GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode);
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 428ac66a..d4ede846 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -87,47 +87,47 @@
#define FEET_IN_METER 3.33f
#endif
-uint8 (&CTheScripts::ScriptSpace)[SIZE_SCRIPT_SPACE] = *(uint8(*)[SIZE_SCRIPT_SPACE])*(uintptr*)0x74B248;
-CRunningScript(&CTheScripts::ScriptsArray)[MAX_NUM_SCRIPTS] = *(CRunningScript(*)[MAX_NUM_SCRIPTS])*(uintptr*)0x6F5C08;
-int32(&CTheScripts::BaseBriefIdForContact)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x880200;
-int32(&CTheScripts::OnAMissionForContactFlag)[MAX_NUM_CONTACTS] = *(int32(*)[MAX_NUM_CONTACTS])*(uintptr*)0x8622F0;
-intro_text_line (&CTheScripts::IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES] = *(intro_text_line (*)[MAX_NUM_INTRO_TEXT_LINES])*(uintptr*)0x70EA68;
-intro_script_rectangle (&CTheScripts::IntroRectangles)[MAX_NUM_INTRO_RECTANGLES] = *(intro_script_rectangle (*)[MAX_NUM_INTRO_RECTANGLES])*(uintptr*)0x72D108;
-CSprite2d (&CTheScripts::ScriptSprites)[MAX_NUM_SCRIPT_SRPITES] = *(CSprite2d(*)[MAX_NUM_SCRIPT_SRPITES])*(uintptr*)0x72B090;
-script_sphere_struct(&CTheScripts::ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES] = *(script_sphere_struct(*)[MAX_NUM_SCRIPT_SPHERES])*(uintptr*)0x727D60;
-tCollectiveData(&CTheScripts::CollectiveArray)[MAX_NUM_COLLECTIVES] = *(tCollectiveData(*)[MAX_NUM_COLLECTIVES])*(uintptr*)0x6FA008;
-tUsedObject(&CTheScripts::UsedObjectArray)[MAX_NUM_USED_OBJECTS] = *(tUsedObject(*)[MAX_NUM_USED_OBJECTS])*(uintptr*)0x6E69C8;
-int32(&CTheScripts::MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS] = *(int32(*)[MAX_NUM_MISSION_SCRIPTS])*(uintptr*)0x6F0558;
-tBuildingSwap(&CTheScripts::BuildingSwapArray)[MAX_NUM_BUILDING_SWAPS] = *(tBuildingSwap(*)[MAX_NUM_BUILDING_SWAPS])*(uintptr*)0x880E30;
-CEntity*(&CTheScripts::InvisibilitySettingArray)[MAX_NUM_INVISIBILITY_SETTINGS] = *(CEntity*(*)[MAX_NUM_INVISIBILITY_SETTINGS])*(uintptr*)0x8620F0;
-CStoredLine (&CTheScripts::aStoredLines)[MAX_NUM_STORED_LINES] = *(CStoredLine(*)[MAX_NUM_STORED_LINES])*(uintptr*)0x743018;
-bool &CTheScripts::DbgFlag = *(bool*)0x95CD87;
-uint32 &CTheScripts::OnAMissionFlag = *(uint32*)0x8F1B64;
-int32 &CTheScripts::StoreVehicleIndex = *(int32*)0x8F5F3C;
-bool &CTheScripts::StoreVehicleWasRandom = *(bool*)0x95CDBC;
-CRunningScript *&CTheScripts::pIdleScripts = *(CRunningScript**)0x9430D4;
-CRunningScript *&CTheScripts::pActiveScripts = *(CRunningScript**)0x8E2BF4;
-uint32 &CTheScripts::NextFreeCollectiveIndex = *(uint32*)0x942F98;
-int32 &CTheScripts::LastRandomPedId = *(int32*)0x8F251C;
-uint16 &CTheScripts::NumberOfUsedObjects = *(uint16*)0x95CC72;
-bool &CTheScripts::bAlreadyRunningAMissionScript = *(bool*)0x95CDB3;
-bool &CTheScripts::bUsingAMultiScriptFile = *(bool*)0x95CD55;
-uint16 &CTheScripts::NumberOfMissionScripts = *(uint16*)0x95CC9A;
-uint32 &CTheScripts::LargestMissionScriptSize = *(uint32*)0x9414C8;
-uint32 &CTheScripts::MainScriptSize = *(uint32*)0x9405A4;
-uint8 &CTheScripts::FailCurrentMission = *(uint8*)0x95CD41;
-uint8 &CTheScripts::CountdownToMakePlayerUnsafe = *(uint8*)0x95CD51;
-uint8 &CTheScripts::DelayMakingPlayerUnsafeThisTime = *(uint8*)0x95CD88;
-uint16 &CTheScripts::NumScriptDebugLines = *(uint16*)0x95CC42;
-uint16 &CTheScripts::NumberOfIntroRectanglesThisFrame = *(uint16*)0x95CC88;
-uint16 &CTheScripts::NumberOfIntroTextLinesThisFrame = *(uint16*)0x95CC32;
-uint8 &CTheScripts::UseTextCommands = *(uint8*)0x95CD57;
-CMissionCleanup (&CTheScripts::MissionCleanup) = *(CMissionCleanup*)0x8F2A24;
-CUpsideDownCarCheck (&CTheScripts::UpsideDownCars) = *(CUpsideDownCarCheck*)0x6EE450;
-CStuckCarCheck (&CTheScripts::StuckCars) = *(CStuckCarCheck*)0x87C588;
-uint16 &CTheScripts::CommandsExecuted = *(uint16*)0x95CCA6;
-uint16 &CTheScripts::ScriptsUpdated = *(uint16*)0x95CC5E;
-int32(&ScriptParams)[32] = *(int32(*)[32])*(uintptr*)0x6ED460;
+uint8 CTheScripts::ScriptSpace[SIZE_SCRIPT_SPACE];
+CRunningScript CTheScripts::ScriptsArray[MAX_NUM_SCRIPTS];
+int32 CTheScripts::BaseBriefIdForContact[MAX_NUM_CONTACTS];
+int32 CTheScripts::OnAMissionForContactFlag[MAX_NUM_CONTACTS];
+intro_text_line CTheScripts::IntroTextLines[MAX_NUM_INTRO_TEXT_LINES];
+intro_script_rectangle CTheScripts::IntroRectangles[MAX_NUM_INTRO_RECTANGLES];
+CSprite2d CTheScripts::ScriptSprites[MAX_NUM_SCRIPT_SRPITES];
+script_sphere_struct CTheScripts::ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES];
+tCollectiveData CTheScripts::CollectiveArray[MAX_NUM_COLLECTIVES];
+tUsedObject CTheScripts::UsedObjectArray[MAX_NUM_USED_OBJECTS];
+int32 CTheScripts::MultiScriptArray[MAX_NUM_MISSION_SCRIPTS];
+tBuildingSwap CTheScripts::BuildingSwapArray[MAX_NUM_BUILDING_SWAPS];
+CEntity* CTheScripts::InvisibilitySettingArray[MAX_NUM_INVISIBILITY_SETTINGS];
+CStoredLine CTheScripts::aStoredLines[MAX_NUM_STORED_LINES];
+bool CTheScripts::DbgFlag;
+uint32 CTheScripts::OnAMissionFlag;
+int32 CTheScripts::StoreVehicleIndex;
+bool CTheScripts::StoreVehicleWasRandom;
+CRunningScript *CTheScripts::pIdleScripts;
+CRunningScript *CTheScripts::pActiveScripts;
+uint32 CTheScripts::NextFreeCollectiveIndex;
+int32 CTheScripts::LastRandomPedId;
+uint16 CTheScripts::NumberOfUsedObjects;
+bool CTheScripts::bAlreadyRunningAMissionScript;
+bool CTheScripts::bUsingAMultiScriptFile;
+uint16 CTheScripts::NumberOfMissionScripts;
+uint32 CTheScripts::LargestMissionScriptSize;
+uint32 CTheScripts::MainScriptSize;
+uint8 CTheScripts::FailCurrentMission;
+uint8 CTheScripts::CountdownToMakePlayerUnsafe;
+uint8 CTheScripts::DelayMakingPlayerUnsafeThisTime;
+uint16 CTheScripts::NumScriptDebugLines;
+uint16 CTheScripts::NumberOfIntroRectanglesThisFrame;
+uint16 CTheScripts::NumberOfIntroTextLinesThisFrame;
+uint8 CTheScripts::UseTextCommands;
+CMissionCleanup CTheScripts::MissionCleanup;
+CUpsideDownCarCheck CTheScripts::UpsideDownCars;
+CStuckCarCheck CTheScripts::StuckCars;
+uint16 CTheScripts::CommandsExecuted;
+uint16 CTheScripts::ScriptsUpdated;
+int32 ScriptParams[32];
CMissionCleanup::CMissionCleanup()
{
diff --git a/src/control/Script.h b/src/control/Script.h
index 4338bd18..2eed29fe 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -240,46 +240,46 @@ enum {
class CTheScripts
{
- static uint8(&ScriptSpace)[SIZE_SCRIPT_SPACE];
- static CRunningScript(&ScriptsArray)[MAX_NUM_SCRIPTS];
- static int32(&BaseBriefIdForContact)[MAX_NUM_CONTACTS];
- static int32(&OnAMissionForContactFlag)[MAX_NUM_CONTACTS];
- static intro_text_line(&IntroTextLines)[MAX_NUM_INTRO_TEXT_LINES];
- static intro_script_rectangle(&IntroRectangles)[MAX_NUM_INTRO_RECTANGLES];
- static CSprite2d(&ScriptSprites)[MAX_NUM_SCRIPT_SRPITES];
- static script_sphere_struct(&ScriptSphereArray)[MAX_NUM_SCRIPT_SPHERES];
- static tCollectiveData(&CollectiveArray)[MAX_NUM_COLLECTIVES];
- static tUsedObject(&UsedObjectArray)[MAX_NUM_USED_OBJECTS];
- static int32(&MultiScriptArray)[MAX_NUM_MISSION_SCRIPTS];
- static tBuildingSwap(&BuildingSwapArray)[MAX_NUM_BUILDING_SWAPS];
- static CEntity*(&InvisibilitySettingArray)[MAX_NUM_INVISIBILITY_SETTINGS];
- static CStoredLine(&aStoredLines)[MAX_NUM_STORED_LINES];
- static bool &DbgFlag;
- static uint32 &OnAMissionFlag;
- static CMissionCleanup &MissionCleanup;
- static CStuckCarCheck &StuckCars;
- static CUpsideDownCarCheck &UpsideDownCars;
- static int32 &StoreVehicleIndex;
- static bool &StoreVehicleWasRandom;
- static CRunningScript *&pIdleScripts;
- static CRunningScript *&pActiveScripts;
- static uint32 &NextFreeCollectiveIndex;
- static int32 &LastRandomPedId;
- static uint16 &NumberOfUsedObjects;
- static bool &bAlreadyRunningAMissionScript;
- static bool &bUsingAMultiScriptFile;
- static uint16 &NumberOfMissionScripts;
- static uint32 &LargestMissionScriptSize;
- static uint32 &MainScriptSize;
- static uint8 &FailCurrentMission;
- static uint8 &CountdownToMakePlayerUnsafe;
- static uint8 &DelayMakingPlayerUnsafeThisTime;
- static uint16 &NumScriptDebugLines;
- static uint16 &NumberOfIntroRectanglesThisFrame;
- static uint16 &NumberOfIntroTextLinesThisFrame;
- static uint8 &UseTextCommands;
- static uint16 &CommandsExecuted;
- static uint16 &ScriptsUpdated;
+ static uint8 ScriptSpace[SIZE_SCRIPT_SPACE];
+ static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
+ static int32 BaseBriefIdForContact[MAX_NUM_CONTACTS];
+ static int32 OnAMissionForContactFlag[MAX_NUM_CONTACTS];
+ static intro_text_line IntroTextLines[MAX_NUM_INTRO_TEXT_LINES];
+ static intro_script_rectangle IntroRectangles[MAX_NUM_INTRO_RECTANGLES];
+ static CSprite2d ScriptSprites[MAX_NUM_SCRIPT_SRPITES];
+ static script_sphere_struct ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES];
+ static tCollectiveData CollectiveArray[MAX_NUM_COLLECTIVES];
+ static tUsedObject UsedObjectArray[MAX_NUM_USED_OBJECTS];
+ static int32 MultiScriptArray[MAX_NUM_MISSION_SCRIPTS];
+ static tBuildingSwap BuildingSwapArray[MAX_NUM_BUILDING_SWAPS];
+ static CEntity* InvisibilitySettingArray[MAX_NUM_INVISIBILITY_SETTINGS];
+ static CStoredLine aStoredLines[MAX_NUM_STORED_LINES];
+ static bool DbgFlag;
+ static uint32 OnAMissionFlag;
+ static CMissionCleanup MissionCleanup;
+ static CStuckCarCheck StuckCars;
+ static CUpsideDownCarCheck UpsideDownCars;
+ static int32 StoreVehicleIndex;
+ static bool StoreVehicleWasRandom;
+ static CRunningScript *pIdleScripts;
+ static CRunningScript *pActiveScripts;
+ static uint32 NextFreeCollectiveIndex;
+ static int32 LastRandomPedId;
+ static uint16 NumberOfUsedObjects;
+ static bool bAlreadyRunningAMissionScript;
+ static bool bUsingAMultiScriptFile;
+ static uint16 NumberOfMissionScripts;
+ static uint32 LargestMissionScriptSize;
+ static uint32 MainScriptSize;
+ static uint8 FailCurrentMission;
+ static uint8 CountdownToMakePlayerUnsafe;
+ static uint8 DelayMakingPlayerUnsafeThisTime;
+ static uint16 NumScriptDebugLines;
+ static uint16 NumberOfIntroRectanglesThisFrame;
+ static uint16 NumberOfIntroTextLinesThisFrame;
+ static uint8 UseTextCommands;
+ static uint16 CommandsExecuted;
+ static uint16 ScriptsUpdated;
public:
static void Init();
diff --git a/src/core/Accident.cpp b/src/core/Accident.cpp
index d8313ddc..3c39b11d 100644
--- a/src/core/Accident.cpp
+++ b/src/core/Accident.cpp
@@ -6,7 +6,7 @@
#include "Pools.h"
#include "World.h"
-CAccidentManager& gAccidentManager = *(CAccidentManager*)0x87FD10;
+CAccidentManager gAccidentManager;
CAccident*
CAccidentManager::GetNextFreeAccident()
diff --git a/src/core/Accident.h b/src/core/Accident.h
index 69889645..949d5fb9 100644
--- a/src/core/Accident.h
+++ b/src/core/Accident.h
@@ -29,4 +29,4 @@ public:
bool WorkToDoForMedics();
};
-extern CAccidentManager& gAccidentManager; \ No newline at end of file
+extern CAccidentManager gAccidentManager; \ No newline at end of file
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index cfdea46a..4d954ccd 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -28,7 +28,7 @@
const float DefaultFOV = 70.0f; // beta: 80.0f
bool PrintDebugCode = false;
-int16 &DebugCamMode = *(int16*)0x95CCF2;
+int16 DebugCamMode;
#ifdef FREE_CAM
bool CCamera::bFreeCam = false;
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index c2392d3b..a1f36d93 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -58,9 +58,9 @@ enum
#define PLAYER (CWorld::Players[CWorld::PlayerInFocus].m_pPed)
// NB: removed explicit TheCamera from all functions
-CCamera &TheCamera = *(CCamera*)0x6FACF8;
-bool &CCamera::m_bUseMouse3rdPerson = *(bool *)0x5F03D8;
-bool &bDidWeProcessAnyCinemaCam = *(bool*)0x95CD46;
+CCamera TheCamera;
+bool CCamera::m_bUseMouse3rdPerson = true;
+bool bDidWeProcessAnyCinemaCam;
#ifdef IMPROVED_CAMERA
#define KEYJUSTDOWN(k) ControlsManager.GetIsKeyboardKeyJustDown((RsKeyCodes)k)
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 09a8d603..d1c8ec03 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -6,7 +6,7 @@ class CPed;
class CAutomobile;
class CGarage;
-extern int16 &DebugCamMode;
+extern int16 DebugCamMode;
enum
{
@@ -540,7 +540,7 @@ uint32 unknown; // some counter having to do with music
uint32 m_uiFadeTimeStarted;
uint32 m_uiFadeTimeStartedMusic;
- static bool &m_bUseMouse3rdPerson;
+ static bool m_bUseMouse3rdPerson;
#ifdef FREE_CAM
static bool bFreeCam;
#endif
@@ -647,7 +647,7 @@ static_assert(offsetof(CCamera, m_vecCutSceneOffset) == 0x6F8, "CCamera: error")
static_assert(offsetof(CCamera, m_arrPathArray) == 0x7a8, "CCamera: error");
static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size");
-extern CCamera &TheCamera;
+extern CCamera TheCamera;
void CamShakeNoPos(CCamera*, float);
void MakeAngleLessThan180(float &Angle);
diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp
index a97dcb5f..69fdd682 100644
--- a/src/core/Clock.cpp
+++ b/src/core/Clock.cpp
@@ -6,17 +6,17 @@
#include "Stats.h"
_TODO("gbFastTime");
-bool &gbFastTime = *(bool*)0x95CDBB;
+bool gbFastTime;
-uint8 &CClock::ms_nGameClockHours = *(uint8*)0x95CDA6;
-uint8 &CClock::ms_nGameClockMinutes = *(uint8*)0x95CDC8;
-uint16 &CClock::ms_nGameClockSeconds = *(uint16*)0x95CC7C;
-uint8 &CClock::ms_Stored_nGameClockHours = *(uint8*)0x95CD7B;
-uint8 &CClock::ms_Stored_nGameClockMinutes = *(uint8*)0x95CD9B;
-uint16 &CClock::ms_Stored_nGameClockSeconds = *(uint16*)0x95CC9C;
-uint32 &CClock::ms_nMillisecondsPerGameMinute = *(uint32*)0x8F2C64;
-uint32 &CClock::ms_nLastClockTick = *(uint32*)0x9430E4;
-bool &CClock::ms_bClockHasBeenStored = *(bool*)0x95CD82;
+uint8 CClock::ms_nGameClockHours;
+uint8 CClock::ms_nGameClockMinutes;
+uint16 CClock::ms_nGameClockSeconds;
+uint8 CClock::ms_Stored_nGameClockHours;
+uint8 CClock::ms_Stored_nGameClockMinutes;
+uint16 CClock::ms_Stored_nGameClockSeconds;
+uint32 CClock::ms_nMillisecondsPerGameMinute;
+uint32 CClock::ms_nLastClockTick;
+bool CClock::ms_bClockHasBeenStored;
void
CClock::Initialise(uint32 scale)
diff --git a/src/core/Clock.h b/src/core/Clock.h
index 6b9908ba..a611cd50 100644
--- a/src/core/Clock.h
+++ b/src/core/Clock.h
@@ -3,15 +3,15 @@
class CClock
{
public:
- static uint8 &ms_nGameClockHours;
- static uint8 &ms_nGameClockMinutes;
- static uint16 &ms_nGameClockSeconds;
- static uint8 &ms_Stored_nGameClockHours;
- static uint8 &ms_Stored_nGameClockMinutes;
- static uint16 &ms_Stored_nGameClockSeconds;
- static uint32 &ms_nMillisecondsPerGameMinute;
- static uint32 &ms_nLastClockTick;
- static bool &ms_bClockHasBeenStored;
+ static uint8 ms_nGameClockHours;
+ static uint8 ms_nGameClockMinutes;
+ static uint16 ms_nGameClockSeconds;
+ static uint8 ms_Stored_nGameClockHours;
+ static uint8 ms_Stored_nGameClockMinutes;
+ static uint16 ms_Stored_nGameClockSeconds;
+ static uint32 ms_nMillisecondsPerGameMinute;
+ static uint32 ms_nLastClockTick;
+ static bool ms_bClockHasBeenStored;
static void Initialise(uint32 scale);
static void Update(void);
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp
index 541257c6..ce8674d7 100644
--- a/src/core/ControllerConfig.cpp
+++ b/src/core/ControllerConfig.cpp
@@ -18,7 +18,7 @@
#include "win.h"
#include "GenericGameStorage.h"
-CControllerConfigManager &ControlsManager = *(CControllerConfigManager*)0x8F43A4;
+CControllerConfigManager ControlsManager;
CControllerConfigManager::CControllerConfigManager()
{
diff --git a/src/core/ControllerConfig.h b/src/core/ControllerConfig.h
index 458e457c..c328594e 100644
--- a/src/core/ControllerConfig.h
+++ b/src/core/ControllerConfig.h
@@ -198,4 +198,4 @@ public:
VALIDATE_SIZE(CControllerConfigManager, 0x143C);
-extern CControllerConfigManager &ControlsManager; \ No newline at end of file
+extern CControllerConfigManager ControlsManager; \ No newline at end of file
diff --git a/src/core/EventList.cpp b/src/core/EventList.cpp
index d1c76f33..5ca4cdb0 100644
--- a/src/core/EventList.cpp
+++ b/src/core/EventList.cpp
@@ -11,7 +11,6 @@
int32 CEventList::ms_nFirstFreeSlotIndex;
CEvent gaEvent[NUMEVENTS];
-//CEvent *gaEvent = (CEvent*)0x6EF830;
enum
{
diff --git a/src/core/FileMgr.cpp b/src/core/FileMgr.cpp
index 2a8628b0..382316bb 100644
--- a/src/core/FileMgr.cpp
+++ b/src/core/FileMgr.cpp
@@ -168,8 +168,8 @@ myfeof(int fd)
}
-char *CFileMgr::ms_rootDirName = (char*)0x5F18F8;
-char *CFileMgr::ms_dirName = (char*)0x713CA8;
+char CFileMgr::ms_rootDirName[128] = {'\0'};
+char CFileMgr::ms_dirName[128];
void
CFileMgr::Initialise(void)
diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h
index 3df0c7d8..a6e4b6e5 100644
--- a/src/core/FileMgr.h
+++ b/src/core/FileMgr.h
@@ -2,8 +2,8 @@
class CFileMgr
{
- static char *ms_rootDirName; //[128];
- static char *ms_dirName; //[128];
+ static char ms_rootDirName[128];
+ static char ms_dirName[128];
public:
static void Initialise(void);
static void ChangeDir(const char *dir);
diff --git a/src/core/Fire.cpp b/src/core/Fire.cpp
index cfa849e9..f900091e 100644
--- a/src/core/Fire.cpp
+++ b/src/core/Fire.cpp
@@ -16,7 +16,7 @@
#include "Ped.h"
#include "Fire.h"
-CFireManager &gFireManager = *(CFireManager*)0x8F31D0;
+CFireManager gFireManager;
CFire::CFire()
{
diff --git a/src/core/Fire.h b/src/core/Fire.h
index a4599d11..85e53f61 100644
--- a/src/core/Fire.h
+++ b/src/core/Fire.h
@@ -48,4 +48,4 @@ public:
void RemoveScriptFire(int16 index);
void SetScriptFireAudio(int16 index, bool state);
};
-extern CFireManager &gFireManager;
+extern CFireManager gFireManager;
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index a01689e4..b2ecdac5 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -93,7 +93,7 @@ int8 CMenuManager::m_PrefsSpeakers;
int32 CMenuManager::m_ControlMethod;
int8 CMenuManager::m_PrefsDMA = 1;
int32 CMenuManager::m_PrefsLanguage;
-uint8 CMenuManager::m_PrefsStereoMono; // *(bool*)0x95CDB5; // unused except restore settings
+uint8 CMenuManager::m_PrefsStereoMono; // unused except restore settings
bool CMenuManager::m_PrefsAllowNastyGame = true;
bool CMenuManager::m_bStartUpFrontEndRequested;
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 8699ffeb..f115d52f 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -89,19 +89,19 @@
-eLevelName &CGame::currLevel = *(eLevelName*)0x941514;
-bool &CGame::bDemoMode = *(bool*)0x5F4DD0;
-bool &CGame::nastyGame = *(bool*)0x5F4DD4;
-bool &CGame::frenchGame = *(bool*)0x95CDCB;
-bool &CGame::germanGame = *(bool*)0x95CD1E;
-bool &CGame::noProstitutes = *(bool*)0x95CDCF;
-bool &CGame::playingIntro = *(bool*)0x95CDC2;
-char *CGame::aDatFile = (char*)0x773A48;
+eLevelName CGame::currLevel;
+bool CGame::bDemoMode = true;
+bool CGame::nastyGame = true;
+bool CGame::frenchGame;
+bool CGame::germanGame;
+bool CGame::noProstitutes;
+bool CGame::playingIntro;
+char CGame::aDatFile[32];
#ifdef MORE_LANGUAGES
bool CGame::russianGame = false;
#endif
-int &gameTxdSlot = *(int*)0x628D88;
+int gameTxdSlot;
bool
CGame::InitialiseOnceBeforeRW(void)
@@ -115,7 +115,9 @@ CGame::InitialiseOnceBeforeRW(void)
bool
CGame::InitialiseRenderWare(void)
{
+#ifdef USE_TEXTURE_POOL
_TexturePoolsInitialise();
+#endif
CTxdStore::Initialise();
CVisibilityPlugins::Initialise();
@@ -188,7 +190,9 @@ void CGame::ShutdownRenderWare(void)
CVisibilityPlugins::Shutdown();
+#ifdef USE_TEXTURE_POOL
_TexturePoolsShutdown();
+#endif
}
bool CGame::InitialiseOnceAfterRW(void)
diff --git a/src/core/Game.h b/src/core/Game.h
index 30581893..8dc73e8a 100644
--- a/src/core/Game.h
+++ b/src/core/Game.h
@@ -11,17 +11,17 @@ enum eLevelName
class CGame
{
public:
- static eLevelName &currLevel;
- static bool &bDemoMode;
- static bool &nastyGame;
- static bool &frenchGame;
- static bool &germanGame;
+ static eLevelName currLevel;
+ static bool bDemoMode;
+ static bool nastyGame;
+ static bool frenchGame;
+ static bool germanGame;
#ifdef MORE_LANGUAGES
static bool russianGame;
#endif
- static bool &noProstitutes;
- static bool &playingIntro;
- static char *aDatFile; //[32];
+ static bool noProstitutes;
+ static bool playingIntro;
+ static char aDatFile[32];
static bool InitialiseOnceBeforeRW(void);
static bool InitialiseRenderWare(void);
diff --git a/src/core/IniFile.cpp b/src/core/IniFile.cpp
index 744f4bd0..d8e91c98 100644
--- a/src/core/IniFile.cpp
+++ b/src/core/IniFile.cpp
@@ -7,8 +7,8 @@
#include "main.h"
#include "Population.h"
-float CIniFile::PedNumberMultiplier = 1.0f;// = *(float*)0x6182F4;
-float CIniFile::CarNumberMultiplier = 1.0f;// = *(float*)0x6182F8;
+float CIniFile::PedNumberMultiplier = 1.0f;
+float CIniFile::CarNumberMultiplier = 1.0f;
void CIniFile::LoadIniFile()
{
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 201dc5b6..2db375b2 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -35,26 +35,26 @@
#include "Wanted.h"
#include "General.h"
-CPad *Pads = (CPad*)0x6F0360; // [2]
-CMousePointerStateHelper &MousePointerStateHelper = *(CMousePointerStateHelper*)0x95CC8C;
+CPad Pads[MAX_PADS];
+CMousePointerStateHelper MousePointerStateHelper;
-bool &CPad::bDisplayNoControllerMessage = *(bool *)0x95CD52;
-bool &CPad::bObsoleteControllerMessage = *(bool *)0x95CDB8;
+bool CPad::bDisplayNoControllerMessage;
+bool CPad::bObsoleteControllerMessage;
bool CPad::bOldDisplayNoControllerMessage;
-bool &CPad::m_bMapPadOneToPadTwo = *(bool *)0x95CD48;
+bool CPad::m_bMapPadOneToPadTwo;
-CKeyboardState &CPad::OldKeyState = *(CKeyboardState*)0x6F1E70;
-CKeyboardState &CPad::NewKeyState = *(CKeyboardState*)0x6E60D0;
-CKeyboardState &CPad::TempKeyState = *(CKeyboardState*)0x774DE8;
+CKeyboardState CPad::OldKeyState;
+CKeyboardState CPad::NewKeyState;
+CKeyboardState CPad::TempKeyState;
char CPad::KeyBoardCheatString[20];
-CMouseControllerState &CPad::OldMouseControllerState = *(CMouseControllerState*)0x8472A0;
-CMouseControllerState &CPad::NewMouseControllerState = *(CMouseControllerState*)0x8809F0;
-CMouseControllerState &CPad::PCTempMouseControllerState = *(CMouseControllerState*)0x6F1E60;
+CMouseControllerState CPad::OldMouseControllerState;
+CMouseControllerState CPad::NewMouseControllerState;
+CMouseControllerState CPad::PCTempMouseControllerState;
_TODO("gbFastTime");
-extern bool &gbFastTime;
+extern bool gbFastTime;
void WeaponCheat()
{
diff --git a/src/core/Pad.h b/src/core/Pad.h
index cb705c6b..9ebd6396 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -66,7 +66,7 @@ public:
VALIDATE_SIZE(CMousePointerStateHelper, 0x2);
-extern CMousePointerStateHelper &MousePointerStateHelper;
+extern CMousePointerStateHelper MousePointerStateHelper;
class CKeyboardState
@@ -163,18 +163,18 @@ public:
CPad() { }
~CPad() { }
- static bool &bDisplayNoControllerMessage;
- static bool &bObsoleteControllerMessage;
+ static bool bDisplayNoControllerMessage;
+ static bool bObsoleteControllerMessage;
static bool bOldDisplayNoControllerMessage;
- static bool &m_bMapPadOneToPadTwo;
+ static bool m_bMapPadOneToPadTwo;
- static CKeyboardState &OldKeyState;
- static CKeyboardState &NewKeyState;
- static CKeyboardState &TempKeyState;
+ static CKeyboardState OldKeyState;
+ static CKeyboardState NewKeyState;
+ static CKeyboardState TempKeyState;
static char KeyBoardCheatString[20];
- static CMouseControllerState &OldMouseControllerState;
- static CMouseControllerState &NewMouseControllerState;
- static CMouseControllerState &PCTempMouseControllerState;
+ static CMouseControllerState OldMouseControllerState;
+ static CMouseControllerState NewMouseControllerState;
+ static CMouseControllerState PCTempMouseControllerState;
#ifdef GTA_PS2_STUFF
@@ -450,4 +450,4 @@ public:
};
VALIDATE_SIZE(CPad, 0xFC);
-extern CPad *Pads; //[2]
+extern CPad Pads[MAX_PADS];
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index 6add9e0c..65294368 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -10,15 +10,15 @@
#include "Wanted.h"
#include "World.h"
-CCPtrNodePool *&CPools::ms_pPtrNodePool = *(CCPtrNodePool**)0x943044;
-CEntryInfoNodePool *&CPools::ms_pEntryInfoNodePool = *(CEntryInfoNodePool**)0x941448;
-CPedPool *&CPools::ms_pPedPool = *(CPedPool**)0x8F2C60;
-CVehiclePool *&CPools::ms_pVehiclePool = *(CVehiclePool**)0x9430DC;
-CBuildingPool *&CPools::ms_pBuildingPool = *(CBuildingPool**)0x8F2C04;
-CTreadablePool *&CPools::ms_pTreadablePool = *(CTreadablePool**)0x8F2568;
-CObjectPool *&CPools::ms_pObjectPool = *(CObjectPool**)0x880E28;
-CDummyPool *&CPools::ms_pDummyPool = *(CDummyPool**)0x8F2C18;
-CAudioScriptObjectPool *&CPools::ms_pAudioScriptObjectPool = *(CAudioScriptObjectPool**)0x8F1B6C;
+CCPtrNodePool *CPools::ms_pPtrNodePool;
+CEntryInfoNodePool *CPools::ms_pEntryInfoNodePool;
+CPedPool *CPools::ms_pPedPool;
+CVehiclePool *CPools::ms_pVehiclePool;
+CBuildingPool *CPools::ms_pBuildingPool;
+CTreadablePool *CPools::ms_pTreadablePool;
+CObjectPool *CPools::ms_pObjectPool;
+CDummyPool *CPools::ms_pDummyPool;
+CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool;
void
CPools::Initialise(void)
diff --git a/src/core/Pools.h b/src/core/Pools.h
index 74b87585..b0ba6598 100644
--- a/src/core/Pools.h
+++ b/src/core/Pools.h
@@ -22,15 +22,15 @@ typedef CPool<cAudioScriptObject> CAudioScriptObjectPool;
class CPools
{
- static CCPtrNodePool *&ms_pPtrNodePool;
- static CEntryInfoNodePool *&ms_pEntryInfoNodePool;
- static CPedPool *&ms_pPedPool;
- static CVehiclePool *&ms_pVehiclePool;
- static CBuildingPool *&ms_pBuildingPool;
- static CTreadablePool *&ms_pTreadablePool;
- static CObjectPool *&ms_pObjectPool;
- static CDummyPool *&ms_pDummyPool;
- static CAudioScriptObjectPool *&ms_pAudioScriptObjectPool;
+ static CCPtrNodePool *ms_pPtrNodePool;
+ static CEntryInfoNodePool *ms_pEntryInfoNodePool;
+ static CPedPool *ms_pPedPool;
+ static CVehiclePool *ms_pVehiclePool;
+ static CBuildingPool *ms_pBuildingPool;
+ static CTreadablePool *ms_pTreadablePool;
+ static CObjectPool *ms_pObjectPool;
+ static CDummyPool *ms_pDummyPool;
+ static CAudioScriptObjectPool *ms_pAudioScriptObjectPool;
public:
static CCPtrNodePool *GetPtrNodePool(void) { return ms_pPtrNodePool; }
static CEntryInfoNodePool *GetEntryInfoNodePool(void) { return ms_pEntryInfoNodePool; }
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index ed24814d..48b97832 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -19,28 +19,28 @@
float CRadar::m_radarRange;
sRadarTrace CRadar::ms_RadarTrace[NUMRADARBLIPS];
CVector2D vec2DRadarOrigin;
-int32 gRadarTxdIds[64];// = (int*)0x6299C0;
-
-CSprite2d CRadar::AsukaSprite;// = *(CSprite2d*)0x8F1A40;
-CSprite2d CRadar::BombSprite;// = (CSprite2d*)0x8F5FB4;
-CSprite2d CRadar::CatSprite;// = (CSprite2d*)0x885B24;
-CSprite2d CRadar::CentreSprite;// = (CSprite2d*)0x8F6268;
-CSprite2d CRadar::CopcarSprite;// = (CSprite2d*)0x8F1A2C;
-CSprite2d CRadar::DonSprite;// = (CSprite2d*)0x8F2BE0;
-CSprite2d CRadar::EightSprite;// = (CSprite2d*)0x8F2BCC;
-CSprite2d CRadar::ElSprite;// = (CSprite2d*)0x8F1B80;
-CSprite2d CRadar::IceSprite;// = (CSprite2d*)0x9415FC;
-CSprite2d CRadar::JoeySprite;// = (CSprite2d*)0x8F2C00;
-CSprite2d CRadar::KenjiSprite;// = (CSprite2d*)0x8F2C68;
-CSprite2d CRadar::LizSprite;// = (CSprite2d*)0x8F5830;
-CSprite2d CRadar::LuigiSprite;// = (CSprite2d*)0x8F1A3C;
-CSprite2d CRadar::NorthSprite;// = (CSprite2d*)0x8F6274;
-CSprite2d CRadar::RaySprite;// = (CSprite2d*)0x8E2A7C;
-CSprite2d CRadar::SalSprite;// = (CSprite2d*)0x8F29EC;
-CSprite2d CRadar::SaveSprite;// = (CSprite2d*)0x8F5F74;
-CSprite2d CRadar::SpraySprite;// = (CSprite2d*)0x94307C;
-CSprite2d CRadar::TonySprite;// = (CSprite2d*)0x885B58;
-CSprite2d CRadar::WeaponSprite;// = (CSprite2d*)0x941534;
+int32 gRadarTxdIds[64];
+
+CSprite2d CRadar::AsukaSprite;
+CSprite2d CRadar::BombSprite;
+CSprite2d CRadar::CatSprite;
+CSprite2d CRadar::CentreSprite;
+CSprite2d CRadar::CopcarSprite;
+CSprite2d CRadar::DonSprite;
+CSprite2d CRadar::EightSprite;
+CSprite2d CRadar::ElSprite;
+CSprite2d CRadar::IceSprite;
+CSprite2d CRadar::JoeySprite;
+CSprite2d CRadar::KenjiSprite;
+CSprite2d CRadar::LizSprite;
+CSprite2d CRadar::LuigiSprite;
+CSprite2d CRadar::NorthSprite;
+CSprite2d CRadar::RaySprite;
+CSprite2d CRadar::SalSprite;
+CSprite2d CRadar::SaveSprite;
+CSprite2d CRadar::SpraySprite;
+CSprite2d CRadar::TonySprite;
+CSprite2d CRadar::WeaponSprite;
CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
nil,
diff --git a/src/core/References.cpp b/src/core/References.cpp
index e87f0fd5..668ea9f1 100644
--- a/src/core/References.cpp
+++ b/src/core/References.cpp
@@ -6,8 +6,8 @@
#include "Pools.h"
#include "References.h"
-CReference *CReferences::aRefs = (CReference*)0x70BBE0; //[NUMREFERENCES];
-CReference *&CReferences::pEmptyList = *(CReference**)0x8F1AF8;
+CReference CReferences::aRefs[NUMREFERENCES];
+CReference *CReferences::pEmptyList;
void
CReferences::Init(void)
diff --git a/src/core/References.h b/src/core/References.h
index 6476e243..e7a64de7 100644
--- a/src/core/References.h
+++ b/src/core/References.h
@@ -11,8 +11,8 @@ struct CReference
class CReferences
{
public:
- static CReference *aRefs; //[NUMREFERENCES];
- static CReference *&pEmptyList;
+ static CReference aRefs[NUMREFERENCES];
+ static CReference *pEmptyList;
static void Init(void);
static void RemoveReferencesToPlayer(void);
diff --git a/src/core/Stats.cpp b/src/core/Stats.cpp
index 02092a30..8d7a3048 100644
--- a/src/core/Stats.cpp
+++ b/src/core/Stats.cpp
@@ -4,59 +4,59 @@
#include "Text.h"
#include "World.h"
-int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
-int32 &CStats::HeadsPopped = *(int32*)0x8F647C;
-int32& CStats::CommercialPassed = *(int32*)0x8F4334;
-int32& CStats::IndustrialPassed = *(int32*)0x8E2A68;
-int32& CStats::SuburbanPassed = *(int32*)0x8F2740;
-int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
-int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;
-int32 &CStats::HelisDestroyed = *(int32*)0x8E2A64;
-int32(&CStats::PedsKilledOfThisType)[NUM_PEDTYPES] = *(int32(*)[NUM_PEDTYPES]) * (uintptr*)0x880DBC;
-int32 &CStats::TimesDied = *(int32*)0x8E2BDC;
-int32 &CStats::TimesArrested = *(int32*)0x8E2BEC;
-int32 &CStats::KillsSinceLastCheckpoint = *(int32*)0x8F2C8C;
-int32& CStats::DistanceTravelledInVehicle = *(int32*)0x940574;
-int32& CStats::DistanceTravelledOnFoot = *(int32*)0x941518;
-int32 &CStats::ProgressMade = *(int32*)0x8F6224;
-int32 &CStats::TotalProgressInGame = *(int32*)0x885B2C;
-int32& CStats::CarsExploded = *(int32*)0x941288;
-int32& CStats::PeopleKilledByPlayer = *(int32*)0x8F1B7C;
-float &CStats::MaximumJumpDistance = *(float*)0x8F2BDC;
-float &CStats::MaximumJumpHeight = *(float*)0x940564;
-int32 &CStats::MaximumJumpFlips = *(int32*)0x8F2524;
-int32 &CStats::MaximumJumpSpins = *(int32*)0x8F29B0;
-int32 &CStats::BestStuntJump = *(int32*)0x885B50;
-int32 &CStats::NumberOfUniqueJumpsFound = *(int32*)0x885B74;
-int32 &CStats::TotalNumberOfUniqueJumps = *(int32*)0x8E2DC0;
-int32 &CStats::PassengersDroppedOffWithTaxi = *(int32*)0x940724;
-int32 &CStats::MoneyMadeWithTaxi = *(int32*)0x941544;
-int32 &CStats::MissionsGiven = *(int32*)0x9430E8;
-int32 &CStats::MissionsPassed = *(int32*)0x940768;
-char(&CStats::LastMissionPassedName)[8] = *(char(*)[8])*(uintptr*)0x70D828;
-int32 &CStats::TotalLegitimateKills = *(int32*)0x8F6004;
-int32 &CStats::ElBurroTime = *(int32*)0x8E2A6C;
-int32& CStats::Record4x4One = *(int32*)0x940570;
-int32& CStats::Record4x4Two = *(int32*)0x94058C;
-int32& CStats::Record4x4Three = *(int32*)0x880FA8;
-int32& CStats::Record4x4Mayhem = *(int32*)0x885B70;
-int32& CStats::LivesSavedWithAmbulance = *(int32*)0x8F57E0;
-int32& CStats::CriminalsCaught = *(int32*)0x8F2518;
-int32& CStats::HighestLevelAmbulanceMission = *(int32*)0x8F2A04;
-int32& CStats::FiresExtinguished = *(int32*)0x8F5FEC;
-int32& CStats::LongestFlightInDodo = *(int32*)0x8F5FE4;
-int32& CStats::TimeTakenDefuseMission = *(int32*)0x880E24;
-int32& CStats::TotalNumberKillFrenzies = *(int32*)0x8E2884;
-int32& CStats::TotalNumberMissions = *(int32*)0x8E2820;
-int32& CStats::RoundsFiredByPlayer = *(int32*)0x8E2BE8;
-int32& CStats::KgsOfExplosivesUsed = *(int32*)0x8F2510;
-int32& CStats::InstantHitsFiredByPlayer = *(int32*)0x943070;
-int32& CStats::InstantHitsHitByPlayer = *(int32*)0x95CB8C;
-int32& CStats::BestTimeBombDefusal = *(int32*)0x880E24;
-int32& CStats::mmRain = *(int32*)0x8F2C98;
-int32& CStats::CarsCrushed = *(int32*)0x943050;
-int32(&CStats::FastestTimes)[CStats::TOTAL_FASTEST_TIMES] = *(int32(*)[CStats::TOTAL_FASTEST_TIMES])*(uintptr*)0x6E9128;
-int32(&CStats::HighestScores)[CStats::TOTAL_HIGHEST_SCORES] = *(int32(*)[CStats::TOTAL_HIGHEST_SCORES]) * (uintptr*)0x8622B0;
+int32 CStats::DaysPassed;
+int32 CStats::HeadsPopped;
+int32 CStats::CommercialPassed;
+int32 CStats::IndustrialPassed;
+int32 CStats::SuburbanPassed;
+int32 CStats::NumberKillFrenziesPassed;
+int32 CStats::PeopleKilledByOthers;
+int32 CStats::HelisDestroyed;
+int32 CStats::PedsKilledOfThisType[NUM_PEDTYPES];
+int32 CStats::TimesDied;
+int32 CStats::TimesArrested;
+int32 CStats::KillsSinceLastCheckpoint;
+int32 CStats::DistanceTravelledInVehicle;
+int32 CStats::DistanceTravelledOnFoot;
+int32 CStats::ProgressMade;
+int32 CStats::TotalProgressInGame;
+int32 CStats::CarsExploded;
+int32 CStats::PeopleKilledByPlayer;
+float CStats::MaximumJumpDistance;
+float CStats::MaximumJumpHeight;
+int32 CStats::MaximumJumpFlips;
+int32 CStats::MaximumJumpSpins;
+int32 CStats::BestStuntJump;
+int32 CStats::NumberOfUniqueJumpsFound;
+int32 CStats::TotalNumberOfUniqueJumps;
+int32 CStats::PassengersDroppedOffWithTaxi;
+int32 CStats::MoneyMadeWithTaxi;
+int32 CStats::MissionsGiven;
+int32 CStats::MissionsPassed;
+char CStats::LastMissionPassedName[8];
+int32 CStats::TotalLegitimateKills;
+int32 CStats::ElBurroTime;
+int32 CStats::Record4x4One;
+int32 CStats::Record4x4Two;
+int32 CStats::Record4x4Three;
+int32 CStats::Record4x4Mayhem;
+int32 CStats::LivesSavedWithAmbulance;
+int32 CStats::CriminalsCaught;
+int32 CStats::HighestLevelAmbulanceMission;
+int32 CStats::FiresExtinguished;
+int32 CStats::LongestFlightInDodo;
+int32 CStats::TimeTakenDefuseMission;
+int32 CStats::TotalNumberKillFrenzies;
+int32 CStats::TotalNumberMissions;
+int32 CStats::RoundsFiredByPlayer;
+int32 CStats::KgsOfExplosivesUsed;
+int32 CStats::InstantHitsFiredByPlayer;
+int32 CStats::InstantHitsHitByPlayer;
+int32 CStats::BestTimeBombDefusal;
+int32 CStats::mmRain;
+int32 CStats::CarsCrushed;
+int32 CStats::FastestTimes[CStats::TOTAL_FASTEST_TIMES];
+int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES];
void CStats::Init()
{
diff --git a/src/core/Stats.h b/src/core/Stats.h
index ac3259f9..4445ecf4 100644
--- a/src/core/Stats.h
+++ b/src/core/Stats.h
@@ -9,59 +9,59 @@ public:
TOTAL_FASTEST_TIMES = 16,
TOTAL_HIGHEST_SCORES = 16
};
- static int32 &DaysPassed;
- static int32 &HeadsPopped;
- static int32& CommercialPassed;
- static int32& IndustrialPassed;
- static int32& SuburbanPassed;
- static int32 &NumberKillFrenziesPassed;
- static int32 &PeopleKilledByOthers;
- static int32 &HelisDestroyed;
- static int32(&PedsKilledOfThisType)[ePedType::NUM_PEDTYPES];
- static int32 &TimesDied;
- static int32 &TimesArrested;
- static int32 &KillsSinceLastCheckpoint;
- static int32 &DistanceTravelledInVehicle;
- static int32 &DistanceTravelledOnFoot;
- static int32 &CarsExploded;
- static int32 &PeopleKilledByPlayer;
- static int32 &ProgressMade;
- static int32 &TotalProgressInGame;
- static float &MaximumJumpDistance;
- static float &MaximumJumpHeight;
- static int32 &MaximumJumpFlips;
- static int32 &MaximumJumpSpins;
- static int32 &BestStuntJump;
- static int32 &NumberOfUniqueJumpsFound;
- static int32 &TotalNumberOfUniqueJumps;
- static int32 &PassengersDroppedOffWithTaxi;
- static int32 &MoneyMadeWithTaxi;
- static int32 &MissionsGiven;
- static int32 &MissionsPassed;
- static char (&LastMissionPassedName)[8];
- static int32 &TotalLegitimateKills;
- static int32 &ElBurroTime;
- static int32 &Record4x4One;
- static int32 &Record4x4Two;
- static int32 &Record4x4Three;
- static int32 &Record4x4Mayhem;
- static int32 &LivesSavedWithAmbulance;
- static int32 &CriminalsCaught;
- static int32 &HighestLevelAmbulanceMission;
- static int32 &FiresExtinguished;
- static int32 &LongestFlightInDodo;
- static int32 &TimeTakenDefuseMission;
- static int32 &TotalNumberKillFrenzies;
- static int32 &TotalNumberMissions;
- static int32 &RoundsFiredByPlayer;
- static int32 &KgsOfExplosivesUsed;
- static int32 &InstantHitsFiredByPlayer;
- static int32 &InstantHitsHitByPlayer;
- static int32 &BestTimeBombDefusal;
- static int32 &mmRain;
- static int32 &CarsCrushed;
- static int32(&FastestTimes)[TOTAL_FASTEST_TIMES];
- static int32(&HighestScores)[TOTAL_HIGHEST_SCORES];
+ static int32 DaysPassed;
+ static int32 HeadsPopped;
+ static int32 CommercialPassed;
+ static int32 IndustrialPassed;
+ static int32 SuburbanPassed;
+ static int32 NumberKillFrenziesPassed;
+ static int32 PeopleKilledByOthers;
+ static int32 HelisDestroyed;
+ static int32 PedsKilledOfThisType[ePedType::NUM_PEDTYPES];
+ static int32 TimesDied;
+ static int32 TimesArrested;
+ static int32 KillsSinceLastCheckpoint;
+ static int32 DistanceTravelledInVehicle;
+ static int32 DistanceTravelledOnFoot;
+ static int32 CarsExploded;
+ static int32 PeopleKilledByPlayer;
+ static int32 ProgressMade;
+ static int32 TotalProgressInGame;
+ static float MaximumJumpDistance;
+ static float MaximumJumpHeight;
+ static int32 MaximumJumpFlips;
+ static int32 MaximumJumpSpins;
+ static int32 BestStuntJump;
+ static int32 NumberOfUniqueJumpsFound;
+ static int32 TotalNumberOfUniqueJumps;
+ static int32 PassengersDroppedOffWithTaxi;
+ static int32 MoneyMadeWithTaxi;
+ static int32 MissionsGiven;
+ static int32 MissionsPassed;
+ static char LastMissionPassedName[8];
+ static int32 TotalLegitimateKills;
+ static int32 ElBurroTime;
+ static int32 Record4x4One;
+ static int32 Record4x4Two;
+ static int32 Record4x4Three;
+ static int32 Record4x4Mayhem;
+ static int32 LivesSavedWithAmbulance;
+ static int32 CriminalsCaught;
+ static int32 HighestLevelAmbulanceMission;
+ static int32 FiresExtinguished;
+ static int32 LongestFlightInDodo;
+ static int32 TimeTakenDefuseMission;
+ static int32 TotalNumberKillFrenzies;
+ static int32 TotalNumberMissions;
+ static int32 RoundsFiredByPlayer;
+ static int32 KgsOfExplosivesUsed;
+ static int32 InstantHitsFiredByPlayer;
+ static int32 InstantHitsHitByPlayer;
+ static int32 BestTimeBombDefusal;
+ static int32 mmRain;
+ static int32 CarsCrushed;
+ static int32 FastestTimes[TOTAL_FASTEST_TIMES];
+ static int32 HighestScores[TOTAL_HIGHEST_SCORES];
public:
static void Init(void);
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index d00edf51..56f4a862 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -30,49 +30,49 @@
#include "Streaming.h"
#include "main.h"
-bool &CStreaming::ms_disableStreaming = *(bool*)0x95CD6E;
-bool &CStreaming::ms_bLoadingBigModel = *(bool*)0x95CDB0;
-int32 &CStreaming::ms_numModelsRequested = *(int32*)0x8E2C10;
-CStreamingInfo *CStreaming::ms_aInfoForModel = (CStreamingInfo*)0x6C7088;
-CStreamingInfo &CStreaming::ms_startLoadedList = *(CStreamingInfo*)0x942F60;
-CStreamingInfo &CStreaming::ms_endLoadedList = *(CStreamingInfo*)0x8F1AC0;
-CStreamingInfo &CStreaming::ms_startRequestedList = *(CStreamingInfo*)0x8F1B3C;
-CStreamingInfo &CStreaming::ms_endRequestedList = *(CStreamingInfo*)0x940738;
-int32 &CStreaming::ms_oldSectorX = *(int32*)0x8F2C84;
-int32 &CStreaming::ms_oldSectorY = *(int32*)0x8F2C88;
-int32 &CStreaming::ms_streamingBufferSize = *(int32*)0x942FB0;
-int8 **CStreaming::ms_pStreamingBuffer = (int8**)0x87F818;
-int32 &CStreaming::ms_memoryUsed = *(int32*)0x940568;
-CStreamingChannel *CStreaming::ms_channel = (CStreamingChannel*)0x727EE0;
-int32 &CStreaming::ms_channelError = *(int32*)0x880DB8;
-int32 &CStreaming::ms_numVehiclesLoaded = *(int32*)0x8F2C80;
-int32 *CStreaming::ms_vehiclesLoaded = (int32*)0x773560;
-int32 &CStreaming::ms_lastVehicleDeleted = *(int32*)0x95CBF8;
-CDirectory *&CStreaming::ms_pExtraObjectsDir = *(CDirectory**)0x95CB90;
-int32 &CStreaming::ms_numPriorityRequests = *(int32*)0x8F31C4;
-bool &CStreaming::ms_hasLoadedLODs = *(bool*)0x95CD47;
-int32 &CStreaming::ms_currentPedGrp = *(int32*)0x8F2BBC;
+bool CStreaming::ms_disableStreaming;
+bool CStreaming::ms_bLoadingBigModel;
+int32 CStreaming::ms_numModelsRequested;
+CStreamingInfo CStreaming::ms_aInfoForModel[NUMSTREAMINFO];
+CStreamingInfo CStreaming::ms_startLoadedList;
+CStreamingInfo CStreaming::ms_endLoadedList;
+CStreamingInfo CStreaming::ms_startRequestedList;
+CStreamingInfo CStreaming::ms_endRequestedList;
+int32 CStreaming::ms_oldSectorX;
+int32 CStreaming::ms_oldSectorY;
+int32 CStreaming::ms_streamingBufferSize;
+int8 *CStreaming::ms_pStreamingBuffer[2];
+int32 CStreaming::ms_memoryUsed;
+CStreamingChannel CStreaming::ms_channel[2];
+int32 CStreaming::ms_channelError;
+int32 CStreaming::ms_numVehiclesLoaded;
+int32 CStreaming::ms_vehiclesLoaded[MAXVEHICLESLOADED];
+int32 CStreaming::ms_lastVehicleDeleted;
+CDirectory *CStreaming::ms_pExtraObjectsDir;
+int32 CStreaming::ms_numPriorityRequests;
+bool CStreaming::ms_hasLoadedLODs;
+int32 CStreaming::ms_currentPedGrp;
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;
-uint32 &CStreaming::ms_memoryAvailable = *(uint32*)0x880F8C;
-
-int32 &desiredNumVehiclesLoaded = *(int32*)0x5EC194;
-
-CEntity *&pIslandLODindustEntity = *(CEntity**)0x6212DC;
-CEntity *&pIslandLODcomIndEntity = *(CEntity**)0x6212E0;
-CEntity *&pIslandLODcomSubEntity = *(CEntity**)0x6212E4;
-CEntity *&pIslandLODsubIndEntity = *(CEntity**)0x6212E8;
-CEntity *&pIslandLODsubComEntity = *(CEntity**)0x6212EC;
-int32 &islandLODindust = *(int32*)0x6212C8;
-int32 &islandLODcomInd = *(int32*)0x6212CC;
-int32 &islandLODcomSub = *(int32*)0x6212D0;
-int32 &islandLODsubInd = *(int32*)0x6212D4;
-int32 &islandLODsubCom = *(int32*)0x6212D8;
+uint16 CStreaming::ms_loadedGangs;
+uint16 CStreaming::ms_loadedGangCars;
+int32 CStreaming::ms_imageOffsets[NUMCDIMAGES];
+int32 CStreaming::ms_lastImageRead;
+int32 CStreaming::ms_imageSize;
+uint32 CStreaming::ms_memoryAvailable;
+
+int32 desiredNumVehiclesLoaded = 12;
+
+CEntity *pIslandLODindustEntity;
+CEntity *pIslandLODcomIndEntity;
+CEntity *pIslandLODcomSubEntity;
+CEntity *pIslandLODsubIndEntity;
+CEntity *pIslandLODsubComEntity;
+int32 islandLODindust;
+int32 islandLODcomInd;
+int32 islandLODcomSub;
+int32 islandLODsubInd;
+int32 islandLODsubCom;
bool
CStreamingInfo::GetCdPosnAndSize(uint32 &posn, uint32 &size)
@@ -199,7 +199,7 @@ CStreaming::Init(void)
// PC only, figure out how much memory we got
#ifdef GTA_PC
#define MB (1024*1024)
- extern unsigned long &_dwMemAvailPhys;
+ extern unsigned long _dwMemAvailPhys;
ms_memoryAvailable = (_dwMemAvailPhys - 10*MB)/2;
if(ms_memoryAvailable < 50*MB)
ms_memoryAvailable = 50*MB;
diff --git a/src/core/Streaming.h b/src/core/Streaming.h
index 1100fd1b..c910c068 100644
--- a/src/core/Streaming.h
+++ b/src/core/Streaming.h
@@ -77,36 +77,36 @@ class CPtrList;
class CStreaming
{
public:
- static bool &ms_disableStreaming;
- static bool &ms_bLoadingBigModel;
- static int32 &ms_numModelsRequested;
- static CStreamingInfo *ms_aInfoForModel; //[NUMSTREAMINFO]
- static CStreamingInfo &ms_startLoadedList;
- static CStreamingInfo &ms_endLoadedList;
- static CStreamingInfo &ms_startRequestedList;
- static CStreamingInfo &ms_endRequestedList;
- static int32 &ms_oldSectorX;
- static int32 &ms_oldSectorY;
- static int32 &ms_streamingBufferSize;
- static int8 **ms_pStreamingBuffer; //[2]
- static int32 &ms_memoryUsed;
- static CStreamingChannel *ms_channel; //[2]
- static int32 &ms_channelError;
- static int32 &ms_numVehiclesLoaded;
- static int32 *ms_vehiclesLoaded; //[MAXVEHICLESLOADED]
- static int32 &ms_lastVehicleDeleted;
- static CDirectory *&ms_pExtraObjectsDir;
- static int32 &ms_numPriorityRequests;
- static bool &ms_hasLoadedLODs;
- static int32 &ms_currentPedGrp;
+ static bool ms_disableStreaming;
+ static bool ms_bLoadingBigModel;
+ static int32 ms_numModelsRequested;
+ static CStreamingInfo ms_aInfoForModel[NUMSTREAMINFO];
+ static CStreamingInfo ms_startLoadedList;
+ static CStreamingInfo ms_endLoadedList;
+ static CStreamingInfo ms_startRequestedList;
+ static CStreamingInfo ms_endRequestedList;
+ static int32 ms_oldSectorX;
+ static int32 ms_oldSectorY;
+ static int32 ms_streamingBufferSize;
+ static int8 *ms_pStreamingBuffer[2];
+ static int32 ms_memoryUsed;
+ static CStreamingChannel ms_channel[2];
+ static int32 ms_channelError;
+ static int32 ms_numVehiclesLoaded;
+ static int32 ms_vehiclesLoaded[MAXVEHICLESLOADED];
+ static int32 ms_lastVehicleDeleted;
+ static CDirectory *ms_pExtraObjectsDir;
+ static int32 ms_numPriorityRequests;
+ static bool ms_hasLoadedLODs;
+ static int32 ms_currentPedGrp;
static int32 ms_lastCullZone;
- static uint16 &ms_loadedGangs;
- static uint16 &ms_loadedGangCars;
+ static uint16 ms_loadedGangs;
+ static uint16 ms_loadedGangCars;
static int32 ms_currentPedLoading;
- static int32 *ms_imageOffsets; //[NUMCDIMAGES]
- static int32 &ms_lastImageRead;
- static int32 &ms_imageSize;
- static uint32 &ms_memoryAvailable;
+ static int32 ms_imageOffsets[NUMCDIMAGES];
+ static int32 ms_lastImageRead;
+ static int32 ms_imageSize;
+ static uint32 ms_memoryAvailable;
static void Init(void);
static void Shutdown(void);
diff --git a/src/core/SurfaceTable.cpp b/src/core/SurfaceTable.cpp
index 2ba884b1..85572fbd 100644
--- a/src/core/SurfaceTable.cpp
+++ b/src/core/SurfaceTable.cpp
@@ -6,7 +6,7 @@
#include "Collision.h"
#include "SurfaceTable.h"
-float (*CSurfaceTable::ms_aAdhesiveLimitTable)[NUMADHESIVEGROUPS] = (float (*)[NUMADHESIVEGROUPS])0x8E29D4;
+float CSurfaceTable::ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS];
void
CSurfaceTable::Initialise(char *filename)
diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h
index 27f4ecca..4af6a265 100644
--- a/src/core/SurfaceTable.h
+++ b/src/core/SurfaceTable.h
@@ -98,8 +98,7 @@ struct CColPoint;
class CSurfaceTable
{
-// static float ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS];
- static float (*ms_aAdhesiveLimitTable)[NUMADHESIVEGROUPS];
+ static float ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS];
public:
static void Initialise(char *filename);
static int GetAdhesionGroup(uint8 surfaceType);
diff --git a/src/core/TempColModels.cpp b/src/core/TempColModels.cpp
index 22ef31bd..05b272ab 100644
--- a/src/core/TempColModels.cpp
+++ b/src/core/TempColModels.cpp
@@ -3,19 +3,19 @@
#include "TempColModels.h"
#include "SurfaceTable.h"
-CColModel &CTempColModels::ms_colModelPed1 = *(CColModel*)0x726CB0;
-CColModel &CTempColModels::ms_colModelPed2 = *(CColModel*)0x726D08;
-CColModel &CTempColModels::ms_colModelBBox = *(CColModel*)0x727FE0;
-CColModel &CTempColModels::ms_colModelBumper1 = *(CColModel*)0x86BE88;
-CColModel &CTempColModels::ms_colModelWheel1 = *(CColModel*)0x878C40;
-CColModel &CTempColModels::ms_colModelPanel1 = *(CColModel*)0x87BDD8;
-CColModel &CTempColModels::ms_colModelBodyPart2 = *(CColModel*)0x87BE30;
-CColModel &CTempColModels::ms_colModelBodyPart1 = *(CColModel*)0x87BE88;
-CColModel (&CTempColModels::ms_colModelCutObj)[5] = *(CColModel(*)[5]) *(uintptr*)0x87C960;
-CColModel &CTempColModels::ms_colModelPedGroundHit = *(CColModel*)0x880480;
-CColModel &CTempColModels::ms_colModelBoot1 = *(CColModel*)0x880670;
-CColModel &CTempColModels::ms_colModelDoor1 = *(CColModel*)0x880850;
-CColModel &CTempColModels::ms_colModelBonnet1 = *(CColModel*)0x8808A8;
+CColModel CTempColModels::ms_colModelPed1;
+CColModel CTempColModels::ms_colModelPed2;
+CColModel CTempColModels::ms_colModelBBox;
+CColModel CTempColModels::ms_colModelBumper1;
+CColModel CTempColModels::ms_colModelWheel1;
+CColModel CTempColModels::ms_colModelPanel1;
+CColModel CTempColModels::ms_colModelBodyPart2;
+CColModel CTempColModels::ms_colModelBodyPart1;
+CColModel CTempColModels::ms_colModelCutObj[5];
+CColModel CTempColModels::ms_colModelPedGroundHit;
+CColModel CTempColModels::ms_colModelBoot1;
+CColModel CTempColModels::ms_colModelDoor1;
+CColModel CTempColModels::ms_colModelBonnet1;
CColSphere s_aPedSpheres[3];
diff --git a/src/core/TempColModels.h b/src/core/TempColModels.h
index 263904d3..3e1dd5e1 100644
--- a/src/core/TempColModels.h
+++ b/src/core/TempColModels.h
@@ -5,19 +5,19 @@
class CTempColModels
{
public:
- static CColModel &ms_colModelPed1;
- static CColModel &ms_colModelPed2;
- static CColModel &ms_colModelBBox;
- static CColModel &ms_colModelBumper1;
- static CColModel &ms_colModelWheel1;
- static CColModel &ms_colModelPanel1;
- static CColModel &ms_colModelBodyPart2;
- static CColModel &ms_colModelBodyPart1;
- static CColModel (&ms_colModelCutObj)[5];
- static CColModel &ms_colModelPedGroundHit;
- static CColModel &ms_colModelBoot1;
- static CColModel &ms_colModelDoor1;
- static CColModel &ms_colModelBonnet1;
+ static CColModel ms_colModelPed1;
+ static CColModel ms_colModelPed2;
+ static CColModel ms_colModelBBox;
+ static CColModel ms_colModelBumper1;
+ static CColModel ms_colModelWheel1;
+ static CColModel ms_colModelPanel1;
+ static CColModel ms_colModelBodyPart2;
+ static CColModel ms_colModelBodyPart1;
+ static CColModel ms_colModelCutObj[5];
+ static CColModel ms_colModelPedGroundHit;
+ static CColModel ms_colModelBoot1;
+ static CColModel ms_colModelDoor1;
+ static CColModel ms_colModelBonnet1;
static void Initialise(void);
};
diff --git a/src/core/TimeStep.cpp b/src/core/TimeStep.cpp
index 9ccf7200..09dae911 100644
--- a/src/core/TimeStep.cpp
+++ b/src/core/TimeStep.cpp
@@ -1,5 +1,5 @@
#include "TimeStep.h"
-float &CTimeStep::ms_fTimeScale = *(float*)0x5F76C8;
-float &CTimeStep::ms_fFramesPerUpdate = *(float*)0x5F76CC;
-float &CTimeStep::ms_fTimeStep = *(float*)0x5F76D0;
+float CTimeStep::ms_fTimeScale = 1.0f;
+float CTimeStep::ms_fFramesPerUpdate = 1.0f;
+float CTimeStep::ms_fTimeStep = 1.0f;
diff --git a/src/core/TimeStep.h b/src/core/TimeStep.h
index c74df02a..6101b4c2 100644
--- a/src/core/TimeStep.h
+++ b/src/core/TimeStep.h
@@ -4,7 +4,7 @@
class CTimeStep
{
public:
- static float &ms_fTimeScale;
- static float &ms_fFramesPerUpdate;
- static float &ms_fTimeStep;
+ static float ms_fTimeScale;
+ static float ms_fFramesPerUpdate;
+ static float ms_fTimeStep;
};
diff --git a/src/core/Timer.cpp b/src/core/Timer.cpp
index fda862f1..68b31e6f 100644
--- a/src/core/Timer.cpp
+++ b/src/core/Timer.cpp
@@ -5,34 +5,28 @@
#include "Record.h"
#include "Timer.h"
-uint32 &CTimer::m_snTimeInMilliseconds = *(uint32*)0x885B48;
-uint32 &CTimer::m_snTimeInMillisecondsPauseMode = *(uint32*)0x5F7614;
-uint32 &CTimer::m_snTimeInMillisecondsNonClipped = *(uint32*)0x9412E8;
-uint32 &CTimer::m_snPreviousTimeInMilliseconds = *(uint32*)0x8F29E4;
-uint32 &CTimer::m_FrameCounter = *(uint32*)0x9412EC;
-float &CTimer::ms_fTimeScale = *(float*)0x8F2C20;
-float &CTimer::ms_fTimeStep = *(float*)0x8E2CB4;
-float &CTimer::ms_fTimeStepNonClipped = *(float*)0x8E2C4C;
-bool &CTimer::m_UserPause = *(bool*)0x95CD7C;
-bool &CTimer::m_CodePause = *(bool*)0x95CDB1;
-
-//UInt32 oldPcTimer;
-uint32 &oldPcTimer = *(uint32*)0x9434F4;
-
-//UInt32 suspendPcTimer;
-uint32 &suspendPcTimer = *(uint32*)0x62A308;
-
-//UInt32 _nCyclesPerMS = 1;
-uint32 &_nCyclesPerMS = *(uint32*)0x5F7610;
-
-//LARGE_INTEGER _oldPerfCounter;
-LARGE_INTEGER &_oldPerfCounter = *(LARGE_INTEGER*)0x62A310;
-
-//LARGE_INTEGER perfSuspendCounter;
-LARGE_INTEGER &perfSuspendCounter = *(LARGE_INTEGER*)0x62A318;
-
-//UInt32 suspendDepth;
-uint32 &suspendDepth = *(uint32*)0x62A320;
+uint32 CTimer::m_snTimeInMilliseconds;
+uint32 CTimer::m_snTimeInMillisecondsPauseMode = 1;
+uint32 CTimer::m_snTimeInMillisecondsNonClipped;
+uint32 CTimer::m_snPreviousTimeInMilliseconds;
+uint32 CTimer::m_FrameCounter;
+float CTimer::ms_fTimeScale;
+float CTimer::ms_fTimeStep;
+float CTimer::ms_fTimeStepNonClipped;
+bool CTimer::m_UserPause;
+bool CTimer::m_CodePause;
+
+uint32 oldPcTimer;
+
+uint32 suspendPcTimer;
+
+uint32 _nCyclesPerMS = 1;
+
+LARGE_INTEGER _oldPerfCounter;
+
+LARGE_INTEGER perfSuspendCounter;
+
+uint32 suspendDepth;
#ifdef FIX_BUGS
double frameTime;
diff --git a/src/core/Timer.h b/src/core/Timer.h
index a4d674da..00a11409 100644
--- a/src/core/Timer.h
+++ b/src/core/Timer.h
@@ -3,17 +3,17 @@
class CTimer
{
- static uint32 &m_snTimeInMilliseconds;
- static uint32 &m_snTimeInMillisecondsPauseMode;
- static uint32 &m_snTimeInMillisecondsNonClipped;
- static uint32 &m_snPreviousTimeInMilliseconds;
- static uint32 &m_FrameCounter;
- static float &ms_fTimeScale;
- static float &ms_fTimeStep;
- static float &ms_fTimeStepNonClipped;
+ static uint32 m_snTimeInMilliseconds;
+ static uint32 m_snTimeInMillisecondsPauseMode;
+ static uint32 m_snTimeInMillisecondsNonClipped;
+ static uint32 m_snPreviousTimeInMilliseconds;
+ static uint32 m_FrameCounter;
+ static float ms_fTimeScale;
+ static float ms_fTimeStep;
+ static float ms_fTimeStepNonClipped;
public:
- static bool &m_UserPause;
- static bool &m_CodePause;
+ static bool m_UserPause;
+ static bool m_CodePause;
static const float &GetTimeStep(void) { return ms_fTimeStep; }
static void SetTimeStep(float ts) { ms_fTimeStep = ts; }
diff --git a/src/core/User.cpp b/src/core/User.cpp
index d89d1cec..a1a69b2d 100644
--- a/src/core/User.cpp
+++ b/src/core/User.cpp
@@ -9,10 +9,10 @@
#include "World.h"
#include "Zones.h"
-CPlaceName& CUserDisplay::PlaceName = *(CPlaceName*)0x8F29BC;
-COnscreenTimer& CUserDisplay::OnscnTimer = *(COnscreenTimer*)0x862238;
-CPager& CUserDisplay::Pager = *(CPager*)0x8F2744;
-CCurrentVehicle& CUserDisplay::CurrentVehicle = *(CCurrentVehicle*)0x8F5FE8;
+CPlaceName CUserDisplay::PlaceName;
+COnscreenTimer CUserDisplay::OnscnTimer;
+CPager CUserDisplay::Pager;
+CCurrentVehicle CUserDisplay::CurrentVehicle;
CPlaceName::CPlaceName()
{
diff --git a/src/core/User.h b/src/core/User.h
index 02d5f613..153ef57b 100644
--- a/src/core/User.h
+++ b/src/core/User.h
@@ -31,10 +31,10 @@ public:
class CUserDisplay
{
public:
- static CPlaceName &PlaceName;
- static COnscreenTimer &OnscnTimer;
- static CPager &Pager;
- static CCurrentVehicle &CurrentVehicle;
+ static CPlaceName PlaceName;
+ static COnscreenTimer OnscnTimer;
+ static CPager Pager;
+ static CCurrentVehicle CurrentVehicle;
static void Init();
static void Process();
diff --git a/src/core/Wanted.cpp b/src/core/Wanted.cpp
index 29294a2b..1911ae59 100644
--- a/src/core/Wanted.cpp
+++ b/src/core/Wanted.cpp
@@ -11,8 +11,8 @@
#include "Wanted.h"
#include "General.h"
-int32 &CWanted::MaximumWantedLevel = *(int32*)0x5F7714; // 6
-int32 &CWanted::nMaximumWantedLevel = *(int32*)0x5F7718; // 6400
+int32 CWanted::MaximumWantedLevel = 6;
+int32 CWanted::nMaximumWantedLevel = 6400;
void
CWanted::Initialise()
diff --git a/src/core/Wanted.h b/src/core/Wanted.h
index 9823529c..afeec8b0 100644
--- a/src/core/Wanted.h
+++ b/src/core/Wanted.h
@@ -60,8 +60,8 @@ public:
CCrimeBeingQd m_aCrimes[16];
CCopPed *m_pCops[10];
- static int32 &MaximumWantedLevel;
- static int32 &nMaximumWantedLevel;
+ static int32 MaximumWantedLevel;
+ static int32 nMaximumWantedLevel;
public:
void Initialise();
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 313b958a..358e1823 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -1,64 +1,54 @@
-#include "common.h"
-#include "patcher.h"
-#include "Entity.h"
-#include "Ped.h"
-#include "PlayerPed.h"
-#include "Vehicle.h"
-#include "Object.h"
+#include "World.h"
#include "Camera.h"
-#include "DMAudio.h"
#include "CarCtrl.h"
+#include "CopPed.h"
+#include "CutsceneMgr.h"
+#include "DMAudio.h"
+#include "Entity.h"
+#include "EventList.h"
+#include "Explosion.h"
+#include "Fire.h"
#include "Garages.h"
-#include "TempColModels.h"
-#include "World.h"
+#include "Glass.h"
+#include "Messages.h"
#include "ModelIndices.h"
-#include "References.h"
-#include "CutsceneMgr.h"
+#include "Object.h"
+#include "ParticleObject.h"
+#include "Ped.h"
+#include "PlayerPed.h"
+#include "Population.h"
+#include "ProjectileInfo.h"
#include "Record.h"
-#include "RpAnimBlend.h"
-#include "Messages.h"
+#include "References.h"
#include "Replay.h"
-#include "Population.h"
-#include "Fire.h"
+#include "RpAnimBlend.h"
+#include "Shadows.h"
+#include "TempColModels.h"
+#include "Vehicle.h"
+#include "WaterLevel.h"
+#include "common.h"
+#include "patcher.h"
+
+#define OBJECT_REPOSITION_OFFSET_Z 2.0f
CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
-CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60;
-CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C;
-CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608;
-uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64;
+CPtrList *CWorld::ms_bigBuildingsList = (CPtrList *)0x6FAB60;
+CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList *)0x8F433C;
+CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector(*)[NUMSECTORS_Y])0x665608;
+uint16 &CWorld::ms_nCurrentScanCode = *(uint16 *)0x95CC64;
uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61;
CPlayerInfo CWorld::Players[NUMPLAYERS];
-bool &CWorld::bNoMoreCollisionTorque = *(bool*)0x95CDCC;
-CEntity *&CWorld::pIgnoreEntity = *(CEntity**)0x8F6494;
-bool &CWorld::bIncludeDeadPeds = *(bool*)0x95CD8F;
-bool &CWorld::bSecondShift = *(bool*)0x95CD54;
-bool &CWorld::bForceProcessControl = *(bool*)0x95CD6C;
-bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B;
-
-bool &CWorld::bDoingCarCollisions = *(bool*)0x95CD8C;
-bool &CWorld::bIncludeCarTyres = *(bool*)0x95CDAA;
-
-WRAPPER void CWorld::ClearForRestart(void) { EAXJMP(0x4AE850); }
-WRAPPER void CWorld::AddParticles(void) { EAXJMP(0x4B4010); }
-WRAPPER void CWorld::ShutDown(void) { EAXJMP(0x4AE450); }
-WRAPPER void CWorld::RepositionCertainDynamicObjects() { EAXJMP(0x4B42B0); }
-WRAPPER void CWorld::RemoveStaticObjects() { EAXJMP(0x4B4D50); }
-WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); }
-WRAPPER void CWorld::FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool){ EAXJMP(0x4B2A30); }
-WRAPPER void CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, uint8) { EAXJMP(0x4B4E70) };
-WRAPPER void CWorld::FindObjectsIntersectingCube(const CVector &, const CVector &, int16*, int16, CEntity **, bool, bool, bool, bool, bool) { EAXJMP(0x4B2E70); }
-WRAPPER void CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool) { EAXJMP(0x4B3280); }
-WRAPPER void CWorld::FindObjectsOfTypeInRange(uint32, CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool) { EAXJMP(0x4B2600); }
-WRAPPER void CWorld::FindObjectsOfTypeInRangeSectorList(uint32, CPtrList&, CVector&, float, bool, short*, short, CEntity**) { EAXJMP(0x4B2960); }
-WRAPPER void CWorld::FindMissionEntitiesIntersectingCube(const CVector&, const CVector&, int16*, int16, CEntity**, bool, bool, bool) { EAXJMP(0x4B3680); }
-WRAPPER void CWorld::ClearCarsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B50E0); }
-WRAPPER void CWorld::ClearPedsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B52B0); }
-WRAPPER void CWorld::CallOffChaseForArea(float, float, float, float) { EAXJMP(0x4B5530); }
-WRAPPER void CWorld::TriggerExplosion(const CVector& a1, float a2, float a3, CEntity *a4, bool a5) { EAXJMP(0x4B1140); }
-WRAPPER void CWorld::SetPedsOnFire(float, float, float, float, CEntity*) { EAXJMP(0x4B3D30); }
-WRAPPER void CWorld::UseDetonator(CEntity *) { EAXJMP(0x4B4650); }
+bool &CWorld::bNoMoreCollisionTorque = *(bool *)0x95CDCC;
+CEntity *&CWorld::pIgnoreEntity = *(CEntity **)0x8F6494;
+bool &CWorld::bIncludeDeadPeds = *(bool *)0x95CD8F;
+bool &CWorld::bSecondShift = *(bool *)0x95CD54;
+bool &CWorld::bForceProcessControl = *(bool *)0x95CD6C;
+bool &CWorld::bProcessCutsceneOnly = *(bool *)0x95CD8B;
+
+bool &CWorld::bDoingCarCollisions = *(bool *)0x95CD8C;
+bool &CWorld::bIncludeCarTyres = *(bool *)0x95CDAA;
void
CWorld::Initialise()
@@ -76,37 +66,31 @@ CWorld::Initialise()
void
CWorld::Add(CEntity *ent)
{
- if(ent->IsVehicle() || ent->IsPed())
- DMAudio.SetEntityStatus(((CPhysical*)ent)->m_audioEntityId, true);
+ if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, true);
if(ent->bIsBIGBuilding)
ms_bigBuildingsList[ent->m_level].InsertItem(ent);
else
ent->Add();
- if(ent->IsBuilding() || ent->IsDummy())
- return;
+ if(ent->IsBuilding() || ent->IsDummy()) return;
- if(!ent->bIsStatic)
- ((CPhysical*)ent)->AddToMovingList();
+ if(!ent->bIsStatic) ((CPhysical *)ent)->AddToMovingList();
}
void
CWorld::Remove(CEntity *ent)
{
- if(ent->IsVehicle() || ent->IsPed())
- DMAudio.SetEntityStatus(((CPhysical*)ent)->m_audioEntityId, false);
+ if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, false);
if(ent->bIsBIGBuilding)
ms_bigBuildingsList[ent->m_level].RemoveItem(ent);
else
ent->Remove();
- if(ent->IsBuilding() || ent->IsDummy())
- return;
+ if(ent->IsBuilding() || ent->IsDummy()) return;
- if(!ent->bIsStatic)
- ((CPhysical*)ent)->RemoveFromMovingList();
+ if(!ent->bIsStatic) ((CPhysical *)ent)->RemoveFromMovingList();
}
void
@@ -114,31 +98,74 @@ CWorld::ClearScanCodes(void)
{
CPtrNode *node;
for(int i = 0; i < NUMSECTORS_Y; i++)
- for(int j = 0; j < NUMSECTORS_X; j++){
- CSector *s = &ms_aSectors[i][j];
- for(node = s->m_lists[ENTITYLIST_BUILDINGS].first; node; node = node->next)
- ((CEntity*)node->item)->m_scanCode = 0;
- for(node = s->m_lists[ENTITYLIST_VEHICLES].first; node; node = node->next)
- ((CEntity*)node->item)->m_scanCode = 0;
- for(node = s->m_lists[ENTITYLIST_PEDS].first; node; node = node->next)
- ((CEntity*)node->item)->m_scanCode = 0;
- for(node = s->m_lists[ENTITYLIST_OBJECTS].first; node; node = node->next)
- ((CEntity*)node->item)->m_scanCode = 0;
- for(node = s->m_lists[ENTITYLIST_DUMMIES].first; node; node = node->next)
- ((CEntity*)node->item)->m_scanCode = 0;
+ for(int j = 0; j < NUMSECTORS_X; j++) {
+ CSector *s = &ms_aSectors[i][j];
+ for(node = s->m_lists[ENTITYLIST_BUILDINGS].first; node; node = node->next)
+ ((CEntity *)node->item)->m_scanCode = 0;
+ for(node = s->m_lists[ENTITYLIST_VEHICLES].first; node; node = node->next)
+ ((CEntity *)node->item)->m_scanCode = 0;
+ for(node = s->m_lists[ENTITYLIST_PEDS].first; node; node = node->next)
+ ((CEntity *)node->item)->m_scanCode = 0;
+ for(node = s->m_lists[ENTITYLIST_OBJECTS].first; node; node = node->next)
+ ((CEntity *)node->item)->m_scanCode = 0;
+ for(node = s->m_lists[ENTITYLIST_DUMMIES].first; node; node = node->next)
+ ((CEntity *)node->item)->m_scanCode = 0;
+ }
+}
+
+void
+CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, bool bRemoveProjectilesAndTidyUpShadows)
+{
+ CPedPool *pedPool = CPools::GetPedPool();
+ for(int32 i = 0; i < pedPool->GetSize(); i++) {
+ CPed *pPed = pedPool->GetSlot(i);
+ if(pPed && !pPed->IsPlayer() && pPed->CanBeDeleted() &&
+ CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < radius) {
+ CPopulation::RemovePed(pPed);
+ }
+ }
+ CVehiclePool *VehiclePool = CPools::GetVehiclePool();
+ for(int32 i = 0; i < VehiclePool->GetSize(); i++) {
+ CVehicle *pVehicle = VehiclePool->GetSlot(i);
+ if(pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < radius &&
+ !pVehicle->bIsLocked && pVehicle->CanBeDeleted()) {
+ if(pVehicle->pDriver) {
+ CPopulation::RemovePed(pVehicle->pDriver);
+ pVehicle->pDriver = nil;
+ }
+ for(int32 j = 0; j < pVehicle->m_nNumMaxPassengers; ++j) {
+ if(pVehicle->pPassengers[j]) {
+ CPopulation::RemovePed(pVehicle->pPassengers[j]);
+ pVehicle->pPassengers[j] = nil;
+ --pVehicle->m_nNumPassengers;
+ }
+ }
+ CCarCtrl::RemoveFromInterestingVehicleList(pVehicle);
+ CWorld::Remove(pVehicle);
+ delete pVehicle;
+ }
+ }
+ CObject::DeleteAllTempObjectsInArea(pos, radius);
+ gFireManager.ExtinguishPoint(pos, radius);
+ CWorld::ExtinguishAllCarFiresInArea(pos, radius);
+ CExplosion::RemoveAllExplosionsInArea(pos, radius);
+ if(bRemoveProjectilesAndTidyUpShadows) {
+ CProjectileInfo::RemoveAllProjectiles();
+ CShadows::TidyUpShadows();
}
}
bool
CWorld::CameraToIgnoreThisObject(CEntity *ent)
{
- if(CGarages::IsModelIndexADoor(ent->GetModelIndex()))
- return false;
- return ((CObject*)ent)->m_bCameraToAvoidThisObject != 1;
+ if(CGarages::IsModelIndexADoor(ent->GetModelIndex())) return false;
+ return ((CObject *)ent)->m_bCameraToAvoidThisObject != 1;
}
bool
-CWorld::ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoint &point, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects)
+CWorld::ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoint &point, CEntity *&entity,
+ bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects,
+ bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects)
{
int x, xstart, xend;
int y, ystart, yend;
@@ -155,94 +182,80 @@ CWorld::ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoi
xend = GetSectorIndexX(point2.x);
yend = GetSectorIndexY(point2.y);
-#define LOSARGS CColLine(point1, point2), point, dist, entity, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, ignoreSomeObjects
+#define LOSARGS \
+ CColLine(point1, point2), point, dist, entity, checkBuildings, checkVehicles, checkPeds, checkObjects, \
+ checkDummies, ignoreSeeThrough, ignoreSomeObjects
- if(xstart == xend && ystart == yend){
+ if(xstart == xend && ystart == yend) {
// Only one sector
return ProcessLineOfSightSector(*GetSector(xstart, ystart), LOSARGS);
- }else if(xstart == xend){
+ } else if(xstart == xend) {
// Only step in y
if(ystart < yend)
- for(y = ystart; y <= yend; y++)
- ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
+ for(y = ystart; y <= yend; y++) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
else
- for(y = ystart; y >= yend; y--)
- ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
+ for(y = ystart; y >= yend; y--) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
return dist < 1.0f;
- }else if(ystart == yend){
+ } else if(ystart == yend) {
// Only step in x
if(xstart < xend)
- for(x = xstart; x <= xend; x++)
- ProcessLineOfSightSector(*GetSector(x, ystart), LOSARGS);
+ for(x = xstart; x <= xend; x++) ProcessLineOfSightSector(*GetSector(x, ystart), LOSARGS);
else
- for(x = xstart; x >= xend; x--)
- ProcessLineOfSightSector(*GetSector(x, ystart), LOSARGS);
+ for(x = xstart; x >= xend; x--) ProcessLineOfSightSector(*GetSector(x, ystart), LOSARGS);
return dist < 1.0f;
- }else{
- if(point1.x < point2.x){
+ } else {
+ if(point1.x < point2.x) {
// Step from left to right
float m = (point2.y - point1.y) / (point2.x - point1.x);
y1 = ystart;
- y2 = GetSectorIndexY((GetWorldX(xstart+1) - point1.x)*m + point1.y);
+ y2 = GetSectorIndexY((GetWorldX(xstart + 1) - point1.x) * m + point1.y);
if(y1 < y2)
- for(y = y1; y <= y2; y++)
- ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
+ for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
else
- for(y = y1; y >= y2; y--)
- ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
+ for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
- for(x = xstart+1; x < xend; x++){
+ for(x = xstart + 1; x < xend; x++) {
y1 = y2;
- y2 = GetSectorIndexY((GetWorldX(x+1) - point1.x)*m + point1.y);
+ y2 = GetSectorIndexY((GetWorldX(x + 1) - point1.x) * m + point1.y);
if(y1 < y2)
- for(y = y1; y <= y2; y++)
- ProcessLineOfSightSector(*GetSector(x, y), LOSARGS);
+ for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(x, y), LOSARGS);
else
- for(y = y1; y >= y2; y--)
- ProcessLineOfSightSector(*GetSector(x, y), LOSARGS);
+ for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(x, y), LOSARGS);
}
y1 = y2;
y2 = yend;
if(y1 < y2)
- for(y = y1; y <= y2; y++)
- ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS);
+ for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS);
else
- for(y = y1; y >= y2; y--)
- ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS);
- }else{
+ for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS);
+ } else {
// Step from right to left
float m = (point2.y - point1.y) / (point2.x - point1.x);
y1 = ystart;
- y2 = GetSectorIndexY((GetWorldX(xstart) - point1.x)*m + point1.y);
+ y2 = GetSectorIndexY((GetWorldX(xstart) - point1.x) * m + point1.y);
if(y1 < y2)
- for(y = y1; y <= y2; y++)
- ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
+ for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
else
- for(y = y1; y >= y2; y--)
- ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
+ for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(xstart, y), LOSARGS);
- for(x = xstart-1; x > xend; x--){
+ for(x = xstart - 1; x > xend; x--) {
y1 = y2;
- y2 = GetSectorIndexY((GetWorldX(x) - point1.x)*m + point1.y);
+ y2 = GetSectorIndexY((GetWorldX(x) - point1.x) * m + point1.y);
if(y1 < y2)
- for(y = y1; y <= y2; y++)
- ProcessLineOfSightSector(*GetSector(x, y), LOSARGS);
+ for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(x, y), LOSARGS);
else
- for(y = y1; y >= y2; y--)
- ProcessLineOfSightSector(*GetSector(x, y), LOSARGS);
+ for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(x, y), LOSARGS);
}
y1 = y2;
y2 = yend;
if(y1 < y2)
- for(y = y1; y <= y2; y++)
- ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS);
+ for(y = y1; y <= y2; y++) ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS);
else
- for(y = y1; y >= y2; y--)
- ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS);
+ for(y = y1; y >= y2; y--) ProcessLineOfSightSector(*GetSector(xend, y), LOSARGS);
}
return dist < 1.0f;
}
@@ -251,51 +264,63 @@ CWorld::ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoi
}
bool
-CWorld::ProcessLineOfSightSector(CSector &sector, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects)
+CWorld::ProcessLineOfSightSector(CSector &sector, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity,
+ bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects,
+ bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects)
{
float mindist = dist;
bool deadPeds = !!bIncludeDeadPeds;
bIncludeDeadPeds = false;
- if(checkBuildings){
- ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_BUILDINGS], line, point, mindist, entity, ignoreSeeThrough);
- ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough);
+ if(checkBuildings) {
+ ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_BUILDINGS], line, point, mindist, entity,
+ ignoreSeeThrough);
+ ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, point, mindist, entity,
+ ignoreSeeThrough);
}
- if(checkVehicles){
- ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_VEHICLES], line, point, mindist, entity, ignoreSeeThrough);
- ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, point, mindist, entity, ignoreSeeThrough);
+ if(checkVehicles) {
+ ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_VEHICLES], line, point, mindist, entity,
+ ignoreSeeThrough);
+ ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, point, mindist, entity,
+ ignoreSeeThrough);
}
- if(checkPeds){
- if(deadPeds)
- bIncludeDeadPeds = true;
- ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS], line, point, mindist, entity, ignoreSeeThrough);
- ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough);
+ if(checkPeds) {
+ if(deadPeds) bIncludeDeadPeds = true;
+ ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS], line, point, mindist, entity,
+ ignoreSeeThrough);
+ ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, point, mindist, entity,
+ ignoreSeeThrough);
bIncludeDeadPeds = false;
}
- if(checkObjects){
- ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_OBJECTS], line, point, mindist, entity, ignoreSeeThrough, ignoreSomeObjects);
- ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, ignoreSomeObjects);
+ if(checkObjects) {
+ ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_OBJECTS], line, point, mindist, entity,
+ ignoreSeeThrough, ignoreSomeObjects);
+ ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, point, mindist, entity,
+ ignoreSeeThrough, ignoreSomeObjects);
}
- if(checkDummies){
- ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_DUMMIES], line, point, mindist, entity, ignoreSeeThrough);
- ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_DUMMIES_OVERLAP], line, point, mindist, entity, ignoreSeeThrough);
+ if(checkDummies) {
+ ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_DUMMIES], line, point, mindist, entity,
+ ignoreSeeThrough);
+ ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_DUMMIES_OVERLAP], line, point, mindist, entity,
+ ignoreSeeThrough);
}
bIncludeDeadPeds = deadPeds;
- if(mindist < dist){
+ if(mindist < dist) {
dist = mindist;
return true;
- }else
+ } else
return false;
}
bool
-CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, bool ignoreSeeThrough, bool ignoreSomeObjects)
+CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist,
+ CEntity *&entity, bool ignoreSeeThrough, bool ignoreSomeObjects)
{
bool deadPeds = false;
float mindist = dist;
@@ -303,119 +328,137 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP
CEntity *e;
CColModel *colmodel;
- if(list.first && bIncludeDeadPeds && ((CEntity*)list.first->item)->IsPed())
- deadPeds = true;
+ if(list.first && bIncludeDeadPeds && ((CEntity *)list.first->item)->IsPed()) deadPeds = true;
- for(node = list.first; node; node = node->next){
- e = (CEntity*)node->item;
- if(e->m_scanCode != GetCurrentScanCode() &&
- e != pIgnoreEntity &&
- (e->bUsesCollision || deadPeds) &&
- !(ignoreSomeObjects && CameraToIgnoreThisObject(e))){
+ for(node = list.first; node; node = node->next) {
+ e = (CEntity *)node->item;
+ if(e->m_scanCode != GetCurrentScanCode() && e != pIgnoreEntity && (e->bUsesCollision || deadPeds) &&
+ !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
colmodel = nil;
e->m_scanCode = GetCurrentScanCode();
- if(e->IsPed()){
- if(e->bUsesCollision ||
- deadPeds && ((CPed*)e)->m_nPedState == PED_DEAD){
- if (((CPed*)e)->UseGroundColModel())
+ if(e->IsPed()) {
+ if(e->bUsesCollision || deadPeds && ((CPed *)e)->m_nPedState == PED_DEAD) {
+ if(((CPed *)e)->UseGroundColModel())
colmodel = &CTempColModels::ms_colModelPedGroundHit;
else
#ifdef ANIMATE_PED_COL_MODEL
- colmodel = CPedModelInfo::AnimatePedColModel(((CPedModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex()))->GetHitColModel(), RpClumpGetFrame(e->GetClump()));
+ colmodel = CPedModelInfo::AnimatePedColModel(
+ ((CPedModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex()))
+ ->GetHitColModel(),
+ RpClumpGetFrame(e->GetClump()));
#else
- colmodel = ((CPedModelInfo*)CModelInfo::GetModelInfo(e->GetModelIndex()))->GetHitColModel();
+ colmodel =
+ ((CPedModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex()))
+ ->GetHitColModel();
#endif
- }else
+ } else
colmodel = nil;
- }else if(e->bUsesCollision)
+ } else if(e->bUsesCollision)
colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
- if(colmodel &&
- CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, dist, ignoreSeeThrough))
+ if(colmodel && CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, dist,
+ ignoreSeeThrough))
entity = e;
}
}
- if(mindist < dist){
+ if(mindist < dist) {
dist = mindist;
return true;
- }else
+ } else
return false;
}
-bool
-CWorld::ProcessVerticalLine(const CVector &point1, float z2, CColPoint &point, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, CStoredCollPoly *poly)
+bool
+CWorld::ProcessVerticalLine(const CVector &point1, float z2, CColPoint &point, CEntity *&entity, bool checkBuildings,
+ bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies,
+ bool ignoreSeeThrough, CStoredCollPoly *poly)
{
AdvanceCurrentScanCode();
CVector point2(point1.x, point1.y, z2);
return ProcessVerticalLineSector(*GetSector(GetSectorIndexX(point1.x), GetSectorIndexX(point1.y)),
- CColLine(point1, point2), point, entity,
- checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, poly);
+ CColLine(point1, point2), point, entity, checkBuildings, checkVehicles,
+ checkPeds, checkObjects, checkDummies, ignoreSeeThrough, poly);
}
bool
-CWorld::ProcessVerticalLineSector(CSector &sector, const CColLine &line, CColPoint &point, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, CStoredCollPoly *poly)
+CWorld::ProcessVerticalLineSector(CSector &sector, const CColLine &line, CColPoint &point, CEntity *&entity,
+ bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects,
+ bool checkDummies, bool ignoreSeeThrough, CStoredCollPoly *poly)
{
float mindist = 1.0f;
- if(checkBuildings){
- ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_BUILDINGS], line, point, mindist, entity, ignoreSeeThrough, poly);
- ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, poly);
+ if(checkBuildings) {
+ ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_BUILDINGS], line, point, mindist, entity,
+ ignoreSeeThrough, poly);
+ ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, point, mindist,
+ entity, ignoreSeeThrough, poly);
}
- if(checkVehicles){
- ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_VEHICLES], line, point, mindist, entity, ignoreSeeThrough, poly);
- ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, poly);
+ if(checkVehicles) {
+ ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_VEHICLES], line, point, mindist, entity,
+ ignoreSeeThrough, poly);
+ ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, point, mindist, entity,
+ ignoreSeeThrough, poly);
}
- if(checkPeds){
- ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_PEDS], line, point, mindist, entity, ignoreSeeThrough, poly);
- ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, poly);
+ if(checkPeds) {
+ ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_PEDS], line, point, mindist, entity,
+ ignoreSeeThrough, poly);
+ ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, point, mindist, entity,
+ ignoreSeeThrough, poly);
}
- if(checkObjects){
- ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_OBJECTS], line, point, mindist, entity, ignoreSeeThrough, poly);
- ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, poly);
+ if(checkObjects) {
+ ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_OBJECTS], line, point, mindist, entity,
+ ignoreSeeThrough, poly);
+ ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, point, mindist, entity,
+ ignoreSeeThrough, poly);
}
- if(checkDummies){
- ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_DUMMIES], line, point, mindist, entity, ignoreSeeThrough, poly);
- ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_DUMMIES_OVERLAP], line, point, mindist, entity, ignoreSeeThrough, poly);
+ if(checkDummies) {
+ ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_DUMMIES], line, point, mindist, entity,
+ ignoreSeeThrough, poly);
+ ProcessVerticalLineSectorList(sector.m_lists[ENTITYLIST_DUMMIES_OVERLAP], line, point, mindist, entity,
+ ignoreSeeThrough, poly);
}
return mindist < 1.0f;
}
bool
-CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, bool ignoreSeeThrough, CStoredCollPoly *poly)
+CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist,
+ CEntity *&entity, bool ignoreSeeThrough, CStoredCollPoly *poly)
{
float mindist = dist;
CPtrNode *node;
CEntity *e;
CColModel *colmodel;
- for(node = list.first; node; node = node->next){
- e = (CEntity*)node->item;
- if(e->m_scanCode != GetCurrentScanCode() &&
- e->bUsesCollision){
+ for(node = list.first; node; node = node->next) {
+ e = (CEntity *)node->item;
+ if(e->m_scanCode != GetCurrentScanCode() && e->bUsesCollision) {
e->m_scanCode = GetCurrentScanCode();
colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
- if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, dist, ignoreSeeThrough, poly))
+ if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, dist,
+ ignoreSeeThrough, poly))
entity = e;
}
}
- if(mindist < dist){
+ if(mindist < dist) {
dist = mindist;
return true;
- }else
+ } else
return false;
}
bool
-CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects)
+CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool checkBuildings, bool checkVehicles,
+ bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough,
+ bool ignoreSomeObjects)
{
int x, xstart, xend;
int y, ystart, yend;
@@ -428,58 +471,54 @@ CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool
xend = GetSectorIndexX(point2.x);
yend = GetSectorIndexY(point2.y);
-#define LOSARGS CColLine(point1, point2), checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, ignoreSomeObjects
+#define LOSARGS \
+ CColLine(point1, point2), checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, \
+ ignoreSeeThrough, ignoreSomeObjects
- if(xstart == xend && ystart == yend){
+ if(xstart == xend && ystart == yend) {
// Only one sector
return GetIsLineOfSightSectorClear(*GetSector(xstart, ystart), LOSARGS);
- }else if(xstart == xend){
+ } else if(xstart == xend) {
// Only step in y
- if(ystart < yend){
+ if(ystart < yend) {
for(y = ystart; y <= yend; y++)
- if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS))
- return false;
- }else{
+ if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false;
+ } else {
for(y = ystart; y >= yend; y--)
- if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS))
- return false;
+ if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false;
}
- }else if(ystart == yend){
+ } else if(ystart == yend) {
// Only step in x
- if(xstart < xend){
+ if(xstart < xend) {
for(x = xstart; x <= xend; x++)
- if(!GetIsLineOfSightSectorClear(*GetSector(x, ystart), LOSARGS))
- return false;
- }else{
+ if(!GetIsLineOfSightSectorClear(*GetSector(x, ystart), LOSARGS)) return false;
+ } else {
for(x = xstart; x >= xend; x--)
- if(!GetIsLineOfSightSectorClear(*GetSector(x, ystart), LOSARGS))
- return false;
+ if(!GetIsLineOfSightSectorClear(*GetSector(x, ystart), LOSARGS)) return false;
}
- }else{
- if(point1.x < point2.x){
+ } else {
+ if(point1.x < point2.x) {
// Step from left to right
float m = (point2.y - point1.y) / (point2.x - point1.x);
y1 = ystart;
- y2 = GetSectorIndexY((GetWorldX(xstart+1) - point1.x)*m + point1.y);
- if(y1 < y2){
+ y2 = GetSectorIndexY((GetWorldX(xstart + 1) - point1.x) * m + point1.y);
+ if(y1 < y2) {
for(y = y1; y <= y2; y++)
- if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS))
- return false;
- }else{
+ if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false;
+ } else {
for(y = y1; y >= y2; y--)
- if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS))
- return false;
+ if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false;
}
- for(x = xstart+1; x < xend; x++){
+ for(x = xstart + 1; x < xend; x++) {
y1 = y2;
- y2 = GetSectorIndexY((GetWorldX(x+1) - point1.x)*m + point1.y);
- if(y1 < y2){
+ y2 = GetSectorIndexY((GetWorldX(x + 1) - point1.x) * m + point1.y);
+ if(y1 < y2) {
for(y = y1; y <= y2; y++)
if(!GetIsLineOfSightSectorClear(*GetSector(x, y), LOSARGS))
return false;
- }else{
+ } else {
for(y = y1; y >= y2; y--)
if(!GetIsLineOfSightSectorClear(*GetSector(x, y), LOSARGS))
return false;
@@ -488,39 +527,35 @@ CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool
y1 = y2;
y2 = yend;
- if(y1 < y2){
+ if(y1 < y2) {
for(y = y1; y <= y2; y++)
- if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS))
- return false;
- }else{
+ if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) return false;
+ } else {
for(y = y1; y >= y2; y--)
- if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS))
- return false;
+ if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) return false;
}
- }else{
+ } else {
// Step from right to left
float m = (point2.y - point1.y) / (point2.x - point1.x);
y1 = ystart;
- y2 = GetSectorIndexY((GetWorldX(xstart) - point1.x)*m + point1.y);
- if(y1 < y2){
+ y2 = GetSectorIndexY((GetWorldX(xstart) - point1.x) * m + point1.y);
+ if(y1 < y2) {
for(y = y1; y <= y2; y++)
- if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS))
- return false;
- }else{
+ if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false;
+ } else {
for(y = y1; y >= y2; y--)
- if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS))
- return false;
+ if(!GetIsLineOfSightSectorClear(*GetSector(xstart, y), LOSARGS)) return false;
}
- for(x = xstart-1; x > xend; x--){
+ for(x = xstart - 1; x > xend; x--) {
y1 = y2;
- y2 = GetSectorIndexY((GetWorldX(x) - point1.x)*m + point1.y);
- if(y1 < y2){
+ y2 = GetSectorIndexY((GetWorldX(x) - point1.x) * m + point1.y);
+ if(y1 < y2) {
for(y = y1; y <= y2; y++)
if(!GetIsLineOfSightSectorClear(*GetSector(x, y), LOSARGS))
return false;
- }else{
+ } else {
for(y = y1; y >= y2; y--)
if(!GetIsLineOfSightSectorClear(*GetSector(x, y), LOSARGS))
return false;
@@ -529,14 +564,12 @@ CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool
y1 = y2;
y2 = yend;
- if(y1 < y2){
+ if(y1 < y2) {
for(y = y1; y <= y2; y++)
- if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS))
- return false;
- }else{
+ if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) return false;
+ } else {
for(y = y1; y >= y2; y--)
- if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS))
- return false;
+ if(!GetIsLineOfSightSectorClear(*GetSector(xend, y), LOSARGS)) return false;
}
}
}
@@ -547,37 +580,43 @@ CWorld::GetIsLineOfSightClear(const CVector &point1, const CVector &point2, bool
}
bool
-CWorld::GetIsLineOfSightSectorClear(CSector &sector, const CColLine &line, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects)
+CWorld::GetIsLineOfSightSectorClear(CSector &sector, const CColLine &line, bool checkBuildings, bool checkVehicles,
+ bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough,
+ bool ignoreSomeObjects)
{
- if(checkBuildings){
+ if(checkBuildings) {
if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_BUILDINGS], line, ignoreSeeThrough))
return false;
- if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, ignoreSeeThrough))
+ if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line,
+ ignoreSeeThrough))
return false;
}
- if(checkVehicles){
+ if(checkVehicles) {
if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_VEHICLES], line, ignoreSeeThrough))
return false;
- if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, ignoreSeeThrough))
+ if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line,
+ ignoreSeeThrough))
return false;
}
- if(checkPeds){
+ if(checkPeds) {
if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_PEDS], line, ignoreSeeThrough))
return false;
if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, ignoreSeeThrough))
return false;
}
- if(checkObjects){
- if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_OBJECTS], line, ignoreSeeThrough, ignoreSomeObjects))
+ if(checkObjects) {
+ if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_OBJECTS], line, ignoreSeeThrough,
+ ignoreSomeObjects))
return false;
- if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, ignoreSeeThrough, ignoreSomeObjects))
+ if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, ignoreSeeThrough,
+ ignoreSomeObjects))
return false;
}
- if(checkDummies){
+ if(checkDummies) {
if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_DUMMIES], line, ignoreSeeThrough))
return false;
if(!GetIsLineOfSightSectorListClear(sector.m_lists[ENTITYLIST_DUMMIES_OVERLAP], line, ignoreSeeThrough))
@@ -588,21 +627,20 @@ CWorld::GetIsLineOfSightSectorClear(CSector &sector, const CColLine &line, bool
}
bool
-CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bool ignoreSeeThrough, bool ignoreSomeObjects)
+CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bool ignoreSeeThrough,
+ bool ignoreSomeObjects)
{
CPtrNode *node;
CEntity *e;
CColModel *colmodel;
- for(node = list.first; node; node = node->next){
- e = (CEntity*)node->item;
- if(e->m_scanCode != GetCurrentScanCode() &&
- e->bUsesCollision){
+ for(node = list.first; node; node = node->next) {
+ e = (CEntity *)node->item;
+ if(e->m_scanCode != GetCurrentScanCode() && e->bUsesCollision) {
e->m_scanCode = GetCurrentScanCode();
- if(e != pIgnoreEntity &&
- !(ignoreSomeObjects && CameraToIgnoreThisObject(e))){
+ if(e != pIgnoreEntity && !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
@@ -616,26 +654,25 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo
}
void
-CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector &centre, float radius, bool ignoreZ, short *nextObject, short lastObject, CEntity **objects)
+CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector &centre, float radius, bool ignoreZ, short *nextObject,
+ short lastObject, CEntity **objects)
{
float radiusSqr = radius * radius;
float objDistSqr;
- for (CPtrNode *node = list.first; node; node = node->next) {
- CEntity *object = (CEntity*)node->item;
- if (object->m_scanCode != GetCurrentScanCode()) {
+ for(CPtrNode *node = list.first; node; node = node->next) {
+ CEntity *object = (CEntity *)node->item;
+ if(object->m_scanCode != GetCurrentScanCode()) {
object->m_scanCode = GetCurrentScanCode();
CVector diff = centre - object->GetPosition();
- if (ignoreZ)
+ if(ignoreZ)
objDistSqr = diff.MagnitudeSqr2D();
else
objDistSqr = diff.MagnitudeSqr();
- if (objDistSqr < radiusSqr && *nextObject < lastObject) {
- if (objects) {
- objects[*nextObject] = object;
- }
+ if(objDistSqr < radiusSqr && *nextObject < lastObject) {
+ if(objects) { objects[*nextObject] = object; }
(*nextObject)++;
}
}
@@ -643,140 +680,237 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector &centre, float radi
}
void
-CWorld::FindObjectsInRange(CVector &centre, float radius, bool ignoreZ, short *nextObject, short lastObject, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies)
+CWorld::FindObjectsInRange(CVector &centre, float radius, bool ignoreZ, short *nextObject, short lastObject,
+ CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds,
+ bool checkObjects, bool checkDummies)
{
int minX = GetSectorIndexX(centre.x - radius);
- if (minX <= 0) minX = 0;
+ if(minX <= 0) minX = 0;
int minY = GetSectorIndexY(centre.y - radius);
- if (minY <= 0) minY = 0;
+ if(minY <= 0) minY = 0;
int maxX = GetSectorIndexX(centre.x + radius);
#ifdef FIX_BUGS
- if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1;
+ if(maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1;
#else
- if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X;
+ if(maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X;
#endif
int maxY = GetSectorIndexY(centre.y + radius);
#ifdef FIX_BUGS
- if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1;
+ if(maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1;
#else
- if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y;
+ if(maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y;
#endif
-
+
AdvanceCurrentScanCode();
*nextObject = 0;
for(int curY = minY; curY <= maxY; curY++) {
for(int curX = minX; curX <= maxX; curX++) {
CSector *sector = GetSector(curX, curY);
- if (checkBuildings) {
- FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius, ignoreZ, nextObject, lastObject, objects);
- FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
+ if(checkBuildings) {
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius,
+ ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre,
+ radius, ignoreZ, nextObject, lastObject, objects);
+ }
+ if(checkVehicles) {
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius,
+ ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre,
+ radius, ignoreZ, nextObject, lastObject, objects);
+ }
+ if(checkPeds) {
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ,
+ nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius,
+ ignoreZ, nextObject, lastObject, objects);
+ }
+ if(checkObjects) {
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius,
+ ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre,
+ radius, ignoreZ, nextObject, lastObject, objects);
+ }
+ if(checkDummies) {
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius,
+ ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre,
+ radius, ignoreZ, nextObject, lastObject, objects);
}
- if (checkVehicles) {
- FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius, ignoreZ, nextObject, lastObject, objects);
- FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
+ }
+ }
+}
+
+void
+CWorld::FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList &list, const CVector &position, float radius,
+ bool bCheck2DOnly, int16 *nEntitiesFound, int16 maxEntitiesToFind,
+ CEntity **aEntities)
+{
+ for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ if(pEntity->m_scanCode != GetCurrentScanCode()) {
+ pEntity->m_scanCode = GetCurrentScanCode();
+ float fMagnitude = 0.0f;
+ if(bCheck2DOnly)
+ fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr2D();
+ else
+ fMagnitude = (position - pEntity->GetPosition()).MagnitudeSqr();
+ if(fMagnitude < radius * radius && *nEntitiesFound < maxEntitiesToFind) {
+ if(aEntities) aEntities[*nEntitiesFound] = pEntity;
+ ++*nEntitiesFound;
+ }
+ }
+ }
+}
+
+void
+CWorld::FindObjectsOfTypeInRange(uint32 modelId, const CVector &position, float radius, bool bCheck2DOnly,
+ int16 *nEntitiesFound, int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings,
+ bool bVehicles, bool bPeds, bool bObjects, bool bDummies)
+{
+ CWorld::AdvanceCurrentScanCode();
+ *nEntitiesFound = 0;
+ const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
+ const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
+ const int32 nStartX = max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0);
+ const int32 nStartY = max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
+ const int32 nEndX = min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
+ const int32 nEndY = min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
+ for(int32 y = nStartY; y <= nEndY; y++) {
+ for(int32 x = nStartX; x <= nEndX; x++) {
+ CSector *pSector = CWorld::GetSector(x, y);
+ if(bBuildings) {
+ CWorld::FindObjectsOfTypeInRangeSectorList(
+ modelId, pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsOfTypeInRangeSectorList(
+ modelId, pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius,
+ bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities);
}
- if (checkPeds) {
- FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ, nextObject, lastObject, objects);
- FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
+ if(bVehicles) {
+ CWorld::FindObjectsOfTypeInRangeSectorList(
+ modelId, pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsOfTypeInRangeSectorList(
+ modelId, pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius,
+ bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities);
}
- if (checkObjects) {
- FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius, ignoreZ, nextObject, lastObject, objects);
- FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
+ if(bPeds) {
+ CWorld::FindObjectsOfTypeInRangeSectorList(
+ modelId, pSector->m_lists[ENTITYLIST_PEDS], position, radius, bCheck2DOnly,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsOfTypeInRangeSectorList(
+ modelId, pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
}
- if (checkDummies) {
- FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius, ignoreZ, nextObject, lastObject, objects);
- FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
+ if(bObjects) {
+ CWorld::FindObjectsOfTypeInRangeSectorList(
+ modelId, pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsOfTypeInRangeSectorList(
+ modelId, pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius,
+ bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities);
+ }
+ if(bDummies) {
+ CWorld::FindObjectsOfTypeInRangeSectorList(
+ modelId, pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsOfTypeInRangeSectorList(
+ modelId, pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius,
+ bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities);
}
}
}
}
-CEntity*
-CWorld::TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects)
+CEntity *
+CWorld::TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings,
+ bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies,
+ bool ignoreSomeObjects)
{
- CEntity* foundE = nil;
+ CEntity *foundE = nil;
int minX = GetSectorIndexX(centre.x - radius);
- if (minX <= 0) minX = 0;
+ if(minX <= 0) minX = 0;
int minY = GetSectorIndexY(centre.y - radius);
- if (minY <= 0) minY = 0;
+ if(minY <= 0) minY = 0;
int maxX = GetSectorIndexX(centre.x + radius);
#ifdef FIX_BUGS
- if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1;
+ if(maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1;
#else
- if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X;
+ if(maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X;
#endif
int maxY = GetSectorIndexY(centre.y + radius);
#ifdef FIX_BUGS
- if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1;
+ if(maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1;
#else
- if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y;
+ if(maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y;
#endif
AdvanceCurrentScanCode();
- for (int curY = minY; curY <= maxY; curY++) {
- for (int curX = minX; curX <= maxX; curX++) {
- CSector* sector = GetSector(curX, curY);
- if (checkBuildings) {
- foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius, entityToIgnore, false);
- if (foundE)
- return foundE;
-
- foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, radius, entityToIgnore, false);
- if (foundE)
- return foundE;
+ for(int curY = minY; curY <= maxY; curY++) {
+ for(int curX = minX; curX <= maxX; curX++) {
+ CSector *sector = GetSector(curX, curY);
+ if(checkBuildings) {
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre,
+ radius, entityToIgnore, false);
+ if(foundE) return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP],
+ centre, radius, entityToIgnore, false);
+ if(foundE) return foundE;
}
- if (checkVehicles) {
- foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius, entityToIgnore, false);
- if (foundE)
- return foundE;
-
- foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, radius, entityToIgnore, false);
- if (foundE)
- return foundE;
+ if(checkVehicles) {
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre,
+ radius, entityToIgnore, false);
+ if(foundE) return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP],
+ centre, radius, entityToIgnore, false);
+ if(foundE) return foundE;
}
- if (checkPeds) {
- foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, entityToIgnore, false);
- if (foundE)
- return foundE;
-
- foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius, entityToIgnore, false);
- if (foundE)
- return foundE;
+ if(checkPeds) {
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius,
+ entityToIgnore, false);
+ if(foundE) return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre,
+ radius, entityToIgnore, false);
+ if(foundE) return foundE;
}
- if (checkObjects) {
- foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius, entityToIgnore, ignoreSomeObjects);
- if (foundE)
- return foundE;
-
- foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, radius, entityToIgnore, ignoreSomeObjects);
- if (foundE)
- return foundE;
+ if(checkObjects) {
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre,
+ radius, entityToIgnore, ignoreSomeObjects);
+ if(foundE) return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP],
+ centre, radius, entityToIgnore, ignoreSomeObjects);
+ if(foundE) return foundE;
}
- if (checkDummies) {
- foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius, entityToIgnore, false);
- if (foundE)
- return foundE;
-
- foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, radius, entityToIgnore, false);
- if (foundE)
- return foundE;
+ if(checkDummies) {
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre,
+ radius, entityToIgnore, false);
+ if(foundE) return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP],
+ centre, radius, entityToIgnore, false);
+ if(foundE) return foundE;
}
}
}
return foundE;
}
-CEntity*
-CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float radius, CEntity *entityToIgnore, bool ignoreSomeObjects)
+CEntity *
+CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float radius, CEntity *entityToIgnore,
+ bool ignoreSomeObjects)
{
static CColModel sphereCol;
@@ -800,24 +934,27 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad
CMatrix sphereMat;
sphereMat.SetTranslate(spherePos);
- for(CPtrNode *node=list.first; node; node = node->next) {
- CEntity *e = (CEntity*)node->item;
+ for(CPtrNode *node = list.first; node; node = node->next) {
+ CEntity *e = (CEntity *)node->item;
- if (e->m_scanCode != GetCurrentScanCode()) {
+ if(e->m_scanCode != GetCurrentScanCode()) {
e->m_scanCode = GetCurrentScanCode();
- if (e != entityToIgnore && e->bUsesCollision && !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
+ if(e != entityToIgnore && e->bUsesCollision &&
+ !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
CVector diff = spherePos - e->GetPosition();
float distance = diff.Magnitude();
- if (e->GetBoundRadius() + radius > distance) {
+ if(e->GetBoundRadius() + radius > distance) {
CColModel *eCol = CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel();
- int collidedSpheres = CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(),
- *eCol, gaTempSphereColPoints, nil, nil);
-
- if (collidedSpheres != 0 ||
- (e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_CAR &&
- e->m_modelIndex != MI_DODO && radius + eCol->boundingBox.max.x > distance)) {
+ int collidedSpheres =
+ CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(), *eCol,
+ gaTempSphereColPoints, nil, nil);
+
+ if(collidedSpheres != 0 ||
+ (e->IsVehicle() && ((CVehicle *)e)->m_vehType == VEHICLE_TYPE_CAR &&
+ e->m_modelIndex != MI_DODO &&
+ radius + eCol->boundingBox.max.x > distance)) {
return e;
}
}
@@ -833,7 +970,8 @@ CWorld::FindGroundZForCoord(float x, float y)
{
CColPoint point;
CEntity *ent;
- if(ProcessVerticalLine(CVector(x, y, 1000.0f), -1000.0f, point, ent, true, false, false, false, true, false, nil))
+ if(ProcessVerticalLine(CVector(x, y, 1000.0f), -1000.0f, point, ent, true, false, false, false, true, false,
+ nil))
return point.point.z;
else
return 20.0f;
@@ -844,13 +982,11 @@ CWorld::FindGroundZFor3DCoord(float x, float y, float z, bool *found)
{
CColPoint point;
CEntity *ent;
- if(ProcessVerticalLine(CVector(x, y, z), -1000.0f, point, ent, true, false, false, false, false, false, nil)){
- if(found)
- *found = true;
+ if(ProcessVerticalLine(CVector(x, y, z), -1000.0f, point, ent, true, false, false, false, false, false, nil)) {
+ if(found) *found = true;
return point.point.z;
- }else{
- if(found)
- *found = false;
+ } else {
+ if(found) *found = false;
return 0.0f;
}
}
@@ -860,35 +996,373 @@ CWorld::FindRoofZFor3DCoord(float x, float y, float z, bool *found)
{
CColPoint point;
CEntity *ent;
- if(ProcessVerticalLine(CVector(x, y, z), 1000.0f, point, ent, true, false, false, false, true, false, nil)){
- if(found)
- *found = true;
+ if(ProcessVerticalLine(CVector(x, y, z), 1000.0f, point, ent, true, false, false, false, true, false, nil)) {
+ if(found) *found = true;
return point.point.z;
- }else{
+ } else {
if(found == nil)
- printf("THERE IS NO MAP BELOW THE FOLLOWING COORS:%f %f %f. (FindGroundZFor3DCoord)\n", x, y, z);
- if(found)
- *found = false;
+ printf("THERE IS NO MAP BELOW THE FOLLOWING COORS:%f %f %f. (FindGroundZFor3DCoord)\n", x, y,
+ z);
+ if(found) *found = false;
return 20.0f;
}
}
-CPlayerPed*
+void
+CWorld::RemoveReferencesToDeletedObject(CEntity *pDeletedObject)
+{
+ int32 i = CPools::GetPedPool()->GetSize();
+ while(--i >= 0) {
+ CPed *pPed = CPools::GetPedPool()->GetSlot(i);
+ if(pPed && pPed != pDeletedObject) {
+ pPed->RemoveRefsToEntity(pDeletedObject);
+ if(pPed->m_pCurrentPhysSurface == pDeletedObject) pPed->m_pCurrentPhysSurface = nil;
+ }
+ }
+ i = CPools::GetVehiclePool()->GetSize();
+ while(--i >= 0) {
+ CVehicle *pVehicle = CPools::GetVehiclePool()->GetSlot(i);
+ if(pVehicle && pVehicle != pDeletedObject) {
+ pVehicle->RemoveRefsToEntity(pDeletedObject);
+ pVehicle->RemoveRefsToVehicle(pDeletedObject);
+ }
+ }
+ i = CPools::GetObjectPool()->GetSize();
+ while(--i >= 0) {
+ CObject *pObject = CPools::GetObjectPool()->GetSlot(i);
+ if(pObject && pObject != pDeletedObject) { pObject->RemoveRefsToEntity(pDeletedObject); }
+ }
+}
+
+void
+CWorld::FindObjectsKindaColliding(const CVector &position, float radius, bool bCheck2DOnly, int16 *nCollidingEntities,
+ int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings, bool bVehicles,
+ bool bPeds, bool bObjects, bool bDummies)
+{
+ CWorld::AdvanceCurrentScanCode();
+ *nCollidingEntities = 0;
+ const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
+ const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
+ const int32 nStartX = max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0);
+ const int32 nStartY = max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
+ const int32 nEndX = min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
+ const int32 nEndY = min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
+ for(int32 y = nStartY; y <= nEndY; y++) {
+ for(int32 x = nStartX; x <= nEndX; x++) {
+ CSector *pSector = CWorld::GetSector(x, y);
+ if(bBuildings) {
+ CWorld::FindObjectsKindaCollidingSectorList(
+ pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly,
+ nCollidingEntities, maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsKindaCollidingSectorList(
+ pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius, bCheck2DOnly,
+ nCollidingEntities, maxEntitiesToFind, aEntities);
+ }
+ if(bVehicles) {
+ CWorld::FindObjectsKindaCollidingSectorList(
+ pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly,
+ nCollidingEntities, maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsKindaCollidingSectorList(
+ pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius, bCheck2DOnly,
+ nCollidingEntities, maxEntitiesToFind, aEntities);
+ }
+ if(bPeds) {
+ CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_PEDS], position,
+ radius, bCheck2DOnly, nCollidingEntities,
+ maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsKindaCollidingSectorList(
+ pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly,
+ nCollidingEntities, maxEntitiesToFind, aEntities);
+ }
+ if(bObjects) {
+ CWorld::FindObjectsKindaCollidingSectorList(
+ pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly,
+ nCollidingEntities, maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsKindaCollidingSectorList(
+ pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius, bCheck2DOnly,
+ nCollidingEntities, maxEntitiesToFind, aEntities);
+ }
+ if(bDummies) {
+ CWorld::FindObjectsKindaCollidingSectorList(
+ pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly,
+ nCollidingEntities, maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsKindaCollidingSectorList(
+ pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius, bCheck2DOnly,
+ nCollidingEntities, maxEntitiesToFind, aEntities);
+ }
+ }
+ }
+}
+
+void
+CWorld::FindObjectsKindaCollidingSectorList(CPtrList &list, const CVector &position, float radius, bool bCheck2DOnly,
+ int16 *nCollidingEntities, int16 maxEntitiesToFind, CEntity **aEntities)
+{
+ for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ if(pEntity->m_scanCode != GetCurrentScanCode()) {
+ pEntity->m_scanCode = GetCurrentScanCode();
+ float fMagnitude = 0.0f;
+ if(bCheck2DOnly)
+ fMagnitude = (position - pEntity->GetPosition()).Magnitude2D();
+ else
+ fMagnitude = (position - pEntity->GetPosition()).Magnitude();
+ if(pEntity->GetBoundRadius() + radius > fMagnitude && *nCollidingEntities < maxEntitiesToFind) {
+ if(aEntities) aEntities[*nCollidingEntities] = pEntity;
+ ++*nCollidingEntities;
+ }
+ }
+ }
+}
+
+void
+CWorld::FindObjectsIntersectingCube(const CVector &vecStartPos, const CVector &vecEndPos, int16 *nIntersecting,
+ int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings, bool bVehicles,
+ bool bPeds, bool bObjects, bool bDummies)
+{
+ CWorld::AdvanceCurrentScanCode();
+ *nIntersecting = 0;
+ const int32 nStartX = max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
+ const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
+ const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
+ const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
+ for(int32 y = nStartY; y <= nEndY; y++) {
+ for(int32 x = nStartX; x <= nEndX; x++) {
+ CSector *pSector = CWorld::GetSector(x, y);
+ if(bBuildings) {
+ CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS],
+ vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsIntersectingCubeSectorList(
+ pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], vecStartPos, vecEndPos,
+ nIntersecting, maxEntitiesToFind, aEntities);
+ }
+ if(bVehicles) {
+ CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES],
+ vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsIntersectingCubeSectorList(
+ pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos,
+ nIntersecting, maxEntitiesToFind, aEntities);
+ }
+ if(bPeds) {
+ CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS],
+ vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP],
+ vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities);
+ }
+ if(bObjects) {
+ CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS],
+ vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsIntersectingCubeSectorList(
+ pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities);
+ }
+ if(bDummies) {
+ CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_DUMMIES],
+ vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsIntersectingCubeSectorList(
+ pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities);
+ }
+ }
+ }
+}
+
+void
+CWorld::FindObjectsIntersectingCubeSectorList(CPtrList &list, const CVector &vecStartPos, const CVector &vecEndPos,
+ int16 *nIntersecting, int16 maxEntitiesToFind, CEntity **aEntities)
+{
+ for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ if(pEntity->m_scanCode != GetCurrentScanCode()) {
+ pEntity->m_scanCode = GetCurrentScanCode();
+ float fRadius = pEntity->GetBoundRadius();
+ const CVector &entityPos = pEntity->GetPosition();
+ if(fRadius + entityPos.x >= vecStartPos.x && entityPos.x - fRadius <= vecEndPos.x &&
+ fRadius + entityPos.y >= vecStartPos.y && entityPos.y - fRadius <= vecEndPos.y &&
+ fRadius + entityPos.z >= vecStartPos.z && entityPos.z - fRadius <= vecEndPos.z &&
+ *nIntersecting < maxEntitiesToFind) {
+ if(aEntities) aEntities[*nIntersecting] = pEntity;
+ ++*nIntersecting;
+ }
+ }
+ }
+}
+
+void
+CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &boundingBox, const CMatrix &matrix,
+ const CVector &position, float fStartX, float fStartY, float fEndX,
+ float fEndY, int16 *nEntitiesFound, int16 maxEntitiesToFind,
+ CEntity **aEntities, bool bBuildings, bool bVehicles, bool bPeds,
+ bool bObjects, bool bDummies)
+{
+ CWorld::AdvanceCurrentScanCode();
+ *nEntitiesFound = 0;
+ const int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
+ const int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
+ const int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
+ const int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
+ for(int32 y = nStartY; y <= nEndY; y++) {
+ for(int32 x = nStartX; x <= nEndX; x++) {
+ CSector *pSector = CWorld::GetSector(x, y);
+ if(bBuildings) {
+ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(
+ pSector->m_lists[ENTITYLIST_BUILDINGS], boundingBox, matrix, position,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(
+ pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], boundingBox, matrix, position,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ }
+ if(bVehicles) {
+ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(
+ pSector->m_lists[ENTITYLIST_VEHICLES], boundingBox, matrix, position,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(
+ pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], boundingBox, matrix, position,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ }
+ if(bPeds) {
+ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(
+ pSector->m_lists[ENTITYLIST_PEDS], boundingBox, matrix, position, nEntitiesFound,
+ maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(
+ pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], boundingBox, matrix, position,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ }
+ if(bObjects) {
+ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(
+ pSector->m_lists[ENTITYLIST_OBJECTS], boundingBox, matrix, position, nEntitiesFound,
+ maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(
+ pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], boundingBox, matrix, position,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ }
+ if(bDummies) {
+ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(
+ pSector->m_lists[ENTITYLIST_DUMMIES], boundingBox, matrix, position, nEntitiesFound,
+ maxEntitiesToFind, aEntities);
+ CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(
+ pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], boundingBox, matrix, position,
+ nEntitiesFound, maxEntitiesToFind, aEntities);
+ }
+ }
+ }
+}
+
+void
+CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList &list, const CColBox &boundingBox,
+ const CMatrix &matrix, const CVector &position,
+ int16 *nEntitiesFound, int16 maxEntitiesToFind,
+ CEntity **aEntities)
+{
+ for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ if(pEntity->m_scanCode != GetCurrentScanCode()) {
+ pEntity->m_scanCode = GetCurrentScanCode();
+ CColSphere sphere;
+ CVector vecDistance = pEntity->GetPosition() - position;
+ sphere.radius = pEntity->GetBoundRadius();
+ sphere.center = Multiply3x3(vecDistance, matrix);
+ if(CCollision::TestSphereBox(sphere, boundingBox) && *nEntitiesFound < maxEntitiesToFind) {
+ if(aEntities) aEntities[*nEntitiesFound] = pEntity;
+ ++*nEntitiesFound;
+ }
+ }
+ }
+}
+
+void
+CWorld::FindMissionEntitiesIntersectingCube(const CVector &vecStartPos, const CVector &vecEndPos, int16 *nIntersecting,
+ int16 maxEntitiesToFind, CEntity **aEntities, bool bVehicles, bool bPeds,
+ bool bObjects)
+{
+ CWorld::AdvanceCurrentScanCode();
+ *nIntersecting = 0;
+ const int32 nStartX = max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
+ const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
+ const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
+ const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
+ for(int32 y = nStartY; y <= nEndY; y++) {
+ for(int32 x = nStartX; x <= nEndX; x++) {
+ CSector *pSector = CWorld::GetSector(x, y);
+ if(bVehicles) {
+ CWorld::FindMissionEntitiesIntersectingCubeSectorList(
+ pSector->m_lists[ENTITYLIST_VEHICLES], vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities, true, false);
+ CWorld::FindMissionEntitiesIntersectingCubeSectorList(
+ pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos,
+ nIntersecting, maxEntitiesToFind, aEntities, true, false);
+ }
+ if(bPeds) {
+ CWorld::FindMissionEntitiesIntersectingCubeSectorList(
+ pSector->m_lists[ENTITYLIST_PEDS], vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities, false, true);
+ CWorld::FindMissionEntitiesIntersectingCubeSectorList(
+ pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities, false, true);
+ }
+ if(bObjects) {
+ CWorld::FindMissionEntitiesIntersectingCubeSectorList(
+ pSector->m_lists[ENTITYLIST_OBJECTS], vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities, false, false);
+ CWorld::FindMissionEntitiesIntersectingCubeSectorList(
+ pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting,
+ maxEntitiesToFind, aEntities, false, false);
+ }
+ }
+ }
+}
+
+void
+CWorld::FindMissionEntitiesIntersectingCubeSectorList(CPtrList &list, const CVector &vecStartPos,
+ const CVector &vecEndPos, int16 *nIntersecting,
+ int16 maxEntitiesToFind, CEntity **aEntities, bool bIsVehicleList,
+ bool bIsPedList)
+{
+ for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ if(pEntity->m_scanCode != GetCurrentScanCode()) {
+ pEntity->m_scanCode = GetCurrentScanCode();
+ bool bIsMissionEntity = false;
+ if(bIsVehicleList)
+ bIsMissionEntity = ((CVehicle *)pEntity)->VehicleCreatedBy == MISSION_VEHICLE;
+ else if(bIsPedList)
+ bIsMissionEntity = ((CPed *)pEntity)->CharCreatedBy == MISSION_CHAR;
+ else
+ bIsMissionEntity = ((CObject *)pEntity)->ObjectCreatedBy == MISSION_OBJECT;
+ float fRadius = pEntity->GetBoundRadius();
+ const CVector &entityPos = pEntity->GetPosition();
+ if(bIsMissionEntity && fRadius + entityPos.x >= vecStartPos.x &&
+ entityPos.x - fRadius <= vecEndPos.x && fRadius + entityPos.y >= vecStartPos.y &&
+ entityPos.y - fRadius <= vecEndPos.y && fRadius + entityPos.z >= vecStartPos.z &&
+ entityPos.z - fRadius <= vecEndPos.z && *nIntersecting < maxEntitiesToFind) {
+ if(aEntities) aEntities[*nIntersecting] = pEntity;
+ ++*nIntersecting;
+ }
+ }
+ }
+}
+
+CPlayerPed *
FindPlayerPed(void)
{
return CWorld::Players[CWorld::PlayerInFocus].m_pPed;
}
-CVehicle*
+CVehicle *
FindPlayerVehicle(void)
{
CPlayerPed *ped = FindPlayerPed();
- if(ped && ped->InVehicle())
- return ped->m_pMyVehicle;
+ if(ped && ped->InVehicle()) return ped->m_pMyVehicle;
return nil;
}
-CVehicle*
+CVehicle *
FindPlayerTrain(void)
{
if(FindPlayerVehicle() && FindPlayerVehicle()->IsTrain())
@@ -897,7 +1371,7 @@ FindPlayerTrain(void)
return nil;
}
-CEntity*
+CEntity *
FindPlayerEntity(void)
{
CPlayerPed *ped = FindPlayerPed();
@@ -917,7 +1391,7 @@ FindPlayerCoors(void)
return ped->GetPosition();
}
-CVector&
+CVector &
FindPlayerSpeed(void)
{
CPlayerPed *ped = FindPlayerPed();
@@ -927,27 +1401,22 @@ FindPlayerSpeed(void)
return ped->m_vecMoveSpeed;
}
-CVector&
+CVector &
FindPlayerCentreOfWorld(int32 player)
{
- if(CCarCtrl::bCarsGeneratedAroundCamera)
- return TheCamera.GetPosition();
- if(CWorld::Players[player].m_pRemoteVehicle)
- return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
- if(FindPlayerVehicle())
- return FindPlayerVehicle()->GetPosition();
+ if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
+ if(CWorld::Players[player].m_pRemoteVehicle) return CWorld::Players[player].m_pRemoteVehicle->GetPosition();
+ if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
return CWorld::Players[player].m_pPed->GetPosition();
}
-CVector&
+CVector &
FindPlayerCentreOfWorld_NoSniperShift(void)
{
- if(CCarCtrl::bCarsGeneratedAroundCamera)
- return TheCamera.GetPosition();
+ if(CCarCtrl::bCarsGeneratedAroundCamera) return TheCamera.GetPosition();
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetPosition();
- if(FindPlayerVehicle())
- return FindPlayerVehicle()->GetPosition();
+ if(FindPlayerVehicle()) return FindPlayerVehicle()->GetPosition();
return FindPlayerPed()->GetPosition();
}
@@ -956,19 +1425,160 @@ FindPlayerHeading(void)
{
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle)
return CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->GetForward().Heading();
- if(FindPlayerVehicle())
- return FindPlayerVehicle()->GetForward().Heading();
+ if(FindPlayerVehicle()) return FindPlayerVehicle()->GetForward().Heading();
return FindPlayerPed()->GetForward().Heading();
}
void
-CWorld::RemoveEntityInsteadOfProcessingIt(CEntity* ent)
+CWorld::ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, float z2)
+{
+ CVehiclePool *pVehiclePool = CPools::GetVehiclePool();
+ for(int32 i = 0; i < pVehiclePool->GetSize(); i++) {
+ CVehicle *pVehicle = CPools::GetVehiclePool()->GetSlot(i);
+ if(pVehicle) {
+ const CVector &position = pVehicle->GetPosition();
+ if(position.x >= x1 && position.x <= x2 && position.y >= y1 && position.y <= y2 &&
+ position.z >= z1 && position.z <= z2 && !pVehicle->bIsLocked && pVehicle->CanBeDeleted()) {
+ if(pVehicle->pDriver) {
+ CPopulation::RemovePed(pVehicle->pDriver);
+ pVehicle->pDriver = nil;
+ }
+ for(int32 j = 0; j < pVehicle->m_nNumMaxPassengers; ++j) {
+ if(pVehicle->pPassengers[j]) {
+ CPopulation::RemovePed(pVehicle->pPassengers[j]);
+ pVehicle->pPassengers[j] = nil;
+ --pVehicle->m_nNumPassengers;
+ }
+ }
+ CCarCtrl::RemoveFromInterestingVehicleList(pVehicle);
+ CWorld::Remove(pVehicle);
+ delete pVehicle;
+ }
+ }
+ }
+}
+
+void
+CWorld::ClearPedsFromArea(float x1, float y1, float z1, float x2, float y2, float z2)
+{
+ CPedPool *pPedPool = CPools::GetPedPool();
+ for(int32 i = 0; i < pPedPool->GetSize(); i++) {
+ CPed *pPed = CPools::GetPedPool()->GetSlot(i);
+ if(pPed) {
+ const CVector &position = pPed->GetPosition();
+ if(!pPed->IsPlayer() && pPed->CanBeDeleted() && position.x >= x1 && position.x <= x2 &&
+ position.y >= y1 && position.y <= y2 && position.z >= z1 && position.z <= z2) {
+ CPopulation::RemovePed(pPed);
+ }
+ }
+ }
+}
+
+void
+CWorld::CallOffChaseForArea(float x1, float y1, float x2, float y2)
+{
+ CWorld::AdvanceCurrentScanCode();
+ float fStartX = x1 - 10.0f;
+ float fStartY = y1 - 10.0f;
+ float fEndX = x2 + 10.0f;
+ float fEndY = y2 + 10.0f;
+ const int32 nStartX = max(CWorld::GetSectorIndexX(fStartX), 0);
+ const int32 nStartY = max(CWorld::GetSectorIndexY(fStartY), 0);
+ const int32 nEndX = min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
+ const int32 nEndY = min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
+ for(int32 y = nStartY; y <= nEndY; y++) {
+ for(int32 x = nStartX; x <= nEndX; x++) {
+ CSector *pSector = CWorld::GetSector(x, y);
+ CWorld::CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES], x1, y1, x2,
+ y2, fStartX, fStartY, fEndX, fEndY);
+ CWorld::CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], x1,
+ y1, x2, y2, fStartX, fStartY, fEndX, fEndY);
+ CWorld::CallOffChaseForAreaSectorListPeds(pSector->m_lists[ENTITYLIST_PEDS], x1, y1, x2, y2);
+ CWorld::CallOffChaseForAreaSectorListPeds(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], x1, y1, x2,
+ y2);
+ }
+ }
+}
+
+void
+CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList &list, float x1, float y1, float x2, float y2, float fStartX,
+ float fStartY, float fEndX, float fEndY)
+{
+ for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) {
+ CVehicle *pVehicle = (CVehicle *)pNode->item;
+ if(pVehicle->m_scanCode != GetCurrentScanCode()) {
+ pVehicle->m_scanCode = GetCurrentScanCode();
+ const CVector &vehiclePos = pVehicle->GetPosition();
+ eCarMission carMission = pVehicle->AutoPilot.m_nCarMission;
+ if(pVehicle != FindPlayerVehicle() && vehiclePos.x > fStartX && vehiclePos.x < fEndX &&
+ vehiclePos.y > fStartY && vehiclePos.y < fEndY && pVehicle->bIsLawEnforcer &&
+ (carMission == MISSION_RAMPLAYER_FARAWAY || carMission == MISSION_RAMPLAYER_CLOSE ||
+ carMission == MISSION_BLOCKPLAYER_FARAWAY || carMission == MISSION_BLOCKPLAYER_CLOSE)) {
+ pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 2000;
+ CColModel *pColModel = pVehicle->GetColModel();
+ bool bInsideSphere = false;
+ for(int32 i = 0; i < pColModel->numSpheres; i++) {
+ CVector pos = pVehicle->m_matrix * pColModel->spheres[i].center;
+ float fRadius = pColModel->spheres[i].radius;
+ if(pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 &&
+ pos.y - fRadius < y2)
+ bInsideSphere = true;
+ // Maybe break the loop when bInsideSphere is set to true?
+ }
+ if(bInsideSphere) {
+ if(pVehicle->GetPosition().x <= (x1 + x2) * 0.5f)
+ pVehicle->m_vecMoveSpeed.x = min(pVehicle->m_vecMoveSpeed.x, 0.0f);
+ else
+ pVehicle->m_vecMoveSpeed.x = max(pVehicle->m_vecMoveSpeed.x, 0.0f);
+ if(pVehicle->GetPosition().y <= (y1 + y2) * 0.5f)
+ pVehicle->m_vecMoveSpeed.y = min(pVehicle->m_vecMoveSpeed.y, 0.0f);
+ else
+ pVehicle->m_vecMoveSpeed.y = max(pVehicle->m_vecMoveSpeed.y, 0.0f);
+ }
+ }
+ }
+ }
+}
+
+void
+CWorld::CallOffChaseForAreaSectorListPeds(CPtrList &list, float x1, float y1, float x2, float y2)
{
- if (ent->IsPed()) {
- if (FindPlayerPed() == ent)
+ for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) {
+ CPed *pPed = (CPed *)pNode->item;
+ const CVector &pedPos = pPed->GetPosition();
+ if(pPed->m_scanCode != GetCurrentScanCode()) {
+ pPed->m_scanCode = GetCurrentScanCode();
+ if(pPed != FindPlayerPed() && pPed->m_leader != FindPlayerPed() && pedPos.x > x1 &&
+ pedPos.x < x2 && pedPos.y > y1 && pedPos.y < y2 &&
+ (pPed->m_pedInObjective == FindPlayerPed() ||
+ pPed->m_carInObjective && pPed->m_carInObjective == FindPlayerVehicle()) &&
+ pPed->m_nPedState != PED_DEAD && pPed->m_nPedState != PED_DIE &&
+ (pPed->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT ||
+ pPed->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER ||
+ pPed->m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS)) {
+ if(pPed->IsPedInControl()) {
+ if(pPed->m_nPedType == PEDTYPE_COP)
+ ((CCopPed *)pPed)->ClearPursuit();
+ else
+ pPed->SetIdle();
+ pPed->SetObjective(OBJECTIVE_NONE);
+ } else {
+ pPed->m_prevObjective = OBJECTIVE_NONE;
+ pPed->m_nLastPedState = PED_IDLE;
+ }
+ }
+ }
+ }
+}
+
+void
+CWorld::RemoveEntityInsteadOfProcessingIt(CEntity *ent)
+{
+ if(ent->IsPed()) {
+ if(FindPlayerPed() == ent)
Remove(ent);
else
- CPopulation::RemovePed((CPed*)ent);
+ CPopulation::RemovePed((CPed *)ent);
} else {
Remove(ent);
delete ent;
@@ -979,12 +1589,13 @@ void
CWorld::RemoveFallenPeds(void)
{
int poolSize = CPools::GetPedPool()->GetSize();
- for(int poolIndex = poolSize-1; poolIndex >= 0; poolIndex--) {
+ for(int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) {
CPed *ped = CPools::GetPedPool()->GetSlot(poolIndex);
- if (ped) {
- if (ped->GetPosition().z < MAP_Z_LOW_LIMIT) {
- if (ped->CharCreatedBy != RANDOM_CHAR || ped->IsPlayer()) {
- int closestNode = ThePaths.FindNodeClosestToCoors(ped->GetPosition(), PATH_PED, 999999.9f, false, false);
+ if(ped) {
+ if(ped->GetPosition().z < MAP_Z_LOW_LIMIT) {
+ if(ped->CharCreatedBy != RANDOM_CHAR || ped->IsPlayer()) {
+ int closestNode = ThePaths.FindNodeClosestToCoors(ped->GetPosition(), PATH_PED,
+ 999999.9f, false, false);
CVector newPos = ThePaths.m_pathNodes[closestNode].pos;
newPos.z += 2.0f;
ped->Teleport(newPos);
@@ -1001,17 +1612,20 @@ void
CWorld::RemoveFallenCars(void)
{
int poolSize = CPools::GetVehiclePool()->GetSize();
- for (int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) {
- CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
- if (veh) {
- if (veh->GetPosition().z < MAP_Z_LOW_LIMIT) {
- if (veh->VehicleCreatedBy == MISSION_VEHICLE || veh == FindPlayerVehicle() || (veh->pDriver && veh->pDriver->IsPlayer())) {
- int closestNode = ThePaths.FindNodeClosestToCoors(veh->GetPosition(), PATH_CAR, 999999.9f, false, false);
+ for(int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) {
+ CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
+ if(veh) {
+ if(veh->GetPosition().z < MAP_Z_LOW_LIMIT) {
+ if(veh->VehicleCreatedBy == MISSION_VEHICLE || veh == FindPlayerVehicle() ||
+ (veh->pDriver && veh->pDriver->IsPlayer())) {
+ int closestNode = ThePaths.FindNodeClosestToCoors(veh->GetPosition(), PATH_CAR,
+ 999999.9f, false, false);
CVector newPos = ThePaths.m_pathNodes[closestNode].pos;
newPos.z += 3.0f;
veh->Teleport(newPos);
veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
- } else if (veh->VehicleCreatedBy == RANDOM_VEHICLE || veh->VehicleCreatedBy == PARKED_VEHICLE) {
+ } else if(veh->VehicleCreatedBy == RANDOM_VEHICLE ||
+ veh->VehicleCreatedBy == PARKED_VEHICLE) {
Remove(veh);
delete veh;
}
@@ -1024,11 +1638,10 @@ void
CWorld::StopAllLawEnforcersInTheirTracks(void)
{
int poolSize = CPools::GetVehiclePool()->GetSize();
- for (int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) {
- CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
- if (veh) {
- if (veh->bIsLawEnforcer)
- veh->SetMoveSpeed(0.0f, 0.0f, 0.0f);
+ for(int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) {
+ CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
+ if(veh) {
+ if(veh->bIsLawEnforcer) veh->SetMoveSpeed(0.0f, 0.0f, 0.0f);
}
}
}
@@ -1037,10 +1650,9 @@ void
CWorld::SetAllCarsCanBeDamaged(bool toggle)
{
int poolSize = CPools::GetVehiclePool()->GetSize();
- for (int poolIndex = 0; poolIndex < poolSize; poolIndex++) {
+ for(int poolIndex = 0; poolIndex < poolSize; poolIndex++) {
CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
- if (veh)
- veh->bCanBeDamaged = toggle;
+ if(veh) veh->bCanBeDamaged = toggle;
}
}
@@ -1048,11 +1660,181 @@ void
CWorld::ExtinguishAllCarFiresInArea(CVector point, float range)
{
int poolSize = CPools::GetVehiclePool()->GetSize();
- for (int poolIndex = 0; poolIndex < poolSize; poolIndex++) {
- CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
- if (veh) {
- if ((point - veh->GetPosition()).MagnitudeSqr() < sq(range))
- veh->ExtinguishCarFire();
+ for(int poolIndex = 0; poolIndex < poolSize; poolIndex++) {
+ CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
+ if(veh) {
+ if((point - veh->GetPosition()).MagnitudeSqr() < sq(range)) veh->ExtinguishCarFire();
+ }
+ }
+}
+
+void
+CWorld::AddParticles(void)
+{
+ for(int32 y = 0; y < NUMSECTORS_Y; y++) {
+ for(int32 x = 0; x < NUMSECTORS_X; x++) {
+ CSector *pSector = GetSector(x, y);
+ CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_BUILDINGS]);
+ CEntity::AddSteamsFromGround(pSector->m_lists[ENTITYLIST_DUMMIES]);
+ }
+ }
+}
+
+void
+CWorld::ShutDown(void)
+{
+ for(int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) {
+ CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y);
+ for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ CWorld::Remove(pEntity);
+ delete pEntity;
+ }
+ for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ CWorld::Remove(pEntity);
+ delete pEntity;
+ }
+ for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ CWorld::Remove(pEntity);
+ delete pEntity;
+ }
+ for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ CWorld::Remove(pEntity);
+ delete pEntity;
+ }
+ for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ CWorld::Remove(pEntity);
+ delete pEntity;
+ }
+ pSector->m_lists[ENTITYLIST_BUILDINGS].Flush();
+ pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush();
+ pSector->m_lists[ENTITYLIST_DUMMIES].Flush();
+ pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush();
+ }
+ for(int32 i = 0; i < 4; i++) {
+ for(CPtrNode *pNode = GetBigBuildingList((eLevelName)i).first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ // Maybe remove from world here?
+ delete pEntity;
+ }
+ GetBigBuildingList((eLevelName)i).Flush();
+ }
+ for(int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) {
+ CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y);
+ if(pSector->m_lists[ENTITYLIST_BUILDINGS].first) {
+ sprintf(gString, "Building list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y);
+ pSector->m_lists[ENTITYLIST_BUILDINGS].Flush();
+ }
+ if(pSector->m_lists[ENTITYLIST_DUMMIES].first) {
+ sprintf(gString, "Dummy list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y);
+ pSector->m_lists[ENTITYLIST_DUMMIES].Flush();
+ }
+ if(pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].first) {
+ sprintf(gString, "Building overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y);
+ pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush();
+ }
+ if(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP].first) {
+ sprintf(gString, "Vehicle overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y);
+ pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP].Flush();
+ }
+ if(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP].first) {
+ sprintf(gString, "Ped overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y);
+ pSector->m_lists[ENTITYLIST_PEDS_OVERLAP].Flush();
+ }
+ if(pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP].first) {
+ sprintf(gString, "Object overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y);
+ pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP].Flush();
+ }
+ if(pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].first) {
+ sprintf(gString, "Dummy overlap list %d,%d not empty\n", i % NUMSECTORS_X, i / NUMSECTORS_Y);
+ pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush();
+ }
+ }
+ ms_listMovingEntityPtrs.Flush();
+}
+
+void
+CWorld::ClearForRestart(void)
+{
+ if(CCutsceneMgr::HasLoaded()) CCutsceneMgr::DeleteCutsceneData();
+ CProjectileInfo::RemoveAllProjectiles();
+ CObject::DeleteAllTempObjects();
+ CObject::DeleteAllMissionObjects();
+ CPopulation::ConvertAllObjectsToDummyObjects();
+ for(int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) {
+ CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y);
+ for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ CWorld::Remove(pEntity);
+ delete pEntity;
+ }
+ for(CPtrNode *pNode = GetBigBuildingList(LEVEL_NONE).first; pNode; pNode = pNode->next) {
+ CVehicle *pVehicle = (CVehicle *)pNode->item;
+ if(pVehicle && pVehicle->IsVehicle() && pVehicle->IsPlane()) {
+ CWorld::Remove(pVehicle);
+ delete pVehicle;
+ }
+ }
+ for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ CWorld::Remove(pEntity);
+ delete pEntity;
+ }
+ }
+ CPools::CheckPoolsEmpty();
+}
+
+void
+CWorld::RepositionCertainDynamicObjects()
+{
+ int32 i = CPools::GetDummyPool()->GetSize();
+ while(--i >= 0) {
+ CDummy *dummy = CPools::GetDummyPool()->GetSlot(i);
+ if(dummy) { RepositionOneObject(dummy); }
+ }
+}
+
+void
+CWorld::RepositionOneObject(CEntity *pEntity)
+{
+ int16 modelId = pEntity->m_modelIndex;
+ if(modelId == MI_SINGLESTREETLIGHTS1 || modelId == MI_SINGLESTREETLIGHTS2 ||
+ modelId == MI_SINGLESTREETLIGHTS3 || modelId == MI_DOUBLESTREETLIGHTS || modelId == MI_TREE1 ||
+ modelId == MI_TREE2 || modelId == MI_TREE3 || modelId == MI_TREE4 || modelId == MI_TREE5 ||
+ modelId == MI_TREE6 || modelId == MI_TREE7 || modelId == MI_TREE8 || modelId == MI_TREE9 ||
+ modelId == MI_TREE10 || modelId == MI_TREE11 || modelId == MI_TREE12 || modelId == MI_TREE13 ||
+ modelId == MI_TREE14 || modelId == MI_TRAFFICLIGHTS || modelId == MI_PARKINGMETER ||
+ modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 ||
+ modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 ||
+ modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 ||
+ modelId == MI_PHONESIGN || modelId == MI_TAXISIGN || modelId == MI_FISHSTALL01 ||
+ modelId == MI_FISHSTALL02 || modelId == MI_FISHSTALL03 || modelId == MI_FISHSTALL04 ||
+ modelId == MI_BAGELSTAND2 || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT ||
+ modelId == MI_PARKTABLE) {
+ CVector &position = pEntity->GetPosition();
+ float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z;
+ position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y,
+ position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
+ fBoundingBoxMinZ;
+ pEntity->m_matrix.UpdateRW();
+ pEntity->UpdateRwFrame();
+ } else if(modelId == MI_BUOY) {
+ float fWaterLevel = 0.0f;
+ bool bFound = true;
+ const CVector &position = pEntity->GetPosition();
+ float fGroundZ = CWorld::FindGroundZFor3DCoord(position.x, position.y,
+ position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound);
+ if(CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z,
+ &fWaterLevel)) {
+ if(!bFound || fWaterLevel > fGroundZ) {
+ CColModel *pColModel = pEntity->GetColModel();
+ float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
+ pEntity->GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight;
+ }
}
}
}
@@ -1061,28 +1843,72 @@ void
CWorld::SetCarsOnFire(float x, float y, float z, float radius, CEntity *reason)
{
int poolSize = CPools::GetVehiclePool()->GetSize();
- for (int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) {
+ for(int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) {
CVehicle *veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
- if (veh && veh->m_status != STATUS_WRECKED && !veh->m_pCarFire && !veh->bFireProof) {
- if (Abs(veh->GetPosition().z - z) < 5.0f && Abs(veh->GetPosition().x - x) < radius && Abs(veh->GetPosition().y - y) < radius)
- gFireManager.StartFire(veh, reason, 0.8f, true);
+ if(veh && veh->m_status != STATUS_WRECKED && !veh->m_pCarFire && !veh->bFireProof) {
+ if(Abs(veh->GetPosition().z - z) < 5.0f && Abs(veh->GetPosition().x - x) < radius &&
+ Abs(veh->GetPosition().y - y) < radius)
+ gFireManager.StartFire(veh, reason, 0.8f, true);
+ }
+ }
+}
+
+void
+CWorld::SetPedsOnFire(float x, float y, float z, float radius, CEntity *reason)
+{
+ int32 poolSize = CPools::GetPedPool()->GetSize();
+ for(int32 i = poolSize - 1; i >= 0; i--) {
+ CPed *pPed = CPools::GetPedPool()->GetSlot(i);
+ if(pPed && pPed->m_nPedState != PED_DEAD && !pPed->bInVehicle && !pPed->m_pFire && !pPed->bFireProof) {
+ if(Abs(pPed->GetPosition().z - z) < 5.0f && Abs(pPed->GetPosition().x - x) < radius &&
+ Abs(pPed->GetPosition().y - y) < radius)
+ gFireManager.StartFire(pPed, reason, 0.8f, true);
+ }
+ }
+}
+
+void
+CWorld::RemoveStaticObjects()
+{
+ for(int i = 0; i < NUMSECTORS_X * NUMSECTORS_Y; i++) {
+ CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y);
+ for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ CWorld::Remove(pEntity);
+ delete pEntity;
+ }
+ for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ CWorld::Remove(pEntity);
+ delete pEntity;
}
+ for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ CWorld::Remove(pEntity);
+ delete pEntity;
+ }
+ pSector->m_lists[ENTITYLIST_BUILDINGS].Flush();
+ pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP].Flush();
+ pSector->m_lists[ENTITYLIST_DUMMIES].Flush();
+ pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP].Flush();
}
}
void
CWorld::Process(void)
{
- if (!(CTimer::GetFrameCounter() & 63))
- CReferences::PruneAllReferencesInWorld();
+ if(!(CTimer::GetFrameCounter() & 63)) CReferences::PruneAllReferencesInWorld();
- if (bProcessCutsceneOnly) {
- for (int i = 0; i < NUMCUTSCENEOBJECTS; i++) {
+ if(bProcessCutsceneOnly) {
+ for(int i = 0; i < NUMCUTSCENEOBJECTS; i++) {
CCutsceneObject *csObj = CCutsceneMgr::GetCutsceneObject(i);
- if (csObj && csObj->m_entryInfoList.first) {
- if (csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP
- && RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) {
- RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), 0.02f * (csObj->m_type == ENTITY_TYPE_OBJECT ? CTimer::GetTimeStepNonClipped() : CTimer::GetTimeStep()));
+ if(csObj && csObj->m_entryInfoList.first) {
+ if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP &&
+ RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) {
+ RpAnimBlendClumpUpdateAnimations(csObj->GetClump(),
+ 0.02f * (csObj->m_type == ENTITY_TYPE_OBJECT
+ ? CTimer::GetTimeStepNonClipped()
+ : CTimer::GetTimeStep()));
}
csObj->ProcessControl();
csObj->ProcessCollision();
@@ -1093,102 +1919,98 @@ CWorld::Process(void)
CRecordDataForChase::ProcessControlCars();
CRecordDataForChase::SaveOrRetrieveCarPositions();
} else {
- for (CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
- CEntity *movingEnt = (CEntity*)node->item;
- if (movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP
- && RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
- RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), 0.02f * (movingEnt->m_type == ENTITY_TYPE_OBJECT ? CTimer::GetTimeStepNonClipped() : CTimer::GetTimeStep()));
+ for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
+ CEntity *movingEnt = (CEntity *)node->item;
+ if(movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP &&
+ RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
+ RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(),
+ 0.02f * (movingEnt->m_type == ENTITY_TYPE_OBJECT
+ ? CTimer::GetTimeStepNonClipped()
+ : CTimer::GetTimeStep()));
}
}
- for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
- CPhysical* movingEnt = (CPhysical*)node->item;
- if (movingEnt->bRemoveFromWorld) {
+ for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
+ CPhysical *movingEnt = (CPhysical *)node->item;
+ if(movingEnt->bRemoveFromWorld) {
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
- if (movingEnt->bIsStatic) {
- movingEnt->RemoveFromMovingList();
- }
+ if(movingEnt->bIsStatic) { movingEnt->RemoveFromMovingList(); }
}
}
bForceProcessControl = true;
- for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
- CPhysical* movingEnt = (CPhysical*)node->item;
- if (movingEnt->bWasPostponed) {
- if (movingEnt->bRemoveFromWorld) {
+ for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
+ CPhysical *movingEnt = (CPhysical *)node->item;
+ if(movingEnt->bWasPostponed) {
+ if(movingEnt->bRemoveFromWorld) {
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
- if (movingEnt->bIsStatic) {
- movingEnt->RemoveFromMovingList();
- }
+ if(movingEnt->bIsStatic) { movingEnt->RemoveFromMovingList(); }
}
}
}
bForceProcessControl = false;
- if (CReplay::IsPlayingBack()) {
- for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
- CEntity* movingEnt = (CEntity*)node->item;
+ if(CReplay::IsPlayingBack()) {
+ for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
+ CEntity *movingEnt = (CEntity *)node->item;
movingEnt->bIsInSafePosition = true;
movingEnt->GetMatrix().UpdateRW();
movingEnt->UpdateRwFrame();
}
} else {
bNoMoreCollisionTorque = false;
- for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
- CEntity* movingEnt = (CEntity*)node->item;
- if (!movingEnt->bIsInSafePosition) {
+ for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
+ CEntity *movingEnt = (CEntity *)node->item;
+ if(!movingEnt->bIsInSafePosition) {
movingEnt->ProcessCollision();
movingEnt->GetMatrix().UpdateRW();
movingEnt->UpdateRwFrame();
}
}
bNoMoreCollisionTorque = true;
- for (int i = 0; i < 4; i++) {
- for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
- CEntity* movingEnt = (CEntity*)node->item;
- if (!movingEnt->bIsInSafePosition) {
+ for(int i = 0; i < 4; i++) {
+ for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
+ CEntity *movingEnt = (CEntity *)node->item;
+ if(!movingEnt->bIsInSafePosition) {
movingEnt->ProcessCollision();
movingEnt->GetMatrix().UpdateRW();
movingEnt->UpdateRwFrame();
}
}
}
- for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
- CEntity* movingEnt = (CEntity*)node->item;
- if (!movingEnt->bIsInSafePosition) {
+ for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
+ CEntity *movingEnt = (CEntity *)node->item;
+ if(!movingEnt->bIsInSafePosition) {
movingEnt->bIsStuck = true;
movingEnt->ProcessCollision();
movingEnt->GetMatrix().UpdateRW();
movingEnt->UpdateRwFrame();
- if (!movingEnt->bIsInSafePosition) {
- movingEnt->bIsStuck = true;
- }
+ if(!movingEnt->bIsInSafePosition) { movingEnt->bIsStuck = true; }
}
}
bSecondShift = false;
- for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
- CEntity* movingEnt = (CEntity*)node->item;
- if (!movingEnt->bIsInSafePosition) {
+ for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
+ CEntity *movingEnt = (CEntity *)node->item;
+ if(!movingEnt->bIsInSafePosition) {
movingEnt->ProcessShift();
movingEnt->GetMatrix().UpdateRW();
movingEnt->UpdateRwFrame();
- if (!movingEnt->bIsInSafePosition) {
- movingEnt->bIsStuck = true;
- }
+ if(!movingEnt->bIsInSafePosition) { movingEnt->bIsStuck = true; }
}
}
bSecondShift = true;
- for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
- CPhysical* movingEnt = (CPhysical*)node->item;
- if (!movingEnt->bIsInSafePosition) {
+ for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
+ CPhysical *movingEnt = (CPhysical *)node->item;
+ if(!movingEnt->bIsInSafePosition) {
movingEnt->ProcessShift();
movingEnt->GetMatrix().UpdateRW();
movingEnt->UpdateRwFrame();
- if (!movingEnt->bIsInSafePosition) {
+ if(!movingEnt->bIsInSafePosition) {
movingEnt->bIsStuck = true;
- if (movingEnt->m_status == STATUS_PLAYER) {
- printf("STUCK: Final Step: Player Entity %d Is Stuck\n", movingEnt->m_modelIndex);
+ if(movingEnt->m_status == STATUS_PLAYER) {
+ printf("STUCK: Final Step: Player Entity %d Is Stuck\n",
+ movingEnt->m_modelIndex);
movingEnt->m_vecMoveSpeed *= 0.3f;
movingEnt->ApplyMoveSpeed();
movingEnt->ApplyTurnSpeed();
@@ -1197,35 +2019,28 @@ CWorld::Process(void)
}
}
}
- for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
- CPed* movingPed = (CPed*)node->item;
- if (movingPed->IsPed()) {
- if (movingPed->bInVehicle && movingPed->m_nPedState != PED_EXIT_TRAIN || movingPed->EnteringCar()) {
+ for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
+ CPed *movingPed = (CPed *)node->item;
+ if(movingPed->IsPed()) {
+ if(movingPed->bInVehicle && movingPed->m_nPedState != PED_EXIT_TRAIN ||
+ movingPed->EnteringCar()) {
CVehicle *movingCar = movingPed->m_pMyVehicle;
- if (movingCar) {
- if (movingCar->IsTrain()) {
+ if(movingCar) {
+ if(movingCar->IsTrain()) {
movingPed->SetPedPositionInTrain();
} else {
- switch (movingPed->m_nPedState) {
- case PED_ENTER_CAR:
- case PED_CARJACK:
- movingPed->EnterCar();
- break;
- case PED_DRAG_FROM_CAR:
+ switch(movingPed->m_nPedState) {
+ case PED_ENTER_CAR:
+ case PED_CARJACK: movingPed->EnterCar(); break;
+ case PED_DRAG_FROM_CAR: movingPed->BeingDraggedFromCar(); break;
+ case PED_EXIT_CAR: movingPed->ExitCar(); break;
+ case PED_ARRESTED:
+ if(movingPed->m_nLastPedState == PED_DRAG_FROM_CAR) {
movingPed->BeingDraggedFromCar();
break;
- case PED_EXIT_CAR:
- movingPed->ExitCar();
- break;
- case PED_ARRESTED:
- if (movingPed->m_nLastPedState == PED_DRAG_FROM_CAR) {
- movingPed->BeingDraggedFromCar();
- break;
- }
- // fall through
- default:
- movingPed->SetPedPositionInCar();
- break;
+ }
+ // fall through
+ default: movingPed->SetPedPositionInCar(); break;
}
}
movingPed->GetMatrix().UpdateRW();
@@ -1240,14 +2055,165 @@ CWorld::Process(void)
CMessages::Process();
Players[PlayerInFocus].Process();
CRecordDataForChase::SaveOrRetrieveCarPositions();
- if ((CTimer::GetFrameCounter() & 7) == 1) {
+ if((CTimer::GetFrameCounter() & 7) == 1) {
RemoveFallenPeds();
- } else if ((CTimer::GetFrameCounter() & 7) == 5) {
+ } else if((CTimer::GetFrameCounter() & 7) == 5) {
RemoveFallenCars();
}
}
}
+void
+CWorld::TriggerExplosion(const CVector &position, float fRadius, float fPower, CEntity *pCreator,
+ bool bProcessVehicleBombTimer)
+{
+ CVector2D vecStartPos(position.x - fRadius, position.y - fRadius);
+ CVector2D vecEndPos(position.x + fRadius, position.y + fRadius);
+ const int32 nStartX = max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
+ const int32 nStartY = max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
+ const int32 nEndX = min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
+ const int32 nEndY = min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
+ for(int32 y = nStartY; y <= nEndY; y++) {
+ for(int32 x = nStartX; x <= nEndX; x++) {
+ CSector *pSector = CWorld::GetSector(x, y);
+ CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], position, fRadius,
+ fPower, pCreator, bProcessVehicleBombTimer);
+ CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_PEDS], position, fRadius, fPower,
+ pCreator, bProcessVehicleBombTimer);
+ CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], position, fRadius,
+ fPower, pCreator, bProcessVehicleBombTimer);
+ }
+ }
+}
+
+void
+CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, float fRadius, float fPower,
+ CEntity *pCreator, bool bProcessVehicleBombTimer)
+{
+ for(CPtrNode *pNode = list.first; pNode; pNode = pNode->next) {
+ CPhysical *pEntity = (CPhysical *)pNode->item;
+ CVector vecDistance = pEntity->GetPosition() - position;
+ float fMagnitude = vecDistance.Magnitude();
+ if(fRadius > fMagnitude) {
+ CWeapon::BlowUpExplosiveThings(pEntity);
+ CPed *pPed = (CPed *)pEntity;
+ CObject *pObject = (CObject *)pEntity;
+ CVehicle *pVehicle = (CVehicle *)pEntity;
+ if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) {
+ if(pEntity->bIsStatic) {
+ if(pEntity->IsObject()) {
+ if(fPower > pObject->m_fUprootLimit || IsFence(pObject->m_modelIndex)) {
+ if(IsGlass(pObject->m_modelIndex)) {
+ CGlass::WindowRespondsToExplosion(pObject, position);
+ } else {
+ pObject->bIsStatic = false;
+ pObject->AddToMovingList();
+ int16 modelId = pEntity->m_modelIndex;
+ if(modelId != MI_FIRE_HYDRANT ||
+ pObject->bHasBeenDamaged) {
+ if(pEntity->IsObject() &&
+ modelId != MI_EXPLODINGBARREL &&
+ modelId != MI_PETROLPUMP)
+ pObject->bHasBeenDamaged = true;
+ } else {
+ CVector pos = pEntity->GetPosition();
+ pos.z -= 0.5f;
+ CParticleObject::AddObject(POBJECT_FIRE_HYDRANT,
+ pos, true);
+ pObject->bHasBeenDamaged = true;
+ }
+ }
+ }
+ if(pEntity->bIsStatic) {
+ float fDamageMultiplier =
+ (fRadius - fMagnitude) * 2.0f / fRadius;
+ float fDamage = 300.0f * min(fDamageMultiplier, 1.0f);
+ pObject->ObjectDamage(fDamage);
+ }
+ } else {
+ pEntity->bIsStatic = false;
+ pEntity->AddToMovingList();
+ }
+ }
+ if(!pEntity->bIsStatic) {
+ float fDamageMultiplier = min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f);
+ CVector vecForceDir =
+ vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier /
+ max(fMagnitude, 0.01f));
+ vecForceDir.z = max(vecForceDir.z, 0.0f);
+ if(pEntity == FindPlayerPed()) vecForceDir.z = min(vecForceDir.z, 1.0f);
+ pEntity->ApplyMoveForce(vecForceDir);
+ if(!pEntity->bPedPhysics) {
+ float fBoundRadius = pEntity->GetBoundRadius();
+ float fDistanceZ = position.z - pEntity->GetPosition().z;
+ float fPointZ = fBoundRadius;
+ if(max(fDistanceZ, -fBoundRadius) < fBoundRadius) {
+ if(fDistanceZ <= -fBoundRadius)
+ fPointZ = -fBoundRadius;
+ else
+ fPointZ = fDistanceZ;
+ }
+ pEntity->ApplyTurnForce(vecForceDir.x, vecForceDir.y, vecForceDir.z,
+ 0.0f, 0.0f, fPointZ);
+ }
+ switch(pEntity->m_type) {
+ case ENTITY_TYPE_VEHICLE:
+ if(pEntity->m_status == STATUS_SIMPLE) {
+ pEntity->m_status = STATUS_PHYSICS;
+ CCarCtrl::SwitchVehicleToRealPhysics(pVehicle);
+ }
+ pVehicle->InflictDamage(pCreator, WEAPONTYPE_EXPLOSION,
+ 1100.0f * fDamageMultiplier);
+ if(bProcessVehicleBombTimer) {
+ if(pVehicle->m_nBombTimer) pVehicle->m_nBombTimer /= 10;
+ }
+ break;
+ case ENTITY_TYPE_PED: {
+ int8 direction = pPed->GetLocalDirection(-vecForceDir);
+ pPed->bIsStanding = false;
+ pPed->ApplyMoveForce(0.0, 0.0, 2.0f);
+ float fDamage = 250.0f * fDamageMultiplier;
+ pPed->InflictDamage(pCreator, WEAPONTYPE_EXPLOSION, fDamage,
+ PEDPIECE_TORSO, direction);
+ if(pPed->m_nPedState != PED_DIE)
+ pPed->SetFall(2000,
+ (AnimationId)(direction + ANIM_KO_SKID_FRONT), 0);
+ if(pCreator && pCreator->IsPed()) {
+ eEventType eventType = EVENT_SHOOT_PED;
+ if(pPed->m_nPedType == PEDTYPE_COP) eventType = EVENT_SHOOT_COP;
+ CEventList::RegisterEvent(eventType, EVENT_ENTITY_PED, pEntity,
+ (CPed *)pCreator, 10000);
+ pPed->RegisterThreatWithGangPeds(pCreator);
+ }
+ break;
+ }
+ case ENTITY_TYPE_OBJECT:
+ pObject->ObjectDamage(300.0f * fDamageMultiplier);
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+void
+CWorld::UseDetonator(CEntity *pEntity)
+{
+ int32 i = CPools::GetVehiclePool()->GetSize();
+ while(--i >= 0) {
+ CAutomobile *pVehicle = (CAutomobile *)CPools::GetVehiclePool()->GetSlot(i);
+ if(pVehicle && !pVehicle->m_vehType && pVehicle->m_bombType == CARBOMB_REMOTE &&
+ pVehicle->m_pBombRigger == pEntity) {
+ pVehicle->m_bombType = CARBOMB_NONE;
+ pVehicle->m_nBombTimer = 500;
+ pVehicle->m_pBlowUpEntity = pVehicle->m_pBombRigger;
+ if(pVehicle->m_pBlowUpEntity)
+ pVehicle->m_pBlowUpEntity->RegisterReference(&pVehicle->m_pBlowUpEntity);
+ }
+ }
+}
+
STARTPATCHES
InjectHook(0x4AE930, CWorld::Add, PATCH_JUMP);
InjectHook(0x4AE9D0, CWorld::Remove, PATCH_JUMP);
diff --git a/src/core/World.h b/src/core/World.h
index d3f1e2d5..a1e2acfd 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -85,7 +85,7 @@ public:
}
}
static void ClearScanCodes(void);
- static void ClearExcitingStuffFromArea(const CVector &pos, float radius, uint8);
+ static void ClearExcitingStuffFromArea(const CVector &pos, float radius, bool bRemoveProjectilesAndTidyUpShadows);
static bool CameraToIgnoreThisObject(CEntity *ent);
@@ -103,19 +103,26 @@ public:
static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**);
static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
- static void FindObjectsOfTypeInRangeSectorList(uint32, CPtrList&, CVector&, float, bool, short*, short, CEntity**);
- static void FindObjectsOfTypeInRange(uint32, CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
+ static void FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities);
+ static void FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies);
static float FindGroundZForCoord(float x, float y);
static float FindGroundZFor3DCoord(float x, float y, float z, bool *found);
static float FindRoofZFor3DCoord(float x, float y, float z, bool *found);
static void RemoveReferencesToDeletedObject(CEntity*);
- static void FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool);
- static void FindObjectsIntersectingCube(const CVector &, const CVector &, int16*, int16, CEntity **, bool, bool, bool, bool, bool);
+ static void FindObjectsKindaColliding(const CVector& position, float radius, bool bCheck2DOnly, int16* nCollidingEntities, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies);
+ static void FindObjectsKindaCollidingSectorList(CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nCollidingEntities, int16 maxEntitiesToFind, CEntity** aEntities);
+ static void FindObjectsIntersectingCube(const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies);
+ static void FindObjectsIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities);
static void FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool);
- static void FindMissionEntitiesIntersectingCube(const CVector&, const CVector&, int16*, int16, CEntity**, bool, bool, bool);
- static void ClearCarsFromArea(float, float, float, float, float, float);
- static void ClearPedsFromArea(float, float, float, float, float, float);
- static void CallOffChaseForArea(float, float, float, float);
+ static void FindObjectsIntersectingAngledCollisionBoxSectorList(CPtrList& list, const CColBox& boundingBox, const CMatrix& matrix, const CVector& position, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities);
+ static void FindMissionEntitiesIntersectingCube(const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bVehicles, bool bPeds, bool bObjects);
+ static void FindMissionEntitiesIntersectingCubeSectorList(CPtrList& list, const CVector& vecStartPos, const CVector& vecEndPos, int16* nIntersecting, int16 maxEntitiesToFind, CEntity** aEntities, bool bIsVehicleList, bool bIsPedList);
+
+ static void ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, float z2);
+ static void ClearPedsFromArea(float x1, float y1, float z1, float x2, float y2, float z2);
+ static void CallOffChaseForArea(float x1, float y1, float x2, float y2);
+ static void CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1, float x2, float y2, float fStartX, float fStartY, float fEndX, float fEndY);
+ static void CallOffChaseForAreaSectorListPeds(CPtrList& list, float x1, float y1, float x2, float y2);
static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }
@@ -131,19 +138,20 @@ public:
static void StopAllLawEnforcersInTheirTracks();
static void SetAllCarsCanBeDamaged(bool);
static void ExtinguishAllCarFiresInArea(CVector, float);
- static void SetCarsOnFire(float, float, float, float, CEntity*);
- static void SetPedsOnFire(float, float, float, float, CEntity*);
+ static void SetCarsOnFire(float x, float y, float z, float radius, CEntity* reason);
+ static void SetPedsOnFire(float x, float y, float z, float radius, CEntity* reason);
static void Initialise();
static void AddParticles();
static void ShutDown();
static void ClearForRestart(void);
static void RepositionCertainDynamicObjects();
+ static void RepositionOneObject(CEntity* pEntity);
static void RemoveStaticObjects();
static void Process();
- static void TriggerExplosion(const CVector &, float, float, CEntity*, bool);
-
- static void UseDetonator(CEntity *);
+ static void TriggerExplosion(const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer);
+ static void TriggerExplosionSectorList(CPtrList& list, const CVector& position, float fRadius, float fPower, CEntity* pCreator, bool bProcessVehicleBombTimer);
+ static void UseDetonator(CEntity *pEntity);
};
extern CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp
index 4a2bea4f..4cdd283e 100644
--- a/src/core/ZoneCull.cpp
+++ b/src/core/ZoneCull.cpp
@@ -11,21 +11,21 @@
#include "ZoneCull.h"
#include "Zones.h"
-int32 &CCullZones::NumCullZones = *(int*)0x8F2564;
-CCullZone(&CCullZones::aZones)[NUMCULLZONES] = *(CCullZone(*)[NUMCULLZONES])*(uintptr*)0x864750;
-int32 &CCullZones::NumAttributeZones = *(int*)0x8E29D0;
-CAttributeZone (&CCullZones::aAttributeZones)[NUMATTRIBZONES] = *(CAttributeZone(*)[NUMATTRIBZONES])*(uintptr*)0x709C60;
-uint16 (&CCullZones::aIndices)[NUMZONEINDICES] = *(uint16(*)[NUMZONEINDICES])*(uintptr*)0x847330;
-int16 (&CCullZones::aPointersToBigBuildingsForBuildings)[NUMBUILDINGS] = *(int16(*)[NUMBUILDINGS])*(uintptr*)0x86C9D0;
-int16 (&CCullZones::aPointersToBigBuildingsForTreadables)[NUMTREADABLES] = *(int16(*)[NUMTREADABLES])*(uintptr*)0x8F1B8C;
-
-int32 &CCullZones::CurrentWantedLevelDrop_Player = *(int32*)0x880DA8;
-int32 &CCullZones::CurrentFlags_Camera = *(int32*)0x940718;
-int32 &CCullZones::CurrentFlags_Player = *(int32*)0x9415F0;
-int32 &CCullZones::OldCullZone = *(int32*)0x8E2C90;
-int32 &CCullZones::EntityIndicesUsed = *(int32*)0x8F2508;
-bool &CCullZones::bCurrentSubwayIsInvisible = *(bool*)0x95CDA5;
-bool &CCullZones::bCullZonesDisabled = *(bool*)0x95CD4A;
+int32 CCullZones::NumCullZones;
+CCullZone CCullZones::aZones[NUMCULLZONES];
+int32 CCullZones::NumAttributeZones;
+CAttributeZone CCullZones::aAttributeZones[NUMATTRIBZONES];
+uint16 CCullZones::aIndices[NUMZONEINDICES];
+int16 CCullZones::aPointersToBigBuildingsForBuildings[NUMBUILDINGS];
+int16 CCullZones::aPointersToBigBuildingsForTreadables[NUMTREADABLES];
+
+int32 CCullZones::CurrentWantedLevelDrop_Player;
+int32 CCullZones::CurrentFlags_Camera;
+int32 CCullZones::CurrentFlags_Player;
+int32 CCullZones::OldCullZone;
+int32 CCullZones::EntityIndicesUsed;
+bool CCullZones::bCurrentSubwayIsInvisible;
+bool CCullZones::bCullZonesDisabled;
void
diff --git a/src/core/ZoneCull.h b/src/core/ZoneCull.h
index edaa7c4b..9bc07b8c 100644
--- a/src/core/ZoneCull.h
+++ b/src/core/ZoneCull.h
@@ -79,21 +79,21 @@ struct CAttributeZone
class CCullZones
{
public:
- static int32 &NumCullZones;
- static CCullZone (&aZones)[NUMCULLZONES];
- static int32 &NumAttributeZones;
- static CAttributeZone(&aAttributeZones)[NUMATTRIBZONES];
- static uint16 (&aIndices)[NUMZONEINDICES];
- static int16 (&aPointersToBigBuildingsForBuildings)[NUMBUILDINGS];
- static int16 (&aPointersToBigBuildingsForTreadables)[NUMTREADABLES];
+ static int32 NumCullZones;
+ static CCullZone aZones[NUMCULLZONES];
+ static int32 NumAttributeZones;
+ static CAttributeZone aAttributeZones[NUMATTRIBZONES];
+ static uint16 aIndices[NUMZONEINDICES];
+ static int16 aPointersToBigBuildingsForBuildings[NUMBUILDINGS];
+ static int16 aPointersToBigBuildingsForTreadables[NUMTREADABLES];
- static int32 &CurrentWantedLevelDrop_Player;
- static int32 &CurrentFlags_Camera;
- static int32 &CurrentFlags_Player;
- static int32 &OldCullZone;
- static int32 &EntityIndicesUsed;
- static bool &bCurrentSubwayIsInvisible;
- static bool &bCullZonesDisabled;
+ static int32 CurrentWantedLevelDrop_Player;
+ static int32 CurrentFlags_Camera;
+ static int32 CurrentFlags_Player;
+ static int32 OldCullZone;
+ static int32 EntityIndicesUsed;
+ static bool bCurrentSubwayIsInvisible;
+ static bool bCullZonesDisabled;
static void Init(void);
static void ResolveVisibilities(void);
diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp
index 4bce3e79..39d4c3b5 100644
--- a/src/core/Zones.cpp
+++ b/src/core/Zones.cpp
@@ -8,18 +8,18 @@
#include "Text.h"
#include "World.h"
-eLevelName &CTheZones::m_CurrLevel = *(eLevelName*)0x8F2BC8;
-CZone *&CTheZones::m_pPlayersZone = *(CZone**)0x8F254C;
-int16 &CTheZones::FindIndex = *(int16*)0x95CC40;
-
-uint16 &CTheZones::NumberOfAudioZones = *(uint16*)0x95CC84;
-int16 *CTheZones::AudioZoneArray = (int16*)0x713BC0;
-uint16 &CTheZones::TotalNumberOfMapZones = *(uint16*)0x95CC74;
-uint16 &CTheZones::TotalNumberOfZones = *(uint16*)0x95CC36;
-CZone *CTheZones::ZoneArray = (CZone*)0x86BEE0;
-CZone *CTheZones::MapZoneArray = (CZone*)0x663EC0;
-uint16 &CTheZones::TotalNumberOfZoneInfos = *(uint16*)0x95CC3C;
-CZoneInfo *CTheZones::ZoneInfoArray = (CZoneInfo*)0x714400;
+eLevelName CTheZones::m_CurrLevel;
+CZone *CTheZones::m_pPlayersZone;
+int16 CTheZones::FindIndex;
+
+uint16 CTheZones::NumberOfAudioZones;
+int16 CTheZones::AudioZoneArray[NUMAUDIOZONES];
+uint16 CTheZones::TotalNumberOfMapZones;
+uint16 CTheZones::TotalNumberOfZones;
+CZone CTheZones::ZoneArray[NUMZONES];
+CZone CTheZones::MapZoneArray[NUMMAPZONES];
+uint16 CTheZones::TotalNumberOfZoneInfos;
+CZoneInfo CTheZones::ZoneInfoArray[2*NUMZONES];
#define SWAPF(a, b) { float t; t = a; a = b; b = t; }
diff --git a/src/core/Zones.h b/src/core/Zones.h
index 76855e8b..bb1585dc 100644
--- a/src/core/Zones.h
+++ b/src/core/Zones.h
@@ -52,18 +52,18 @@ public:
class CTheZones
{
public:
- static eLevelName &m_CurrLevel;
- static CZone *&m_pPlayersZone;
- static int16 &FindIndex;
+ static eLevelName m_CurrLevel;
+ static CZone *m_pPlayersZone;
+ static int16 FindIndex;
- static uint16 &NumberOfAudioZones;
- static int16 *AudioZoneArray; //[NUMAUDIOZONES];
- static uint16 &TotalNumberOfMapZones;
- static uint16 &TotalNumberOfZones;
- static CZone *ZoneArray; //[NUMZONES];
- static CZone *MapZoneArray; //[NUMMAPZONES];
- static uint16 &TotalNumberOfZoneInfos;
- static CZoneInfo *ZoneInfoArray; //[2*NUMZONES];
+ static uint16 NumberOfAudioZones;
+ static int16 AudioZoneArray[NUMAUDIOZONES];
+ static uint16 TotalNumberOfMapZones;
+ static uint16 TotalNumberOfZones;
+ static CZone ZoneArray[NUMZONES];
+ static CZone MapZoneArray[NUMMAPZONES];
+ static uint16 TotalNumberOfZoneInfos;
+ static CZoneInfo ZoneInfoArray[2*NUMZONES];
static void Init(void);
static void Update(void);
diff --git a/src/core/config.h b/src/core/config.h
index f9edb74a..ba684092 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -192,6 +192,7 @@ enum Config {
#define MORE_LANGUAGES // Add more translations to the game
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
//#define USE_TXD_CDIMAGE // generate and load textures from txd.img
+//#define USE_TEXTURE_POOL
// Pad
#define XINPUT
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 08463df9..1b46d453 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -60,23 +60,18 @@
#include "GenericGameStorage.h"
#include "SceneEdit.h"
-GlobalScene &Scene = *(GlobalScene*)0x726768;
+GlobalScene Scene;
uint8 work_buff[55000];
-//char gString[256];
-//char gString2[512];
-//wchar gUString[256];
-//wchar gUString2[256];
-char *gString = (char*)0x711B40;
-char *gString2 = (char*)0x878A40;
-wchar *gUString = (wchar*)0x74B018;
-wchar *gUString2 = (wchar*)0x6EDD70;
-
+char gString[256];
+char gString2[512];
+wchar gUString[256];
+wchar gUString2[256];
float FramesPerSecond = 30.0f;
bool gbPrintShite = false;
-bool &gbModelViewer = *(bool*)0x95CD93;
+bool gbModelViewer;
int32 frameCount;
diff --git a/src/core/main.h b/src/core/main.h
index 5ee758a4..90b13fbb 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -5,19 +5,15 @@ struct GlobalScene
RpWorld *world;
RwCamera *camera;
};
-extern GlobalScene &Scene;
+extern GlobalScene Scene;
extern uint8 work_buff[55000];
-//extern char gString[256];
-//extern char gString2[512];
-//extern wchar gUString[256];
-//extern wchar gUString2[256];
-extern char *gString;
-extern char *gString2;
-extern wchar *gUString;
-extern wchar *gUString2;
+extern char gString[256];
+extern char gString2[512];
+extern wchar gUString[256];
+extern wchar gUString2[256];
extern bool gbPrintShite;
-extern bool &gbModelViewer;
+extern bool gbModelViewer;
class CSprite2d;
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 25e5db48..0efee4e7 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -865,6 +865,16 @@ CEntity::ModifyMatrixForBannerInWind(void)
UpdateRwFrame();
}
+void
+CEntity::AddSteamsFromGround(CPtrList& list)
+{
+ CPtrNode *pNode = list.first;
+ while (pNode) {
+ ((CEntity*)pNode->item)->AddSteamsFromGround(nil);
+ pNode = pNode->next;
+ }
+}
+
#include <new>
class CEntity_ : public CEntity
@@ -912,7 +922,7 @@ STARTPATCHES
InjectHook(0x473F60, &CEntity::DetachFromRwObject, PATCH_JUMP);
InjectHook(0x475A20, &CEntity::PreRenderForGlassWindow, PATCH_JUMP);
- InjectHook(0x50CE40, &CEntity::AddSteamsFromGround, PATCH_JUMP);
+ InjectHook(0x50CE40, (void (CEntity::*)(CVector*))& CEntity::AddSteamsFromGround, PATCH_JUMP);
InjectHook(0x475670, &CEntity::ModifyMatrixForTreeInWind, PATCH_JUMP);
InjectHook(0x475830, &CEntity::ModifyMatrixForBannerInWind, PATCH_JUMP);
InjectHook(0x4FA530, &CEntity::ProcessLightsForEntity, PATCH_JUMP);
diff --git a/src/entities/Entity.h b/src/entities/Entity.h
index ca501ba4..dadeee54 100644
--- a/src/entities/Entity.h
+++ b/src/entities/Entity.h
@@ -4,6 +4,7 @@
#include "Placeable.h"
struct CReference;
+class CPtrList;
enum eEntityType
{
@@ -152,5 +153,7 @@ public:
void ModifyMatrixForTreeInWind(void);
void ModifyMatrixForBannerInWind(void);
void ProcessLightsForEntity(void);
+
+ static void AddSteamsFromGround(CPtrList& list);
};
static_assert(sizeof(CEntity) == 0x64, "CEntity: error");
diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h
index 309fa1bb..cc8399e7 100644
--- a/src/modelinfo/ModelIndices.h
+++ b/src/modelinfo/ModelIndices.h
@@ -496,4 +496,11 @@ IsExplosiveThingModel(int16 id)
{
return id == MI_EXPLODINGBARREL ||
id == MI_PETROLPUMP;
+}
+
+inline bool
+IsFence(int16 id)
+{
+ return id == MI_FENCE ||
+ id == MI_FENCE2;
} \ No newline at end of file
diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp
index b6a95992..58124e53 100644
--- a/src/modelinfo/ModelInfo.cpp
+++ b/src/modelinfo/ModelInfo.cpp
@@ -5,11 +5,8 @@
#include "ModelIndices.h"
#include "ModelInfo.h"
-CBaseModelInfo **CModelInfo::ms_modelInfoPtrs = (CBaseModelInfo**)0x83D408;
+CBaseModelInfo *CModelInfo::ms_modelInfoPtrs[MODELINFOSIZE];
-//CStore<CSimpleModelInfo, SIMPLEMODELSIZE> &CModelInfo::ms_simpleModelStore = *(CStore<CSimpleModelInfo, SIMPLEMODELSIZE>*)0x885BB4;
-//CStore<CTimeModelInfo, TIMEMODELSIZE> &CModelInfo::ms_timeModelStore = *(CStore<CTimeModelInfo, TIMEMODELSIZE>*)0x94076C;
-//CStore<C2dEffect, TWODFXSIZE> &CModelInfo::ms_2dEffectStore = *(CStore<C2dEffect, TWODFXSIZE>*)0x9434F8;
CStore<CSimpleModelInfo, SIMPLEMODELSIZE> CModelInfo::ms_simpleModelStore;
CStore<CMloModelInfo, MLOMODELSIZE> CModelInfo::ms_mloModelStore;
CStore<CInstance, MLOINSTANCESIZE> CModelInfo::ms_mloInstanceStore;
diff --git a/src/modelinfo/ModelInfo.h b/src/modelinfo/ModelInfo.h
index e6dec1d8..65cfa4e7 100644
--- a/src/modelinfo/ModelInfo.h
+++ b/src/modelinfo/ModelInfo.h
@@ -13,7 +13,7 @@
class CModelInfo
{
- static CBaseModelInfo **ms_modelInfoPtrs; //[MODELINFOSIZE];
+ static CBaseModelInfo *ms_modelInfoPtrs[MODELINFOSIZE];
static CStore<CSimpleModelInfo, SIMPLEMODELSIZE> ms_simpleModelStore;
static CStore<CMloModelInfo, MLOMODELSIZE> ms_mloModelStore;
static CStore<CInstance, MLOINSTANCESIZE> ms_mloInstanceStore;
diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp
index 0c45aa12..fb9e0358 100644
--- a/src/modelinfo/VehicleModelInfo.cpp
+++ b/src/modelinfo/VehicleModelInfo.cpp
@@ -19,14 +19,14 @@
#include "ModelIndices.h"
#include "ModelInfo.h"
-int8 *CVehicleModelInfo::ms_compsToUse = (int8*)0x5FF2EC; // -2, -2
-int8 *CVehicleModelInfo::ms_compsUsed = (int8*)0x95CCB2;
-RwTexture **CVehicleModelInfo::ms_pEnvironmentMaps = (RwTexture **)0x8F1A30;
-RwRGBA *CVehicleModelInfo::ms_vehicleColourTable = (RwRGBA*)0x86BA88;
-RwTexture **CVehicleModelInfo::ms_colourTextureTable = (RwTexture**)0x711C40;
-
-RwTexture *&gpWhiteTexture = *(RwTexture**)0x64C4F8;
-RwFrame *&pMatFxIdentityFrame = *(RwFrame**)0x64C510;
+int8 CVehicleModelInfo::ms_compsToUse[2] = { -2, -2 };
+int8 CVehicleModelInfo::ms_compsUsed[2];
+RwTexture *CVehicleModelInfo::ms_pEnvironmentMaps[NUM_VEHICLE_ENVMAPS];
+RwRGBA CVehicleModelInfo::ms_vehicleColourTable[256];
+RwTexture *CVehicleModelInfo::ms_colourTextureTable[256];
+
+RwTexture *gpWhiteTexture;
+RwFrame *pMatFxIdentityFrame;
enum {
VEHICLE_FLAG_COLLAPSE = 0x2,
diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h
index 5969c4ca..9992ab98 100644
--- a/src/modelinfo/VehicleModelInfo.h
+++ b/src/modelinfo/VehicleModelInfo.h
@@ -81,11 +81,11 @@ public:
RpAtomic *m_comps[6];
int32 m_numComps;
- static int8 *ms_compsToUse; // [2];
- static int8 *ms_compsUsed; // [2];
- static RwTexture **ms_pEnvironmentMaps; // [NUM_VEHICLE_ENVMAPS]
- static RwRGBA *ms_vehicleColourTable; // [256]
- static RwTexture **ms_colourTextureTable; // [256]
+ static int8 ms_compsToUse[2];
+ static int8 ms_compsUsed[2];
+ static RwTexture *ms_pEnvironmentMaps[NUM_VEHICLE_ENVMAPS];
+ static RwRGBA ms_vehicleColourTable[256];
+ static RwTexture *ms_colourTextureTable[256];
static RwObjectNameIdAssocation *ms_vehicleDescs[NUM_VEHICLE_TYPES];
CVehicleModelInfo(void);
diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp
index 867624c7..c22148e9 100644
--- a/src/objects/Object.cpp
+++ b/src/objects/Object.cpp
@@ -12,8 +12,8 @@
#include "World.h"
#include "Floater.h"
-int16 &CObject::nNoTempObjects = *(int16*)0x95CCA2;
-int16 &CObject::nBodyCastHealth = *(int16*)0x5F7D4C; // 1000
+int16 CObject::nNoTempObjects;
+int16 CObject::nBodyCastHealth = 1000;
void *CObject::operator new(size_t sz) { return CPools::GetObjectPool()->New(); }
void *CObject::operator new(size_t sz, int handle) { return CPools::GetObjectPool()->New(handle);};
@@ -383,7 +383,7 @@ CObject::DeleteAllTempObjects()
}
void
-CObject::DeleteAllTempObjectInArea(CVector point, float fRadius)
+CObject::DeleteAllTempObjectsInArea(CVector point, float fRadius)
{
CObjectPool *objectPool = CPools::GetObjectPool();
for (int32 i = 0; i < objectPool->GetSize(); i++) {
@@ -426,5 +426,5 @@ STARTPATCHES
InjectHook(0x4BB010, &CObject::CanBeDeleted, PATCH_JUMP);
InjectHook(0x4BBE60, &CObject::DeleteAllMissionObjects, PATCH_JUMP);
InjectHook(0x4BBDF0, &CObject::DeleteAllTempObjects, PATCH_JUMP);
- InjectHook(0x4BBED0, &CObject::DeleteAllTempObjectInArea, PATCH_JUMP);
+ InjectHook(0x4BBED0, &CObject::DeleteAllTempObjectsInArea, PATCH_JUMP);
ENDPATCHES
diff --git a/src/objects/Object.h b/src/objects/Object.h
index 6d04c78a..0c00f441 100644
--- a/src/objects/Object.h
+++ b/src/objects/Object.h
@@ -73,8 +73,8 @@ public:
CEntity *m_pCollidingEntity;
int8 m_colour1, m_colour2;
- static int16 &nNoTempObjects;
- static int16 &nBodyCastHealth;
+ static int16 nNoTempObjects;
+ static int16 nBodyCastHealth;
static void *operator new(size_t);
static void *operator new(size_t, int);
@@ -99,6 +99,6 @@ public:
static void DeleteAllMissionObjects();
static void DeleteAllTempObjects();
- static void DeleteAllTempObjectInArea(CVector point, float fRadius);
+ static void DeleteAllTempObjectsInArea(CVector point, float fRadius);
};
static_assert(sizeof(CObject) == 0x198, "CObject: error");
diff --git a/src/objects/ParticleObject.cpp b/src/objects/ParticleObject.cpp
index 60827411..5e4ad231 100644
--- a/src/objects/ParticleObject.cpp
+++ b/src/objects/ParticleObject.cpp
@@ -9,11 +9,11 @@
#include "Game.h"
-CParticleObject (&gPObjectArray)[MAX_PARTICLEOBJECTS] = *(CParticleObject(*)[MAX_PARTICLEOBJECTS])*(uintptr*)0x62A58C;
+CParticleObject gPObjectArray[MAX_PARTICLEOBJECTS];
-CParticleObject *&CParticleObject::pCloseListHead = *(CParticleObject **)int(0x8F4340);
-CParticleObject *&CParticleObject::pFarListHead = *(CParticleObject **)int(0x942F78);
-CParticleObject *&CParticleObject::pUnusedListHead = *(CParticleObject **)int(0x94128C);
+CParticleObject *CParticleObject::pCloseListHead;
+CParticleObject *CParticleObject::pFarListHead;
+CParticleObject *CParticleObject::pUnusedListHead;
CAudioHydrant List[MAX_AUDIOHYDRANTS];
diff --git a/src/objects/ParticleObject.h b/src/objects/ParticleObject.h
index 45a3fa30..cfa5936d 100644
--- a/src/objects/ParticleObject.h
+++ b/src/objects/ParticleObject.h
@@ -62,9 +62,9 @@ public:
int8 m_nCreationChance;
char _pad1[2];
- static CParticleObject *&pCloseListHead;
- static CParticleObject *&pFarListHead;
- static CParticleObject *&pUnusedListHead;
+ static CParticleObject *pCloseListHead;
+ static CParticleObject *pFarListHead;
+ static CParticleObject *pUnusedListHead;
CParticleObject();
~CParticleObject();
@@ -89,7 +89,7 @@ public:
static void MoveToList(CParticleObject **from, CParticleObject **to, CParticleObject *obj);
};
-extern CParticleObject (&gPObjectArray)[MAX_PARTICLEOBJECTS];
+extern CParticleObject gPObjectArray[MAX_PARTICLEOBJECTS];
class CAudioHydrant
{
diff --git a/src/render/Credits.cpp b/src/render/Credits.cpp
index b423fcc0..25f7bbcf 100644
--- a/src/render/Credits.cpp
+++ b/src/render/Credits.cpp
@@ -8,8 +8,8 @@
#include "Text.h"
#include "Credits.h"
-bool &CCredits::bCreditsGoing = *(bool*)0x95CDD3;
-uint32 &CCredits::CreditsStartTime = *(uint32*)0x8F2528;
+bool CCredits::bCreditsGoing;
+uint32 CCredits::CreditsStartTime;
void
CCredits::Init(void)
diff --git a/src/render/Credits.h b/src/render/Credits.h
index c39fb035..e049ce76 100644
--- a/src/render/Credits.h
+++ b/src/render/Credits.h
@@ -2,8 +2,8 @@
class CCredits
{
- static bool &bCreditsGoing;
- static uint32 &CreditsStartTime;
+ static bool bCreditsGoing;
+ static uint32 CreditsStartTime;
public:
static void Init(void);
static void Start(void);
diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp
index 862fc024..dcbb6342 100644
--- a/src/render/Draw.cpp
+++ b/src/render/Draw.cpp
@@ -8,15 +8,15 @@
float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO;
#endif
-float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4;
-float &CDraw::ms_fFarClipZ = *(float*)0x9434F0;
-float &CDraw::ms_fFOV = *(float*)0x5FBC6C;
-float &CDraw::ms_fLODDistance = *(float*)0x8F2C30;
+float CDraw::ms_fNearClipZ;
+float CDraw::ms_fFarClipZ;
+float CDraw::ms_fFOV = 45.0f;
+float CDraw::ms_fLODDistance;
-uint8 &CDraw::FadeValue = *(uint8*)0x95CD68;
-uint8 &CDraw::FadeRed = *(uint8*)0x95CD90;
-uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71;
-uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53;
+uint8 CDraw::FadeValue;
+uint8 CDraw::FadeRed;
+uint8 CDraw::FadeGreen;
+uint8 CDraw::FadeBlue;
float
CDraw::FindAspectRatio(void)
diff --git a/src/render/Draw.h b/src/render/Draw.h
index 50e1e294..55958a2a 100644
--- a/src/render/Draw.h
+++ b/src/render/Draw.h
@@ -13,11 +13,11 @@ enum eAspectRatio
class CDraw
{
private:
- static float &ms_fNearClipZ;
- static float &ms_fFarClipZ;
- static float &ms_fFOV;
+ static float ms_fNearClipZ;
+ static float ms_fFarClipZ;
+ static float ms_fFOV;
public:
- static float &ms_fLODDistance; // set but unused?
+ static float ms_fLODDistance; // set but unused?
#ifdef ASPECT_RATIO_SCALE
// we use this variable to scale a lot of 2D elements
@@ -25,10 +25,10 @@ public:
static float ms_fAspectRatio;
#endif
- static uint8 &FadeValue;
- static uint8 &FadeRed;
- static uint8 &FadeGreen;
- static uint8 &FadeBlue;
+ static uint8 FadeValue;
+ static uint8 FadeRed;
+ static uint8 FadeGreen;
+ static uint8 FadeBlue;
static void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; }
static float GetNearClipZ(void) { return ms_fNearClipZ; }
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index ca15cba7..ba4c4301 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -4,18 +4,18 @@
#include "TxdStore.h"
#include "Font.h"
-CFontDetails &CFont::Details = *(CFontDetails*)0x8F317C;
-int16 &CFont::NewLine = *(int16*)0x95CC94;
-CSprite2d *CFont::Sprite = (CSprite2d*)0x95CC04;
+CFontDetails CFont::Details;
+int16 CFont::NewLine;
+CSprite2d CFont::Sprite[MAX_FONTS];
#ifdef MORE_LANGUAGES
uint8 CFont::LanguageSet = FONT_LANGSET_EFIGS;
int32 CFont::Slot = -1;
-int16 CFont::Size[2][3][193] = {
+int16 CFont::Size[2][MAX_FONTS][193] = {
{
#else
-int16 CFont::Size[3][193] = {
+int16 CFont::Size[MAX_FONTS][193] = {
#endif
{
13, 12, 31, 35, 23, 35, 31, 9, 14, 15, 25, 30, 11, 17, 13, 31,
diff --git a/src/render/Font.h b/src/render/Font.h
index 0659dda1..ebf5e292 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -31,6 +31,7 @@ enum {
FONT_BANK,
FONT_PAGER,
FONT_HEADING,
+ MAX_FONTS
};
enum {
@@ -50,16 +51,16 @@ enum
class CFont
{
#ifdef MORE_LANGUAGES
- static int16 Size[2][3][193];
+ static int16 Size[2][MAX_FONTS][193];
static uint8 LanguageSet;
static int32 Slot;
#else
- static int16 Size[3][193];
+ static int16 Size[MAX_FONTS][193];
#endif
- static int16 &NewLine;
- static CSprite2d *Sprite; //[3]
+ static int16 NewLine;
+ static CSprite2d Sprite[MAX_FONTS];
public:
- static CFontDetails& Details;
+ static CFontDetails Details;
static void Initialise(void);
static void Shutdown(void);
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 9529c4c1..5bcdd450 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -21,52 +21,52 @@
#include "User.h"
#include "World.h"
-wchar CHud::m_HelpMessage[256]; // = (wchar*)0x86B888;
-wchar CHud::m_LastHelpMessage[256]; // = (wchar*)0x6E8F28;
-uint32 CHud::m_HelpMessageState; // = *(int32*)0x880E1C;
-uint32 CHud::m_HelpMessageTimer; // = *(int32*)0x880FA4;
-int32 CHud::m_HelpMessageFadeTimer; // = *(int32*)0x8F6258;
-wchar CHud::m_HelpMessageToPrint[256]; // = (wchar*)0x664480;
-float CHud::m_fHelpMessageTime; // *(float *)0x8E2C28;
-bool CHud::m_HelpMessageQuick; // = *(bool*)0x95CCF7;
-uint32 CHud::m_ZoneState; // = *(int32*)0x8F29AC;
+wchar CHud::m_HelpMessage[256];
+wchar CHud::m_LastHelpMessage[256];
+uint32 CHud::m_HelpMessageState;
+uint32 CHud::m_HelpMessageTimer;
+int32 CHud::m_HelpMessageFadeTimer;
+wchar CHud::m_HelpMessageToPrint[256];
+float CHud::m_fHelpMessageTime;
+bool CHud::m_HelpMessageQuick;
+uint32 CHud::m_ZoneState;
int32 CHud::m_ZoneFadeTimer;
-uint32 CHud::m_ZoneNameTimer; // = *(int32*)0x8F1A50;
-wchar *CHud::m_pZoneName; // = *(wchar**)0x8E2C2C;
-wchar *CHud::m_pLastZoneName; // = (wchar*)0x8F432C;
+uint32 CHud::m_ZoneNameTimer;
+wchar *CHud::m_pZoneName;
+wchar *CHud::m_pLastZoneName;
wchar *CHud::m_ZoneToPrint;
-uint32 CHud::m_VehicleState; // = *(int32*)0x940560;
+uint32 CHud::m_VehicleState;
int32 CHud::m_VehicleFadeTimer;
-uint32 CHud::m_VehicleNameTimer; // = *(int32*)0x8F2A14;
-wchar *CHud::m_VehicleName; // = *(wchar**)0x942FB4;
-wchar *CHud::m_pLastVehicleName; // = *(wchar**)0x8E2DD8;
+uint32 CHud::m_VehicleNameTimer;
+wchar *CHud::m_VehicleName;
+wchar *CHud::m_pLastVehicleName;
wchar *CHud::m_pVehicleNameToPrint;
-wchar CHud::m_Message[256];// = (wchar*)0x72E318;
-wchar CHud::m_PagerMessage[256]; // = (wchar*)0x878840;
-bool CHud::m_Wants_To_Draw_Hud; // (bool*)0x95CD89;
-bool CHud::m_Wants_To_Draw_3dMarkers; // = *(bool*)0x95CD62;
-wchar CHud::m_BigMessage[6][128]; // = *(wchar(*)[6][128]) * (uintptr*)0x664CE0;
-int16 CHud::m_ItemToFlash; // = *(int16*)0x95CC82;
+wchar CHud::m_Message[256];
+wchar CHud::m_PagerMessage[256];
+bool CHud::m_Wants_To_Draw_Hud;
+bool CHud::m_Wants_To_Draw_3dMarkers;
+wchar CHud::m_BigMessage[6][128];
+int16 CHud::m_ItemToFlash;
// These aren't really in CHud
float CHud::BigMessageInUse[6];
float CHud::BigMessageAlpha[6];
float CHud::BigMessageX[6];
-float CHud::OddJob2OffTimer; // = *(float*)0x942FA0;
-bool CHud::CounterOnLastFrame; // = *(int8*)0x95CD67;
-float CHud::OddJob2XOffset; // = *(float*)0x8F1B5C;
-uint16 CHud::CounterFlashTimer; // = *(int16*)0x95CC20;
-uint16 CHud::OddJob2Timer; // = *(int16*)0x95CC52;
-bool CHud::TimerOnLastFrame; //= *(int8*)0x95CDA7;
-int16 CHud::OddJob2On; //= *(int16*)0x95CC78;
-uint16 CHud::TimerFlashTimer; //= *(int16*)0x95CC6C;
-int16 CHud::PagerSoundPlayed; //= *(int16*)0x95CC4A;
-int32 CHud::SpriteBrightness; //= *(int32*)0x95CC54;
-float CHud::PagerXOffset; //= *(float*)0x941590;
-int16 CHud::PagerTimer; //= *(int16*)0x95CC3A;
-int16 CHud::PagerOn; //= *(int16*)0x95CCA0;
-
-CSprite2d CHud::Sprites[NUM_HUD_SPRITES]; // = (CSprite2d*)0x95CB9C;
+float CHud::OddJob2OffTimer;
+bool CHud::CounterOnLastFrame;
+float CHud::OddJob2XOffset;
+uint16 CHud::CounterFlashTimer;
+uint16 CHud::OddJob2Timer;
+bool CHud::TimerOnLastFrame;
+int16 CHud::OddJob2On;
+uint16 CHud::TimerFlashTimer;
+int16 CHud::PagerSoundPlayed;
+int32 CHud::SpriteBrightness;
+float CHud::PagerXOffset;
+int16 CHud::PagerTimer;
+int16 CHud::PagerOn;
+
+CSprite2d CHud::Sprites[NUM_HUD_SPRITES];
struct
{
@@ -98,8 +98,8 @@ struct
{"siterocket", "siterocket"}
};
-RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834;
-RwTexture *&gpRocketSightTex = *(RwTexture**)0x8E2C20;
+RwTexture *gpSniperSightTex;
+RwTexture *gpRocketSightTex;
void CHud::Draw()
{
diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp
index d28671fa..d15fa422 100644
--- a/src/render/MBlur.cpp
+++ b/src/render/MBlur.cpp
@@ -6,9 +6,9 @@
// Originally taken from RW example 'mblur'
-RwRaster *&CMBlur::pFrontBuffer = *(RwRaster**)0x8E2C48;
-bool &CMBlur::ms_bJustInitialised = *(bool*)0x95CDAB;
-bool &CMBlur::BlurOn = *(bool*)0x95CDAD;
+RwRaster *CMBlur::pFrontBuffer;
+bool CMBlur::ms_bJustInitialised;
+bool CMBlur::BlurOn;
static RwIm2DVertex Vertex[4];
static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 };
diff --git a/src/render/MBlur.h b/src/render/MBlur.h
index 42827f99..e8a5bef8 100644
--- a/src/render/MBlur.h
+++ b/src/render/MBlur.h
@@ -3,9 +3,9 @@
class CMBlur
{
public:
- static RwRaster *&pFrontBuffer;
- static bool &ms_bJustInitialised;
- static bool &BlurOn;
+ static RwRaster *pFrontBuffer;
+ static bool ms_bJustInitialised;
+ static bool BlurOn;
public:
static void MotionBlurOpen(RwCamera *cam);
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index 6956a887..eb188128 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -204,26 +204,21 @@ RwRaster *gpGunShellRaster;
RwRaster *gpWakeOldRaster;
-//RwRaster *gpPointlightRaster; // CPointLights::RenderFogEffect
-RwRaster *&gpPointlightRaster = *(RwRaster **)0x8F5FE0;
+RwRaster *gpPointlightRaster; // CPointLights::RenderFogEffect
-//RwTexture *gpRainDropTex[MAX_RAINDROP_FILES]; // CWeather::RenderRainStreaks
-RwTexture * (&gpRainDropTex)[MAX_RAINDROP_FILES] = *(RwTexture * (*)[MAX_RAINDROP_FILES])*(int *)0x880660;
+RwTexture *gpRainDropTex[MAX_RAINDROP_FILES]; // CWeather::RenderRainStreaks
RwRaster *gpRainDropRaster[MAX_RAINDROP_FILES];
-//Float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE]; //
-float (&CParticle::ms_afRandTable)[CParticle::RAND_TABLE_SIZE] = *(float (*)[CParticle::RAND_TABLE_SIZE])*(int *)0x6E98C8;
+float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE];
CParticle *CParticle::m_pUnusedListHead;
-//Float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE]; //
-//Float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE]; /
-float (&CParticle::m_SinTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x877358;
-float (&CParticle::m_CosTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x70DA18;
+float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE];
+float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE];
int32 Randomizer;
diff --git a/src/render/Particle.h b/src/render/Particle.h
index 310ef0d4..604fbb82 100644
--- a/src/render/Particle.h
+++ b/src/render/Particle.h
@@ -49,16 +49,11 @@ public:
;
}
- //static float ms_afRandTable[RAND_TABLE_SIZE];
- static float (&ms_afRandTable)[RAND_TABLE_SIZE];
+ static float ms_afRandTable[RAND_TABLE_SIZE];
static CParticle *m_pUnusedListHead;
- /*
static float m_SinTable[SIN_COS_TABLE_SIZE];
static float m_CosTable[SIN_COS_TABLE_SIZE];
- */
- static float (&m_SinTable)[SIN_COS_TABLE_SIZE];
- static float (&m_CosTable)[SIN_COS_TABLE_SIZE];
static float Sin(int32 value) { return m_SinTable[value]; }
static float Cos(int32 value) { return m_CosTable[value]; }
diff --git a/src/render/PointLights.cpp b/src/render/PointLights.cpp
index a015ec54..92a89582 100644
--- a/src/render/PointLights.cpp
+++ b/src/render/PointLights.cpp
@@ -10,8 +10,8 @@
#include "Timer.h"
#include "PointLights.h"
-int16 &CPointLights::NumLights = *(int16*)0x95CC3E;
-CRegisteredPointLight *CPointLights::aLights = (CRegisteredPointLight*)0x7096D0;
+int16 CPointLights::NumLights;
+CRegisteredPointLight CPointLights::aLights[NUMPOINTLIGHTS];
void
CPointLights::InitPerFrame(void)
@@ -114,7 +114,7 @@ CPointLights::GenerateLightsAffectingObject(CVector *objCoors)
return ret;
}
-extern RwRaster *&gpPointlightRaster;
+extern RwRaster *gpPointlightRaster;
void
CPointLights::RemoveLightsAffectingObject(void)
diff --git a/src/render/PointLights.h b/src/render/PointLights.h
index c1dad87f..215e1dc9 100644
--- a/src/render/PointLights.h
+++ b/src/render/PointLights.h
@@ -18,8 +18,8 @@ static_assert(sizeof(CRegisteredPointLight) == 0x2C, "CRegisteredPointLight: err
class CPointLights
{
public:
- static int16 &NumLights;
- static CRegisteredPointLight *aLights; //[NUMPOINTLIGHTS]
+ static int16 NumLights;
+ static CRegisteredPointLight aLights[NUMPOINTLIGHTS];
enum {
LIGHT_POINT,
diff --git a/src/render/RenderBuffer.cpp b/src/render/RenderBuffer.cpp
index f6499451..4225619f 100644
--- a/src/render/RenderBuffer.cpp
+++ b/src/render/RenderBuffer.cpp
@@ -2,14 +2,14 @@
#include "patcher.h"
#include "RenderBuffer.h"
-int32 &TempBufferVerticesStored = *(int32*)0x8F5F78;
-int32 &TempBufferIndicesStored = *(int32*)0x8F1A4C;
+int32 TempBufferVerticesStored;
+int32 TempBufferIndicesStored;
-RwIm3DVertex *TempBufferRenderVertices = (RwIm3DVertex*)0x862330;
-RwImVertexIndex *TempBufferRenderIndexList = (RwImVertexIndex*)0x846288;
+RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE];
+RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE];
-int &RenderBuffer::VerticesToBeStored = *(int*)0x8F59C4;
-int &RenderBuffer::IndicesToBeStored = *(int*)0x8E28B0;
+int RenderBuffer::VerticesToBeStored;
+int RenderBuffer::IndicesToBeStored;
void
RenderBuffer::ClearRenderBuffer(void)
diff --git a/src/render/RenderBuffer.h b/src/render/RenderBuffer.h
index 2b8a9f86..485d24e3 100644
--- a/src/render/RenderBuffer.h
+++ b/src/render/RenderBuffer.h
@@ -1,8 +1,8 @@
class RenderBuffer
{
public:
- static int &VerticesToBeStored;
- static int &IndicesToBeStored;
+ static int VerticesToBeStored;
+ static int IndicesToBeStored;
static void ClearRenderBuffer(void);
static void StartStoring(int numIndices, int numVertices, RwImVertexIndex **indexStart, RwIm3DVertex **vertexStart);
static void StopStoring(void);
@@ -12,7 +12,7 @@ public:
#define TEMPBUFFERVERTSIZE 256
#define TEMPBUFFERINDEXSIZE 1024
-extern int32 &TempBufferVerticesStored;
-extern int32 &TempBufferIndicesStored;
-extern RwIm3DVertex *TempBufferRenderVertices;
-extern RwImVertexIndex *TempBufferRenderIndexList; \ No newline at end of file
+extern int32 TempBufferVerticesStored;
+extern int32 TempBufferIndicesStored;
+extern RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE];
+extern RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE]; \ No newline at end of file
diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp
index e14b0453..56a93238 100644
--- a/src/render/Shadows.cpp
+++ b/src/render/Shadows.cpp
@@ -20,43 +20,31 @@
SETTWEAKPATH("Shadows");
TWEAKBOOL(gbPrintShite);
-#if 1
RwImVertexIndex ShadowIndexList[24];
-#else
-RwImVertexIndex (&ShadowIndexList)[24] = *(RwImVertexIndex (*)[24])*(int *)0x649188;
-#endif
-RwTexture *&gpShadowCarTex = *(RwTexture **)0x8F2C90;
-RwTexture *&gpShadowPedTex = *(RwTexture **)0x8F59D0;
-RwTexture *&gpShadowHeliTex = *(RwTexture **)0x8E2A90;
-RwTexture *&gpShadowExplosionTex = *(RwTexture **)0x8F2A00;
-RwTexture *&gpShadowHeadLightsTex = *(RwTexture **)0x95CB98;
-RwTexture *&gpOutline1Tex = *(RwTexture **)0x8F1B24;
-RwTexture *&gpOutline2Tex = *(RwTexture **)0x8F1B04;
-RwTexture *&gpOutline3Tex = *(RwTexture **)0x8F1B08;
-RwTexture *&gpBloodPoolTex = *(RwTexture **)0x9415F8;
-RwTexture *&gpReflectionTex = *(RwTexture **)0x8F582C;
-RwTexture *&gpGoalMarkerTex = *(RwTexture **)0x94142C;
-RwTexture *&gpWalkDontTex = *(RwTexture **)0x95CB4C;
-RwTexture *&gpCrackedGlassTex = *(RwTexture **)0x95CB94;
-RwTexture *&gpPostShadowTex = *(RwTexture **)0x8F59D4;
-RwTexture *&gpGoalTex = *(RwTexture**)0x94142C;
-
-#if 1
+RwTexture *gpShadowCarTex;
+RwTexture *gpShadowPedTex;
+RwTexture *gpShadowHeliTex;
+RwTexture *gpShadowExplosionTex;
+RwTexture *gpShadowHeadLightsTex;
+RwTexture *gpOutline1Tex;
+RwTexture *gpOutline2Tex;
+RwTexture *gpOutline3Tex;
+RwTexture *gpBloodPoolTex;
+RwTexture *gpReflectionTex;
+RwTexture *gpGoalMarkerTex;
+RwTexture *gpWalkDontTex;
+RwTexture *gpCrackedGlassTex;
+RwTexture *gpPostShadowTex;
+RwTexture *gpGoalTex;
+
int16 CShadows::ShadowsStoredToBeRendered;
CStoredShadow CShadows::asShadowsStored [MAX_STOREDSHADOWS];
CPolyBunch CShadows::aPolyBunches [MAX_POLYBUNCHES];
CStaticShadow CShadows::aStaticShadows [MAX_STATICSHADOWS];
CPolyBunch *CShadows::pEmptyBunchList;
CPermanentShadow CShadows::aPermanentShadows[MAX_PERMAMENTSHADOWS];
-#else
-int16 &CShadows::ShadowsStoredToBeRendered = *(int16*)0x95CCEE;
-CStoredShadow (&CShadows::asShadowsStored)[MAX_STOREDSHADOWS] = *(CStoredShadow (*)[MAX_STOREDSHADOWS])*(int *)0x779058;
-CPolyBunch (&CShadows::aPolyBunches)[MAX_POLYBUNCHES] = *(CPolyBunch (*)[MAX_POLYBUNCHES])*(int *)0x86F4C8;
-CStaticShadow (&CShadows::aStaticShadows)[MAX_STATICSHADOWS] = *(CStaticShadow (*)[MAX_STATICSHADOWS])*(int *)0x773BE8;
-CPolyBunch *&CShadows::pEmptyBunchList = *(CPolyBunch**)0x8F435C;
-CPermanentShadow (&CShadows::aPermanentShadows)[MAX_PERMAMENTSHADOWS] = *(CPermanentShadow (*)[MAX_PERMAMENTSHADOWS])*(int *)0x712040;
-#endif
+
void
CShadows::Init(void)
diff --git a/src/render/Shadows.h b/src/render/Shadows.h
index ced9f11b..d209fe90 100644
--- a/src/render/Shadows.h
+++ b/src/render/Shadows.h
@@ -174,18 +174,18 @@ public:
static void RenderIndicatorShadow (uint32 nID, uint8 ShadowType, RwTexture *pTexture, CVector *pPosn, float fFrontX, float fFrontY, float fSideX, float fSideY, int16 nIntensity);
};
-extern RwTexture *&gpShadowCarTex;
-extern RwTexture *&gpShadowPedTex;
-extern RwTexture *&gpShadowHeliTex;
-extern RwTexture *&gpShadowExplosionTex;
-extern RwTexture *&gpShadowHeadLightsTex;
-extern RwTexture *&gpOutline1Tex;
-extern RwTexture *&gpOutline2Tex;
-extern RwTexture *&gpOutline3Tex;
-extern RwTexture *&gpBloodPoolTex;
-extern RwTexture *&gpReflectionTex;
-extern RwTexture *&gpGoalMarkerTex;
-extern RwTexture *&gpWalkDontTex;
-extern RwTexture *&gpCrackedGlassTex;
-extern RwTexture *&gpPostShadowTex;
-extern RwTexture *&gpGoalTex;
+extern RwTexture *gpShadowCarTex;
+extern RwTexture *gpShadowPedTex;
+extern RwTexture *gpShadowHeliTex;
+extern RwTexture *gpShadowExplosionTex;
+extern RwTexture *gpShadowHeadLightsTex;
+extern RwTexture *gpOutline1Tex;
+extern RwTexture *gpOutline2Tex;
+extern RwTexture *gpOutline3Tex;
+extern RwTexture *gpBloodPoolTex;
+extern RwTexture *gpReflectionTex;
+extern RwTexture *gpGoalMarkerTex;
+extern RwTexture *gpWalkDontTex;
+extern RwTexture *gpCrackedGlassTex;
+extern RwTexture *gpPostShadowTex;
+extern RwTexture *gpGoalTex;
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index 82754121..57ab8f14 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -5,10 +5,10 @@
#include "Camera.h"
#include "Sprite.h"
-float &CSprite::m_f2DNearScreenZ = *(float*)0x8F1ABC;
-float &CSprite::m_f2DFarScreenZ = *(float*)0x8F2C94;
-float &CSprite::m_fRecipNearClipPlane = *(float*)0x8F5FFC;
-int32 &CSprite::m_bFlushSpriteBufferSwitchZTest = *(int32*)0x8F5FB0;
+float CSprite::m_f2DNearScreenZ;
+float CSprite::m_f2DFarScreenZ;
+float CSprite::m_fRecipNearClipPlane;
+int32 CSprite::m_bFlushSpriteBufferSwitchZTest;
float
CSprite::CalcHorizonCoors(void)
@@ -40,9 +40,9 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh,
}
#define SPRITEBUFFERSIZE 64
-static int32 &nSpriteBufferIndex = *(int32*)0x649A80;
-static RwIm2DVertex *SpriteBufferVerts = (RwIm2DVertex*)0x649A84; //[SPRITEBUFFERSIZE*6];
-static RwIm2DVertex *verts = (RwIm2DVertex*)0x64C484; //[4];
+static int32 nSpriteBufferIndex;
+static RwIm2DVertex SpriteBufferVerts[SPRITEBUFFERSIZE*6];
+static RwIm2DVertex verts[4];
void
CSprite::InitSpriteBuffer(void)
diff --git a/src/render/Sprite.h b/src/render/Sprite.h
index 33953ff3..ec4c1d1b 100644
--- a/src/render/Sprite.h
+++ b/src/render/Sprite.h
@@ -2,10 +2,10 @@
class CSprite
{
- static float &m_f2DNearScreenZ;
- static float &m_f2DFarScreenZ;
- static float &m_fRecipNearClipPlane;
- static int32 &m_bFlushSpriteBufferSwitchZTest;
+ static float m_f2DNearScreenZ;
+ static float m_f2DFarScreenZ;
+ static float m_fRecipNearClipPlane;
+ static int32 m_bFlushSpriteBufferSwitchZTest;
public:
static float CalcHorizonCoors(void);
static bool CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, bool farclip);
diff --git a/src/render/Timecycle.cpp b/src/render/Timecycle.cpp
index 7ab3e91e..6e24a76e 100644
--- a/src/render/Timecycle.cpp
+++ b/src/render/Timecycle.cpp
@@ -10,101 +10,101 @@
#include "FileMgr.h"
#include "Timecycle.h"
-int (*CTimeCycle::m_nAmbientRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x86AF78;
-int (*CTimeCycle::m_nAmbientGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x665308;
-int (*CTimeCycle::m_nAmbientBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x72CF88;
-int (*CTimeCycle::m_nDirectionalRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6FAB78;
-int (*CTimeCycle::m_nDirectionalGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6F4528;
-int (*CTimeCycle::m_nDirectionalBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x83CE58;
-int (*CTimeCycle::m_nSkyTopRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87FB90;
-int (*CTimeCycle::m_nSkyTopGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x8460A8;
-int (*CTimeCycle::m_nSkyTopBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87B158;
-int (*CTimeCycle::m_nSkyBottomRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6FA960;
-int (*CTimeCycle::m_nSkyBottomGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x70D6A8;
-int (*CTimeCycle::m_nSkyBottomBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x83D288;
-int (*CTimeCycle::m_nSunCoreRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x878360;
-int (*CTimeCycle::m_nSunCoreGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6EE088;
-int (*CTimeCycle::m_nSunCoreBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x773A68;
-int (*CTimeCycle::m_nSunCoronaRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x664B60;
-int (*CTimeCycle::m_nSunCoronaGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6F01E0;
-int (*CTimeCycle::m_nSunCoronaBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6E6340;
-float (*CTimeCycle::m_fSunSize)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x733510;
-float (*CTimeCycle::m_fSpriteSize)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x87F820;
-float (*CTimeCycle::m_fSpriteBrightness)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x6E96F0;
-short (*CTimeCycle::m_nShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x83CFD8;
-short (*CTimeCycle::m_nLightShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x72B0F8;
-short (*CTimeCycle::m_nTreeShadowStrength)[NUMWEATHERS] = (short(*)[NUMWEATHERS])0x733450;
-float (*CTimeCycle::m_fFogStart)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8806C8;
-float (*CTimeCycle::m_fFarClip)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8804E0;
-float (*CTimeCycle::m_fLightsOnGroundBrightness)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x83D108;
-int (*CTimeCycle::m_nLowCloudsRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x726770;
-int (*CTimeCycle::m_nLowCloudsGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87BF08;
-int (*CTimeCycle::m_nLowCloudsBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x87FA10;
-int (*CTimeCycle::m_nFluffyCloudsTopRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x70F2B0;
-int (*CTimeCycle::m_nFluffyCloudsTopGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x72D288;
-int (*CTimeCycle::m_nFluffyCloudsTopBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x86B108;
-int (*CTimeCycle::m_nFluffyCloudsBottomRed)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6E8DA8;
-int (*CTimeCycle::m_nFluffyCloudsBottomGreen)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x715AA8;
-int (*CTimeCycle::m_nFluffyCloudsBottomBlue)[NUMWEATHERS] = (int(*)[NUMWEATHERS])0x6EE2D0;
-float (*CTimeCycle::m_fBlurRed)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x87C7E0;
-float (*CTimeCycle::m_fBlurGreen)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x774C10;
-float (*CTimeCycle::m_fBlurBlue)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x8784E0;
-float (*CTimeCycle::m_fBlurAlpha)[NUMWEATHERS] = (float(*)[NUMWEATHERS])0x733690;
-
-float &CTimeCycle::m_fCurrentAmbientRed = *(float*)0x8F29B4;
-float &CTimeCycle::m_fCurrentAmbientGreen = *(float*)0x94144C;
-float &CTimeCycle::m_fCurrentAmbientBlue = *(float*)0x942FC0;
-float &CTimeCycle::m_fCurrentDirectionalRed = *(float*)0x8F29D8;
-float &CTimeCycle::m_fCurrentDirectionalGreen = *(float*)0x940594;
-float &CTimeCycle::m_fCurrentDirectionalBlue = *(float*)0x942FAC;
-int &CTimeCycle::m_nCurrentSkyTopRed = *(int*)0x9403C0;
-int &CTimeCycle::m_nCurrentSkyTopGreen = *(int*)0x943074;
-int &CTimeCycle::m_nCurrentSkyTopBlue = *(int*)0x8F29B8;
-int &CTimeCycle::m_nCurrentSkyBottomRed = *(int*)0x9414D0;
-int &CTimeCycle::m_nCurrentSkyBottomGreen = *(int*)0x8F2BD0;
-int &CTimeCycle::m_nCurrentSkyBottomBlue = *(int*)0x8F625C;
-int &CTimeCycle::m_nCurrentSunCoreRed = *(int*)0x8F2534;
-int &CTimeCycle::m_nCurrentSunCoreGreen = *(int*)0x8F6264;
-int &CTimeCycle::m_nCurrentSunCoreBlue = *(int*)0x94149C;
-int &CTimeCycle::m_nCurrentSunCoronaRed = *(int*)0x8F2C1C;
-int &CTimeCycle::m_nCurrentSunCoronaGreen = *(int*)0x885B54;
-int &CTimeCycle::m_nCurrentSunCoronaBlue = *(int*)0x880F60;
-float &CTimeCycle::m_fCurrentSunSize = *(float*)0x940588;
-float &CTimeCycle::m_fCurrentSpriteSize = *(float*)0x8F1AA8;
-float &CTimeCycle::m_fCurrentSpriteBrightness = *(float*)0x8F5FDC;
-int &CTimeCycle::m_nCurrentShadowStrength = *(int*)0x95CC76;
-int &CTimeCycle::m_nCurrentLightShadowStrength = *(int*)0x95CC66;
-int &CTimeCycle::m_nCurrentTreeShadowStrength = *(int*)0x95CC86;
-float &CTimeCycle::m_fCurrentFogStart = *(float*)0x8F1AE0;
-float &CTimeCycle::m_fCurrentFarClip = *(float*)0x8F5FD8;
-float &CTimeCycle::m_fCurrentLightsOnGroundBrightness = *(float*)0x8F1B60;
-int &CTimeCycle::m_nCurrentLowCloudsRed = *(int*)0x95CB54;
-int &CTimeCycle::m_nCurrentLowCloudsGreen = *(int*)0x95CB48;
-int &CTimeCycle::m_nCurrentLowCloudsBlue = *(int*)0x95CC1C;
-int &CTimeCycle::m_nCurrentFluffyCloudsTopRed = *(int*)0x8F2550;
-int &CTimeCycle::m_nCurrentFluffyCloudsTopGreen = *(int*)0x8F59CC;
-int &CTimeCycle::m_nCurrentFluffyCloudsTopBlue = *(int*)0x941434;
-int &CTimeCycle::m_nCurrentFluffyCloudsBottomRed = *(int*)0x8F1A38;
-int &CTimeCycle::m_nCurrentFluffyCloudsBottomGreen = *(int*)0x8E28B8;
-int &CTimeCycle::m_nCurrentFluffyCloudsBottomBlue = *(int*)0x8F3960;
-float &CTimeCycle::m_fCurrentBlurRed = *(float*)0x8F6000;
-float &CTimeCycle::m_fCurrentBlurGreen = *(float*)0x9405A0;
-float &CTimeCycle::m_fCurrentBlurBlue = *(float*)0x8F250C;
-float &CTimeCycle::m_fCurrentBlurAlpha = *(float*)0x940728;
-int &CTimeCycle::m_nCurrentFogColourRed = *(int*)0x940714;
-int &CTimeCycle::m_nCurrentFogColourGreen = *(int*)0x8E2A60;
-int &CTimeCycle::m_nCurrentFogColourBlue = *(int*)0x8F57EC;
-
-int &CTimeCycle::m_FogReduction = *(int*)0x880FB8;
-
-int &CTimeCycle::m_CurrentStoredValue = *(int*)0x94057C;
-CVector *CTimeCycle::m_VectorToSun = (CVector*)0x665548; // [16]
-float *CTimeCycle::m_fShadowFrontX = (float*)0x72CE90;
-float *CTimeCycle::m_fShadowFrontY = (float*)0x72CE50;
-float *CTimeCycle::m_fShadowSideX = (float*)0x87C708;
-float *CTimeCycle::m_fShadowSideY = (float*)0x87C6C8;
-float *CTimeCycle::m_fShadowDisplacementX = (float*)0x6F0748;
-float *CTimeCycle::m_fShadowDisplacementY = (float*)0x6F0788;
+int CTimeCycle::m_nAmbientRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fSunSize[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fSpriteSize[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
+short CTimeCycle::m_nShadowStrength[NUMHOURS][NUMWEATHERS];
+short CTimeCycle::m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
+short CTimeCycle::m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fFogStart[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fFarClip[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
+int CTimeCycle::m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurRed[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurGreen[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurBlue[NUMHOURS][NUMWEATHERS];
+float CTimeCycle::m_fBlurAlpha[NUMHOURS][NUMWEATHERS];
+
+float CTimeCycle::m_fCurrentAmbientRed;
+float CTimeCycle::m_fCurrentAmbientGreen;
+float CTimeCycle::m_fCurrentAmbientBlue;
+float CTimeCycle::m_fCurrentDirectionalRed;
+float CTimeCycle::m_fCurrentDirectionalGreen;
+float CTimeCycle::m_fCurrentDirectionalBlue;
+int CTimeCycle::m_nCurrentSkyTopRed;
+int CTimeCycle::m_nCurrentSkyTopGreen;
+int CTimeCycle::m_nCurrentSkyTopBlue;
+int CTimeCycle::m_nCurrentSkyBottomRed;
+int CTimeCycle::m_nCurrentSkyBottomGreen;
+int CTimeCycle::m_nCurrentSkyBottomBlue;
+int CTimeCycle::m_nCurrentSunCoreRed;
+int CTimeCycle::m_nCurrentSunCoreGreen;
+int CTimeCycle::m_nCurrentSunCoreBlue;
+int CTimeCycle::m_nCurrentSunCoronaRed;
+int CTimeCycle::m_nCurrentSunCoronaGreen;
+int CTimeCycle::m_nCurrentSunCoronaBlue;
+float CTimeCycle::m_fCurrentSunSize;
+float CTimeCycle::m_fCurrentSpriteSize;
+float CTimeCycle::m_fCurrentSpriteBrightness;
+int CTimeCycle::m_nCurrentShadowStrength;
+int CTimeCycle::m_nCurrentLightShadowStrength;
+int CTimeCycle::m_nCurrentTreeShadowStrength;
+float CTimeCycle::m_fCurrentFogStart;
+float CTimeCycle::m_fCurrentFarClip;
+float CTimeCycle::m_fCurrentLightsOnGroundBrightness;
+int CTimeCycle::m_nCurrentLowCloudsRed;
+int CTimeCycle::m_nCurrentLowCloudsGreen;
+int CTimeCycle::m_nCurrentLowCloudsBlue;
+int CTimeCycle::m_nCurrentFluffyCloudsTopRed;
+int CTimeCycle::m_nCurrentFluffyCloudsTopGreen;
+int CTimeCycle::m_nCurrentFluffyCloudsTopBlue;
+int CTimeCycle::m_nCurrentFluffyCloudsBottomRed;
+int CTimeCycle::m_nCurrentFluffyCloudsBottomGreen;
+int CTimeCycle::m_nCurrentFluffyCloudsBottomBlue;
+float CTimeCycle::m_fCurrentBlurRed;
+float CTimeCycle::m_fCurrentBlurGreen;
+float CTimeCycle::m_fCurrentBlurBlue;
+float CTimeCycle::m_fCurrentBlurAlpha;
+int CTimeCycle::m_nCurrentFogColourRed;
+int CTimeCycle::m_nCurrentFogColourGreen;
+int CTimeCycle::m_nCurrentFogColourBlue;
+
+int CTimeCycle::m_FogReduction;
+
+int CTimeCycle::m_CurrentStoredValue;
+CVector CTimeCycle::m_VectorToSun[16];
+float CTimeCycle::m_fShadowFrontX[16];
+float CTimeCycle::m_fShadowFrontY[16];
+float CTimeCycle::m_fShadowSideX[16];
+float CTimeCycle::m_fShadowSideY[16];
+float CTimeCycle::m_fShadowDisplacementX[16];
+float CTimeCycle::m_fShadowDisplacementY[16];
void
diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h
index ed4a026b..28a0b7dd 100644
--- a/src/render/Timecycle.h
+++ b/src/render/Timecycle.h
@@ -2,102 +2,102 @@
class CTimeCycle
{
- static int (*m_nAmbientRed)[NUMWEATHERS];
- static int (*m_nAmbientGreen)[NUMWEATHERS];
- static int (*m_nAmbientBlue)[NUMWEATHERS];
- static int (*m_nDirectionalRed)[NUMWEATHERS];
- static int (*m_nDirectionalGreen)[NUMWEATHERS];
- static int (*m_nDirectionalBlue)[NUMWEATHERS];
- static int (*m_nSkyTopRed)[NUMWEATHERS];
- static int (*m_nSkyTopGreen)[NUMWEATHERS];
- static int (*m_nSkyTopBlue)[NUMWEATHERS];
- static int (*m_nSkyBottomRed)[NUMWEATHERS];
- static int (*m_nSkyBottomGreen)[NUMWEATHERS];
- static int (*m_nSkyBottomBlue)[NUMWEATHERS];
- static int (*m_nSunCoreRed)[NUMWEATHERS];
- static int (*m_nSunCoreGreen)[NUMWEATHERS];
- static int (*m_nSunCoreBlue)[NUMWEATHERS];
- static int (*m_nSunCoronaRed)[NUMWEATHERS];
- static int (*m_nSunCoronaGreen)[NUMWEATHERS];
- static int (*m_nSunCoronaBlue)[NUMWEATHERS];
- static float (*m_fSunSize)[NUMWEATHERS];
- static float (*m_fSpriteSize)[NUMWEATHERS];
- static float (*m_fSpriteBrightness)[NUMWEATHERS];
- static short (*m_nShadowStrength)[NUMWEATHERS];
- static short (*m_nLightShadowStrength)[NUMWEATHERS];
- static short (*m_nTreeShadowStrength)[NUMWEATHERS];
- static float (*m_fFogStart)[NUMWEATHERS];
- static float (*m_fFarClip)[NUMWEATHERS];
- static float (*m_fLightsOnGroundBrightness)[NUMWEATHERS];
- static int (*m_nLowCloudsRed)[NUMWEATHERS];
- static int (*m_nLowCloudsGreen)[NUMWEATHERS];
- static int (*m_nLowCloudsBlue)[NUMWEATHERS];
- static int (*m_nFluffyCloudsTopRed)[NUMWEATHERS];
- static int (*m_nFluffyCloudsTopGreen)[NUMWEATHERS];
- static int (*m_nFluffyCloudsTopBlue)[NUMWEATHERS];
- static int (*m_nFluffyCloudsBottomRed)[NUMWEATHERS];
- static int (*m_nFluffyCloudsBottomGreen)[NUMWEATHERS];
- static int (*m_nFluffyCloudsBottomBlue)[NUMWEATHERS];
- static float (*m_fBlurRed)[NUMWEATHERS];
- static float (*m_fBlurGreen)[NUMWEATHERS];
- static float (*m_fBlurBlue)[NUMWEATHERS];
- static float (*m_fBlurAlpha)[NUMWEATHERS];
+ static int m_nAmbientRed[NUMHOURS][NUMWEATHERS];
+ static int m_nAmbientGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nAmbientBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nDirectionalRed[NUMHOURS][NUMWEATHERS];
+ static int m_nDirectionalGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nDirectionalBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyTopRed[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyTopGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyTopBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyBottomRed[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyBottomGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nSkyBottomBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoreRed[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoreGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoreBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoronaRed[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoronaGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nSunCoronaBlue[NUMHOURS][NUMWEATHERS];
+ static float m_fSunSize[NUMHOURS][NUMWEATHERS];
+ static float m_fSpriteSize[NUMHOURS][NUMWEATHERS];
+ static float m_fSpriteBrightness[NUMHOURS][NUMWEATHERS];
+ static short m_nShadowStrength[NUMHOURS][NUMWEATHERS];
+ static short m_nLightShadowStrength[NUMHOURS][NUMWEATHERS];
+ static short m_nTreeShadowStrength[NUMHOURS][NUMWEATHERS];
+ static float m_fFogStart[NUMHOURS][NUMWEATHERS];
+ static float m_fFarClip[NUMHOURS][NUMWEATHERS];
+ static float m_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS];
+ static int m_nLowCloudsRed[NUMHOURS][NUMWEATHERS];
+ static int m_nLowCloudsGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nLowCloudsBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS];
+ static int m_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS];
+ static float m_fBlurRed[NUMHOURS][NUMWEATHERS];
+ static float m_fBlurGreen[NUMHOURS][NUMWEATHERS];
+ static float m_fBlurBlue[NUMHOURS][NUMWEATHERS];
+ static float m_fBlurAlpha[NUMHOURS][NUMWEATHERS];
- static float &m_fCurrentAmbientRed;
- static float &m_fCurrentAmbientGreen;
- static float &m_fCurrentAmbientBlue;
- static float &m_fCurrentDirectionalRed;
- static float &m_fCurrentDirectionalGreen;
- static float &m_fCurrentDirectionalBlue;
- static int &m_nCurrentSkyTopRed;
- static int &m_nCurrentSkyTopGreen;
- static int &m_nCurrentSkyTopBlue;
- static int &m_nCurrentSkyBottomRed;
- static int &m_nCurrentSkyBottomGreen;
- static int &m_nCurrentSkyBottomBlue;
- static int &m_nCurrentSunCoreRed;
- static int &m_nCurrentSunCoreGreen;
- static int &m_nCurrentSunCoreBlue;
- static int &m_nCurrentSunCoronaRed;
- static int &m_nCurrentSunCoronaGreen;
- static int &m_nCurrentSunCoronaBlue;
- static float &m_fCurrentSunSize;
- static float &m_fCurrentSpriteSize;
- static float &m_fCurrentSpriteBrightness;
- static int &m_nCurrentShadowStrength;
- static int &m_nCurrentLightShadowStrength;
- static int &m_nCurrentTreeShadowStrength;
- static float &m_fCurrentFogStart;
- static float &m_fCurrentFarClip;
- static float &m_fCurrentLightsOnGroundBrightness;
- static int &m_nCurrentLowCloudsRed;
- static int &m_nCurrentLowCloudsGreen;
- static int &m_nCurrentLowCloudsBlue;
- static int &m_nCurrentFluffyCloudsTopRed;
- static int &m_nCurrentFluffyCloudsTopGreen;
- static int &m_nCurrentFluffyCloudsTopBlue;
- static int &m_nCurrentFluffyCloudsBottomRed;
- static int &m_nCurrentFluffyCloudsBottomGreen;
- static int &m_nCurrentFluffyCloudsBottomBlue;
- static float &m_fCurrentBlurRed;
- static float &m_fCurrentBlurGreen;
- static float &m_fCurrentBlurBlue;
- static float &m_fCurrentBlurAlpha;
- static int &m_nCurrentFogColourRed;
- static int &m_nCurrentFogColourGreen;
- static int &m_nCurrentFogColourBlue;
+ static float m_fCurrentAmbientRed;
+ static float m_fCurrentAmbientGreen;
+ static float m_fCurrentAmbientBlue;
+ static float m_fCurrentDirectionalRed;
+ static float m_fCurrentDirectionalGreen;
+ static float m_fCurrentDirectionalBlue;
+ static int m_nCurrentSkyTopRed;
+ static int m_nCurrentSkyTopGreen;
+ static int m_nCurrentSkyTopBlue;
+ static int m_nCurrentSkyBottomRed;
+ static int m_nCurrentSkyBottomGreen;
+ static int m_nCurrentSkyBottomBlue;
+ static int m_nCurrentSunCoreRed;
+ static int m_nCurrentSunCoreGreen;
+ static int m_nCurrentSunCoreBlue;
+ static int m_nCurrentSunCoronaRed;
+ static int m_nCurrentSunCoronaGreen;
+ static int m_nCurrentSunCoronaBlue;
+ static float m_fCurrentSunSize;
+ static float m_fCurrentSpriteSize;
+ static float m_fCurrentSpriteBrightness;
+ static int m_nCurrentShadowStrength;
+ static int m_nCurrentLightShadowStrength;
+ static int m_nCurrentTreeShadowStrength;
+ static float m_fCurrentFogStart;
+ static float m_fCurrentFarClip;
+ static float m_fCurrentLightsOnGroundBrightness;
+ static int m_nCurrentLowCloudsRed;
+ static int m_nCurrentLowCloudsGreen;
+ static int m_nCurrentLowCloudsBlue;
+ static int m_nCurrentFluffyCloudsTopRed;
+ static int m_nCurrentFluffyCloudsTopGreen;
+ static int m_nCurrentFluffyCloudsTopBlue;
+ static int m_nCurrentFluffyCloudsBottomRed;
+ static int m_nCurrentFluffyCloudsBottomGreen;
+ static int m_nCurrentFluffyCloudsBottomBlue;
+ static float m_fCurrentBlurRed;
+ static float m_fCurrentBlurGreen;
+ static float m_fCurrentBlurBlue;
+ static float m_fCurrentBlurAlpha;
+ static int m_nCurrentFogColourRed;
+ static int m_nCurrentFogColourGreen;
+ static int m_nCurrentFogColourBlue;
- static int &m_FogReduction;
+ static int m_FogReduction;
public:
- static int &m_CurrentStoredValue;
- static CVector *m_VectorToSun; // [16]
- static float *m_fShadowFrontX; // [16]
- static float *m_fShadowFrontY; // [16]
- static float *m_fShadowSideX; // [16]
- static float *m_fShadowSideY; // [16]
- static float *m_fShadowDisplacementX; // [16]
- static float *m_fShadowDisplacementY; // [16]
+ static int m_CurrentStoredValue;
+ static CVector m_VectorToSun[16];
+ static float m_fShadowFrontX[16];
+ static float m_fShadowFrontY[16];
+ static float m_fShadowSideX[16];
+ static float m_fShadowSideY[16];
+ static float m_fShadowDisplacementX[16];
+ static float m_fShadowDisplacementY[16];
static float GetAmbientRed(void) { return m_fCurrentAmbientRed; }
static float GetAmbientGreen(void) { return m_fCurrentAmbientGreen; }
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index a1c2af93..d5a54742 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -39,8 +39,8 @@ int16 CWaterLevel::nGeomUsed;
//RwTexture *gpWaterTex;
//RwRaster *gpWaterRaster;
-RwTexture *&gpWaterTex = *(RwTexture **)0x64D070;
-RwRaster *&gpWaterRaster = *(RwRaster **)0x8F5FD4;
+RwTexture *gpWaterTex;
+RwRaster *gpWaterRaster;
const float fAdd1 = 180.0f;
diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h
index 827e83d2..a471bc52 100644
--- a/src/render/WaterLevel.h
+++ b/src/render/WaterLevel.h
@@ -64,7 +64,7 @@
#define MAX_BOAT_WAKES 8
-extern RwRaster*& gpWaterRaster;
+extern RwRaster* gpWaterRaster;
class CWaterLevel
{
diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp
index 7aa2778f..1aa6be82 100644
--- a/src/render/Weather.cpp
+++ b/src/render/Weather.cpp
@@ -18,35 +18,35 @@
#include "World.h"
#include "ZoneCull.h"
-int32 &CWeather::SoundHandle = *(int32*)0x5FFBC4;
+int32 CWeather::SoundHandle = -1;
-int32 &CWeather::WeatherTypeInList = *(int32*)0x8F626C;
-int16 &CWeather::OldWeatherType = *(int16*)0x95CCEC;
-int16 &CWeather::NewWeatherType = *(int16*)0x95CC70;
-int16 &CWeather::ForcedWeatherType = *(int16*)0x95CC80;
+int32 CWeather::WeatherTypeInList;
+int16 CWeather::OldWeatherType;
+int16 CWeather::NewWeatherType;
+int16 CWeather::ForcedWeatherType;
-bool &CWeather::LightningFlash = *(bool*)0x95CDA3;
-bool &CWeather::LightningBurst = *(bool*)0x95CDAC;
-uint32 &CWeather::LightningStart = *(uint32*)0x8F5F84;
-uint32 &CWeather::LightningFlashLastChange = *(uint32*)0x8E2C0C;
-uint32 &CWeather::WhenToPlayLightningSound = *(uint32*)0x8F57E4;
-uint32 &CWeather::LightningDuration = *(uint32*)0x940578;
+bool CWeather::LightningFlash;
+bool CWeather::LightningBurst;
+uint32 CWeather::LightningStart;
+uint32 CWeather::LightningFlashLastChange;
+uint32 CWeather::WhenToPlayLightningSound;
+uint32 CWeather::LightningDuration;
-float &CWeather::Foggyness = *(float*)0x885AF4;
-float &CWeather::CloudCoverage = *(float*)0x8E2818;
-float &CWeather::Wind = *(float*)0x8E2BF8;
-float &CWeather::Rain = *(float*)0x8E2BFC;
-float &CWeather::InterpolationValue = *(float*)0x8F2520;
-float &CWeather::WetRoads = *(float*)0x8F5FF8;
-float &CWeather::Rainbow = *(float*)0x940598;
+float CWeather::Foggyness;
+float CWeather::CloudCoverage;
+float CWeather::Wind;
+float CWeather::Rain;
+float CWeather::InterpolationValue;
+float CWeather::WetRoads;
+float CWeather::Rainbow;
-bool &CWeather::bScriptsForceRain = *(bool*)0x95CD7D;
-bool &CWeather::Stored_StateStored = *(bool*)0x95CDC1;
+bool CWeather::bScriptsForceRain;
+bool CWeather::Stored_StateStored;
-float &CWeather::Stored_InterpolationValue = *(float*)0x942F54;
-int16 &CWeather::Stored_OldWeatherType = *(int16*)0x95CC68;
-int16 &CWeather::Stored_NewWeatherType = *(int16*)0x95CCAE;
-float &CWeather::Stored_Rain = *(float*)0x885B4C;
+float CWeather::Stored_InterpolationValue;
+int16 CWeather::Stored_OldWeatherType;
+int16 CWeather::Stored_NewWeatherType;
+float CWeather::Stored_Rain;
tRainStreak Streaks[NUM_RAIN_STREAKS];
diff --git a/src/render/Weather.h b/src/render/Weather.h
index 9e4ea378..9c670317 100644
--- a/src/render/Weather.h
+++ b/src/render/Weather.h
@@ -16,34 +16,34 @@ public:
WEATHER_FOGGY = 3,
WEATHER_TOTAL = 4
};
- static int32 &SoundHandle;
+ static int32 SoundHandle;
- static int32 &WeatherTypeInList;
- static int16 &OldWeatherType;
- static int16 &NewWeatherType;
- static int16 &ForcedWeatherType;
+ static int32 WeatherTypeInList;
+ static int16 OldWeatherType;
+ static int16 NewWeatherType;
+ static int16 ForcedWeatherType;
- static bool &LightningFlash;
- static bool &LightningBurst;
- static uint32 &LightningStart;
- static uint32 &LightningFlashLastChange;
- static uint32 &WhenToPlayLightningSound;
- static uint32 &LightningDuration;
+ static bool LightningFlash;
+ static bool LightningBurst;
+ static uint32 LightningStart;
+ static uint32 LightningFlashLastChange;
+ static uint32 WhenToPlayLightningSound;
+ static uint32 LightningDuration;
- static float &Foggyness;
- static float &CloudCoverage;
- static float &Wind;
- static float &Rain;
- static float &InterpolationValue;
- static float &WetRoads;
- static float &Rainbow;
+ static float Foggyness;
+ static float CloudCoverage;
+ static float Wind;
+ static float Rain;
+ static float InterpolationValue;
+ static float WetRoads;
+ static float Rainbow;
- static bool &bScriptsForceRain;
- static bool &Stored_StateStored;
- static float &Stored_InterpolationValue;
- static int16 &Stored_OldWeatherType;
- static int16 &Stored_NewWeatherType;
- static float &Stored_Rain;
+ static bool bScriptsForceRain;
+ static bool Stored_StateStored;
+ static float Stored_InterpolationValue;
+ static int16 Stored_OldWeatherType;
+ static int16 Stored_NewWeatherType;
+ static float Stored_Rain;
static void RenderRainStreaks(void);
static void Update(void);
@@ -68,4 +68,4 @@ struct tRainStreak
uint32 timer;
};
-extern RwTexture* (&gpRainDropTex)[4]; \ No newline at end of file
+extern RwTexture* gpRainDropTex[4]; \ No newline at end of file
diff --git a/src/rw/Lights.cpp b/src/rw/Lights.cpp
index 112c8982..6e9edbed 100644
--- a/src/rw/Lights.cpp
+++ b/src/rw/Lights.cpp
@@ -9,18 +9,18 @@
#include "ZoneCull.h"
#include "Frontend.h"
-RpLight *pAmbient;// = *(RpLight**)0x885B6C;
-RpLight *pDirect;// = *(RpLight**)0x880F7C;
-RpLight *pExtraDirectionals[] = { nil, nil, nil, nil };// = (RpLight**)0x60009C;
-int LightStrengths[4];// = (int*)0x87BEF0;
-int NumExtraDirLightsInWorld;// = *(int*)0x64C608;
-
-RwRGBAReal AmbientLightColourForFrame;// = *(RwRGBAReal*)0x6F46F8;
-RwRGBAReal AmbientLightColourForFrame_PedsCarsAndObjects;// = *(RwRGBAReal*)0x6F1D10;
-RwRGBAReal DirectionalLightColourForFrame;// = *(RwRGBAReal*)0x87C6B8;
-
-RwRGBAReal AmbientLightColour;// = *(RwRGBAReal*)0x86B0F8;
-RwRGBAReal DirectionalLightColour;// = *(RwRGBAReal*)0x72E308;
+RpLight *pAmbient;
+RpLight *pDirect;
+RpLight *pExtraDirectionals[] = { nil };
+int LightStrengths[4];
+int NumExtraDirLightsInWorld;
+
+RwRGBAReal AmbientLightColourForFrame;
+RwRGBAReal AmbientLightColourForFrame_PedsCarsAndObjects;
+RwRGBAReal DirectionalLightColourForFrame;
+
+RwRGBAReal AmbientLightColour;
+RwRGBAReal DirectionalLightColour;
void
SetLightsWithTimeOfDayColour(RpWorld *)
diff --git a/src/rw/NodeName.cpp b/src/rw/NodeName.cpp
index 7422a323..b3477dba 100644
--- a/src/rw/NodeName.cpp
+++ b/src/rw/NodeName.cpp
@@ -2,7 +2,7 @@
#include "patcher.h"
#include "NodeName.h"
-static int32 gPluginOffset;// = *(int32*)0x64C610;
+static int32 gPluginOffset;
enum
{
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index cf1a6f2b..6bb78e7b 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -389,8 +389,10 @@ CameraCreate(RwInt32 width, RwInt32 height, RwBool zBuffer)
return (nil);
}
+#ifdef USE_TEXTURE_POOL
WRAPPER void _TexturePoolsInitialise() { EAXJMP(0x598B10); }
WRAPPER void _TexturePoolsShutdown() { EAXJMP(0x598B30); }
+#endif
STARTPATCHES
//InjectHook(0x526450, GetFirstObjectCallback, PATCH_JUMP);
diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp
index 1ac5a75e..64fea20f 100644
--- a/src/rw/TexRead.cpp
+++ b/src/rw/TexRead.cpp
@@ -22,8 +22,8 @@
#include "RwHelper.h"
#endif //GTA_PC
-float texLoadTime;// = *(float*)0x8F1B50;
-int32 texNumLoaded;// = *(int32*)0x8F252C;
+float texLoadTime;
+int32 texNumLoaded;
#ifdef LIBRW
#define READNATIVE(stream, tex, size) rwNativeTextureHackRead(stream, tex, size)
diff --git a/src/rw/TxdStore.cpp b/src/rw/TxdStore.cpp
index a32755a4..d640d99d 100644
--- a/src/rw/TxdStore.cpp
+++ b/src/rw/TxdStore.cpp
@@ -6,8 +6,8 @@
#include "RwHelper.h"
#include "TxdStore.h"
-CPool<TxdDef,TxdDef> *CTxdStore::ms_pTxdPool;// = *(CPool<TxdDef,TxdDef>**)0x8F5FB8;
-RwTexDictionary *CTxdStore::ms_pStoredTxd;// = *(RwTexDictionary**)0x9405BC;
+CPool<TxdDef,TxdDef> *CTxdStore::ms_pTxdPool;
+RwTexDictionary *CTxdStore::ms_pStoredTxd;
void
CTxdStore::Initialise(void)
diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp
index 5438ed0f..b7afd751 100644
--- a/src/rw/VisibilityPlugins.cpp
+++ b/src/rw/VisibilityPlugins.cpp
@@ -11,24 +11,24 @@
#define FADE_DISTANCE 20.0f
-CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaList;// = *(CLinkList<CVisibilityPlugins::AlphaObjectInfo>*)0x8F42E4;
-CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaEntityList;// = *(CLinkList<CVisibilityPlugins::AlphaObjectInfo>*)0x943084;
-
-int32 CVisibilityPlugins::ms_atomicPluginOffset = -1;// = *(int32*)0x600124;
-int32 CVisibilityPlugins::ms_framePluginOffset = -1;// = *(int32*)0x600128;
-int32 CVisibilityPlugins::ms_clumpPluginOffset = -1;// = *(int32*)0x60012C;
-
-RwCamera *CVisibilityPlugins::ms_pCamera;// = *(RwCamera**)0x8F2514;
-RwV3d *CVisibilityPlugins::ms_pCameraPosn;// = *(RwV3d**)0x8F6270;
-float CVisibilityPlugins::ms_cullCompsDist;// = *(float*)0x8F2BC4;
-float CVisibilityPlugins::ms_vehicleLod0Dist;// = *(float*)0x885B28;
-float CVisibilityPlugins::ms_vehicleLod1Dist;// = *(float*)0x885B30;
-float CVisibilityPlugins::ms_vehicleFadeDist;// = *(float*)0x8E28B4;
-float CVisibilityPlugins::ms_bigVehicleLod0Dist;// = *(float*)0x8E2A84;
-float CVisibilityPlugins::ms_bigVehicleLod1Dist;// = *(float*)0x8E2A8C;
-float CVisibilityPlugins::ms_pedLod0Dist;// = *(float*)0x8F2BD4;
-float CVisibilityPlugins::ms_pedLod1Dist;// = *(float*)0x8F2BD8;
-float CVisibilityPlugins::ms_pedFadeDist;// = *(float*)0x8E2C34;
+CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaList;
+CLinkList<CVisibilityPlugins::AlphaObjectInfo> CVisibilityPlugins::m_alphaEntityList;
+
+int32 CVisibilityPlugins::ms_atomicPluginOffset = -1;
+int32 CVisibilityPlugins::ms_framePluginOffset = -1;
+int32 CVisibilityPlugins::ms_clumpPluginOffset = -1;
+
+RwCamera *CVisibilityPlugins::ms_pCamera;
+RwV3d *CVisibilityPlugins::ms_pCameraPosn;
+float CVisibilityPlugins::ms_cullCompsDist;
+float CVisibilityPlugins::ms_vehicleLod0Dist;
+float CVisibilityPlugins::ms_vehicleLod1Dist;
+float CVisibilityPlugins::ms_vehicleFadeDist;
+float CVisibilityPlugins::ms_bigVehicleLod0Dist;
+float CVisibilityPlugins::ms_bigVehicleLod1Dist;
+float CVisibilityPlugins::ms_pedLod0Dist;
+float CVisibilityPlugins::ms_pedLod1Dist;
+float CVisibilityPlugins::ms_pedFadeDist;
void
CVisibilityPlugins::Initialise(void)
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index 0bae979b..88f32c33 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -40,22 +40,22 @@
const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729;
-char DefaultPCSaveFileName[260];// = *(char(*)[260]) * (uintptr*)0x8E28C0;
-char ValidSaveName[260];// = *(char(*)[260])*(uintptr*)0x8E2CBC;
-char LoadFileName[256];// = *(char(*)[256])*(uintptr*)0x9403C4;
-wchar SlotFileName[SLOT_COUNT][260];// = *(wchar(*)[SLOT_COUNT][260])*(uintptr*)0x6F07C8;
-wchar SlotSaveDate[SLOT_COUNT][70];// = *(wchar(*)[SLOT_COUNT][70])*(uintptr*)0x72B858;
-int CheckSum;// = *(int*)0x8E2BE0;
-eLevelName m_LevelToLoad;// = *(eLevelName*)0x8E29CC;
+char DefaultPCSaveFileName[260];
+char ValidSaveName[260];
+char LoadFileName[256];
+wchar SlotFileName[SLOT_COUNT][260];
+wchar SlotSaveDate[SLOT_COUNT][70];
+int CheckSum;
+eLevelName m_LevelToLoad;
char SaveFileNameJustSaved[260];
-int Slots[SLOT_COUNT+1];// = *(int(*)[SLOT_COUNT+1])*(uintptr*)0x72803C;
-CDate CompileDateAndTime;// = *(CDate*)0x72BCB8;
-
-bool b_FoundRecentSavedGameWantToLoad;// = *(bool*)0x95CDA8;
-bool JustLoadedDontFadeInYet;// = *(bool*)0x95CDB4;
-bool StillToFadeOut;// = *(bool*)0x95CD99;
-uint32 TimeStartedCountingForFade;// = *(uint32*)0x9430EC;
-uint32 TimeToStayFadedBeforeFadeOut = 1750;// = *(uint32*)0x611564;
+int Slots[SLOT_COUNT+1];
+CDate CompileDateAndTime;
+
+bool b_FoundRecentSavedGameWantToLoad;
+bool JustLoadedDontFadeInYet;
+bool StillToFadeOut;
+uint32 TimeStartedCountingForFade;
+uint32 TimeToStayFadedBeforeFadeOut = 1750;
#define ReadDataFromBufferPointer(buf, to) memcpy(&to, buf, sizeof(to)); buf += align4bytes(sizeof(to));
#define WriteDataToBufferPointer(buf, from) memcpy(buf, &from, sizeof(from)); buf += align4bytes(sizeof(from));
diff --git a/src/save/PCSave.cpp b/src/save/PCSave.cpp
index 4afcb645..06024e04 100644
--- a/src/save/PCSave.cpp
+++ b/src/save/PCSave.cpp
@@ -9,7 +9,7 @@
const char* _psGetUserFilesFolder();
-C_PcSave PcSaveHelper;// = *(C_PcSave*)0x8E2C60;
+C_PcSave PcSaveHelper;
void
C_PcSave::SetSaveDirectory(const char *path)
diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp
index 73dd8bf8..a02d7e0b 100644
--- a/src/skel/skeleton.cpp
+++ b/src/skel/skeleton.cpp
@@ -17,8 +17,7 @@ static RwBool DefaultVideoMode = TRUE;
bool TurnOnAnimViewer = false;
-//RsGlobalType RsGlobal;
-RsGlobalType &RsGlobal = *(RsGlobalType*)0x8F4360;
+RsGlobalType RsGlobal;
RwUInt32
RsTimer(void)
diff --git a/src/skel/skeleton.h b/src/skel/skeleton.h
index 6bf8d2fd..13588411 100644
--- a/src/skel/skeleton.h
+++ b/src/skel/skeleton.h
@@ -232,7 +232,7 @@ enum RsPadButtons
typedef enum RsPadButtons RsPadButtons;
-extern RsGlobalType &RsGlobal;
+extern RsGlobalType RsGlobal;
extern RsEventStatus AppEventHandler(RsEvent event, void *param);
extern RwBool AttachInputDevices(void);
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp
index acc9650c..351b7247 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -45,31 +45,25 @@
#define MAX_SUBSYSTEMS (16)
-//static RwBool ForegroundApp = TRUE;
-static RwBool &ForegroundApp = *(RwBool*)0x060F000;
+static RwBool ForegroundApp = TRUE;
-//static RwBool RwInitialised = FALSE;
-static RwBool &RwInitialised = *(RwBool*)0x885B88;
+static RwBool RwInitialised = FALSE;
static RwSubSystemInfo GsubSysInfo[MAX_SUBSYSTEMS];
static RwInt32 GnumSubSystems = 0;
static RwInt32 GcurSel = 0, GcurSelVM = 0;
-//static RwBool startupDeactivate;
-static RwBool &startupDeactivate = *(RwBool*)0x8E2878;
+static RwBool startupDeactivate;
-//static RwBool useDefault;
-static RwBool &useDefault = *(RwBool*)0x6510D4;
+static RwBool useDefault;
-//static RwBool defaultFullscreenRes = TRUE;
-static RwBool &defaultFullscreenRes = *(RwBool*)0x60EFFC;
+static RwBool defaultFullscreenRes = TRUE;
/* Class name for the MS Window's window class. */
static const RwChar *AppClassName = RWSTRING("Grand theft auto 3");
-//static psGlobalType PsGlobal;
-static psGlobalType &PsGlobal = *(psGlobalType*)0x72CF60;
+static psGlobalType PsGlobal;
#define PSGLOBAL(var) (((psGlobalType *)(RsGlobal.ps))->var)
@@ -107,14 +101,14 @@ IMediaSeeking *pMS = nil;
DWORD dwDXVersion;
DWORD _dwMemTotalPhys;
-DWORD &_dwMemAvailPhys = *(DWORD*)0x70F29C;
+DWORD _dwMemAvailPhys;
DWORD _dwMemTotalVirtual;
DWORD _dwMemAvailVirtual;
-DWORD &_dwMemTotalVideo = *(DWORD*)0x70F2A8;
+DWORD _dwMemTotalVideo;
DWORD _dwMemAvailVideo;
-DWORD &_dwOperatingSystemVersion = *(DWORD*)0x70F290;
+DWORD _dwOperatingSystemVersion;
-RwUInt32 &gGameState = *(RwUInt32*)0x8F5838;
+RwUInt32 gGameState;
CJoySticks AllValidWinJoys;
CJoySticks::CJoySticks()
diff --git a/src/skel/win/win.h b/src/skel/win/win.h
index 242438ea..ca16c4a0 100644
--- a/src/skel/win/win.h
+++ b/src/skel/win/win.h
@@ -29,9 +29,9 @@ enum eWinVersion
OS_WINXP,
};
-extern DWORD &_dwOperatingSystemVersion;
+extern DWORD _dwOperatingSystemVersion;
-extern RwUInt32 &gGameState;
+extern RwUInt32 gGameState;
/* platform specfic global data */
typedef struct
@@ -127,5 +127,5 @@ void HandleExit();
#endif /* __cplusplus */
-extern DWORD &_dwOperatingSystemVersion;
+extern DWORD _dwOperatingSystemVersion;
#endif /* (!defined(_PLATFORM_WIN_H)) */
diff --git a/src/text/Messages.cpp b/src/text/Messages.cpp
index 4b181d67..67a7bab4 100644
--- a/src/text/Messages.cpp
+++ b/src/text/Messages.cpp
@@ -12,9 +12,9 @@
#include "ControllerConfig.h"
-tMessage CMessages::BriefMessages[NUMBRIEFMESSAGES];// = *(tMessage(*)[NUMBRIEFMESSAGES]) * (uintptr*)0x8786E0;
-tPreviousBrief CMessages::PreviousBriefs[NUMPREVIOUSBRIEFS];// = *(tPreviousBrief(*)[NUMPREVIOUSBRIEFS]) * (uintptr*)0x713C08;
-tBigMessage CMessages::BIGMessages[NUMBIGMESSAGES];// = *(tBigMessage(*)[NUMBIGMESSAGES]) * (uintptr*)0x773628;
+tMessage CMessages::BriefMessages[NUMBRIEFMESSAGES];
+tPreviousBrief CMessages::PreviousBriefs[NUMPREVIOUSBRIEFS];
+tBigMessage CMessages::BIGMessages[NUMBIGMESSAGES];
char CMessages::PreviousMissionTitle[16]; // unused
void
diff --git a/src/text/Text.cpp b/src/text/Text.cpp
index b3da27e8..144dfed1 100644
--- a/src/text/Text.cpp
+++ b/src/text/Text.cpp
@@ -7,7 +7,7 @@
static wchar WideErrorString[25];
-CText TheText;// = *(CText*)0x941520;
+CText TheText;
CText::CText(void)
{
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 12d4f589..0a0bc7a6 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -49,7 +49,7 @@ bool bAllCarCheat; // unused
RwObject *GetCurrentAtomicObjectCB(RwObject *object, void *data);
-bool CAutomobile::m_sAllTaxiLights;// = *(bool*)0x95CD21;
+bool CAutomobile::m_sAllTaxiLights;
CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
: CVehicle(CreatedBy)
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index d694d8b0..478257b6 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -21,16 +21,16 @@
#define INVALID_ORIENTATION (-9999.99f)
-float fShapeLength = 0.4f;// *(float*)0x600E78;
-float fShapeTime = 0.05f;// *(float*)0x600E7C;
-float fRangeMult = 0.75f; // = *(float*)0x600E80; //0.6f; // 0.75f gta 3
-float fTimeMult;// = *(float*)0x943008;
+float fShapeLength = 0.4f;
+float fShapeTime = 0.05f;
+float fRangeMult = 0.75f; //0.6f; // 0.75f gta 3
+float fTimeMult;
float MAX_WAKE_LENGTH = 50.0f;
float MIN_WAKE_INTERVAL = 1.0f;
float WAKE_LIFETIME = 400.0f;
-CBoat *CBoat::apFrameWakeGeneratingBoats[4];// = *(CBoat * (*)[4]) * (uintptr*)0x8620E0;
+CBoat *CBoat::apFrameWakeGeneratingBoats[4];
CBoat::CBoat(int mi, uint8 owner) : CVehicle(owner)
{
diff --git a/src/vehicles/Floater.cpp b/src/vehicles/Floater.cpp
index ee4a1191..8b5e1e0a 100644
--- a/src/vehicles/Floater.cpp
+++ b/src/vehicles/Floater.cpp
@@ -7,9 +7,9 @@
#include "Vehicle.h"
#include "Floater.h"
-cBuoyancy mod_Buoyancy;// = *(cBuoyancy*)0x8F2674;
+cBuoyancy mod_Buoyancy;
-static float fVolMultiplier = 1.0f; // 0x601394;
+static float fVolMultiplier = 1.0f;
// amount of boat volume in bounding box
// 1.0-volume is the empty space in the bbox
static float fBoatVolumeDistribution[9] = {
diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp
index 40715887..b33015ab 100644
--- a/src/vehicles/HandlingMgr.cpp
+++ b/src/vehicles/HandlingMgr.cpp
@@ -4,7 +4,7 @@
#include "FileMgr.h"
#include "HandlingMgr.h"
-cHandlingDataMgr mod_HandlingManager;// = *(cHandlingDataMgr*)0x728060;
+cHandlingDataMgr mod_HandlingManager;
const char *HandlingFilename = "HANDLING.CFG";
diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp
index 61714133..81ac9bd3 100644
--- a/src/vehicles/Heli.cpp
+++ b/src/vehicles/Heli.cpp
@@ -34,13 +34,13 @@ enum
HELI_STATUS_HOVER2,
};
-CHeli *CHeli::pHelis[NUM_HELIS];// = (CHeli**)0x72CF50;
-int16 CHeli::NumRandomHelis;// = *(int16*)0x95CCAA;
-uint32 CHeli::TestForNewRandomHelisTimer;// = *(uint32*)0x8F1A7C;
+CHeli *CHeli::pHelis[NUM_HELIS];
+int16 CHeli::NumRandomHelis;
+uint32 CHeli::TestForNewRandomHelisTimer;
int16 CHeli::NumScriptHelis; // unused
-bool CHeli::CatalinaHeliOn;// = *(bool*)0x95CD85;
-bool CHeli::CatalinaHasBeenShotDown;// = *(bool*)0x95CD56;
-bool CHeli::ScriptHeliOn;// = *(bool*)0x95CD43;
+bool CHeli::CatalinaHeliOn;
+bool CHeli::CatalinaHasBeenShotDown;
+bool CHeli::ScriptHeliOn;
CHeli::CHeli(int32 id, uint8 CreatedBy)
: CVehicle(CreatedBy)
diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp
index 49f5d69d..892bc0d5 100644
--- a/src/vehicles/Plane.cpp
+++ b/src/vehicles/Plane.cpp
@@ -16,35 +16,35 @@
#include "HandlingMgr.h"
#include "Plane.h"
-CPlaneNode *pPathNodes;// = *(CPlaneNode**)0x8F1B68;
-CPlaneNode *pPath2Nodes;// = *(CPlaneNode**)0x885B8C;
-CPlaneNode *pPath3Nodes;// = *(CPlaneNode**)0x885B78;
-CPlaneNode *pPath4Nodes;// = *(CPlaneNode**)0x885AD8;
-int32 NumPathNodes;// = *(int32*)0x8F2BE4;
-int32 NumPath2Nodes;// = *(int32*)0x941498;
-int32 NumPath3Nodes;// = *(int32*)0x9414D8;
-int32 NumPath4Nodes;// = *(int32*)0x9412C8;
-float TotalLengthOfFlightPath;// = *(float*)0x8F2C6C;
-float TotalLengthOfFlightPath2;// = *(float*)0x64CFBC;
-float TotalLengthOfFlightPath3;// = *(float*)0x64CFD0;
-float TotalLengthOfFlightPath4;// = *(float*)0x64CFDC;
-float TotalDurationOfFlightPath;// = *(float*)0x64CFB8;
-float TotalDurationOfFlightPath2;// = *(float*)0x64CFC0;
-float TotalDurationOfFlightPath3;// = *(float*)0x64CFD4;
-float TotalDurationOfFlightPath4;// = *(float*)0x64CFE0;
-float LandingPoint;// = *(float*)0x8F2C7C;
-float TakeOffPoint;// = *(float*)0x8E28A4;
-CPlaneInterpolationLine aPlaneLineBits[6]; // = (CPlaneInterpolationLine*)0x734168;
-
-float PlanePathPosition[3];// = (float*)0x8F5FC8; //[3]
-float OldPlanePathPosition[3];// = (float*)0x8F5FBC; //[3]
-float PlanePathSpeed[3];// = (float*)0x941538; //[3]
-float PlanePath2Position[3];// = (float*)0x64CFC4; //[3]
-float PlanePath3Position;// = *(float*)0x64CFD8;
-float PlanePath4Position;// = *(float*)0x64CFE4;
-float PlanePath2Speed[3];// = (float*)0x8F1A54; //[3]
-float PlanePath3Speed;// = *(float*)0x8F1A94;
-float PlanePath4Speed;// = *(float*)0x8F1AFC;
+CPlaneNode *pPathNodes;
+CPlaneNode *pPath2Nodes;
+CPlaneNode *pPath3Nodes;
+CPlaneNode *pPath4Nodes;
+int32 NumPathNodes;
+int32 NumPath2Nodes;
+int32 NumPath3Nodes;
+int32 NumPath4Nodes;
+float TotalLengthOfFlightPath;
+float TotalLengthOfFlightPath2;
+float TotalLengthOfFlightPath3;
+float TotalLengthOfFlightPath4;
+float TotalDurationOfFlightPath;
+float TotalDurationOfFlightPath2;
+float TotalDurationOfFlightPath3;
+float TotalDurationOfFlightPath4;
+float LandingPoint;
+float TakeOffPoint;
+CPlaneInterpolationLine aPlaneLineBits[6];
+
+float PlanePathPosition[3];
+float OldPlanePathPosition[3];
+float PlanePathSpeed[3];
+float PlanePath2Position[3];
+float PlanePath3Position;
+float PlanePath4Position;
+float PlanePath2Speed[3];
+float PlanePath3Speed;
+float PlanePath4Speed;
enum
@@ -55,12 +55,12 @@ enum
CESNA_STATUS_LANDED,
};
-int32 &CesnaMissionStatus = *(int32*)0x64CFE8;
-int32 &CesnaMissionStartTime = *(int32*)0x64CFEC;
-CPlane *&pDrugRunCesna = *(CPlane**)0x8F5F80;
-int32 &DropOffCesnaMissionStatus = *(int32*)0x64CFF0;
-int32 &DropOffCesnaMissionStartTime = *(int32*)0x64CFF4;
-CPlane *&pDropOffCesna = *(CPlane**)0x8E2A38;
+int32 CesnaMissionStatus;
+int32 CesnaMissionStartTime;
+CPlane *pDrugRunCesna;
+int32 DropOffCesnaMissionStatus;
+int32 DropOffCesnaMissionStartTime;
+CPlane *pDropOffCesna;
CPlane::CPlane(int32 id, uint8 CreatedBy)
diff --git a/src/weapons/ShotInfo.cpp b/src/weapons/ShotInfo.cpp
index 43d0579d..1eae5e87 100644
--- a/src/weapons/ShotInfo.cpp
+++ b/src/weapons/ShotInfo.cpp
@@ -13,8 +13,6 @@
CShotInfo gaShotInfo[NUMSHOTINFOS];
float CShotInfo::ms_afRandTable[20];
-// CShotInfo (&gaShotInfo)[100] = *(CShotInfo(*)[100])*(uintptr*)0x64F0D0;
-// float (&CShotInfo::ms_afRandTable)[20] = *(float(*)[20])*(uintptr*)0x6E9878;
/*
Used for flamethrower. I don't know why it's name is CShotInfo.
diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp
index a4a1a085..dca120a3 100644
--- a/src/weapons/WeaponInfo.cpp
+++ b/src/weapons/WeaponInfo.cpp
@@ -7,7 +7,6 @@
#include "AnimBlendAssociation.h"
#include "Weapon.h"
-//CWeaponInfo (&CWeaponInfo::ms_apWeaponInfos)[14] = * (CWeaponInfo(*)[14]) * (uintptr*)0x6503EC;
CWeaponInfo CWeaponInfo::ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS];
static char ms_aWeaponNames[][32] = {