summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-08 08:46:42 +0200
committeraap <aap@papnet.eu>2019-07-08 08:46:42 +0200
commit12af85ca3d29e155f40323ad07a77f96a4aececf (patch)
tree7a6d7c8ed51ec1c527903835bbe4ee39eef2ab8b /src/peds
parentMerge pull request #111 from gennariarmando/master (diff)
downloadre3-12af85ca3d29e155f40323ad07a77f96a4aececf.tar
re3-12af85ca3d29e155f40323ad07a77f96a4aececf.tar.gz
re3-12af85ca3d29e155f40323ad07a77f96a4aececf.tar.bz2
re3-12af85ca3d29e155f40323ad07a77f96a4aececf.tar.lz
re3-12af85ca3d29e155f40323ad07a77f96a4aececf.tar.xz
re3-12af85ca3d29e155f40323ad07a77f96a4aececf.tar.zst
re3-12af85ca3d29e155f40323ad07a77f96a4aececf.zip
Diffstat (limited to '')
-rw-r--r--src/peds/CivilianPed.cpp13
-rw-r--r--src/peds/CivilianPed.h7
-rw-r--r--src/peds/CopPed.cpp10
-rw-r--r--src/peds/CopPed.h1
-rw-r--r--src/peds/EmergencyPed.cpp10
-rw-r--r--src/peds/EmergencyPed.h2
-rw-r--r--src/peds/Ped.cpp28
-rw-r--r--src/peds/Ped.h35
-rw-r--r--src/peds/PlayerPed.cpp13
-rw-r--r--src/peds/PlayerPed.h1
10 files changed, 71 insertions, 49 deletions
diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp
index a4881e71..cf8a0580 100644
--- a/src/peds/CivilianPed.cpp
+++ b/src/peds/CivilianPed.cpp
@@ -13,7 +13,14 @@ CCivilianPed::CCivilianPed(int pedtype, int mi) : CPed(pedtype)
}
}
+class CCivilianPed_ : public CCivilianPed
+{
+public:
+ CCivilianPed *ctor(int pedtype, int mi) { return ::new (this) CCivilianPed(pedtype, mi); };
+ void dtor(void) { CCivilianPed::~CCivilianPed(); }
+};
+
STARTPATCHES
- InjectHook(0x4BFF30, &CCivilianPed::ctor, PATCH_JUMP);
- InjectHook(0x4BFFC0, &CCivilianPed::dtor, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
+ InjectHook(0x4BFF30, &CCivilianPed_::ctor, PATCH_JUMP);
+ InjectHook(0x4BFFC0, &CCivilianPed_::dtor, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/peds/CivilianPed.h b/src/peds/CivilianPed.h
index 8d004ad7..14859a5c 100644
--- a/src/peds/CivilianPed.h
+++ b/src/peds/CivilianPed.h
@@ -6,11 +6,8 @@ class CCivilianPed : public CPed
{
public:
CCivilianPed(int, int);
- virtual ~CCivilianPed(void) { }
+ ~CCivilianPed(void) { }
- virtual void ProcessControl(void);
-
- CCivilianPed *ctor(int pedtype, int mi) { return ::new (this) CCivilianPed(pedtype, mi); };
- void dtor(void) { this->CCivilianPed::~CCivilianPed(); }
+ void ProcessControl(void);
};
static_assert(sizeof(CCivilianPed) == 0x53C, "CCivilianPed: error");
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index 041185ee..0ac0473f 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -9,6 +9,12 @@ CCopPed::~CCopPed()
WRAPPER void CCopPed::ClearPursuit(void) { EAXJMP(0x4C28C0); }
+class CCopPed_ : public CCopPed
+{
+public:
+ void dtor(void) { CCopPed::~CCopPed(); }
+};
+
STARTPATCHES
- InjectHook(0x4C13E0, &CCopPed::dtor, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
+ InjectHook(0x4C13E0, &CCopPed_::dtor, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/peds/CopPed.h b/src/peds/CopPed.h
index b938dfc2..5827f9bc 100644
--- a/src/peds/CopPed.h
+++ b/src/peds/CopPed.h
@@ -65,7 +65,6 @@ public:
int8 field_1367;
~CCopPed();
- void dtor(void) { this->CCopPed::~CCopPed(); }
void ClearPursuit(void);
};
diff --git a/src/peds/EmergencyPed.cpp b/src/peds/EmergencyPed.cpp
index 7b847896..664bd6f6 100644
--- a/src/peds/EmergencyPed.cpp
+++ b/src/peds/EmergencyPed.cpp
@@ -2,6 +2,12 @@
#include "patcher.h"
#include "EmergencyPed.h"
+class CEmergencyPed_ : public CEmergencyPed
+{
+public:
+ void dtor(void) { CEmergencyPed::~CEmergencyPed(); }
+};
+
STARTPATCHES
-InjectHook(0x4C2EF0, &CEmergencyPed::dtor, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
+ InjectHook(0x4C2EF0, &CEmergencyPed_::dtor, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/peds/EmergencyPed.h b/src/peds/EmergencyPed.h
index fa07f3ee..f21996e8 100644
--- a/src/peds/EmergencyPed.h
+++ b/src/peds/EmergencyPed.h
@@ -7,7 +7,5 @@ class CEmergencyPed : public CPed
public:
// 0x53C
uint8 stuff[24];
-
- void dtor(void) { this->CEmergencyPed::~CEmergencyPed(); }
};
static_assert(sizeof(CEmergencyPed) == 0x554, "CEmergencyPed: error");
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 016fea2f..20f26688 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -2893,9 +2893,28 @@ WRAPPER void CPed::PedLandCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0
WRAPPER void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4C6580); }
WRAPPER void CPed::RestoreHeadingRateCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4D6550); }
+class CPed_ : public CPed
+{
+public:
+ CPed* ctor(uint32 pedType) { return ::new (this) CPed(pedType); }
+ void dtor(void) { CPed::~CPed(); }
+
+ void SetModelIndex_(uint32 mi) { CPed::SetModelIndex(mi); }
+ void FlagToDestroyWhenNextProcessed_(void) { CPed::FlagToDestroyWhenNextProcessed(); }
+ bool SetupLighting_(void) { return CPed::SetupLighting(); }
+ void RemoveLighting_(bool reset) { CPed::RemoveLighting(reset); }
+ void Teleport_(CVector pos) { CPed::Teleport(pos); }
+};
+
STARTPATCHES
- InjectHook(0x4C41C0, &CPed::ctor, PATCH_JUMP);
- InjectHook(0x4C50D0, &CPed::dtor, PATCH_JUMP);
+ InjectHook(0x4C41C0, &CPed_::ctor, PATCH_JUMP);
+ InjectHook(0x4C50D0, &CPed_::dtor, PATCH_JUMP);
+ InjectHook(0x4C52A0, &CPed_::SetModelIndex_, PATCH_JUMP);
+ InjectHook(0x4D6570, &CPed_::FlagToDestroyWhenNextProcessed_, PATCH_JUMP);
+ InjectHook(0x4A7D30, &CPed_::SetupLighting_, PATCH_JUMP);
+ InjectHook(0x4A7DC0, &CPed_::RemoveLighting_, PATCH_JUMP);
+ InjectHook(0x4D3E70, &CPed_::Teleport_, PATCH_JUMP);
+
InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP);
InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP);
InjectHook(0x4EB470, &CPed::ApplyHeadShot, PATCH_JUMP);
@@ -2926,11 +2945,6 @@ STARTPATCHES
InjectHook(0x4CC6C0, &CPed::PlayFootSteps, PATCH_JUMP);
InjectHook(0x4C5350, &CPed::BuildPedLists, PATCH_JUMP);
InjectHook(0x4CF9B0, &CPed::GiveWeapon, PATCH_JUMP);
- InjectHook(0x4C52A0, &CPed::SetModelIndex_, PATCH_JUMP);
- InjectHook(0x4D6570, &CPed::FlagToDestroyWhenNextProcessed_, PATCH_JUMP);
- InjectHook(0x4A7D30, &CPed::SetupLighting_, PATCH_JUMP);
- InjectHook(0x4A7DC0, &CPed::RemoveLighting_, PATCH_JUMP);
- InjectHook(0x4D3E70, &CPed::Teleport_, PATCH_JUMP);
InjectHook(0x4C7EA0, &CPed::CalculateNewOrientation, PATCH_JUMP);
InjectHook(0x4C78F0, &CPed::WorkOutHeadingForMovingFirstPerson, PATCH_JUMP);
InjectHook(0x4C73F0, &CPed::CalculateNewVelocity, PATCH_JUMP);
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 0493eeee..6b04404b 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -399,21 +399,19 @@ public:
static void operator delete(void*, int);
CPed(uint32 pedType);
- virtual ~CPed(void);
-
- virtual void SetModelIndex(uint32 mi);
- virtual void ProcessControl(void);
- virtual void Teleport(CVector);
- virtual void PreRender(void);
- virtual void Render(void);
- virtual bool SetupLighting(void);
- virtual void RemoveLighting(bool);
- virtual void FlagToDestroyWhenNextProcessed(void);
- virtual int32 ProcessEntityCollision(CEntity*, CColPoint*);
- virtual void SetMoveAnim(void);
+ ~CPed(void);
+
+ void SetModelIndex(uint32 mi);
+ void ProcessControl(void);
+ void Teleport(CVector);
+ void PreRender(void);
+ void Render(void);
+ bool SetupLighting(void);
+ void RemoveLighting(bool);
+ void FlagToDestroyWhenNextProcessed(void);
+ int32 ProcessEntityCollision(CEntity*, CColPoint*);
- CPed* ctor(uint32 pedType) { return ::new (this) CPed(pedType); }
- void dtor(void) { this->CPed::~CPed(); }
+ virtual void SetMoveAnim(void);
void AddWeaponModel(int id);
void AimGun(void);
@@ -465,7 +463,7 @@ public:
void RegisterThreatWithGangPeds(CEntity*);
bool TurnBody(void);
void Chat(void);
- void MakeChangesForNewWeapon(int8);
+ void MakeChangesForNewWeapon(int8);
// Static methods
@@ -545,13 +543,6 @@ public:
PedState GetPedState(void) { return m_nPedState; }
void SetPedState(PedState state) { m_nPedState = state; }
- // to make patching virtual functions possible
- void SetModelIndex_(uint32 mi) { CPed::SetModelIndex(mi); }
- void FlagToDestroyWhenNextProcessed_(void) { CPed::FlagToDestroyWhenNextProcessed(); }
- bool SetupLighting_(void) { return CPed::SetupLighting(); }
- void RemoveLighting_(bool reset) { CPed::RemoveLighting(reset); }
- void Teleport_(CVector pos) { CPed::Teleport(pos); }
-
// set by 0482:set_threat_reaction_range_multiplier opcode
static uint16 &distanceMultToCountPedNear;
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 7eb01db0..07cb5541 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -21,8 +21,13 @@ void CPlayerPed::ClearWeaponTarget()
ClearPointGunAt();
}
-STARTPATCHES
-InjectHook(0x4EFB30, &CPlayerPed::dtor, PATCH_JUMP);
-InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP);
+class CPlayerPed_ : public CPlayerPed
+{
+public:
+ void dtor(void) { CPlayerPed::~CPlayerPed(); }
+};
-ENDPATCHES \ No newline at end of file
+STARTPATCHES
+ InjectHook(0x4EFB30, &CPlayerPed_::dtor, PATCH_JUMP);
+ InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/peds/PlayerPed.h b/src/peds/PlayerPed.h
index 4f325da3..1a106b38 100644
--- a/src/peds/PlayerPed.h
+++ b/src/peds/PlayerPed.h
@@ -41,7 +41,6 @@ public:
~CPlayerPed();
- void dtor(void) { this->CPlayerPed::~CPlayerPed(); }
void ReApplyMoveAnims(void);
void ClearWeaponTarget();
};