summaryrefslogtreecommitdiffstats
path: root/src/entities
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/entities/Building.cpp11
-rw-r--r--src/entities/Building.h3
-rw-r--r--src/entities/Dummy.cpp14
-rw-r--r--src/entities/Dummy.h5
-rw-r--r--src/entities/Entity.cpp40
-rw-r--r--src/entities/Entity.h20
-rw-r--r--src/entities/Physical.cpp29
-rw-r--r--src/entities/Physical.h26
-rw-r--r--src/entities/Treadable.cpp10
-rw-r--r--src/entities/Treadable.h3
10 files changed, 90 insertions, 71 deletions
diff --git a/src/entities/Building.cpp b/src/entities/Building.cpp
index b9fca96f..188cbfe7 100644
--- a/src/entities/Building.cpp
+++ b/src/entities/Building.cpp
@@ -21,8 +21,15 @@ CBuilding::ReplaceWithNewModel(int32 id)
CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE);
}
+class CBuilding_ : public CBuilding
+{
+public:
+ CBuilding *ctor(void) { return ::new (this) CBuilding(); }
+ void dtor(void) { CBuilding::~CBuilding(); }
+};
+
STARTPATCHES
- InjectHook(0x4057D0, &CBuilding::ctor, PATCH_JUMP);
- InjectHook(0x405800, &CBuilding::dtor, PATCH_JUMP);
+ InjectHook(0x4057D0, &CBuilding_::ctor, PATCH_JUMP);
+ InjectHook(0x405800, &CBuilding_::dtor, PATCH_JUMP);
InjectHook(0x405850, &CBuilding::ReplaceWithNewModel, PATCH_JUMP);
ENDPATCHES
diff --git a/src/entities/Building.h b/src/entities/Building.h
index 89d0a460..7b837f46 100644
--- a/src/entities/Building.h
+++ b/src/entities/Building.h
@@ -15,8 +15,5 @@ public:
void ReplaceWithNewModel(int32 id);
virtual bool GetIsATreadable(void) { return false; }
-
- CBuilding *ctor(void) { return ::new (this) CBuilding(); }
- void dtor(void) { this->CBuilding::~CBuilding(); }
};
static_assert(sizeof(CBuilding) == 0x64, "CBuilding: error");
diff --git a/src/entities/Dummy.cpp b/src/entities/Dummy.cpp
index 5401c1fa..176e5682 100644
--- a/src/entities/Dummy.cpp
+++ b/src/entities/Dummy.cpp
@@ -51,8 +51,16 @@ CDummy::Remove(void)
}
}
+class CDummy_ : public CDummy
+{
+public:
+ void Add_(void) { CDummy::Add(); }
+ void Remove_(void) { CDummy::Remove(); }
+ void dtor(void) { CDummy::~CDummy(); }
+};
+
STARTPATCHES
- InjectHook(0x473810, &CDummy::dtor, PATCH_JUMP);
- InjectHook(0x473860, &CDummy::Add_, PATCH_JUMP);
- InjectHook(0x473AD0, &CDummy::Remove_, PATCH_JUMP);
+ InjectHook(0x473810, &CDummy_::dtor, PATCH_JUMP);
+ InjectHook(0x473860, &CDummy_::Add_, PATCH_JUMP);
+ InjectHook(0x473AD0, &CDummy_::Remove_, PATCH_JUMP);
ENDPATCHES
diff --git a/src/entities/Dummy.h b/src/entities/Dummy.h
index 59359bb5..fcfd23fb 100644
--- a/src/entities/Dummy.h
+++ b/src/entities/Dummy.h
@@ -14,10 +14,5 @@ public:
static void *operator new(size_t);
static void operator delete(void*, size_t);
-
- // to make patching virtual functions possible
- void Add_(void) { CDummy::Add(); }
- void Remove_(void) { CDummy::Remove(); }
- void dtor(void) { this->CDummy::~CDummy(); }
};
static_assert(sizeof(CDummy) == 0x68, "CDummy: error");
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index fac7f17f..105f14c3 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -865,10 +865,35 @@ CEntity::ModifyMatrixForBannerInWind(void)
UpdateRwFrame();
}
+class CEntity_ : public CEntity
+{
+public:
+ CEntity *ctor(void) { return ::new (this) CEntity(); }
+ void dtor(void) { this->CEntity::~CEntity(); }
+ void Add_(void) { CEntity::Add(); }
+ void Remove_(void) { CEntity::Remove(); }
+ void SetModelIndex_(uint32 i) { CEntity::SetModelIndex(i); }
+ void CreateRwObject_(void) { CEntity::CreateRwObject(); }
+ void DeleteRwObject_(void) { CEntity::DeleteRwObject(); }
+ CRect GetBoundRect_(void) { return CEntity::GetBoundRect(); }
+ void PreRender_(void) { CEntity::PreRender(); }
+ void Render_(void) { CEntity::Render(); }
+ bool SetupLighting_(void) { return CEntity::SetupLighting(); }
+};
+
STARTPATCHES
- InjectHook(0x473C30, &CEntity::ctor, PATCH_JUMP);
- InjectHook(0x473E40, &CEntity::dtor, PATCH_JUMP);
- InjectHook(0x473E70, &CEntity::SetModelIndex_, PATCH_JUMP);
+ InjectHook(0x473C30, &CEntity_::ctor, PATCH_JUMP);
+ InjectHook(0x473E40, &CEntity_::dtor, PATCH_JUMP);
+ InjectHook(0x473E70, &CEntity_::SetModelIndex_, PATCH_JUMP);
+ InjectHook(0x475080, &CEntity_::Add_, PATCH_JUMP);
+ InjectHook(0x475310, &CEntity_::Remove_, PATCH_JUMP);
+ InjectHook(0x473EA0, &CEntity_::CreateRwObject_, PATCH_JUMP);
+ InjectHook(0x473F90, &CEntity_::DeleteRwObject_, PATCH_JUMP);
+ InjectHook(0x474000, &CEntity_::GetBoundRect_, PATCH_JUMP);
+ InjectHook(0x474350, &CEntity_::PreRender_, PATCH_JUMP);
+ InjectHook(0x474BD0, &CEntity_::Render_, PATCH_JUMP);
+ InjectHook(0x4A7C60, &CEntity_::SetupLighting_, PATCH_JUMP);
+
InjectHook(0x4742C0, (void (CEntity::*)(CVector&))&CEntity::GetBoundCentre, PATCH_JUMP);
InjectHook(0x474310, &CEntity::GetBoundRadius, PATCH_JUMP);
InjectHook(0x474C10, &CEntity::GetIsTouching, PATCH_JUMP);
@@ -889,13 +914,4 @@ STARTPATCHES
InjectHook(0x475670, &CEntity::ModifyMatrixForTreeInWind, PATCH_JUMP);
InjectHook(0x475830, &CEntity::ModifyMatrixForBannerInWind, PATCH_JUMP);
InjectHook(0x4FA530, &CEntity::ProcessLightsForEntity, PATCH_JUMP);
-
- InjectHook(0x475080, &CEntity::Add_, PATCH_JUMP);
- InjectHook(0x475310, &CEntity::Remove_, PATCH_JUMP);
- InjectHook(0x473EA0, &CEntity::CreateRwObject_, PATCH_JUMP);
- InjectHook(0x473F90, &CEntity::DeleteRwObject_, PATCH_JUMP);
- InjectHook(0x474000, &CEntity::GetBoundRect_, PATCH_JUMP);
- InjectHook(0x474350, &CEntity::PreRender_, PATCH_JUMP);
- InjectHook(0x474BD0, &CEntity::Render_, PATCH_JUMP);
- InjectHook(0x4A7C60, &CEntity::SetupLighting_, PATCH_JUMP);
ENDPATCHES
diff --git a/src/entities/Entity.h b/src/entities/Entity.h
index 92c4c351..d055d25f 100644
--- a/src/entities/Entity.h
+++ b/src/entities/Entity.h
@@ -95,12 +95,12 @@ public:
CReference *m_pFirstReference;
CEntity(void);
- virtual ~CEntity(void);
+ ~CEntity(void);
virtual void Add(void);
virtual void Remove(void);
- virtual void SetModelIndex(uint32 i) { m_modelIndex = i; CreateRwObject(); }
- virtual void SetModelIndexNoCreate(uint32 i) { m_modelIndex = i; }
+ virtual void SetModelIndex(uint32 id) { m_modelIndex = id; CreateRwObject(); }
+ virtual void SetModelIndexNoCreate(uint32 id) { m_modelIndex = id; }
virtual void CreateRwObject(void);
virtual void DeleteRwObject(void);
virtual CRect GetBoundRect(void);
@@ -145,19 +145,5 @@ public:
void ModifyMatrixForTreeInWind(void);
void ModifyMatrixForBannerInWind(void);
void ProcessLightsForEntity(void);
-
-
- // to make patching virtual functions possible
- CEntity *ctor(void) { return ::new (this) CEntity(); }
- void dtor(void) { this->CEntity::~CEntity(); }
- void Add_(void) { CEntity::Add(); }
- void Remove_(void) { CEntity::Remove(); }
- void SetModelIndex_(uint32 i) { CEntity::SetModelIndex(i); }
- void CreateRwObject_(void) { CEntity::CreateRwObject(); }
- void DeleteRwObject_(void) { CEntity::DeleteRwObject(); }
- CRect GetBoundRect_(void) { return CEntity::GetBoundRect(); }
- void PreRender_(void) { CEntity::PreRender(); }
- void Render_(void) { CEntity::Render(); }
- bool SetupLighting_(void) { return CEntity::SetupLighting(); }
};
static_assert(sizeof(CEntity) == 0x64, "CEntity: error");
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index d6a82658..3d45bf52 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -3,6 +3,7 @@
#include "World.h"
#include "Timer.h"
#include "ModelIndices.h"
+#include "Treadable.h"
#include "Vehicle.h"
#include "Ped.h"
#include "Object.h"
@@ -1932,16 +1933,28 @@ CPhysical::ProcessCollision(void)
RemoveAndAdd();
}
+class CPhysical_ : public CPhysical
+{
+public:
+ void dtor(void) { CPhysical::~CPhysical(); }
+ void Add_(void) { CPhysical::Add(); }
+ void Remove_(void) { CPhysical::Remove(); }
+ CRect GetBoundRect_(void) { return CPhysical::GetBoundRect(); }
+ void ProcessControl_(void) { CPhysical::ProcessControl(); }
+ void ProcessShift_(void) { CPhysical::ProcessShift(); }
+ void ProcessCollision_(void) { CPhysical::ProcessCollision(); }
+ int32 ProcessEntityCollision_(CEntity *ent, CColPoint *point) { return CPhysical::ProcessEntityCollision(ent, point); }
+};
STARTPATCHES
- InjectHook(0x495130, &CPhysical::dtor, PATCH_JUMP);
- InjectHook(0x4951F0, &CPhysical::Add_, PATCH_JUMP);
- InjectHook(0x4954B0, &CPhysical::Remove_, PATCH_JUMP);
- InjectHook(0x495540, &CPhysical::RemoveAndAdd, PATCH_JUMP);
- InjectHook(0x495F10, &CPhysical::ProcessControl_, PATCH_JUMP);
- InjectHook(0x496F10, &CPhysical::ProcessShift_, PATCH_JUMP);
- InjectHook(0x4961A0, &CPhysical::ProcessCollision_, PATCH_JUMP);
- InjectHook(0x49F790, &CPhysical::ProcessEntityCollision_, PATCH_JUMP);
+ InjectHook(0x495130, &CPhysical_::dtor, PATCH_JUMP);
+ InjectHook(0x4951F0, &CPhysical_::Add_, PATCH_JUMP);
+ InjectHook(0x4954B0, &CPhysical_::Remove_, PATCH_JUMP);
+ InjectHook(0x495540, &CPhysical_::RemoveAndAdd, PATCH_JUMP);
+ InjectHook(0x495F10, &CPhysical_::ProcessControl_, PATCH_JUMP);
+ InjectHook(0x496F10, &CPhysical_::ProcessShift_, PATCH_JUMP);
+ InjectHook(0x4961A0, &CPhysical_::ProcessCollision_, PATCH_JUMP);
+ InjectHook(0x49F790, &CPhysical_::ProcessEntityCollision_, PATCH_JUMP);
InjectHook(0x4958F0, &CPhysical::AddToMovingList, PATCH_JUMP);
InjectHook(0x495940, &CPhysical::RemoveFromMovingList, PATCH_JUMP);
InjectHook(0x497180, &CPhysical::AddCollisionRecord, PATCH_JUMP);
diff --git a/src/entities/Physical.h b/src/entities/Physical.h
index 81d3d649..c1f9f1d9 100644
--- a/src/entities/Physical.h
+++ b/src/entities/Physical.h
@@ -3,12 +3,13 @@
#include "Lists.h"
#include "Timer.h"
#include "Entity.h"
-#include "Treadable.h"
enum {
PHYSICAL_MAX_COLLISIONRECORDS = 6
};
+class CTreadable;
+
class CPhysical : public CEntity
{
public:
@@ -65,13 +66,14 @@ public:
~CPhysical(void);
// from CEntity
- virtual void Add(void);
- virtual void Remove(void);
- virtual CRect GetBoundRect(void);
- virtual void ProcessControl(void);
+ void Add(void);
+ void Remove(void);
+ CRect GetBoundRect(void);
+ void ProcessControl(void);
+ void ProcessShift(void);
+ void ProcessCollision(void);
+
virtual int32 ProcessEntityCollision(CEntity *ent, CColPoint *point);
- virtual void ProcessShift(void);
- virtual void ProcessCollision(void);
void RemoveAndAdd(void);
void AddToMovingList(void);
@@ -137,15 +139,5 @@ public:
bool ProcessCollisionSectorList(CPtrList *lists);
bool CheckCollision(void);
bool CheckCollision_SimpleCar(void);
-
- // to make patching virtual functions possible
- void dtor(void) { this->CPhysical::~CPhysical(); }
- void Add_(void) { CPhysical::Add(); }
- void Remove_(void) { CPhysical::Remove(); }
- CRect GetBoundRect_(void) { return CPhysical::GetBoundRect(); }
- void ProcessControl_(void) { CPhysical::ProcessControl(); }
- void ProcessShift_(void) { CPhysical::ProcessShift(); }
- void ProcessCollision_(void) { CPhysical::ProcessCollision(); }
- int32 ProcessEntityCollision_(CEntity *ent, CColPoint *point) { return CPhysical::ProcessEntityCollision(ent, point); }
};
static_assert(sizeof(CPhysical) == 0x128, "CPhysical: error");
diff --git a/src/entities/Treadable.cpp b/src/entities/Treadable.cpp
index 230d1633..ea949f00 100644
--- a/src/entities/Treadable.cpp
+++ b/src/entities/Treadable.cpp
@@ -7,6 +7,12 @@
void *CTreadable::operator new(size_t sz) { return CPools::GetTreadablePool()->New(); }
void CTreadable::operator delete(void *p, size_t sz) { CPools::GetTreadablePool()->Delete((CTreadable*)p); }
+class CTreadable_ : public CTreadable
+{
+public:
+ void dtor(void) { CTreadable::~CTreadable(); }
+};
+
STARTPATCHES
- InjectHook(0x405A10, &CTreadable::dtor, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
+ InjectHook(0x405A10, &CTreadable_::dtor, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/entities/Treadable.h b/src/entities/Treadable.h
index 2194638d..d82ff52b 100644
--- a/src/entities/Treadable.h
+++ b/src/entities/Treadable.h
@@ -11,7 +11,6 @@ public:
int16 m_nodeIndicesCars[12];
int16 m_nodeIndicesPeds[12];
- virtual bool GetIsATreadable(void) { return true; }
- void dtor(void) { this->CTreadable::~CTreadable(); }
+ bool GetIsATreadable(void) { return true; }
};
static_assert(sizeof(CTreadable) == 0x94, "CTreadable: error");