summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/animation/AnimBlendAssociation.cpp15
-rw-r--r--src/animation/AnimBlendAssociation.h4
-rw-r--r--src/animation/AnimBlendClumpData.cpp14
-rw-r--r--src/animation/AnimBlendClumpData.h4
-rw-r--r--src/audio/AudioManager.cpp5
-rw-r--r--src/audio/AudioScriptObject.cpp1
-rw-r--r--src/audio/DMAudio.h1
-rw-r--r--src/audio/MusicManager.cpp1
-rw-r--r--src/audio/PoliceRadio.h2
-rw-r--r--src/control/Bridge.h3
-rw-r--r--src/control/CarAI.cpp3
-rw-r--r--src/control/CarCtrl.cpp3
-rw-r--r--src/control/Darkel.cpp1
-rw-r--r--src/control/Darkel.h2
-rw-r--r--src/control/GameLogic.cpp1
-rw-r--r--src/control/Gangs.cpp7
-rw-r--r--src/control/Gangs.h6
-rw-r--r--src/control/Phones.cpp1
-rw-r--r--src/control/Pickups.cpp3
-rw-r--r--src/control/Replay.cpp5
-rw-r--r--src/control/Replay.h10
-rw-r--r--src/control/Script.cpp3
-rw-r--r--src/core/AnimViewer.cpp5
-rw-r--r--src/core/Cam.cpp4
-rw-r--r--src/core/Collision.cpp19
-rw-r--r--src/core/Collision.h4
-rw-r--r--src/core/CutsceneMgr.cpp2
-rw-r--r--src/core/EventList.cpp2
-rw-r--r--src/core/Frontend.cpp21
-rw-r--r--src/core/Game.cpp2
-rw-r--r--src/core/Pad.cpp24
-rw-r--r--src/core/Placeable.cpp2
-rw-r--r--src/core/PlayerInfo.cpp3
-rw-r--r--src/core/Streaming.cpp1
-rw-r--r--src/core/common.h2
-rw-r--r--src/entities/Building.cpp2
-rw-r--r--src/entities/Entity.cpp2
-rw-r--r--src/math/Vector.h8
-rw-r--r--src/objects/DummyObject.cpp2
-rw-r--r--src/objects/Object.cpp3
-rw-r--r--src/objects/Object.h2
-rw-r--r--src/objects/Projectile.cpp2
-rw-r--r--src/peds/CivilianPed.cpp4
-rw-r--r--src/peds/CopPed.cpp208
-rw-r--r--src/peds/CopPed.h4
-rw-r--r--src/peds/EmergencyPed.cpp3
-rw-r--r--src/peds/Ped.cpp14
-rw-r--r--src/peds/Ped.h11
-rw-r--r--src/peds/PedIK.cpp2
-rw-r--r--src/peds/PedIK.h3
-rw-r--r--src/peds/PedPlacement.cpp1
-rw-r--r--src/peds/PedPlacement.h2
-rw-r--r--src/peds/PlayerPed.cpp7
-rw-r--r--src/peds/PlayerPed.h6
-rw-r--r--src/peds/Population.cpp10
-rw-r--r--src/peds/Population.h4
-rw-r--r--src/render/Hud.cpp1
-rw-r--r--src/render/WaterCannon.cpp320
-rw-r--r--src/render/WaterCannon.h37
-rw-r--r--src/skel/win/resource.h1
-rw-r--r--src/skel/win/win.rc12
-rw-r--r--src/text/Pager.h28
-rw-r--r--src/text/Text.cpp542
-rw-r--r--src/vehicles/Automobile.cpp3
-rw-r--r--src/vehicles/Boat.cpp2
-rw-r--r--src/vehicles/Heli.cpp3
-rw-r--r--src/vehicles/Plane.cpp3
-rw-r--r--src/vehicles/Train.cpp3
-rw-r--r--src/vehicles/Vehicle.cpp1
-rw-r--r--src/weapons/WeaponInfo.cpp2
-rw-r--r--src/weapons/WeaponInfo.h7
71 files changed, 1055 insertions, 396 deletions
diff --git a/src/animation/AnimBlendAssociation.cpp b/src/animation/AnimBlendAssociation.cpp
index ec42191b..246322ba 100644
--- a/src/animation/AnimBlendAssociation.cpp
+++ b/src/animation/AnimBlendAssociation.cpp
@@ -203,6 +203,15 @@ CAnimBlendAssociation::UpdateBlend(float timeDelta)
return true;
}
+#include <new>
+
+class CAnimBlendAssociation_ : public CAnimBlendAssociation
+{
+public:
+ CAnimBlendAssociation *ctor1(void) { return ::new (this) CAnimBlendAssociation(); }
+ CAnimBlendAssociation *ctor2(CAnimBlendAssociation &other) { return ::new (this) CAnimBlendAssociation(other); }
+ void dtor(void) { this->CAnimBlendAssociation::~CAnimBlendAssociation(); }
+};
STARTPATCHES
InjectHook(0x4016A0, &CAnimBlendAssociation::AllocateAnimBlendNodeArray, PATCH_JUMP);
@@ -219,7 +228,7 @@ STARTPATCHES
InjectHook(0x4031F0, &CAnimBlendAssociation::UpdateTime, PATCH_JUMP);
InjectHook(0x4032B0, &CAnimBlendAssociation::UpdateBlend, PATCH_JUMP);
- InjectHook(0x401460, &CAnimBlendAssociation::ctor1, PATCH_JUMP);
- InjectHook(0x4014C0, &CAnimBlendAssociation::ctor2, PATCH_JUMP);
- InjectHook(0x401520, &CAnimBlendAssociation::dtor, PATCH_JUMP);
+ InjectHook(0x401460, &CAnimBlendAssociation_::ctor1, PATCH_JUMP);
+ InjectHook(0x4014C0, &CAnimBlendAssociation_::ctor2, PATCH_JUMP);
+ InjectHook(0x401520, &CAnimBlendAssociation_::dtor, PATCH_JUMP);
ENDPATCHES
diff --git a/src/animation/AnimBlendAssociation.h b/src/animation/AnimBlendAssociation.h
index aec28f56..d35db1db 100644
--- a/src/animation/AnimBlendAssociation.h
+++ b/src/animation/AnimBlendAssociation.h
@@ -85,9 +85,5 @@ public:
static CAnimBlendAssociation *FromLink(CAnimBlendLink *l) {
return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link));
}
-
- CAnimBlendAssociation *ctor1(void) { return ::new (this) CAnimBlendAssociation(); }
- CAnimBlendAssociation *ctor2(CAnimBlendAssociation &other) { return ::new (this) CAnimBlendAssociation(other); }
- void dtor(void) { this->CAnimBlendAssociation::~CAnimBlendAssociation(); }
};
static_assert(sizeof(CAnimBlendAssociation) == 0x40, "CAnimBlendAssociation: error");
diff --git a/src/animation/AnimBlendClumpData.cpp b/src/animation/AnimBlendClumpData.cpp
index 06625eb5..cc4281d6 100644
--- a/src/animation/AnimBlendClumpData.cpp
+++ b/src/animation/AnimBlendClumpData.cpp
@@ -36,9 +36,19 @@ CAnimBlendClumpData::ForAllFrames(void (*cb)(AnimBlendFrameData*, void*), void *
cb(&frames[i], arg);
}
+#include <new>
+
+class CAnimBlendClumpData_ : public CAnimBlendClumpData
+{
+public:
+ CAnimBlendClumpData *ctor(void) { return ::new (this) CAnimBlendClumpData(); }
+ void dtor(void) { this->CAnimBlendClumpData::~CAnimBlendClumpData(); }
+};
+
+
STARTPATCHES
- InjectHook(0x401880, &CAnimBlendClumpData::ctor, PATCH_JUMP);
- InjectHook(0x4018B0, &CAnimBlendClumpData::dtor, PATCH_JUMP);
+ InjectHook(0x401880, &CAnimBlendClumpData_::ctor, PATCH_JUMP);
+ InjectHook(0x4018B0, &CAnimBlendClumpData_::dtor, PATCH_JUMP);
InjectHook(0x4018F0, &CAnimBlendClumpData::SetNumberOfFrames, PATCH_JUMP);
InjectHook(0x401930, &CAnimBlendClumpData::ForAllFrames, PATCH_JUMP);
ENDPATCHES
diff --git a/src/animation/AnimBlendClumpData.h b/src/animation/AnimBlendClumpData.h
index df2fbc56..1c8c391d 100644
--- a/src/animation/AnimBlendClumpData.h
+++ b/src/animation/AnimBlendClumpData.h
@@ -49,9 +49,5 @@ public:
void SetNumberOfBones(int n) { SetNumberOfFrames(n); }
#endif
void ForAllFrames(void (*cb)(AnimBlendFrameData*, void*), void *arg);
-
-
- CAnimBlendClumpData *ctor(void) { return ::new (this) CAnimBlendClumpData(); }
- void dtor(void) { this->CAnimBlendClumpData::~CAnimBlendClumpData(); }
};
static_assert(sizeof(CAnimBlendClumpData) == 0x14, "CAnimBlendClumpData: error");
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 539c9e91..417fddf1 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -20,6 +20,7 @@
#include "MusicManager.h"
#include "Pad.h"
#include "Ped.h"
+#include "Fire.h"
#include "Physical.h"
#include "Placeable.h"
#include "Plane.h"
@@ -7533,8 +7534,8 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams *params)
void cAudioManager::ProcessWaterCannon(int32)
{
for(int32 i = 0; i < NUM_WATERCANNONS; i++) {
- if(aCannons[i].m_nId) {
- m_sQueueSample.m_vecPos = aCannons[0].m_avecPos[aCannons[i].m_wIndex];
+ if(CWaterCannons::aCannons[i].m_nId) {
+ m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur];
float distSquared = GetDistanceSquared(&m_sQueueSample.m_vecPos);
if(distSquared < 900.f) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
diff --git a/src/audio/AudioScriptObject.cpp b/src/audio/AudioScriptObject.cpp
index 796cd88b..b5093c52 100644
--- a/src/audio/AudioScriptObject.cpp
+++ b/src/audio/AudioScriptObject.cpp
@@ -2,6 +2,7 @@
#include "patcher.h"
#include "AudioScriptObject.h"
#include "Pools.h"
+#include "DMAudio.h"
WRAPPER void cAudioScriptObject::SaveAllAudioScriptObjects(uint8 *buf, uint32 *size) { EAXJMP(0x57c460); }
diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h
index 125263f0..c792b414 100644
--- a/src/audio/DMAudio.h
+++ b/src/audio/DMAudio.h
@@ -1,7 +1,6 @@
#pragma once
#include "audio_enums.h"
-#include "Wanted.h"
enum eSound : int16
{
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index 1fac8a23..1f1c343a 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -8,6 +8,7 @@
#include "Hud.h"
#include "ModelIndices.h"
#include "Replay.h"
+#include "Pad.h"
#include "Text.h"
#include "Timer.h"
#include "World.h"
diff --git a/src/audio/PoliceRadio.h b/src/audio/PoliceRadio.h
index 152a5ee2..4c7030f1 100644
--- a/src/audio/PoliceRadio.h
+++ b/src/audio/PoliceRadio.h
@@ -1,5 +1,7 @@
#pragma once
+#include "Wanted.h"
+
struct cAMCrime {
int32 type;
CVector position;
diff --git a/src/control/Bridge.h b/src/control/Bridge.h
index 377c8bf8..63f41578 100644
--- a/src/control/Bridge.h
+++ b/src/control/Bridge.h
@@ -1,5 +1,6 @@
#pragma once
-#include "Entity.h"
+
+class CEntity;
enum bridgeStates {
STATE_BRIDGE_LOCKED,
diff --git a/src/control/CarAI.cpp b/src/control/CarAI.cpp
index c5d62c48..e47e3d5e 100644
--- a/src/control/CarAI.cpp
+++ b/src/control/CarAI.cpp
@@ -9,6 +9,9 @@
#include "HandlingMgr.h"
#include "ModelIndices.h"
#include "PlayerPed.h"
+#include "Wanted.h"
+#include "DMAudio.h"
+#include "Fire.h"
#include "Pools.h"
#include "Timer.h"
#include "TrafficLights.h"
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index de8c799e..07ba2e3c 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -19,6 +19,7 @@
#include "Ped.h"
#include "PlayerInfo.h"
#include "PlayerPed.h"
+#include "Wanted.h"
#include "Pools.h"
#include "Renderer.h"
#include "RoadBlocks.h"
@@ -27,7 +28,7 @@
#include "Streaming.h"
#include "VisibilityPlugins.h"
#include "Vehicle.h"
-#include "Wanted.h"
+#include "Fire.h"
#include "World.h"
#include "Zones.h"
diff --git a/src/control/Darkel.cpp b/src/control/Darkel.cpp
index b7ae0726..ec1b887e 100644
--- a/src/control/Darkel.cpp
+++ b/src/control/Darkel.cpp
@@ -3,6 +3,7 @@
#include "main.h"
#include "Darkel.h"
#include "PlayerPed.h"
+#include "Wanted.h"
#include "Timer.h"
#include "DMAudio.h"
#include "Population.h"
diff --git a/src/control/Darkel.h b/src/control/Darkel.h
index f17d7581..12ce4451 100644
--- a/src/control/Darkel.h
+++ b/src/control/Darkel.h
@@ -1,9 +1,9 @@
#pragma once
-#include "Weapon.h"
#include "ModelIndices.h"
class CVehicle;
class CPed;
+enum eWeaponType;
enum
{
diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp
index 1e5b72c3..1493cec0 100644
--- a/src/control/GameLogic.cpp
+++ b/src/control/GameLogic.cpp
@@ -9,6 +9,7 @@
#include "CutsceneMgr.h"
#include "World.h"
#include "PlayerPed.h"
+#include "Wanted.h"
#include "Camera.h"
#include "Messages.h"
#include "CarCtrl.h"
diff --git a/src/control/Gangs.cpp b/src/control/Gangs.cpp
index f9cb4698..340fe0f6 100644
--- a/src/control/Gangs.cpp
+++ b/src/control/Gangs.cpp
@@ -1,7 +1,8 @@
#include "common.h"
#include "patcher.h"
#include "ModelIndices.h"
-#include "Gangs.h"
+#include "Gangs.h"
+#include "Weapon.h"
//CGangInfo(&CGangs::Gang)[NUM_GANGS] = *(CGangInfo(*)[NUM_GANGS])*(uintptr*)0x6EDF78;
CGangInfo CGangs::Gang[NUM_GANGS];
@@ -38,8 +39,8 @@ void CGangs::SetGangVehicleModel(int16 gang, int32 model)
void CGangs::SetGangWeapons(int16 gang, int32 weapon1, int32 weapon2)
{
CGangInfo *gi = GetGangInfo(gang);
- gi->m_Weapon1 = (eWeaponType)weapon1;
- gi->m_Weapon2 = (eWeaponType)weapon2;
+ gi->m_Weapon1 = weapon1;
+ gi->m_Weapon2 = weapon2;
}
void CGangs::SetGangPedModelOverride(int16 gang, int8 ovrd)
diff --git a/src/control/Gangs.h b/src/control/Gangs.h
index a348f259..cf22cc73 100644
--- a/src/control/Gangs.h
+++ b/src/control/Gangs.h
@@ -1,13 +1,11 @@
#pragma once
-#include "Weapon.h"
-
struct CGangInfo
{
int32 m_nVehicleMI;
int8 m_nPedModelOverride;
- eWeaponType m_Weapon1;
- eWeaponType m_Weapon2;
+ int32 m_Weapon1;
+ int32 m_Weapon2;
CGangInfo();
};
diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp
index f3b3a8db..276f02b9 100644
--- a/src/control/Phones.cpp
+++ b/src/control/Phones.cpp
@@ -11,6 +11,7 @@
#include "General.h"
#include "AudioScriptObject.h"
#include "RpAnimBlend.h"
+#include "AnimBlendAssociation.h"
CPhoneInfo &gPhoneInfo = *(CPhoneInfo*)0x732A20;
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 53da89f4..b1832f0e 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -15,6 +15,9 @@
#include "Pad.h"
#include "Pickups.h"
#include "PlayerPed.h"
+#include "Wanted.h"
+#include "DMAudio.h"
+#include "Fire.h"
#include "PointLights.h"
#include "Pools.h"
#include "Script.h"
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index a68dd5e7..3c0393aa 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -5,6 +5,7 @@
#include "SpecialFX.h"
#include "CarCtrl.h"
#include "CivilianPed.h"
+#include "Wanted.h"
#include "Clock.h"
#include "DMAudio.h"
#include "Draw.h"
@@ -22,6 +23,8 @@
#include "Pools.h"
#include "Population.h"
#include "Replay.h"
+#include "References.h"
+#include "Pools.h"
#include "RpAnimBlend.h"
#include "RwHelper.h"
#include "CutsceneMgr.h"
@@ -33,6 +36,8 @@
#include "Zones.h"
#include "Font.h"
#include "Text.h"
+#include "Camera.h"
+#include "Radar.h"
uint8 &CReplay::Mode = *(uint8*)0x95CD5B;
CAddressInReplayBuffer &CReplay::Record = *(CAddressInReplayBuffer*)0x942F7C;
diff --git a/src/control/Replay.h b/src/control/Replay.h
index cc652a11..56de52a3 100644
--- a/src/control/Replay.h
+++ b/src/control/Replay.h
@@ -1,14 +1,7 @@
#pragma once
-#include "Camera.h"
-#include "Ped.h"
#include "Pools.h"
-#include "Radar.h"
-#include "References.h"
-#include "Vehicle.h"
-#include "Wanted.h"
#include "World.h"
-#include "common.h"
#ifdef FIX_BUGS
#ifndef DONT_FIX_REPLAY_BUGS
@@ -16,6 +9,9 @@
#endif
#endif
+class CVehicle;
+struct CReference;
+
struct CAddressInReplayBuffer
{
uint32 m_nOffset;
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 2cfd2a9b..14f55734 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -53,6 +53,8 @@
#include "Restart.h"
#include "Replay.h"
#include "RpAnimBlend.h"
+#include "AnimBlendAssociation.h"
+#include "Fire.h"
#include "Rubbish.h"
#include "Shadows.h"
#include "SpecialFX.h"
@@ -65,6 +67,7 @@
#include "Weather.h"
#include "World.h"
#include "Zones.h"
+#include "Radar.h"
#define PICKUP_PLACEMENT_OFFSET 0.5f
#define PED_FIND_Z_OFFSET 5.0f
diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp
index a2d7b94a..20a0098d 100644
--- a/src/core/AnimViewer.cpp
+++ b/src/core/AnimViewer.cpp
@@ -33,6 +33,7 @@
#include "Clock.h"
#include "Timecycle.h"
#include "RpAnimBlend.h"
+#include "AnimBlendAssociation.h"
#include "Shadows.h"
#include "Radar.h"
#include "Hud.h"
@@ -207,6 +208,7 @@ PlayAnimation(RpClump *clump, AssocGroupId animGroup, AnimationId anim)
animAssoc->SetRun();
}
+extern void (*DebugMenuProcess)(void);
void
CAnimViewer::Update(void)
{
@@ -246,6 +248,9 @@ CAnimViewer::Update(void)
}
CPad::UpdatePads();
CPad* pad = CPad::GetPad(0);
+
+ DebugMenuProcess();
+
CStreaming::UpdateForAnimViewer();
CStreaming::RequestModel(modelId, 0);
if (CStreaming::HasModelLoaded(modelId)) {
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 12c72993..546dfde0 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -1530,7 +1530,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
CamDist = fBaseDist + Cos(Alpha)*fAngleDist;
if(TheCamera.m_bUseTransitionBeta)
- Beta = -CGeneral::GetATanOfXY(-Cos(m_fTransitionBeta), -Sin(m_fTransitionBeta));
+ Beta = CGeneral::GetATanOfXY(-Cos(m_fTransitionBeta), -Sin(m_fTransitionBeta));
if(TheCamera.m_bCamDirectlyBehind)
Beta = TheCamera.m_PedOrientForBehindOrInFront;
@@ -1601,7 +1601,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
entity = nil;
}
- if(CamTargetEntity->GetClump()){
+ if(CamTargetEntity->m_rwObject){
// what's going on here?
if(RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_PUMP) ||
RpAnimBlendClumpGetAssociation(CamTargetEntity->GetClump(), ANIM_WEAPON_THROW) ||
diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp
index fc8428be..94ef769e 100644
--- a/src/core/Collision.cpp
+++ b/src/core/Collision.cpp
@@ -2061,6 +2061,19 @@ CColModel::operator=(const CColModel &other)
return *this;
}
+#include <new>
+struct CColLine_ : public CColLine
+{
+ CColLine *ctor(CVector *p0, CVector *p1) { return ::new (this) CColLine(*p0, *p1); }
+};
+
+struct CColModel_ : public CColModel
+{
+ CColModel *ctor(void) { return ::new (this) CColModel(); }
+ void dtor(void) { this->CColModel::~CColModel(); }
+};
+
+
STARTPATCHES
InjectHook(0x4B9C30, (CMatrix& (*)(const CMatrix &src, CMatrix &dst))Invert, PATCH_JUMP);
@@ -2099,15 +2112,15 @@ STARTPATCHES
InjectHook(0x411E40, (void (CColSphere::*)(float, const CVector&, uint8, uint8))&CColSphere::Set, PATCH_JUMP);
InjectHook(0x40B2A0, &CColBox::Set, PATCH_JUMP);
- InjectHook(0x40B320, &CColLine::ctor, PATCH_JUMP);
+ InjectHook(0x40B320, &CColLine_::ctor, PATCH_JUMP);
InjectHook(0x40B350, &CColLine::Set, PATCH_JUMP);
InjectHook(0x411E70, &CColTriangle::Set, PATCH_JUMP);
InjectHook(0x411EA0, &CColTrianglePlane::Set, PATCH_JUMP);
InjectHook(0x412140, &CColTrianglePlane::GetNormal, PATCH_JUMP);
- InjectHook(0x411680, &CColModel::ctor, PATCH_JUMP);
- InjectHook(0x4116E0, &CColModel::dtor, PATCH_JUMP);
+ InjectHook(0x411680, &CColModel_::ctor, PATCH_JUMP);
+ InjectHook(0x4116E0, &CColModel_::dtor, PATCH_JUMP);
InjectHook(0x411D80, &CColModel::RemoveCollisionVolumes, PATCH_JUMP);
InjectHook(0x411CB0, &CColModel::CalculateTrianglePlanes, PATCH_JUMP);
InjectHook(0x411D10, &CColModel::RemoveTrianglePlanes, PATCH_JUMP);
diff --git a/src/core/Collision.h b/src/core/Collision.h
index 9597a181..429fc17f 100644
--- a/src/core/Collision.h
+++ b/src/core/Collision.h
@@ -35,8 +35,6 @@ struct CColLine
CColLine(void) { };
CColLine(const CVector &p0, const CVector &p1) { this->p0 = p0; this->p1 = p1; };
void Set(const CVector &p0, const CVector &p1);
-
- CColLine *ctor(CVector *p0, CVector *p1) { return ::new (this) CColLine(*p0, *p1); }
};
struct CColTriangle
@@ -106,8 +104,6 @@ struct CColModel
void SetLinkPtr(CLink<CColModel*>*);
void GetTrianglePoint(CVector &v, int i) const;
- CColModel *ctor(void) { return ::new (this) CColModel(); }
- void dtor(void) { this->CColModel::~CColModel(); }
CColModel& operator=(const CColModel& other);
};
diff --git a/src/core/CutsceneMgr.cpp b/src/core/CutsceneMgr.cpp
index c13aa3a8..a3ff2fd0 100644
--- a/src/core/CutsceneMgr.cpp
+++ b/src/core/CutsceneMgr.cpp
@@ -9,12 +9,14 @@
#include "FileMgr.h"
#include "main.h"
#include "AnimManager.h"
+#include "AnimBlendAssociation.h"
#include "AnimBlendAssocGroup.h"
#include "AnimBlendClumpData.h"
#include "Pad.h"
#include "DMAudio.h"
#include "World.h"
#include "PlayerPed.h"
+#include "Wanted.h"
#include "CutsceneHead.h"
#include "RpAnimBlend.h"
#include "ModelIndices.h"
diff --git a/src/core/EventList.cpp b/src/core/EventList.cpp
index 4364359a..d72e32c4 100644
--- a/src/core/EventList.cpp
+++ b/src/core/EventList.cpp
@@ -212,7 +212,7 @@ CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCar
#ifdef VC_PED_PORTS
if (crime == CRIME_HIT_PED && ((CPed*)crimeId)->IsPointerValid() &&
- FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 && ((CPed*)crimeId)->m_ped_flagE2) {
+ FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 && ((CPed*)crimeId)->bBeingChasedByPolice) {
if(!((CPed*)crimeId)->DyingOrDead()) {
sprintf(gString, "$50 Good Citizen Bonus!");
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index aff8a3ec..0bade6c7 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -94,7 +94,6 @@ int32 *&pControlEdit = *(int32**)0x628D08;
bool &DisplayComboButtonErrMsg = *(bool*)0x628D14;
int32 &MouseButtonJustClicked = *(int32*)0x628D0C;
int32 &JoyButtonJustClicked = *(int32*)0x628D10;
-uint32 &nTimeForSomething = *(uint32*)0x628D54;
bool &holdingScrollBar = *(bool*)0x628D59;
//int32 *pControlTemp = 0;
@@ -2202,15 +2201,15 @@ CMenuManager::ProcessButtonPresses(void)
field_535 = false;
}
- static int nTimeForSomething = 0;
+ static uint32 lastTimeClickedScrollButton = 0;
- if (CTimer::GetTimeInMillisecondsPauseMode() - nTimeForSomething >= 200) {
+ if (CTimer::GetTimeInMillisecondsPauseMode() - lastTimeClickedScrollButton >= 200) {
m_bPressedPgUpOnList = false;
m_bPressedPgDnOnList = false;
m_bPressedUpOnList = false;
m_bPressedDownOnList = false;
m_bPressedScrollButton = false;
- nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
+ lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
}
if (CPad::GetPad(0)->GetTabJustDown()) {
@@ -2249,7 +2248,7 @@ CMenuManager::ProcessButtonPresses(void)
m_nCurrExLayer = 19;
if (!m_bPressedUpOnList) {
m_bPressedUpOnList = true;
- nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
+ lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
ScrollUpListByOne();
}
@@ -2271,7 +2270,7 @@ CMenuManager::ProcessButtonPresses(void)
m_nCurrExLayer = 19;
if (!m_bPressedDownOnList) {
m_bPressedDownOnList = true;
- nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
+ lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
ScrollDownListByOne();
}
@@ -2286,7 +2285,7 @@ CMenuManager::ProcessButtonPresses(void)
m_nCurrExLayer = 19;
if (!m_bPressedPgUpOnList) {
m_bPressedPgUpOnList = true;
- nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
+ lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
m_bShowMouse = false;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
PageUpList(false);
@@ -2298,7 +2297,7 @@ CMenuManager::ProcessButtonPresses(void)
m_nCurrExLayer = 19;
if (!m_bPressedPgDnOnList) {
m_bPressedPgDnOnList = true;
- nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
+ lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
m_bShowMouse = false;
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_DENIED, 0);
PageDownList(false);
@@ -2384,7 +2383,7 @@ CMenuManager::ProcessButtonPresses(void)
case HOVEROPTION_CLICKED_SCROLL_UP:
if (!m_bPressedScrollButton) {
m_bPressedScrollButton = true;
- nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
+ lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
ScrollUpListByOne();
}
break;
@@ -2392,7 +2391,7 @@ CMenuManager::ProcessButtonPresses(void)
case HOVEROPTION_CLICKED_SCROLL_DOWN:
if (!m_bPressedScrollButton) {
m_bPressedScrollButton = true;
- nTimeForSomething = CTimer::GetTimeInMillisecondsPauseMode();
+ lastTimeClickedScrollButton = CTimer::GetTimeInMillisecondsPauseMode();
ScrollDownListByOne();
}
break;
@@ -3593,7 +3592,7 @@ void CMenuManager::SwitchMenuOnAndOff()
PcSaveHelper.PopulateSlotInfo();
m_nCurrOption = 0;
}
-/* // PS2 leftover?
+/* // PS2 leftover
if (m_nCurrScreen != MENUPAGE_SOUND_SETTINGS && gMusicPlaying)
{
DMAudio.StopFrontEndTrack();
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index e89d62a0..fce0c67f 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -41,6 +41,8 @@
#include "Record.h"
#include "Renderer.h"
#include "Replay.h"
+#include "References.h"
+#include "Radar.h"
#include "Restart.h"
#include "RoadBlocks.h"
#include "PedRoutes.h"
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 9a911aa4..6bbe00f2 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -7,7 +7,7 @@
#include "common.h"
#ifdef XINPUT
#include <Xinput.h>
-#pragma comment( lib, "Xinput.lib" )
+#pragma comment( lib, "Xinput9_1_0.lib" )
#endif
#include "patcher.h"
#include "Pad.h"
@@ -574,8 +574,9 @@ void CPad::AffectFromXinput(uint32 pad)
PCTempJoyState.RightShoulder2 = xstate.Gamepad.bRightTrigger;
PCTempJoyState.Select = (xstate.Gamepad.wButtons & XINPUT_GAMEPAD_BACK) ? 255 : 0;
+#ifdef REGISTER_START_BUTTON
PCTempJoyState.Start = (xstate.Gamepad.wButtons & XINPUT_GAMEPAD_START) ? 255 : 0;
-
+#endif
float lx = (float)xstate.Gamepad.sThumbLX / (float)0x7FFF;
float ly = (float)xstate.Gamepad.sThumbLY / (float)0x7FFF;
float rx = (float)xstate.Gamepad.sThumbRX / (float)0x7FFF;
@@ -590,6 +591,24 @@ void CPad::AffectFromXinput(uint32 pad)
PCTempJoyState.RightStickX = (int32)(rx * 128.0f);
PCTempJoyState.RightStickY = (int32)(ry * 128.0f);
}
+
+ XINPUT_VIBRATION VibrationState;
+
+ memset(&VibrationState, 0, sizeof(XINPUT_VIBRATION));
+
+ uint16 iLeftMotor = (uint16)((float)ShakeFreq / 255.0f * (float)0xffff);
+ uint16 iRightMotor = (uint16)((float)ShakeFreq / 255.0f * (float)0xffff);
+
+ if (ShakeDur < CTimer::GetTimeStepInMilliseconds())
+ ShakeDur = 0;
+ else
+ ShakeDur -= CTimer::GetTimeStepInMilliseconds();
+ if (ShakeDur == 0) ShakeFreq = 0;
+
+ VibrationState.wLeftMotorSpeed = iLeftMotor;
+ VibrationState.wRightMotorSpeed = iRightMotor;
+
+ XInputSetState(pad, &VibrationState);
}
}
#endif
@@ -617,6 +636,7 @@ void CPad::UpdatePads(void)
if ( bUpdate )
{
GetPad(0)->Update(0);
+ GetPad(1)->Update(0);
}
#if defined(MASTER) && !defined(XINPUT)
diff --git a/src/core/Placeable.cpp b/src/core/Placeable.cpp
index d2cec82b..c882fc27 100644
--- a/src/core/Placeable.cpp
+++ b/src/core/Placeable.cpp
@@ -63,6 +63,8 @@ CPlaceable::IsWithinArea(float x1, float y1, float z1, float x2, float y2, float
z1 <= GetPosition().z && GetPosition().z <= z2;
}
+#include <new>
+
class CPlaceable_ : public CPlaceable
{
public:
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp
index e0c0259e..ead32ee7 100644
--- a/src/core/PlayerInfo.cpp
+++ b/src/core/PlayerInfo.cpp
@@ -2,7 +2,9 @@
#include "patcher.h"
#include "main.h"
#include "PlayerPed.h"
+#include "Wanted.h"
#include "PlayerInfo.h"
+#include "Fire.h"
#include "Frontend.h"
#include "PlayerSkin.h"
#include "Darkel.h"
@@ -12,6 +14,7 @@
#include "Remote.h"
#include "World.h"
#include "Replay.h"
+#include "Camera.h"
#include "Pad.h"
#include "ProjectileInfo.h"
#include "Explosion.h"
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 6106f3df..3dcb767a 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -10,6 +10,7 @@
#include "TxdStore.h"
#include "ModelIndices.h"
#include "Pools.h"
+#include "Wanted.h"
#include "Directory.h"
#include "RwHelper.h"
#include "World.h"
diff --git a/src/core/common.h b/src/core/common.h
index 0cdff871..7b4ff4a0 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -10,8 +10,6 @@
#include <stdint.h>
#include <string.h>
#include <math.h>
-//#include <assert.h>
-#include <new>
#ifdef WITHWINDOWS
#include <Windows.h>
diff --git a/src/entities/Building.cpp b/src/entities/Building.cpp
index 188cbfe7..7813c87f 100644
--- a/src/entities/Building.cpp
+++ b/src/entities/Building.cpp
@@ -21,6 +21,8 @@ CBuilding::ReplaceWithNewModel(int32 id)
CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE);
}
+#include <new>
+
class CBuilding_ : public CBuilding
{
public:
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 04a93420..8bec1ac8 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -865,6 +865,8 @@ CEntity::ModifyMatrixForBannerInWind(void)
UpdateRwFrame();
}
+#include <new>
+
class CEntity_ : public CEntity
{
public:
diff --git a/src/math/Vector.h b/src/math/Vector.h
index cd436123..6f544ada 100644
--- a/src/math/Vector.h
+++ b/src/math/Vector.h
@@ -38,6 +38,14 @@ public:
}else
x = 1.0f;
}
+
+ void Normalise(float norm) {
+ float sq = MagnitudeSqr();
+ float invsqrt = RecipSqrt(norm, sq);
+ x *= invsqrt;
+ y *= invsqrt;
+ z *= invsqrt;
+ }
const CVector &operator+=(CVector const &right) {
x += right.x;
diff --git a/src/objects/DummyObject.cpp b/src/objects/DummyObject.cpp
index 9649cf7a..ba09ac3e 100644
--- a/src/objects/DummyObject.cpp
+++ b/src/objects/DummyObject.cpp
@@ -12,6 +12,8 @@ CDummyObject::CDummyObject(CObject *obj)
m_level = obj->m_level;
}
+#include <new>
+
class CDummyObject_ : public CDummyObject
{
public:
diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp
index 357d67d7..89959975 100644
--- a/src/objects/Object.cpp
+++ b/src/objects/Object.cpp
@@ -5,6 +5,7 @@
#include "Pools.h"
#include "Radar.h"
#include "Object.h"
+#include "DummyObject.h"
WRAPPER void CObject::ObjectDamage(float amount) { EAXJMP(0x4BB240); }
WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); }
@@ -141,6 +142,8 @@ CObject::CanBeDeleted(void)
}
}
+#include <new>
+
class CObject_ : public CObject
{
public:
diff --git a/src/objects/Object.h b/src/objects/Object.h
index b9c570f5..9fcf9c0c 100644
--- a/src/objects/Object.h
+++ b/src/objects/Object.h
@@ -1,7 +1,6 @@
#pragma once
#include "Physical.h"
-#include "DummyObject.h"
enum {
GAME_OBJECT = 1,
@@ -26,6 +25,7 @@ enum {
};
class CVehicle;
+class CDummyObject;
class CObject : public CPhysical
{
diff --git a/src/objects/Projectile.cpp b/src/objects/Projectile.cpp
index 0f6542e7..32bc6bdb 100644
--- a/src/objects/Projectile.cpp
+++ b/src/objects/Projectile.cpp
@@ -14,6 +14,8 @@ CProjectile::CProjectile(int32 model) : CObject()
ObjectCreatedBy = MISSION_OBJECT;
}
+#include <new>
+
class CProjectile_ : public CProjectile
{
public:
diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp
index bb61e086..533d7c98 100644
--- a/src/peds/CivilianPed.cpp
+++ b/src/peds/CivilianPed.cpp
@@ -4,6 +4,8 @@
#include "Phones.h"
#include "General.h"
#include "PlayerPed.h"
+#include "Wanted.h"
+#include "DMAudio.h"
#include "World.h"
#include "Vehicle.h"
#include "SurfaceTable.h"
@@ -377,6 +379,8 @@ CCivilianPed::ProcessControl(void)
Avoid();
}
+#include <new>
+
class CCivilianPed_ : public CCivilianPed
{
public:
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index dae866a4..b5812136 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -3,15 +3,19 @@
#include "World.h"
#include "PlayerPed.h"
#include "CopPed.h"
+#include "Wanted.h"
+#include "DMAudio.h"
#include "ModelIndices.h"
#include "Vehicle.h"
#include "RpAnimBlend.h"
+#include "AnimBlendAssociation.h"
#include "General.h"
#include "ZoneCull.h"
#include "PathFind.h"
#include "RoadBlocks.h"
-
-WRAPPER void CCopPed::ProcessControl() { EAXJMP(0x4C1400); }
+#include "CarCtrl.h"
+#include "Renderer.h"
+#include "Camera.h"
CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
{
@@ -62,12 +66,12 @@ CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
field_1356 = 0;
m_attackTimer = 0;
m_bBeatingSuspect = false;
- m_bZoneDisabledButClose = false;
+ m_bStopAndShootDisabledZone = false;
m_bZoneDisabled = false;
field_1364 = -1;
m_pPointGunAt = nil;
- // VC also initializes in here, but it keeps object
+ // VC also initializes in here, but as nil
#ifdef FIX_BUGS
m_wRoadblockNode = -1;
#endif
@@ -171,7 +175,7 @@ CCopPed::ClearPursuit(void)
bIsRunning = false;
bNotAllowedToDuck = false;
bKindaStayInSamePlace = false;
- m_bZoneDisabledButClose = false;
+ m_bStopAndShootDisabledZone = false;
m_bZoneDisabled = false;
ClearObjective();
if (IsPedInControl()) {
@@ -213,7 +217,7 @@ CCopPed::SetPursuit(bool ignoreCopLimit)
SetObjectiveTimer(0);
bNotAllowedToDuck = true;
bIsRunning = true;
- m_bZoneDisabledButClose = false;
+ m_bStopAndShootDisabledZone = false;
}
}
}
@@ -315,13 +319,15 @@ CCopPed::CopAI(void)
m_prevObjective = OBJECTIVE_NONE;
m_nLastPedState = PED_NONE;
SetAttackTimer(0);
+
+ // Safe distance for disabled zone? Or to just make game easier?
if (m_fDistanceToTarget > 15.0f)
- m_bZoneDisabledButClose = true;
+ m_bStopAndShootDisabledZone = true;
}
} else if (m_bZoneDisabled && !CCullZones::NoPolice()) {
m_bZoneDisabled = false;
m_bIsDisabledCop = false;
- m_bZoneDisabledButClose = false;
+ m_bStopAndShootDisabledZone = false;
bKindaStayInSamePlace = false;
bCrouchWhenShooting = false;
bDuckAndCover = false;
@@ -524,7 +530,7 @@ CCopPed::CopAI(void)
if (!anotherCopChasesHim) {
SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, nearPed);
nearPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, this);
- nearPed->m_ped_flagE2 = true;
+ nearPed->bBeingChasedByPolice = true;
return;
}
}
@@ -551,16 +557,200 @@ CCopPed::CopAI(void)
}
}
+void
+CCopPed::ProcessControl(void)
+{
+ if (m_nZoneLevel > LEVEL_NONE && m_nZoneLevel != CCollision::ms_collisionInMemory)
+ return;
+
+ CPed::ProcessControl();
+ if (bWasPostponed)
+ return;
+
+ if (m_nPedState == PED_DEAD) {
+ ClearPursuit();
+ m_objective = OBJECTIVE_NONE;
+ return;
+ }
+ if (m_nPedState == PED_DIE)
+ return;
+
+ if (m_nPedState == PED_ARREST_PLAYER) {
+ ArrestPlayer();
+ return;
+ }
+ GetWeapon()->Update(m_audioEntityId);
+ if (m_moved.Magnitude() > 0.0f)
+ Avoid();
+
+ CPhysical *playerOrHisVeh = FindPlayerVehicle() ? (CPhysical*)FindPlayerVehicle() : (CPhysical*)FindPlayerPed();
+ CPlayerPed *player = FindPlayerPed();
+
+ m_fDistanceToTarget = (playerOrHisVeh->GetPosition() - GetPosition()).Magnitude();
+ if (player->m_nPedState == PED_ARRESTED || player->DyingOrDead()) {
+ if (m_fDistanceToTarget < 5.0f) {
+ SetArrestPlayer(player);
+ return;
+ }
+ if (IsPedInControl())
+ SetIdle();
+ }
+ if (m_bIsInPursuit) {
+ if (player->m_nPedState != PED_ARRESTED && !player->DyingOrDead()) {
+ switch (m_nCopType) {
+ case COP_FBI:
+ Say(SOUND_PED_PURSUIT_FBI);
+ break;
+ case COP_SWAT:
+ Say(SOUND_PED_PURSUIT_SWAT);
+ break;
+ case COP_ARMY:
+ Say(SOUND_PED_PURSUIT_ARMY);
+ break;
+ default:
+ Say(SOUND_PED_PURSUIT_COP);
+ break;
+ }
+ }
+ }
+
+ if (IsPedInControl()) {
+ CopAI();
+ /* switch (m_nCopType)
+ {
+ case COP_FBI:
+ CopAI();
+ break;
+ case COP_SWAT:
+ CopAI();
+ break;
+ case COP_ARMY:
+ CopAI();
+ break;
+ default:
+ CopAI();
+ break;
+ } */
+ } else if (InVehicle()) {
+ if (m_pMyVehicle->pDriver == this && m_pMyVehicle->AutoPilot.m_nCarMission == MISSION_NONE &&
+ CanPedDriveOff() && m_pMyVehicle->VehicleCreatedBy != MISSION_VEHICLE) {
+
+ CCarCtrl::JoinCarWithRoadSystem(m_pMyVehicle);
+ m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
+ m_pMyVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
+ m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 17;
+ }
+ }
+ if (IsPedInControl() || m_nPedState == PED_DRIVING)
+ ScanForCrimes();
+
+ // They may have used goto to jump here in case of PED_ATTACK.
+ if (m_nPedState == PED_IDLE || m_nPedState == PED_ATTACK) {
+ if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT &&
+ player && player->EnteringCar() && m_fDistanceToTarget < 1.3f) {
+ SetArrestPlayer(player);
+ }
+ } else {
+ if (m_nPedState == PED_SEEK_POS) {
+ if (player->m_nPedState == PED_ARRESTED) {
+ SetIdle();
+ SetLookFlag(player, false);
+ SetLookTimer(1000);
+ RestorePreviousObjective();
+ } else {
+ if (player->m_pMyVehicle && player->m_pMyVehicle->m_nNumGettingIn != 0) {
+ // This is 1.3f when arresting in car without seeking first (in above)
+#if defined(VC_PED_PORTS) || defined(FIX_BUGS)
+ m_distanceToCountSeekDone = 1.3f;
+#else
+ m_distanceToCountSeekDone = 2.0f;
+#endif
+ }
+
+ if (bDuckAndCover) {
+ if (!bNotAllowedToDuck && Seek()) {
+ SetMoveState(PEDMOVE_STILL);
+ SetMoveAnim();
+ SetPointGunAt(m_pedInObjective);
+ }
+ } else if (Seek()) {
+ CVehicle *playerVeh = FindPlayerVehicle();
+ if (!playerVeh && player && player->EnteringCar()) {
+ SetArrestPlayer(player);
+ } else if (1.5f + GetPosition().z <= m_vecSeekPos.z || GetPosition().z - 0.3f >= m_vecSeekPos.z) {
+ SetMoveState(PEDMOVE_STILL);
+ } else if (playerVeh && playerVeh->CanPedEnterCar() && playerVeh->m_nNumGettingIn == 0) {
+ SetCarJack(playerVeh);
+ }
+ }
+ }
+ } else if (m_nPedState == PED_SEEK_ENTITY) {
+ if (!m_pSeekTarget) {
+ RestorePreviousState();
+ } else {
+ m_vecSeekPos = m_pSeekTarget->GetPosition();
+ if (Seek()) {
+ if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT && m_fDistanceToTarget < 2.5f && player) {
+ if (player->m_nPedState == PED_ARRESTED || player->m_nPedState == PED_ENTER_CAR ||
+ (player->m_nPedState == PED_CARJACK && m_fDistanceToTarget < 1.3f)) {
+ SetArrestPlayer(player);
+ } else
+ RestorePreviousState();
+ } else {
+ RestorePreviousState();
+ }
+
+ }
+ }
+ }
+ }
+ if (!m_bStopAndShootDisabledZone)
+ return;
+
+ bool dontShoot = false;
+ if (GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(this)) {
+ if (((CTimer::GetFrameCounter() + m_randomSeed) & 0x1F) == 17) {
+ CEntity *foundBuilding = nil;
+ CColPoint foundCol;
+ CVector lookPos = GetPosition() + CVector(0.0f, 0.0f, 0.7f);
+ CVector camPos = TheCamera.GetGameCamPosition();
+ CWorld::ProcessLineOfSight(camPos, lookPos, foundCol, foundBuilding,
+ true, false, false, false, false, false, false);
+
+ // He's at least 15.0 far, in disabled zone, collided into somewhere (that's why m_bStopAndShootDisabledZone set),
+ // and now has building on front of him. He's stupid, we don't need him.
+ if (foundBuilding) {
+ FlagToDestroyWhenNextProcessed();
+ dontShoot = true;
+ }
+ }
+ } else {
+ FlagToDestroyWhenNextProcessed();
+ dontShoot = true;
+ }
+
+ if (!dontShoot) {
+ bStopAndShoot = true;
+ bKindaStayInSamePlace = true;
+ bIsPointingGunAt = true;
+ SetAttack(m_pedInObjective);
+ }
+}
+
+#include <new>
+
class CCopPed_ : public CCopPed
{
public:
CCopPed *ctor(eCopType type) { return ::new (this) CCopPed(type); };
void dtor(void) { CCopPed::~CCopPed(); }
+ void ProcessControl_(void) { CCopPed::ProcessControl(); }
};
STARTPATCHES
InjectHook(0x4C11B0, &CCopPed_::ctor, PATCH_JUMP);
InjectHook(0x4C13E0, &CCopPed_::dtor, PATCH_JUMP);
+ InjectHook(0x4C1400, &CCopPed_::ProcessControl_, PATCH_JUMP);
InjectHook(0x4C28C0, &CCopPed::ClearPursuit, PATCH_JUMP);
InjectHook(0x4C2B00, &CCopPed::SetArrestPlayer, PATCH_JUMP);
InjectHook(0x4C27D0, &CCopPed::SetPursuit, PATCH_JUMP);
diff --git a/src/peds/CopPed.h b/src/peds/CopPed.h
index 142be56a..625cae49 100644
--- a/src/peds/CopPed.h
+++ b/src/peds/CopPed.h
@@ -17,10 +17,10 @@ public:
int8 field_1343;
float m_fDistanceToTarget;
int8 m_bIsInPursuit;
- int8 m_bIsDisabledCop; // What disabled cop actually is?
+ int8 m_bIsDisabledCop;
int8 field_1350;
bool m_bBeatingSuspect;
- int8 m_bZoneDisabledButClose;
+ int8 m_bStopAndShootDisabledZone;
int8 m_bZoneDisabled;
int8 field_1354;
int8 field_1355;
diff --git a/src/peds/EmergencyPed.cpp b/src/peds/EmergencyPed.cpp
index ee559f57..3a5067e7 100644
--- a/src/peds/EmergencyPed.cpp
+++ b/src/peds/EmergencyPed.cpp
@@ -1,6 +1,7 @@
#include "common.h"
#include "patcher.h"
#include "EmergencyPed.h"
+#include "DMAudio.h"
#include "ModelIndices.h"
#include "Vehicle.h"
#include "Fire.h"
@@ -413,6 +414,8 @@ CEmergencyPed::MedicAI(void)
}
}
+#include <new>
+
class CEmergencyPed_ : public CEmergencyPed
{
public:
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index c8e8c4e4..8b83d976 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -7,13 +7,21 @@
#include "World.h"
#include "RpAnimBlend.h"
#include "Ped.h"
+#include "Wanted.h"
#include "PlayerPed.h"
+#include "PedType.h"
+#include "AnimBlendClumpData.h"
+#include "AnimBlendAssociation.h"
+#include "Fire.h"
+#include "DMAudio.h"
#include "General.h"
#include "SurfaceTable.h"
#include "VisibilityPlugins.h"
#include "AudioManager.h"
#include "HandlingMgr.h"
#include "Replay.h"
+#include "Camera.h"
+#include "Radar.h"
#include "PedPlacement.h"
#include "Shadows.h"
#include "Weather.h"
@@ -552,7 +560,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bScriptObjectiveCompleted = false;
bKindaStayInSamePlace = false;
- m_ped_flagE2 = false;
+ bBeingChasedByPolice = false;
bNotAllowedToDuck = false;
bCrouchWhenShooting = false;
bIsDucking = false;
@@ -9597,7 +9605,7 @@ CPed::ProcessControl(void)
float neededTurnToCriminal = angleToLookCriminal - angleToFace;
if (neededTurnToCriminal > DEGTORAD(150.0f) && neededTurnToCriminal < DEGTORAD(210.0f)) {
- ((CCopPed*)this)->m_bZoneDisabledButClose = true;
+ ((CCopPed*)this)->m_bStopAndShootDisabledZone = true;
}
}
}
@@ -17455,6 +17463,8 @@ CPed::SetExitBoat(CVehicle *boat)
CWaterLevel::FreeBoatWakeArray();
}
+#include <new>
+
class CPed_ : public CPed
{
public:
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index a19dc9f0..2edd5d68 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -3,14 +3,9 @@
#include "Physical.h"
#include "Weapon.h"
#include "PedStats.h"
-#include "PedType.h"
#include "PedIK.h"
#include "AnimManager.h"
-#include "AnimBlendClumpData.h"
-#include "AnimBlendAssociation.h"
#include "WeaponInfo.h"
-#include "Fire.h"
-#include "DMAudio.h"
#include "EventList.h"
#define FEET_OFFSET 1.04f
@@ -19,6 +14,10 @@
struct CPathNode;
class CAccident;
class CObject;
+class CFire;
+struct AnimBlendFrameData;
+class CAnimBlendAssociation;
+enum eCrimeType;
struct PedAudioData
{
@@ -339,7 +338,7 @@ public:
uint8 bScriptObjectiveCompleted : 1;
uint8 bKindaStayInSamePlace : 1;
- uint8 m_ped_flagE2 : 1; // bBeingChasedByPolice?
+ uint8 bBeingChasedByPolice : 1; // Unused VC leftover. Should've been set for criminal/gang members
uint8 bNotAllowedToDuck : 1;
uint8 bCrouchWhenShooting : 1;
uint8 bIsDucking : 1;
diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp
index 38ab429e..cc4b0dd0 100644
--- a/src/peds/PedIK.cpp
+++ b/src/peds/PedIK.cpp
@@ -80,7 +80,7 @@ CPedIK::RotateTorso(AnimBlendFrameData *animBlend, LimbOrientation *limb, bool c
}
void
-CPedIK::GetComponentPosition(RwV3d *pos, PedNode node)
+CPedIK::GetComponentPosition(RwV3d *pos, uint32 node)
{
RwFrame *f;
RwMatrix *mat;
diff --git a/src/peds/PedIK.h b/src/peds/PedIK.h
index dc3f8dda..df9017f3 100644
--- a/src/peds/PedIK.h
+++ b/src/peds/PedIK.h
@@ -1,6 +1,5 @@
#pragma once
#include "common.h"
-#include "PedModelInfo.h"
#include "AnimBlendClumpData.h"
struct LimbOrientation
@@ -52,7 +51,7 @@ public:
bool PointGunInDirection(float phi, float theta);
bool PointGunInDirectionUsingArm(float phi, float theta);
bool PointGunAtPosition(CVector const& position);
- void GetComponentPosition(RwV3d *pos, PedNode node);
+ void GetComponentPosition(RwV3d *pos, uint32 node);
static RwMatrix *GetWorldMatrix(RwFrame *source, RwMatrix *destination);
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
void ExtractYawAndPitchLocal(RwMatrixTag *mat, float *yaw, float *pitch);
diff --git a/src/peds/PedPlacement.cpp b/src/peds/PedPlacement.cpp
index b22e1d58..e5f6a077 100644
--- a/src/peds/PedPlacement.cpp
+++ b/src/peds/PedPlacement.cpp
@@ -1,5 +1,6 @@
#include "common.h"
#include "patcher.h"
+#include "Ped.h"
#include "PedPlacement.h"
#include "World.h"
diff --git a/src/peds/PedPlacement.h b/src/peds/PedPlacement.h
index b1b5be93..6ba4ae71 100644
--- a/src/peds/PedPlacement.h
+++ b/src/peds/PedPlacement.h
@@ -1,7 +1,5 @@
#pragma once
-#include "Ped.h"
-
class CPedPlacement {
public:
static void FindZCoorForPed(CVector* pos);
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index c6580d32..5275f716 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -1,11 +1,16 @@
#include "common.h"
#include "patcher.h"
#include "PlayerPed.h"
+#include "Wanted.h"
+#include "Fire.h"
+#include "DMAudio.h"
+#include "Pad.h"
#include "Camera.h"
#include "WeaponEffects.h"
#include "ModelIndices.h"
#include "World.h"
#include "RpAnimBlend.h"
+#include "AnimBlendAssociation.h"
#include "General.h"
#include "Pools.h"
#include "Darkel.h"
@@ -1414,6 +1419,8 @@ CPlayerPed::ProcessControl(void)
}
}
+#include <new>
+
class CPlayerPed_ : public CPlayerPed
{
public:
diff --git a/src/peds/PlayerPed.h b/src/peds/PlayerPed.h
index b27cd983..c139bbbc 100644
--- a/src/peds/PlayerPed.h
+++ b/src/peds/PlayerPed.h
@@ -1,8 +1,10 @@
#pragma once
#include "Ped.h"
-#include "Wanted.h"
-#include "Pad.h"
+
+class CPad;
+class CCopPed;
+class CWanted;
class CPlayerPed : public CPed
{
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 6b674dd3..3bf81066 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -4,6 +4,8 @@
#include "General.h"
#include "World.h"
#include "Population.h"
+#include "CopPed.h"
+#include "Wanted.h"
#include "FileMgr.h"
#include "Gangs.h"
#include "ModelIndices.h"
@@ -11,6 +13,7 @@
#include "CivilianPed.h"
#include "EmergencyPed.h"
#include "Replay.h"
+#include "Camera.h"
#include "CutsceneMgr.h"
#include "CarCtrl.h"
#include "IniFile.h"
@@ -110,7 +113,8 @@ CPopulation::ChooseCivilianOccupation(int32 group)
return ms_pPedGroups[group].models[CGeneral::GetRandomNumberInRange(0, NUMMODELSPERPEDGROUP)];
}
-eCopType
+// returns eCopType
+int32
CPopulation::ChoosePolicePedOccupation()
{
CGeneral::GetRandomNumber();
@@ -512,9 +516,9 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
uint32 weapon;
if (CGeneral::GetRandomNumberInRange(0, 100) >= 50)
- weapon = ped->GiveWeapon(CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon2, 25001);
+ weapon = ped->GiveWeapon((eWeaponType)CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon2, 25001);
else
- weapon = ped->GiveWeapon(CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon1, 25001);
+ weapon = ped->GiveWeapon((eWeaponType)CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon1, 25001);
ped->SetCurrentWeapon(weapon);
return ped;
}
diff --git a/src/peds/Population.h b/src/peds/Population.h
index b299c0a1..f9e6c3b7 100644
--- a/src/peds/Population.h
+++ b/src/peds/Population.h
@@ -2,11 +2,11 @@
#include "Game.h"
#include "PedType.h"
-#include "CopPed.h"
class CPed;
class CVehicle;
class CDummyObject;
+class CObject;
struct PedGroup
{
@@ -71,7 +71,7 @@ public:
static bool IsPointInSafeZone(CVector *coors);
static void RemovePed(CPed *ent);
static int32 ChooseCivilianOccupation(int32);
- static eCopType ChoosePolicePedOccupation();
+ static int32 ChoosePolicePedOccupation();
static int32 ChooseGangOccupation(int);
static void FindCollisionZoneForCoors(CVector*, int*, eLevelName*);
static void FindClosestZoneForCoors(CVector*, int*, eLevelName, eLevelName);
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 52930067..51aa390f 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -11,6 +11,7 @@
#include "Pad.h"
#include "Radar.h"
#include "Replay.h"
+#include "Wanted.h"
#include "Sprite.h"
#include "Sprite2d.h"
#include "Text.h"
diff --git a/src/render/WaterCannon.cpp b/src/render/WaterCannon.cpp
index 7a9aa4d9..e848fb43 100644
--- a/src/render/WaterCannon.cpp
+++ b/src/render/WaterCannon.cpp
@@ -1,10 +1,320 @@
#include "common.h"
#include "patcher.h"
#include "WaterCannon.h"
+#include "Vector.h"
+#include "General.h"
+#include "main.h"
+#include "Timer.h"
+#include "Pools.h"
+#include "Ped.h"
+#include "AnimManager.h"
+#include "Fire.h"
+#include "WaterLevel.h"
+#include "Camera.h"
-CWaterCannon (&aCannons)[NUM_WATERCANNONS] = *(CWaterCannon(*)[NUM_WATERCANNONS])*(uintptr*)0x8F2CA8;
+#define WATERCANNONVERTS 4
+#define WATERCANNONINDEXES 12
-WRAPPER void CWaterCannons::Update(void) { EAXJMP(0x522510); }
-WRAPPER void CWaterCannons::UpdateOne(uint32 id, CVector *pos, CVector *dir) { EAXJMP(0x522470); }
-WRAPPER void CWaterCannons::Render(void) { EAXJMP(0x522550); }
-WRAPPER void CWaterCannons::Init(void) { EAXJMP(0x522440); }
+RwIm3DVertex WaterCannonVertices[WATERCANNONVERTS];
+RwImVertexIndex WaterCannonIndexList[WATERCANNONINDEXES];
+
+CWaterCannon CWaterCannons::aCannons[NUM_WATERCANNONS];
+
+void CWaterCannon::Init(void)
+{
+ m_nId = 0;
+ m_nCur = 0;
+ m_nTimeCreated = CTimer::GetTimeInMilliseconds();
+
+ for ( int32 i = 0; i < NUM_SEGMENTPOINTS; i++ )
+ m_abUsed[i] = false;
+
+ RwIm3DVertexSetU(&WaterCannonVertices[0], 0.0f);
+ RwIm3DVertexSetV(&WaterCannonVertices[0], 0.0f);
+
+ RwIm3DVertexSetU(&WaterCannonVertices[1], 1.0f);
+ RwIm3DVertexSetV(&WaterCannonVertices[1], 0.0f);
+
+ RwIm3DVertexSetU(&WaterCannonVertices[2], 0.0f);
+ RwIm3DVertexSetV(&WaterCannonVertices[2], 0.0f);
+
+ RwIm3DVertexSetU(&WaterCannonVertices[3], 1.0f);
+ RwIm3DVertexSetV(&WaterCannonVertices[3], 0.0f);
+
+ WaterCannonIndexList[0] = 0;
+ WaterCannonIndexList[1] = 1;
+ WaterCannonIndexList[2] = 2;
+
+ WaterCannonIndexList[3] = 1;
+ WaterCannonIndexList[4] = 3;
+ WaterCannonIndexList[5] = 2;
+
+ WaterCannonIndexList[6] = 0;
+ WaterCannonIndexList[7] = 2;
+ WaterCannonIndexList[8] = 1;
+
+ WaterCannonIndexList[9] = 1;
+ WaterCannonIndexList[10] = 2;
+ WaterCannonIndexList[11] = 3;
+}
+
+void CWaterCannon::Update_OncePerFrame(int16 index)
+{
+ ASSERT(index < NUM_WATERCANNONS);
+
+ if (CTimer::GetTimeInMilliseconds() > m_nTimeCreated + WATERCANNON_LIFETIME )
+ {
+ m_nCur = (m_nCur + 1) % -NUM_SEGMENTPOINTS;
+ m_abUsed[m_nCur] = false;
+ }
+
+ for ( int32 i = 0; i < NUM_SEGMENTPOINTS; i++ )
+ {
+ if ( m_abUsed[i] )
+ {
+ m_avecVelocity[i].z += -WATERCANNON_GRAVITY * CTimer::GetTimeStep();
+ m_avecPos[i] += m_avecVelocity[i] * CTimer::GetTimeStep();
+ }
+ }
+
+ int32 extinguishingPoint = CGeneral::GetRandomNumber() & (NUM_SEGMENTPOINTS - 1);
+ if ( m_abUsed[extinguishingPoint] )
+ gFireManager.ExtinguishPoint(m_avecPos[extinguishingPoint], 3.0f);
+
+ if ( ((index + CTimer::GetFrameCounter()) & 3) == 0 )
+ PushPeds();
+
+ // free if unused
+
+ int32 i = 0;
+ while ( 1 )
+ {
+ if ( m_abUsed[i] )
+ break;
+
+ if ( ++i >= NUM_SEGMENTPOINTS )
+ {
+ m_nId = 0;
+ return;
+ }
+ }
+}
+
+void CWaterCannon::Update_NewInput(CVector *pos, CVector *dir)
+{
+ ASSERT(pos != NULL);
+ ASSERT(dir != NULL);
+
+ m_avecPos[m_nCur] = *pos;
+ m_avecVelocity[m_nCur] = *dir;
+ m_abUsed[m_nCur] = true;
+}
+
+void CWaterCannon::Render(void)
+{
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
+ RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void *)TRUE);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)gpWaterRaster);
+
+ float v = float(CGeneral::GetRandomNumber() & 255) / 256;
+
+ RwIm3DVertexSetV(&WaterCannonVertices[0], v);
+ RwIm3DVertexSetV(&WaterCannonVertices[1], v);
+ RwIm3DVertexSetV(&WaterCannonVertices[2], v);
+ RwIm3DVertexSetV(&WaterCannonVertices[3], v);
+
+ int16 pointA = m_nCur % -NUM_SEGMENTPOINTS;
+
+ int16 pointB = pointA - 1;
+ if ( (pointA - 1) < 0 )
+ pointB += NUM_SEGMENTPOINTS;
+
+ bool bInit = false;
+ CVector norm;
+
+ for ( int32 i = 0; i < NUM_SEGMENTPOINTS - 1; i++ )
+ {
+ if ( m_abUsed[pointA] && m_abUsed[pointB] )
+ {
+ if ( !bInit )
+ {
+ CVector cp = CrossProduct(m_avecPos[pointB] - m_avecPos[pointA], TheCamera.GetForward());
+ cp.Normalise(0.05f);
+ norm = cp;
+ bInit = true;
+ }
+
+ float dist = float(i*i*i) / 300.0f + 1.0f;
+ float brightness = float(i) / NUM_SEGMENTPOINTS;
+
+ int32 color = (int32)((1.0f - brightness*brightness) * 255.0f);
+ CVector offset = dist * norm;
+
+ RwIm3DVertexSetRGBA(&WaterCannonVertices[0], color, color, color, color);
+ RwIm3DVertexSetPos (&WaterCannonVertices[0], m_avecPos[pointA].x - offset.x, m_avecPos[pointA].y - offset.y, m_avecPos[pointA].z - offset.z);
+
+ RwIm3DVertexSetRGBA(&WaterCannonVertices[1], color, color, color, color);
+ RwIm3DVertexSetPos (&WaterCannonVertices[1], m_avecPos[pointA].x + offset.x, m_avecPos[pointA].y + offset.y, m_avecPos[pointA].z + offset.z);
+
+ RwIm3DVertexSetRGBA(&WaterCannonVertices[2], color, color, color, color);
+ RwIm3DVertexSetPos (&WaterCannonVertices[2], m_avecPos[pointB].x - offset.x, m_avecPos[pointB].y - offset.y, m_avecPos[pointB].z - offset.z);
+
+ RwIm3DVertexSetRGBA(&WaterCannonVertices[3], color, color, color, color);
+ RwIm3DVertexSetPos (&WaterCannonVertices[3], m_avecPos[pointB].x + offset.x, m_avecPos[pointB].y + offset.y, m_avecPos[pointB].z + offset.z);
+
+ LittleTest();
+
+ if ( RwIm3DTransform(WaterCannonVertices, WATERCANNONVERTS, NULL, rwIM3D_VERTEXUV) )
+ {
+ RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, WaterCannonIndexList, WATERCANNONINDEXES);
+ RwIm3DEnd();
+ }
+ }
+
+ pointA = pointB--;
+ if ( pointB < 0 )
+ pointB += NUM_SEGMENTPOINTS;
+ }
+
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)TRUE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)FALSE);
+ RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void *)FALSE);
+}
+
+void CWaterCannon::PushPeds(void)
+{
+ float minx = 10000.0f;
+ float maxx = -10000.0f;
+ float miny = 10000.0f;
+ float maxy = -10000.0f;
+ float minz = 10000.0f;
+ float maxz = -10000.0f;
+
+ for ( int32 i = 0; i < NUM_SEGMENTPOINTS; i++ )
+ {
+ if ( m_abUsed[i] )
+ {
+ minx = min(minx, m_avecPos[i].x);
+ maxx = max(maxx, m_avecPos[i].x);
+
+ miny = min(miny, m_avecPos[i].y);
+ maxy = max(maxy, m_avecPos[i].y);
+
+ minz = min(minz, m_avecPos[i].z);
+ maxz = max(maxz, m_avecPos[i].z);
+ }
+ }
+
+ for ( int32 i = CPools::GetPedPool()->GetSize() - 1; i >= 0; i--)
+ {
+ CPed *ped = CPools::GetPedPool()->GetSlot(i);
+ if ( ped )
+ {
+ if ( ped->GetPosition().x > minx && ped->GetPosition().x < maxx
+ && ped->GetPosition().y > miny && ped->GetPosition().y < maxy
+ && ped->GetPosition().z > minz && ped->GetPosition().z < maxz )
+ {
+ for ( int32 j = 0; j < NUM_SEGMENTPOINTS; j++ )
+ {
+ if ( m_abUsed[j] )
+ {
+ CVector dist = m_avecPos[j] - ped->GetPosition();
+
+ if ( dist.MagnitudeSqr() < 5.0f )
+ {
+ int32 localDir = ped->GetLocalDirection(CVector2D(1.0f, 0.0f));
+
+ ped->bIsStanding = false;
+
+ ped->ApplyMoveForce(0.0f, 0.0f, 2.0f * CTimer::GetTimeStep());
+
+ ped->m_vecMoveSpeed.x = (0.6f * m_avecVelocity[j].x + ped->m_vecMoveSpeed.x) * 0.5f;
+ ped->m_vecMoveSpeed.y = (0.6f * m_avecVelocity[j].y + ped->m_vecMoveSpeed.y) * 0.5f;
+
+ ped->SetFall(2000, AnimationId(ANIM_KO_SKID_FRONT + localDir), 0);
+
+ CFire *fire = ped->m_pFire;
+ if ( fire )
+ fire->Extinguish();
+
+ j = NUM_SEGMENTPOINTS;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void CWaterCannons::Init(void)
+{
+ for ( int32 i = 0; i < NUM_WATERCANNONS; i++ )
+ aCannons[i].Init();
+}
+
+void CWaterCannons::UpdateOne(uint32 id, CVector *pos, CVector *dir)
+{
+ ASSERT(pos != NULL);
+ ASSERT(dir != NULL);
+
+ // find the one by id
+ {
+ int32 n = 0;
+ while ( n < NUM_WATERCANNONS && id != aCannons[n].m_nId )
+ n++;
+
+ if ( n < NUM_WATERCANNONS )
+ {
+ aCannons[n].Update_NewInput(pos, dir);
+ return;
+ }
+ }
+
+ // if no luck then find a free one
+ {
+ int32 n = 0;
+ while ( n < NUM_WATERCANNONS && 0 != aCannons[n].m_nId )
+ n++;
+
+ if ( n < NUM_WATERCANNONS )
+ {
+ aCannons[n].Init();
+ aCannons[n].m_nId = id;
+ aCannons[n].Update_NewInput(pos, dir);
+ return;
+ }
+ }
+}
+
+void CWaterCannons::Update(void)
+{
+ for ( int32 i = 0; i < NUM_WATERCANNONS; i++ )
+ {
+ if ( aCannons[i].m_nId != 0 )
+ aCannons[i].Update_OncePerFrame(i);
+ }
+}
+
+void CWaterCannons::Render(void)
+{
+ for ( int32 i = 0; i < NUM_WATERCANNONS; i++ )
+ {
+ if ( aCannons[i].m_nId != 0 )
+ aCannons[i].Render();
+ }
+}
+
+STARTPATCHES
+ InjectHook(0x521A30, &CWaterCannon::Init, PATCH_JUMP);
+ InjectHook(0x521B80, &CWaterCannon::Update_OncePerFrame, PATCH_JUMP);
+ InjectHook(0x521CC0, &CWaterCannon::Update_NewInput, PATCH_JUMP);
+ InjectHook(0x521D30, &CWaterCannon::Render, PATCH_JUMP);
+ InjectHook(0x5220B0, &CWaterCannon::PushPeds, PATCH_JUMP);
+ InjectHook(0x522440, CWaterCannons::Init, PATCH_JUMP);
+ InjectHook(0x522470, CWaterCannons::UpdateOne, PATCH_JUMP);
+ InjectHook(0x522510, CWaterCannons::Update, PATCH_JUMP);
+ InjectHook(0x522550, CWaterCannons::Render, PATCH_JUMP);
+ //InjectHook(0x522B40, `global constructor keyed to'watercannon.cpp, PATCH_JUMP);
+ //InjectHook(0x522B60, CWaterCannon::CWaterCannon, PATCH_JUMP);
+ENDPATCHES \ No newline at end of file
diff --git a/src/render/WaterCannon.h b/src/render/WaterCannon.h
index c2b288f2..826dc78e 100644
--- a/src/render/WaterCannon.h
+++ b/src/render/WaterCannon.h
@@ -1,15 +1,29 @@
#pragma once
+#define WATERCANNON_GRAVITY (0.009f)
+#define WATERCANNON_LIFETIME (150)
+
class CWaterCannon
{
public:
+ enum
+ {
+ NUM_SEGMENTPOINTS = 16,
+ };
+
int32 m_nId;
- int16 m_wIndex;
- char gap_6[2];
- int32 m_nTimeCreated;
- CVector m_avecPos[16];
- CVector m_avecVelocity[16];
- char m_abUsed[16];
+ int16 m_nCur;
+ char _pad0[2];
+ uint32 m_nTimeCreated;
+ CVector m_avecPos[NUM_SEGMENTPOINTS];
+ CVector m_avecVelocity[NUM_SEGMENTPOINTS];
+ bool m_abUsed[NUM_SEGMENTPOINTS];
+
+ void Init(void);
+ void Update_OncePerFrame(int16 index);
+ void Update_NewInput(CVector *pos, CVector *dir);
+ void Render(void);
+ void PushPeds(void);
};
static_assert(sizeof(CWaterCannon) == 412, "CWaterCannon: error");
@@ -17,11 +31,10 @@ static_assert(sizeof(CWaterCannon) == 412, "CWaterCannon: error");
class CWaterCannons
{
public:
- static void Update();
+ static CWaterCannon aCannons[NUM_WATERCANNONS];
+
+ static void Init(void);
static void UpdateOne(uint32 id, CVector *pos, CVector *dir);
+ static void Update();
static void Render(void);
- static void Init(void);
-};
-
-extern CWaterCannon (&aCannons)[NUM_WATERCANNONS];
-
+}; \ No newline at end of file
diff --git a/src/skel/win/resource.h b/src/skel/win/resource.h
index 2fb3dc50..84dffb95 100644
--- a/src/skel/win/resource.h
+++ b/src/skel/win/resource.h
@@ -8,6 +8,7 @@
#define IDEXIT 1002
#define IDC_SELECTDEVICE 1005
+#define IDI_MAIN_ICON 1042
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
diff --git a/src/skel/win/win.rc b/src/skel/win/win.rc
index 676b8ef7..379c473d 100644
--- a/src/skel/win/win.rc
+++ b/src/skel/win/win.rc
@@ -30,8 +30,18 @@ BEGIN
WS_TABSTOP
DEFPUSHBUTTON "EXIT",IDEXIT,103,69,52,14
DEFPUSHBUTTON "OK",IDOK,28,69,50,14
- LTEXT "Please select the device to use:",IDC_SELECTDEVICE,7,7,
+ LTEXT "Please select the Device To Use:",IDC_SELECTDEVICE,7,7,
137,8
END
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_MAIN_ICON ICON DISCARDABLE "gta3.ico"
+
+///////////////////////////////////////////////////////////////////////////// \ No newline at end of file
diff --git a/src/text/Pager.h b/src/text/Pager.h
index 727eeb24..1719e726 100644
--- a/src/text/Pager.h
+++ b/src/text/Pager.h
@@ -1,5 +1,5 @@
#pragma once
-
+
struct PagerMessage {
wchar *m_pText;
uint16 m_nSpeedMs;
@@ -9,20 +9,20 @@ struct PagerMessage {
uint32 m_nTimeToChangePosition;
int16 field_10;
int32 m_nNumber[6];
-};
-
-#define NUMPAGERMESSAGES 8
-
-class CPager
-{
+};
+
+#define NUMPAGERMESSAGES 8
+
+class CPager
+{
int16 m_nNumDisplayLetters;
- PagerMessage m_messages[NUMPAGERMESSAGES];
+ PagerMessage m_messages[NUMPAGERMESSAGES];
public:
- void Init();
- void Process();
- void Display();
+ void Init();
+ void Process();
+ void Display();
void AddMessage(wchar*, uint16, uint16, uint16);
- void AddMessageWithNumber(wchar *str, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, uint16 speed, uint16 priority, uint16 a11);
- void ClearMessages();
- void RestartCurrentMessage();
+ void AddMessageWithNumber(wchar *str, int32 n1, int32 n2, int32 n3, int32 n4, int32 n5, int32 n6, uint16 speed, uint16 priority, uint16 a11);
+ void ClearMessages();
+ void RestartCurrentMessage();
}; \ No newline at end of file
diff --git a/src/text/Text.cpp b/src/text/Text.cpp
index 40717ed5..8bffa7e1 100644
--- a/src/text/Text.cpp
+++ b/src/text/Text.cpp
@@ -1,92 +1,92 @@
-#include "common.h"
-#include "patcher.h"
-#include "FileMgr.h"
-#include "Frontend.h"
-#include "Messages.h"
-#include "Text.h"
-
-static wchar WideErrorString[25];
-
-CText &TheText = *(CText*)0x941520;
-
-CText::CText(void)
-{
- encoding = 'e';
- memset(WideErrorString, 0, sizeof(WideErrorString));
-}
-
-void
-CText::Load(void)
-{
- uint8 *filedata;
- char filename[32], type[4];
- int length;
- int offset, sectlen;
-
- Unload();
- filedata = new uint8[0x40000];
-
- CFileMgr::SetDir("TEXT");
- switch(CMenuManager::m_PrefsLanguage){
- case LANGUAGE_AMERICAN:
- sprintf(filename, "AMERICAN.GXT");
- break;
- case LANGUAGE_FRENCH:
- sprintf(filename, "FRENCH.GXT");
- break;
- case LANGUAGE_GERMAN:
- sprintf(filename, "GERMAN.GXT");
- break;
- case LANGUAGE_ITALIAN:
- sprintf(filename, "ITALIAN.GXT");
- break;
- case LANGUAGE_SPANISH:
- sprintf(filename, "SPANISH.GXT");
- break;
- }
-
- length = CFileMgr::LoadFile(filename, filedata, 0x40000, "rb");
- CFileMgr::SetDir("");
-
- offset = 0;
- while(offset < length){
- type[0] = filedata[offset++];
- type[1] = filedata[offset++];
- type[2] = filedata[offset++];
- type[3] = filedata[offset++];
- sectlen = (int)filedata[offset+3]<<24 | (int)filedata[offset+2]<<16 |
- (int)filedata[offset+1]<<8 | (int)filedata[offset+0];
- offset += 4;
- if(sectlen != 0){
- if(strncmp(type, "TKEY", 4) == 0)
- keyArray.Load(sectlen, filedata, &offset);
- else if(strncmp(type, "TDAT", 4) == 0)
- data.Load(sectlen, filedata, &offset);
- else
- offset += sectlen;
- }
- }
-
- keyArray.Update(data.chars);
-
- delete[] filedata;
-}
-
-void
-CText::Unload(void)
-{
- CMessages::ClearAllMessagesDisplayedByGame();
- data.Unload();
- keyArray.Unload();
-}
-
-wchar*
-CText::Get(const char *key)
-{
- return keyArray.Search(key);
-}
-
-wchar UpperCaseTable[128] = {
+#include "common.h"
+#include "patcher.h"
+#include "FileMgr.h"
+#include "Frontend.h"
+#include "Messages.h"
+#include "Text.h"
+
+static wchar WideErrorString[25];
+
+CText &TheText = *(CText*)0x941520;
+
+CText::CText(void)
+{
+ encoding = 'e';
+ memset(WideErrorString, 0, sizeof(WideErrorString));
+}
+
+void
+CText::Load(void)
+{
+ uint8 *filedata;
+ char filename[32], type[4];
+ int length;
+ int offset, sectlen;
+
+ Unload();
+ filedata = new uint8[0x40000];
+
+ CFileMgr::SetDir("TEXT");
+ switch(CMenuManager::m_PrefsLanguage){
+ case LANGUAGE_AMERICAN:
+ sprintf(filename, "AMERICAN.GXT");
+ break;
+ case LANGUAGE_FRENCH:
+ sprintf(filename, "FRENCH.GXT");
+ break;
+ case LANGUAGE_GERMAN:
+ sprintf(filename, "GERMAN.GXT");
+ break;
+ case LANGUAGE_ITALIAN:
+ sprintf(filename, "ITALIAN.GXT");
+ break;
+ case LANGUAGE_SPANISH:
+ sprintf(filename, "SPANISH.GXT");
+ break;
+ }
+
+ length = CFileMgr::LoadFile(filename, filedata, 0x40000, "rb");
+ CFileMgr::SetDir("");
+
+ offset = 0;
+ while(offset < length){
+ type[0] = filedata[offset++];
+ type[1] = filedata[offset++];
+ type[2] = filedata[offset++];
+ type[3] = filedata[offset++];
+ sectlen = (int)filedata[offset+3]<<24 | (int)filedata[offset+2]<<16 |
+ (int)filedata[offset+1]<<8 | (int)filedata[offset+0];
+ offset += 4;
+ if(sectlen != 0){
+ if(strncmp(type, "TKEY", 4) == 0)
+ keyArray.Load(sectlen, filedata, &offset);
+ else if(strncmp(type, "TDAT", 4) == 0)
+ data.Load(sectlen, filedata, &offset);
+ else
+ offset += sectlen;
+ }
+ }
+
+ keyArray.Update(data.chars);
+
+ delete[] filedata;
+}
+
+void
+CText::Unload(void)
+{
+ CMessages::ClearAllMessagesDisplayedByGame();
+ data.Unload();
+ keyArray.Unload();
+}
+
+wchar*
+CText::Get(const char *key)
+{
+ return keyArray.Search(key);
+}
+
+wchar UpperCaseTable[128] = {
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
150, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
@@ -98,10 +98,10 @@ wchar UpperCaseTable[128] = {
216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226,
227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237,
238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248,
- 249, 250, 251, 252, 253, 254, 255
-};
-
-wchar FrenchUpperCaseTable[128] = {
+ 249, 250, 251, 252, 253, 254, 255
+};
+
+wchar FrenchUpperCaseTable[128] = {
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
150, 65, 65, 65, 65, 132, 133, 69, 69, 69, 69, 73, 73,
@@ -113,11 +113,11 @@ wchar FrenchUpperCaseTable[128] = {
220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
- 253, 254, 255
-};
-
-wchar
-CText::GetUpperCase(wchar c)
+ 253, 254, 255
+};
+
+wchar
+CText::GetUpperCase(wchar c)
{
switch (encoding)
{
@@ -144,176 +144,176 @@ CText::GetUpperCase(wchar c)
default:
break;
}
- return c;
-}
-
-void
-CText::UpperCase(wchar *s)
-{
- while(*s){
- *s = GetUpperCase(*s);
- s++;
- }
-}
-
-
-void
-CKeyArray::Load(uint32 length, uint8 *data, int *offset)
-{
- uint32 i;
- uint8 *rawbytes;
-
- numEntries = length / sizeof(CKeyEntry);
- entries = new CKeyEntry[numEntries];
- rawbytes = (uint8*)entries;
-
- for(i = 0; i < length; i++)
- rawbytes[i] = data[(*offset)++];
-}
-
-void
-CKeyArray::Unload(void)
-{
- delete[] entries;
- entries = nil;
- numEntries = 0;
-}
-
-void
-CKeyArray::Update(wchar *chars)
-{
- int i;
- for(i = 0; i < numEntries; i++)
- entries[i].value = (wchar*)((uint8*)chars + (uintptr)entries[i].value);
-}
-
-CKeyEntry*
-CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high)
-{
- int mid;
- int diff;
-
- if(low > high)
- return nil;
-
- mid = (low + high)/2;
- diff = strcmp(key, entries[mid].key);
- if(diff == 0)
- return &entries[mid];
- if(diff < 0)
- return BinarySearch(key, entries, low, mid-1);
- if(diff > 0)
- return BinarySearch(key, entries, mid+1, high);
- return nil;
-}
-
-wchar*
-CKeyArray::Search(const char *key)
-{
- CKeyEntry *found;
- char errstr[25];
- int i;
-
- found = BinarySearch(key, entries, 0, numEntries-1);
- if(found)
- return found->value;
- sprintf(errstr, "%s missing", key);
- for(i = 0; i < 25; i++)
- WideErrorString[i] = errstr[i];
- return WideErrorString;
-}
-
-
-void
-CData::Load(uint32 length, uint8 *data, int *offset)
-{
- uint32 i;
- uint8 *rawbytes;
-
- numChars = length / sizeof(wchar);
- chars = new wchar[numChars];
- rawbytes = (uint8*)chars;
-
- for(i = 0; i < length; i++)
- rawbytes[i] = data[(*offset)++];
-}
-
-void
-CData::Unload(void)
-{
- delete[] chars;
- chars = nil;
- numChars = 0;
-}
-
-void
-AsciiToUnicode(const char *src, wchar *dst)
-{
- while((*dst++ = *src++) != '\0');
-}
-
-char*
-UnicodeToAscii(wchar *src)
-{
- static char aStr[256];
- int len;
- for(len = 0; *src != '\0' && len < 256-1; len++, src++)
- if(*src < 128)
- aStr[len] = *src;
- else
- aStr[len] = '#';
- aStr[len] = '\0';
- return aStr;
-}
-
-char*
-UnicodeToAsciiForSaveLoad(wchar *src)
-{
- static char aStr[256];
- int len;
- for(len = 0; *src != '\0' && len < 256-1; len++, src++)
- if(*src < 256)
- aStr[len] = *src;
- else
- aStr[len] = '#';
- aStr[len] = '\0';
- return aStr;
-}
-
-void
-UnicodeStrcpy(wchar *dst, const wchar *src)
-{
- while((*dst++ = *src++) != '\0');
-}
-
-int
-UnicodeStrlen(const wchar *str)
-{
- int len;
- for(len = 0; *str != '\0'; len++, str++);
- return len;
-}
-
-void
-TextCopy(wchar *dst, const wchar *src)
-{
- while((*dst++ = *src++) != '\0');
-}
-
-
-STARTPATCHES
- InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP);
- InjectHook(0x52C580, &CText::Unload, PATCH_JUMP);
- InjectHook(0x52C5A0, &CText::Get, PATCH_JUMP);
- InjectHook(0x52C220, &CText::GetUpperCase, PATCH_JUMP);
- InjectHook(0x52C2C0, &CText::UpperCase, PATCH_JUMP);
-
- InjectHook(0x52BE70, &CKeyArray::Load, PATCH_JUMP);
- InjectHook(0x52BF60, &CKeyArray::Unload, PATCH_JUMP);
- InjectHook(0x52BF80, &CKeyArray::Update, PATCH_JUMP);
- InjectHook(0x52C060, &CKeyArray::BinarySearch, PATCH_JUMP);
- InjectHook(0x52BFB0, &CKeyArray::Search, PATCH_JUMP);
-
- InjectHook(0x52C120, &CData::Load, PATCH_JUMP);
- InjectHook(0x52C200, &CData::Unload, PATCH_JUMP);
-ENDPATCHES
+ return c;
+}
+
+void
+CText::UpperCase(wchar *s)
+{
+ while(*s){
+ *s = GetUpperCase(*s);
+ s++;
+ }
+}
+
+
+void
+CKeyArray::Load(uint32 length, uint8 *data, int *offset)
+{
+ uint32 i;
+ uint8 *rawbytes;
+
+ numEntries = length / sizeof(CKeyEntry);
+ entries = new CKeyEntry[numEntries];
+ rawbytes = (uint8*)entries;
+
+ for(i = 0; i < length; i++)
+ rawbytes[i] = data[(*offset)++];
+}
+
+void
+CKeyArray::Unload(void)
+{
+ delete[] entries;
+ entries = nil;
+ numEntries = 0;
+}
+
+void
+CKeyArray::Update(wchar *chars)
+{
+ int i;
+ for(i = 0; i < numEntries; i++)
+ entries[i].value = (wchar*)((uint8*)chars + (uintptr)entries[i].value);
+}
+
+CKeyEntry*
+CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high)
+{
+ int mid;
+ int diff;
+
+ if(low > high)
+ return nil;
+
+ mid = (low + high)/2;
+ diff = strcmp(key, entries[mid].key);
+ if(diff == 0)
+ return &entries[mid];
+ if(diff < 0)
+ return BinarySearch(key, entries, low, mid-1);
+ if(diff > 0)
+ return BinarySearch(key, entries, mid+1, high);
+ return nil;
+}
+
+wchar*
+CKeyArray::Search(const char *key)
+{
+ CKeyEntry *found;
+ char errstr[25];
+ int i;
+
+ found = BinarySearch(key, entries, 0, numEntries-1);
+ if(found)
+ return found->value;
+ sprintf(errstr, "%s missing", key);
+ for(i = 0; i < 25; i++)
+ WideErrorString[i] = errstr[i];
+ return WideErrorString;
+}
+
+
+void
+CData::Load(uint32 length, uint8 *data, int *offset)
+{
+ uint32 i;
+ uint8 *rawbytes;
+
+ numChars = length / sizeof(wchar);
+ chars = new wchar[numChars];
+ rawbytes = (uint8*)chars;
+
+ for(i = 0; i < length; i++)
+ rawbytes[i] = data[(*offset)++];
+}
+
+void
+CData::Unload(void)
+{
+ delete[] chars;
+ chars = nil;
+ numChars = 0;
+}
+
+void
+AsciiToUnicode(const char *src, wchar *dst)
+{
+ while((*dst++ = *src++) != '\0');
+}
+
+char*
+UnicodeToAscii(wchar *src)
+{
+ static char aStr[256];
+ int len;
+ for(len = 0; *src != '\0' && len < 256-1; len++, src++)
+ if(*src < 128)
+ aStr[len] = *src;
+ else
+ aStr[len] = '#';
+ aStr[len] = '\0';
+ return aStr;
+}
+
+char*
+UnicodeToAsciiForSaveLoad(wchar *src)
+{
+ static char aStr[256];
+ int len;
+ for(len = 0; *src != '\0' && len < 256-1; len++, src++)
+ if(*src < 256)
+ aStr[len] = *src;
+ else
+ aStr[len] = '#';
+ aStr[len] = '\0';
+ return aStr;
+}
+
+void
+UnicodeStrcpy(wchar *dst, const wchar *src)
+{
+ while((*dst++ = *src++) != '\0');
+}
+
+int
+UnicodeStrlen(const wchar *str)
+{
+ int len;
+ for(len = 0; *str != '\0'; len++, str++);
+ return len;
+}
+
+void
+TextCopy(wchar *dst, const wchar *src)
+{
+ while((*dst++ = *src++) != '\0');
+}
+
+
+STARTPATCHES
+ InjectHook(0x52C3C0, &CText::Load, PATCH_JUMP);
+ InjectHook(0x52C580, &CText::Unload, PATCH_JUMP);
+ InjectHook(0x52C5A0, &CText::Get, PATCH_JUMP);
+ InjectHook(0x52C220, &CText::GetUpperCase, PATCH_JUMP);
+ InjectHook(0x52C2C0, &CText::UpperCase, PATCH_JUMP);
+
+ InjectHook(0x52BE70, &CKeyArray::Load, PATCH_JUMP);
+ InjectHook(0x52BF60, &CKeyArray::Unload, PATCH_JUMP);
+ InjectHook(0x52BF80, &CKeyArray::Update, PATCH_JUMP);
+ InjectHook(0x52C060, &CKeyArray::BinarySearch, PATCH_JUMP);
+ InjectHook(0x52BFB0, &CKeyArray::Search, PATCH_JUMP);
+
+ InjectHook(0x52C120, &CData::Load, PATCH_JUMP);
+ InjectHook(0x52C200, &CData::Unload, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index a05a1236..8cb0cfa4 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -39,6 +39,7 @@
#include "PathFind.h"
#include "AnimManager.h"
#include "RpAnimBlend.h"
+#include "AnimBlendAssociation.h"
#include "Ped.h"
#include "PlayerPed.h"
#include "Object.h"
@@ -4483,6 +4484,8 @@ CAutomobile::SetAllTaxiLights(bool set)
m_sAllTaxiLights = set;
}
+#include <new>
+
class CAutomobile_ : public CAutomobile
{
public:
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 7dbd7080..6d584017 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -299,6 +299,8 @@ CBoat::FillBoatList()
}
}
+#include <new>
+
class CBoat_ : public CBoat
{
public:
diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp
index aab9dd0d..3dc1deeb 100644
--- a/src/vehicles/Heli.cpp
+++ b/src/vehicles/Heli.cpp
@@ -19,6 +19,8 @@
#include "World.h"
#include "WaterLevel.h"
#include "PlayerPed.h"
+#include "Wanted.h"
+#include "DMAudio.h"
#include "Object.h"
#include "HandlingMgr.h"
#include "Heli.h"
@@ -1034,6 +1036,7 @@ bool CHeli::HasCatalinaBeenShotDown(void) { return CatalinaHasBeenShotDown; }
void CHeli::ActivateHeli(bool activate) { ScriptHeliOn = activate; }
+#include <new>
class CHeli_ : public CHeli
{
diff --git a/src/vehicles/Plane.cpp b/src/vehicles/Plane.cpp
index b4d80581..c2b9e493 100644
--- a/src/vehicles/Plane.cpp
+++ b/src/vehicles/Plane.cpp
@@ -7,6 +7,8 @@
#include "Streaming.h"
#include "Replay.h"
#include "Camera.h"
+#include "DMAudio.h"
+#include "Wanted.h"
#include "Coronas.h"
#include "Particle.h"
#include "Explosion.h"
@@ -964,6 +966,7 @@ bool CPlane::HasCesnaLanded(void) { return CesnaMissionStatus == CESNA_STATUS_LA
bool CPlane::HasCesnaBeenDestroyed(void) { return CesnaMissionStatus == CESNA_STATUS_DESTROYED; }
bool CPlane::HasDropOffCesnaBeenShotDown(void) { return DropOffCesnaMissionStatus == CESNA_STATUS_DESTROYED; }
+#include <new>
class CPlane_ : public CPlane
{
diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp
index 1c73ed05..7d81fd57 100644
--- a/src/vehicles/Train.cpp
+++ b/src/vehicles/Train.cpp
@@ -10,6 +10,7 @@
#include "Coronas.h"
#include "World.h"
#include "Ped.h"
+#include "DMAudio.h"
#include "HandlingMgr.h"
#include "Train.h"
@@ -691,6 +692,8 @@ CTrain::UpdateTrains(void)
}
}
+#include <new>
+
class CTrain_ : public CTrain
{
public:
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index ac0da52c..54bc2c01 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -16,6 +16,7 @@
#include "Renderer.h"
#include "DMAudio.h"
#include "Radar.h"
+#include "Fire.h"
bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75;
diff --git a/src/weapons/WeaponInfo.cpp b/src/weapons/WeaponInfo.cpp
index 6884d347..a4a1a085 100644
--- a/src/weapons/WeaponInfo.cpp
+++ b/src/weapons/WeaponInfo.cpp
@@ -3,7 +3,9 @@
#include "main.h"
#include "FileMgr.h"
#include "WeaponInfo.h"
+#include "AnimManager.h"
#include "AnimBlendAssociation.h"
+#include "Weapon.h"
//CWeaponInfo (&CWeaponInfo::ms_apWeaponInfos)[14] = * (CWeaponInfo(*)[14]) * (uintptr*)0x6503EC;
CWeaponInfo CWeaponInfo::ms_apWeaponInfos[WEAPONTYPE_TOTALWEAPONS];
diff --git a/src/weapons/WeaponInfo.h b/src/weapons/WeaponInfo.h
index faa8bf7b..e2e71d23 100644
--- a/src/weapons/WeaponInfo.h
+++ b/src/weapons/WeaponInfo.h
@@ -1,7 +1,8 @@
#pragma once
-#include "common.h"
-#include "Weapon.h"
-#include "AnimManager.h"
+
+enum AnimationId;
+enum eWeaponFire;
+enum eWeaponType;
class CWeaponInfo {
// static CWeaponInfo(&ms_apWeaponInfos)[14];