cleaned up patching of virtual functions; started CAutomobile

This commit is contained in:
aap 2019-07-08 08:46:42 +02:00
parent 6ec421fe7b
commit 12af85ca3d
64 changed files with 771 additions and 278 deletions

View File

@ -1,10 +1,12 @@
#pragma once #pragma once
#include "common.h" #include "common.h"
#include "Collision.h"
#include "Ped.h"
#include "Object.h"
#include "Sprite2d.h" #include "Sprite2d.h"
#include "Vehicle.h"
class CEntity;
class CBuilding;
class CVehicle;
class CPed;
class CObject;
struct CScriptRectangle struct CScriptRectangle
{ {

13
src/core/Instance.cpp Normal file
View File

@ -0,0 +1,13 @@
#include "common.h"
#include "patcher.h"
#include "Instance.h"
class CInstance_ : public CInstance
{
public:
void dtor() { CInstance::~CInstance(); }
};
STARTPATCHES
InjectHook(0x50BE90, &CInstance_::dtor, PATCH_JUMP);
ENDPATCHES

10
src/core/Instance.h Normal file
View File

@ -0,0 +1,10 @@
#pragma once
#include "Placeable.h"
// unused
class CInstance : CPlaceable
{
public:
};

View File

@ -63,9 +63,17 @@ CPlaceable::IsWithinArea(float x1, float y1, float z1, float x2, float y2, float
z1 <= GetPosition().z && GetPosition().z <= z2; z1 <= GetPosition().z && GetPosition().z <= z2;
} }
class CPlaceable_ : public CPlaceable
{
public:
CPlaceable *ctor(void) { return ::new (this) CPlaceable(); }
void dtor(void) { CPlaceable::~CPlaceable(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x49F9A0, &CPlaceable::ctor, PATCH_JUMP); InjectHook(0x49F9A0, &CPlaceable_::ctor, PATCH_JUMP);
InjectHook(0x49F9E0, &CPlaceable::dtor, PATCH_JUMP); InjectHook(0x49F9E0, &CPlaceable_::dtor, PATCH_JUMP);
InjectHook(0x49FA00, &CPlaceable::SetHeading, PATCH_JUMP); InjectHook(0x49FA00, &CPlaceable::SetHeading, PATCH_JUMP);
InjectHook(0x49FA50, (bool (CPlaceable::*)(float, float, float, float))&CPlaceable::IsWithinArea, PATCH_JUMP); InjectHook(0x49FA50, (bool (CPlaceable::*)(float, float, float, float))&CPlaceable::IsWithinArea, PATCH_JUMP);
InjectHook(0x49FAF0, (bool (CPlaceable::*)(float, float, float, float, float, float))&CPlaceable::IsWithinArea, PATCH_JUMP); InjectHook(0x49FAF0, (bool (CPlaceable::*)(float, float, float, float, float, float))&CPlaceable::IsWithinArea, PATCH_JUMP);

View File

@ -19,8 +19,5 @@ public:
void SetHeading(float angle); void SetHeading(float angle);
bool IsWithinArea(float x1, float y1, float x2, float y2); bool IsWithinArea(float x1, float y1, float x2, float y2);
bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2); bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2);
CPlaceable *ctor(void) { return ::new (this) CPlaceable(); }
void dtor(void) { this->CPlaceable::~CPlaceable(); }
}; };
static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error"); static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error");

View File

@ -21,8 +21,15 @@ CBuilding::ReplaceWithNewModel(int32 id)
CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE); CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE);
} }
class CBuilding_ : public CBuilding
{
public:
CBuilding *ctor(void) { return ::new (this) CBuilding(); }
void dtor(void) { CBuilding::~CBuilding(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x4057D0, &CBuilding::ctor, PATCH_JUMP); InjectHook(0x4057D0, &CBuilding_::ctor, PATCH_JUMP);
InjectHook(0x405800, &CBuilding::dtor, PATCH_JUMP); InjectHook(0x405800, &CBuilding_::dtor, PATCH_JUMP);
InjectHook(0x405850, &CBuilding::ReplaceWithNewModel, PATCH_JUMP); InjectHook(0x405850, &CBuilding::ReplaceWithNewModel, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -15,8 +15,5 @@ public:
void ReplaceWithNewModel(int32 id); void ReplaceWithNewModel(int32 id);
virtual bool GetIsATreadable(void) { return false; } 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"); static_assert(sizeof(CBuilding) == 0x64, "CBuilding: error");

View File

@ -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 STARTPATCHES
InjectHook(0x473810, &CDummy::dtor, PATCH_JUMP); InjectHook(0x473810, &CDummy_::dtor, PATCH_JUMP);
InjectHook(0x473860, &CDummy::Add_, PATCH_JUMP); InjectHook(0x473860, &CDummy_::Add_, PATCH_JUMP);
InjectHook(0x473AD0, &CDummy::Remove_, PATCH_JUMP); InjectHook(0x473AD0, &CDummy_::Remove_, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -14,10 +14,5 @@ public:
static void *operator new(size_t); static void *operator new(size_t);
static void operator delete(void*, 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"); static_assert(sizeof(CDummy) == 0x68, "CDummy: error");

View File

@ -865,10 +865,35 @@ CEntity::ModifyMatrixForBannerInWind(void)
UpdateRwFrame(); 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 STARTPATCHES
InjectHook(0x473C30, &CEntity::ctor, PATCH_JUMP); InjectHook(0x473C30, &CEntity_::ctor, PATCH_JUMP);
InjectHook(0x473E40, &CEntity::dtor, PATCH_JUMP); InjectHook(0x473E40, &CEntity_::dtor, PATCH_JUMP);
InjectHook(0x473E70, &CEntity::SetModelIndex_, 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(0x4742C0, (void (CEntity::*)(CVector&))&CEntity::GetBoundCentre, PATCH_JUMP);
InjectHook(0x474310, &CEntity::GetBoundRadius, PATCH_JUMP); InjectHook(0x474310, &CEntity::GetBoundRadius, PATCH_JUMP);
InjectHook(0x474C10, &CEntity::GetIsTouching, PATCH_JUMP); InjectHook(0x474C10, &CEntity::GetIsTouching, PATCH_JUMP);
@ -889,13 +914,4 @@ STARTPATCHES
InjectHook(0x475670, &CEntity::ModifyMatrixForTreeInWind, PATCH_JUMP); InjectHook(0x475670, &CEntity::ModifyMatrixForTreeInWind, PATCH_JUMP);
InjectHook(0x475830, &CEntity::ModifyMatrixForBannerInWind, PATCH_JUMP); InjectHook(0x475830, &CEntity::ModifyMatrixForBannerInWind, PATCH_JUMP);
InjectHook(0x4FA530, &CEntity::ProcessLightsForEntity, 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 ENDPATCHES

View File

@ -95,12 +95,12 @@ public:
CReference *m_pFirstReference; CReference *m_pFirstReference;
CEntity(void); CEntity(void);
virtual ~CEntity(void); ~CEntity(void);
virtual void Add(void); virtual void Add(void);
virtual void Remove(void); virtual void Remove(void);
virtual void SetModelIndex(uint32 i) { m_modelIndex = i; CreateRwObject(); } virtual void SetModelIndex(uint32 id) { m_modelIndex = id; CreateRwObject(); }
virtual void SetModelIndexNoCreate(uint32 i) { m_modelIndex = i; } virtual void SetModelIndexNoCreate(uint32 id) { m_modelIndex = id; }
virtual void CreateRwObject(void); virtual void CreateRwObject(void);
virtual void DeleteRwObject(void); virtual void DeleteRwObject(void);
virtual CRect GetBoundRect(void); virtual CRect GetBoundRect(void);
@ -145,19 +145,5 @@ public:
void ModifyMatrixForTreeInWind(void); void ModifyMatrixForTreeInWind(void);
void ModifyMatrixForBannerInWind(void); void ModifyMatrixForBannerInWind(void);
void ProcessLightsForEntity(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"); static_assert(sizeof(CEntity) == 0x64, "CEntity: error");

View File

@ -3,6 +3,7 @@
#include "World.h" #include "World.h"
#include "Timer.h" #include "Timer.h"
#include "ModelIndices.h" #include "ModelIndices.h"
#include "Treadable.h"
#include "Vehicle.h" #include "Vehicle.h"
#include "Ped.h" #include "Ped.h"
#include "Object.h" #include "Object.h"
@ -1932,16 +1933,28 @@ CPhysical::ProcessCollision(void)
RemoveAndAdd(); 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 STARTPATCHES
InjectHook(0x495130, &CPhysical::dtor, PATCH_JUMP); InjectHook(0x495130, &CPhysical_::dtor, PATCH_JUMP);
InjectHook(0x4951F0, &CPhysical::Add_, PATCH_JUMP); InjectHook(0x4951F0, &CPhysical_::Add_, PATCH_JUMP);
InjectHook(0x4954B0, &CPhysical::Remove_, PATCH_JUMP); InjectHook(0x4954B0, &CPhysical_::Remove_, PATCH_JUMP);
InjectHook(0x495540, &CPhysical::RemoveAndAdd, PATCH_JUMP); InjectHook(0x495540, &CPhysical_::RemoveAndAdd, PATCH_JUMP);
InjectHook(0x495F10, &CPhysical::ProcessControl_, PATCH_JUMP); InjectHook(0x495F10, &CPhysical_::ProcessControl_, PATCH_JUMP);
InjectHook(0x496F10, &CPhysical::ProcessShift_, PATCH_JUMP); InjectHook(0x496F10, &CPhysical_::ProcessShift_, PATCH_JUMP);
InjectHook(0x4961A0, &CPhysical::ProcessCollision_, PATCH_JUMP); InjectHook(0x4961A0, &CPhysical_::ProcessCollision_, PATCH_JUMP);
InjectHook(0x49F790, &CPhysical::ProcessEntityCollision_, PATCH_JUMP); InjectHook(0x49F790, &CPhysical_::ProcessEntityCollision_, PATCH_JUMP);
InjectHook(0x4958F0, &CPhysical::AddToMovingList, PATCH_JUMP); InjectHook(0x4958F0, &CPhysical::AddToMovingList, PATCH_JUMP);
InjectHook(0x495940, &CPhysical::RemoveFromMovingList, PATCH_JUMP); InjectHook(0x495940, &CPhysical::RemoveFromMovingList, PATCH_JUMP);
InjectHook(0x497180, &CPhysical::AddCollisionRecord, PATCH_JUMP); InjectHook(0x497180, &CPhysical::AddCollisionRecord, PATCH_JUMP);

View File

@ -3,12 +3,13 @@
#include "Lists.h" #include "Lists.h"
#include "Timer.h" #include "Timer.h"
#include "Entity.h" #include "Entity.h"
#include "Treadable.h"
enum { enum {
PHYSICAL_MAX_COLLISIONRECORDS = 6 PHYSICAL_MAX_COLLISIONRECORDS = 6
}; };
class CTreadable;
class CPhysical : public CEntity class CPhysical : public CEntity
{ {
public: public:
@ -65,13 +66,14 @@ public:
~CPhysical(void); ~CPhysical(void);
// from CEntity // from CEntity
virtual void Add(void); void Add(void);
virtual void Remove(void); void Remove(void);
virtual CRect GetBoundRect(void); CRect GetBoundRect(void);
virtual void ProcessControl(void); void ProcessControl(void);
void ProcessShift(void);
void ProcessCollision(void);
virtual int32 ProcessEntityCollision(CEntity *ent, CColPoint *point); virtual int32 ProcessEntityCollision(CEntity *ent, CColPoint *point);
virtual void ProcessShift(void);
virtual void ProcessCollision(void);
void RemoveAndAdd(void); void RemoveAndAdd(void);
void AddToMovingList(void); void AddToMovingList(void);
@ -137,15 +139,5 @@ public:
bool ProcessCollisionSectorList(CPtrList *lists); bool ProcessCollisionSectorList(CPtrList *lists);
bool CheckCollision(void); bool CheckCollision(void);
bool CheckCollision_SimpleCar(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"); static_assert(sizeof(CPhysical) == 0x128, "CPhysical: error");

View File

@ -7,6 +7,12 @@
void *CTreadable::operator new(size_t sz) { return CPools::GetTreadablePool()->New(); } 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); } 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 STARTPATCHES
InjectHook(0x405A10, &CTreadable::dtor, PATCH_JUMP); InjectHook(0x405A10, &CTreadable_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -11,7 +11,6 @@ public:
int16 m_nodeIndicesCars[12]; int16 m_nodeIndicesCars[12];
int16 m_nodeIndicesPeds[12]; int16 m_nodeIndicesPeds[12];
virtual bool GetIsATreadable(void) { return true; } bool GetIsATreadable(void) { return true; }
void dtor(void) { this->CTreadable::~CTreadable(); }
}; };
static_assert(sizeof(CTreadable) == 0x94, "CTreadable: error"); static_assert(sizeof(CTreadable) == 0x94, "CTreadable: error");

View File

@ -101,9 +101,15 @@ CBaseModelInfo::Get2dEffect(int n)
} }
class CBaseModelInfo_ : public CBaseModelInfo
{
public:
void Shutdown_(void) { CBaseModelInfo::Shutdown(); }
};
STARTPATCHES STARTPATCHES
// can't easily replace ctor at 4F6A50 // can't easily replace ctor at 4F6A50
InjectHook(0x4F6A90, &CBaseModelInfo::Shutdown_, PATCH_JUMP); InjectHook(0x4F6A90, &CBaseModelInfo_::Shutdown_, PATCH_JUMP);
InjectHook(0x4F6AC0, &CBaseModelInfo::DeleteCollisionModel, PATCH_JUMP); InjectHook(0x4F6AC0, &CBaseModelInfo::DeleteCollisionModel, PATCH_JUMP);
InjectHook(0x4F6B70, &CBaseModelInfo::ClearTexDictionary, PATCH_JUMP); InjectHook(0x4F6B70, &CBaseModelInfo::ClearTexDictionary, PATCH_JUMP);
InjectHook(0x4F6BA0, &CBaseModelInfo::AddRef, PATCH_JUMP); InjectHook(0x4F6BA0, &CBaseModelInfo::AddRef, PATCH_JUMP);

View File

@ -62,8 +62,6 @@ public:
void Init2dEffects(void); void Init2dEffects(void);
void Add2dEffect(C2dEffect *fx); void Add2dEffect(C2dEffect *fx);
C2dEffect *Get2dEffect(int n); C2dEffect *Get2dEffect(int n);
void Shutdown_(void) { this->CBaseModelInfo::Shutdown(); }
}; };
static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error"); static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error");

View File

@ -139,12 +139,22 @@ CClumpModelInfo::GetFrameFromId(RpClump *clump, int32 id)
} }
class CClumpModelInfo_ : public CClumpModelInfo
{
public:
void DeleteRwObject_(void) { this->CClumpModelInfo::DeleteRwObject(); }
RwObject *CreateInstance_1(void) { return CClumpModelInfo::CreateInstance(); }
RwObject *CreateInstance_2(RwMatrix *m) { return CClumpModelInfo::CreateInstance(m); }
RwObject *GetRwObject_(void) { return CClumpModelInfo::GetRwObject(); }
void SetClump_(RpClump *clump) { CClumpModelInfo::SetClump(clump); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x4F8800, &CClumpModelInfo::DeleteRwObject_, PATCH_JUMP); InjectHook(0x4F8800, &CClumpModelInfo_::DeleteRwObject_, PATCH_JUMP);
InjectHook(0x4F8920, &CClumpModelInfo::CreateInstance_1, PATCH_JUMP); InjectHook(0x4F8920, &CClumpModelInfo_::CreateInstance_1, PATCH_JUMP);
InjectHook(0x4F88A0, &CClumpModelInfo::CreateInstance_2, PATCH_JUMP); InjectHook(0x4F88A0, &CClumpModelInfo_::CreateInstance_2, PATCH_JUMP);
InjectHook(0x50C1C0, &CClumpModelInfo::GetRwObject_, PATCH_JUMP); InjectHook(0x50C1C0, &CClumpModelInfo_::GetRwObject_, PATCH_JUMP);
InjectHook(0x4F8830, &CClumpModelInfo::SetClump_, PATCH_JUMP); InjectHook(0x4F8830, &CClumpModelInfo_::SetClump_, PATCH_JUMP);
InjectHook(0x4F8940, &CClumpModelInfo::SetAtomicRendererCB, PATCH_JUMP); InjectHook(0x4F8940, &CClumpModelInfo::SetAtomicRendererCB, PATCH_JUMP);
InjectHook(0x4F8960, &CClumpModelInfo::FindFrameFromNameCB, PATCH_JUMP); InjectHook(0x4F8960, &CClumpModelInfo::FindFrameFromNameCB, PATCH_JUMP);
InjectHook(0x4F8A10, &CClumpModelInfo::FindFrameFromNameWithoutIdCB, PATCH_JUMP); InjectHook(0x4F8A10, &CClumpModelInfo::FindFrameFromNameWithoutIdCB, PATCH_JUMP);

View File

@ -49,12 +49,5 @@ public:
static void FillFrameArray(RpClump *clump, RwFrame **frames); static void FillFrameArray(RpClump *clump, RwFrame **frames);
static RwFrame *FillFrameArrayCB(RwFrame *frame, void *data); static RwFrame *FillFrameArrayCB(RwFrame *frame, void *data);
static RwFrame *GetFrameFromId(RpClump *clump, int32 id); static RwFrame *GetFrameFromId(RpClump *clump, int32 id);
void DeleteRwObject_(void) { this->CClumpModelInfo::DeleteRwObject(); }
RwObject *CreateInstance_1(void) { return this->CClumpModelInfo::CreateInstance(); }
RwObject *CreateInstance_2(RwMatrix *m) { return this->CClumpModelInfo::CreateInstance(m); }
RwObject *GetRwObject_(void) { return this->CClumpModelInfo::GetRwObject(); }
void SetClump_(RpClump *clump) { this->CClumpModelInfo::SetClump(clump); }
}; };
static_assert(sizeof(CClumpModelInfo) == 0x34, "CClumpModelInfo: error"); static_assert(sizeof(CClumpModelInfo) == 0x34, "CClumpModelInfo: error");

View File

@ -1,7 +0,0 @@
#include "common.h"
#include "patcher.h"
#include "MloInstance.h"
STARTPATCHES
InjectHook(0x50BE90, &CMloInstance::dtor, PATCH_JUMP);
ENDPATCHES

View File

@ -1,9 +0,0 @@
#pragma once
#include "Placeable.h"
class CMloInstance : CPlaceable
{
public:
void dtor() { this->CMloInstance::~CMloInstance(); }
};

View File

@ -189,9 +189,17 @@ CPedModelInfo::CreateHitColModel(void)
m_hitColModel = colmodel; m_hitColModel = colmodel;
} }
class CPedModelInfo_ : public CPedModelInfo
{
public:
void DeleteRwObject_(void) { CPedModelInfo::DeleteRwObject(); }
void SetClump_(RpClump *clump) { CPedModelInfo::SetClump(clump); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x510210, &CPedModelInfo::SetClump_, PATCH_JUMP); InjectHook(0x510210, &CPedModelInfo_::SetClump_, PATCH_JUMP);
InjectHook(0x510280, &CPedModelInfo::DeleteRwObject_, PATCH_JUMP); InjectHook(0x510280, &CPedModelInfo_::DeleteRwObject_, PATCH_JUMP);
InjectHook(0x510390, &CPedModelInfo::SetLowDetailClump, PATCH_JUMP); InjectHook(0x510390, &CPedModelInfo::SetLowDetailClump, PATCH_JUMP);
InjectHook(0x5104D0, &CPedModelInfo::CreateHitColModel, PATCH_JUMP); InjectHook(0x5104D0, &CPedModelInfo::CreateHitColModel, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -39,9 +39,5 @@ public:
void SetLowDetailClump(RpClump*); void SetLowDetailClump(RpClump*);
void CreateHitColModel(void); void CreateHitColModel(void);
CColModel *GetHitColModel(void) { return m_hitColModel; } CColModel *GetHitColModel(void) { return m_hitColModel; }
void DeleteRwObject_(void) { this->CPedModelInfo::DeleteRwObject(); }
void SetClump_(RpClump *clump) { this->CPedModelInfo::SetClump(clump); }
}; };
static_assert(sizeof(CPedModelInfo) == 0x54, "CPedModelInfo: error"); static_assert(sizeof(CPedModelInfo) == 0x54, "CPedModelInfo: error");

View File

@ -154,12 +154,20 @@ CSimpleModelInfo::SetupBigBuilding(void)
} }
} }
class CSimpleModelInfo_ : public CSimpleModelInfo
{
public:
void DeleteRwObject_(void) { CSimpleModelInfo::DeleteRwObject(); }
RwObject *CreateInstance_1(void) { return CSimpleModelInfo::CreateInstance(); }
RwObject *CreateInstance_2(RwMatrix *m) { return CSimpleModelInfo::CreateInstance(m); }
RwObject *GetRwObject_(void) { return CSimpleModelInfo::GetRwObject(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x5179B0, &CSimpleModelInfo::DeleteRwObject_, PATCH_JUMP); InjectHook(0x5179B0, &CSimpleModelInfo_::DeleteRwObject_, PATCH_JUMP);
InjectHook(0x517B60, &CSimpleModelInfo::CreateInstance_1, PATCH_JUMP); InjectHook(0x517B60, &CSimpleModelInfo_::CreateInstance_1, PATCH_JUMP);
InjectHook(0x517AC0, &CSimpleModelInfo::CreateInstance_2, PATCH_JUMP); InjectHook(0x517AC0, &CSimpleModelInfo_::CreateInstance_2, PATCH_JUMP);
InjectHook(0x4A9BA0, &CSimpleModelInfo::GetRwObject_, PATCH_JUMP); InjectHook(0x4A9BA0, &CSimpleModelInfo_::GetRwObject_, PATCH_JUMP);
InjectHook(0x517990, &CSimpleModelInfo::Init, PATCH_JUMP); InjectHook(0x517990, &CSimpleModelInfo::Init, PATCH_JUMP);
InjectHook(0x517C60, &CSimpleModelInfo::IncreaseAlpha, PATCH_JUMP); InjectHook(0x517C60, &CSimpleModelInfo::IncreaseAlpha, PATCH_JUMP);
InjectHook(0x517950, &CSimpleModelInfo::SetAtomic, PATCH_JUMP); InjectHook(0x517950, &CSimpleModelInfo::SetAtomic, PATCH_JUMP);

View File

@ -48,10 +48,5 @@ public:
return (CSimpleModelInfo*)m_atomics[2]; } return (CSimpleModelInfo*)m_atomics[2]; }
void SetRelatedModel(CSimpleModelInfo *m){ void SetRelatedModel(CSimpleModelInfo *m){
m_atomics[2] = (RpAtomic*)m; } m_atomics[2] = (RpAtomic*)m; }
void DeleteRwObject_(void) { this->CSimpleModelInfo::DeleteRwObject(); }
RwObject *CreateInstance_1(void) { return this->CSimpleModelInfo::CreateInstance(); }
RwObject *CreateInstance_2(RwMatrix *m) { return this->CSimpleModelInfo::CreateInstance(m); }
RwObject *GetRwObject_(void) { return this->CSimpleModelInfo::GetRwObject(); }
}; };
static_assert(sizeof(CSimpleModelInfo) == 0x4C, "CSimpleModelInfo: error"); static_assert(sizeof(CSimpleModelInfo) == 0x4C, "CSimpleModelInfo: error");

View File

@ -1098,10 +1098,18 @@ CVehicleModelInfo::GetMaximumNumberOfPassengersFromNumberOfDoors(int id)
return n - 1; return n - 1;
} }
class CVehicleModelInfo_ : public CVehicleModelInfo
{
public:
void DeleteRwObject_(void) { CVehicleModelInfo::DeleteRwObject(); }
RwObject *CreateInstance_(void) { return CVehicleModelInfo::CreateInstance(); }
void SetClump_(RpClump *clump) { CVehicleModelInfo::SetClump(clump); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x51FDC0, &CVehicleModelInfo::DeleteRwObject_, PATCH_JUMP); InjectHook(0x51FDC0, &CVehicleModelInfo_::DeleteRwObject_, PATCH_JUMP);
InjectHook(0x51FCB0, &CVehicleModelInfo::CreateInstance_, PATCH_JUMP); InjectHook(0x51FCB0, &CVehicleModelInfo_::CreateInstance_, PATCH_JUMP);
InjectHook(0x51FC60, &CVehicleModelInfo::SetClump_, PATCH_JUMP); InjectHook(0x51FC60, &CVehicleModelInfo_::SetClump_, PATCH_JUMP);
InjectHook(0x51FE10, &CVehicleModelInfo::CollapseFramesCB, PATCH_JUMP); InjectHook(0x51FE10, &CVehicleModelInfo::CollapseFramesCB, PATCH_JUMP);
InjectHook(0x51FE50, &CVehicleModelInfo::MoveObjectsCB, PATCH_JUMP); InjectHook(0x51FE50, &CVehicleModelInfo::MoveObjectsCB, PATCH_JUMP);

View File

@ -10,6 +10,7 @@ enum {
}; };
enum { enum {
ATOMIC_FLAG_NONE = 0x0,
ATOMIC_FLAG_OK = 0x1, ATOMIC_FLAG_OK = 0x1,
ATOMIC_FLAG_DAM = 0x2, ATOMIC_FLAG_DAM = 0x2,
ATOMIC_FLAG_LEFT = 0x4, ATOMIC_FLAG_LEFT = 0x4,
@ -131,9 +132,5 @@ public:
static void ShutdownEnvironmentMaps(void); static void ShutdownEnvironmentMaps(void);
static int GetMaximumNumberOfPassengersFromNumberOfDoors(int id); static int GetMaximumNumberOfPassengersFromNumberOfDoors(int id);
void DeleteRwObject_(void) { this->CVehicleModelInfo::DeleteRwObject(); }
RwObject *CreateInstance_(void) { return this->CVehicleModelInfo::CreateInstance(); }
void SetClump_(RpClump *clump) { this->CVehicleModelInfo::SetClump(clump); }
}; };
static_assert(sizeof(CVehicleModelInfo) == 0x1F8, "CVehicleModelInfo: error"); static_assert(sizeof(CVehicleModelInfo) == 0x1F8, "CVehicleModelInfo: error");

View File

@ -109,10 +109,19 @@ CCutsceneHead::PlayAnimation(const char *animName)
} }
} }
class CCutsceneHead_ : public CCutsceneHead
{
public:
void CreateRwObject_(void) { CCutsceneHead::CreateRwObject(); }
void DeleteRwObject_(void) { CCutsceneHead::DeleteRwObject(); }
void ProcessControl_(void) { CCutsceneHead::ProcessControl(); }
void Render_(void) { CCutsceneHead::Render(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x4BA650, &CCutsceneHead::CreateRwObject_, PATCH_JUMP); InjectHook(0x4BA650, &CCutsceneHead_::CreateRwObject_, PATCH_JUMP);
InjectHook(0x4BA690, &CCutsceneHead::DeleteRwObject_, PATCH_JUMP); InjectHook(0x4BA690, &CCutsceneHead_::DeleteRwObject_, PATCH_JUMP);
InjectHook(0x4BA760, &CCutsceneHead::ProcessControl_, PATCH_JUMP); InjectHook(0x4BA760, &CCutsceneHead_::ProcessControl_, PATCH_JUMP);
InjectHook(0x4BA800, &CCutsceneHead::Render_, PATCH_JUMP); InjectHook(0x4BA800, &CCutsceneHead_::Render_, PATCH_JUMP);
InjectHook(0x4BA6A0, &CCutsceneHead::PlayAnimation, PATCH_JUMP); InjectHook(0x4BA6A0, &CCutsceneHead::PlayAnimation, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -15,10 +15,5 @@ public:
void Render(void); void Render(void);
void PlayAnimation(const char *animName); void PlayAnimation(const char *animName);
void CreateRwObject_(void) { CCutsceneHead::CreateRwObject(); }
void DeleteRwObject_(void) { CCutsceneHead::DeleteRwObject(); }
void ProcessControl_(void) { CCutsceneHead::ProcessControl(); }
void Render_(void) { CCutsceneHead::Render(); }
}; };
static_assert(sizeof(CCutsceneHead) == 0x19C, "CCutsceneHead: error"); static_assert(sizeof(CCutsceneHead) == 0x19C, "CCutsceneHead: error");

View File

@ -89,12 +89,24 @@ CCutsceneObject::RemoveLighting(bool reset)
CRenderer::RemoveVehiclePedLights(this, reset); CRenderer::RemoveVehiclePedLights(this, reset);
} }
class CCutsceneObject_ : public CCutsceneObject
{
public:
void dtor(void) { this->CCutsceneObject::~CCutsceneObject(); }
void SetModelIndex_(uint32 id) { CCutsceneObject::SetModelIndex(id); }
void ProcessControl_(void) { CCutsceneObject::ProcessControl(); }
void PreRender_(void) { CCutsceneObject::PreRender(); }
void Render_(void) { CCutsceneObject::Render(); }
bool SetupLighting_(void) { return CCutsceneObject::SetupLighting(); }
void RemoveLighting_(bool reset) { CCutsceneObject::RemoveLighting(reset); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x4BA960, &CCutsceneObject::dtor, PATCH_JUMP); InjectHook(0x4BA960, &CCutsceneObject_::dtor, PATCH_JUMP);
InjectHook(0x4BA980, &CCutsceneObject::SetModelIndex_, PATCH_JUMP); InjectHook(0x4BA980, &CCutsceneObject_::SetModelIndex_, PATCH_JUMP);
InjectHook(0x4BA9C0, &CCutsceneObject::ProcessControl_, PATCH_JUMP); InjectHook(0x4BA9C0, &CCutsceneObject_::ProcessControl_, PATCH_JUMP);
InjectHook(0x4BAA40, &CCutsceneObject::PreRender_, PATCH_JUMP); InjectHook(0x4BAA40, &CCutsceneObject_::PreRender_, PATCH_JUMP);
InjectHook(0x4BAAA0, &CCutsceneObject::Render_, PATCH_JUMP); InjectHook(0x4BAAA0, &CCutsceneObject_::Render_, PATCH_JUMP);
InjectHook(0x4A7E70, &CCutsceneObject::SetupLighting_, PATCH_JUMP); InjectHook(0x4A7E70, &CCutsceneObject_::SetupLighting_, PATCH_JUMP);
InjectHook(0x4A7F00, &CCutsceneObject::RemoveLighting_, PATCH_JUMP); InjectHook(0x4A7F00, &CCutsceneObject_::RemoveLighting_, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -7,19 +7,11 @@ class CCutsceneObject : public CObject
public: public:
CCutsceneObject(void); CCutsceneObject(void);
virtual void SetModelIndex(uint32 id); void SetModelIndex(uint32 id);
virtual void ProcessControl(void); void ProcessControl(void);
virtual void PreRender(void); void PreRender(void);
virtual void Render(void); void Render(void);
virtual bool SetupLighting(void); bool SetupLighting(void);
virtual void RemoveLighting(bool reset); void RemoveLighting(bool reset);
void dtor(void) { this->CCutsceneObject::~CCutsceneObject(); }
void SetModelIndex_(uint32 id) { CCutsceneObject::SetModelIndex(id); }
void ProcessControl_(void) { CCutsceneObject::ProcessControl(); }
void PreRender_(void) { CCutsceneObject::PreRender(); }
void Render_(void) { CCutsceneObject::Render(); }
bool SetupLighting_(void) { return CCutsceneObject::SetupLighting(); }
void RemoveLighting_(bool reset) { CCutsceneObject::RemoveLighting(reset); }
}; };
static_assert(sizeof(CCutsceneObject) == 0x198, "CCutsceneObject: error"); static_assert(sizeof(CCutsceneObject) == 0x198, "CCutsceneObject: error");

View File

@ -12,6 +12,12 @@ CDummyObject::CDummyObject(CObject *obj)
m_level = obj->m_level; m_level = obj->m_level;
} }
class CDummyObject_ : public CDummyObject
{
public:
void dtor(void) { CDummyObject::~CDummyObject(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x4BAB70, &CDummyObject::dtor, PATCH_JUMP); InjectHook(0x4BAB70, &CDummyObject_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -9,6 +9,5 @@ class CDummyObject : public CDummy
public: public:
CDummyObject(void) {} CDummyObject(void) {}
CDummyObject(CObject *obj); CDummyObject(CObject *obj);
void dtor(void) { this->CDummyObject::~CDummyObject(); }
}; };
static_assert(sizeof(CDummyObject) == 0x68, "CDummyObject: error"); static_assert(sizeof(CDummyObject) == 0x68, "CDummyObject: error");

View File

@ -87,7 +87,14 @@ CObject::RemoveLighting(bool reset)
WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); } WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); }
class CObject_ : public CObject
{
public:
void dtor(void) { this->CObject::~CObject(); }
void Render_(void) { CObject::Render(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x4BAE00, &CObject::dtor, PATCH_JUMP); InjectHook(0x4BAE00, &CObject_::dtor, PATCH_JUMP);
InjectHook(0x4BB1E0, &CObject::Render_, PATCH_JUMP); InjectHook(0x4BB1E0, &CObject_::Render_, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -74,8 +74,5 @@ public:
void ObjectDamage(float amount); void ObjectDamage(float amount);
static void DeleteAllTempObjectInArea(CVector, float); static void DeleteAllTempObjectInArea(CVector, float);
void dtor(void) { this->CObject::~CObject(); }
void Render_(void) { CObject::Render(); }
}; };
static_assert(sizeof(CObject) == 0x198, "CObject: error"); static_assert(sizeof(CObject) == 0x198, "CObject: error");

View File

@ -18,6 +18,12 @@ void CParticleObject::UpdateAll()
((void (__cdecl *)())0x4BCA30)(); ((void (__cdecl *)())0x4BCA30)();
} }
class CParticleObject_ : public CParticleObject
{
public:
void dtor() { CParticleObject::~CParticleObject(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x4BC420, &CParticleObject::dtor, PATCH_JUMP); InjectHook(0x4BC420, &CParticleObject_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -34,6 +34,4 @@ public:
static void AddObject(uint16 type, const CVector &pos, const CVector &dir, float size, bool remove); static void AddObject(uint16 type, const CVector &pos, const CVector &dir, float size, bool remove);
static void Initialise(); static void Initialise();
static void UpdateAll(); static void UpdateAll();
void dtor() { this->CParticleObject::~CParticleObject(); }
}; };

View File

@ -2,6 +2,12 @@
#include "patcher.h" #include "patcher.h"
#include "Projectile.h" #include "Projectile.h"
class CProjectile_ : public CProjectile
{
public:
void dtor(void) { CProjectile::~CProjectile(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x4BFED0, &CProjectile::dtor, PATCH_JUMP); InjectHook(0x4BFED0, &CProjectile_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -7,5 +7,4 @@
class CProjectile : public CObject class CProjectile : public CObject
{ {
public: public:
void dtor(void) { this->CProjectile::~CProjectile(); }
}; };

View File

@ -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 STARTPATCHES
InjectHook(0x4BFF30, &CCivilianPed::ctor, PATCH_JUMP); InjectHook(0x4BFF30, &CCivilianPed_::ctor, PATCH_JUMP);
InjectHook(0x4BFFC0, &CCivilianPed::dtor, PATCH_JUMP); InjectHook(0x4BFFC0, &CCivilianPed_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -6,11 +6,8 @@ class CCivilianPed : public CPed
{ {
public: public:
CCivilianPed(int, int); CCivilianPed(int, int);
virtual ~CCivilianPed(void) { } ~CCivilianPed(void) { }
virtual void ProcessControl(void); void ProcessControl(void);
CCivilianPed *ctor(int pedtype, int mi) { return ::new (this) CCivilianPed(pedtype, mi); };
void dtor(void) { this->CCivilianPed::~CCivilianPed(); }
}; };
static_assert(sizeof(CCivilianPed) == 0x53C, "CCivilianPed: error"); static_assert(sizeof(CCivilianPed) == 0x53C, "CCivilianPed: error");

View File

@ -9,6 +9,12 @@ CCopPed::~CCopPed()
WRAPPER void CCopPed::ClearPursuit(void) { EAXJMP(0x4C28C0); } WRAPPER void CCopPed::ClearPursuit(void) { EAXJMP(0x4C28C0); }
class CCopPed_ : public CCopPed
{
public:
void dtor(void) { CCopPed::~CCopPed(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x4C13E0, &CCopPed::dtor, PATCH_JUMP); InjectHook(0x4C13E0, &CCopPed_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -65,7 +65,6 @@ public:
int8 field_1367; int8 field_1367;
~CCopPed(); ~CCopPed();
void dtor(void) { this->CCopPed::~CCopPed(); }
void ClearPursuit(void); void ClearPursuit(void);
}; };

View File

@ -2,6 +2,12 @@
#include "patcher.h" #include "patcher.h"
#include "EmergencyPed.h" #include "EmergencyPed.h"
class CEmergencyPed_ : public CEmergencyPed
{
public:
void dtor(void) { CEmergencyPed::~CEmergencyPed(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x4C2EF0, &CEmergencyPed::dtor, PATCH_JUMP); InjectHook(0x4C2EF0, &CEmergencyPed_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -7,7 +7,5 @@ class CEmergencyPed : public CPed
public: public:
// 0x53C // 0x53C
uint8 stuff[24]; uint8 stuff[24];
void dtor(void) { this->CEmergencyPed::~CEmergencyPed(); }
}; };
static_assert(sizeof(CEmergencyPed) == 0x554, "CEmergencyPed: error"); static_assert(sizeof(CEmergencyPed) == 0x554, "CEmergencyPed: error");

View File

@ -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 FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4C6580); }
WRAPPER void CPed::RestoreHeadingRateCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4D6550); } 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 STARTPATCHES
InjectHook(0x4C41C0, &CPed::ctor, PATCH_JUMP); InjectHook(0x4C41C0, &CPed_::ctor, PATCH_JUMP);
InjectHook(0x4C50D0, &CPed::dtor, 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(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP);
InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP); InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP);
InjectHook(0x4EB470, &CPed::ApplyHeadShot, PATCH_JUMP); InjectHook(0x4EB470, &CPed::ApplyHeadShot, PATCH_JUMP);
@ -2926,11 +2945,6 @@ STARTPATCHES
InjectHook(0x4CC6C0, &CPed::PlayFootSteps, PATCH_JUMP); InjectHook(0x4CC6C0, &CPed::PlayFootSteps, PATCH_JUMP);
InjectHook(0x4C5350, &CPed::BuildPedLists, PATCH_JUMP); InjectHook(0x4C5350, &CPed::BuildPedLists, PATCH_JUMP);
InjectHook(0x4CF9B0, &CPed::GiveWeapon, 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(0x4C7EA0, &CPed::CalculateNewOrientation, PATCH_JUMP);
InjectHook(0x4C78F0, &CPed::WorkOutHeadingForMovingFirstPerson, PATCH_JUMP); InjectHook(0x4C78F0, &CPed::WorkOutHeadingForMovingFirstPerson, PATCH_JUMP);
InjectHook(0x4C73F0, &CPed::CalculateNewVelocity, PATCH_JUMP); InjectHook(0x4C73F0, &CPed::CalculateNewVelocity, PATCH_JUMP);

View File

@ -399,22 +399,20 @@ public:
static void operator delete(void*, int); static void operator delete(void*, int);
CPed(uint32 pedType); CPed(uint32 pedType);
virtual ~CPed(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*);
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); virtual void SetMoveAnim(void);
CPed* ctor(uint32 pedType) { return ::new (this) CPed(pedType); }
void dtor(void) { this->CPed::~CPed(); }
void AddWeaponModel(int id); void AddWeaponModel(int id);
void AimGun(void); void AimGun(void);
void KillPedWithCar(CVehicle *veh, float impulse); void KillPedWithCar(CVehicle *veh, float impulse);
@ -545,13 +543,6 @@ public:
PedState GetPedState(void) { return m_nPedState; } PedState GetPedState(void) { return m_nPedState; }
void SetPedState(PedState state) { m_nPedState = state; } 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 // set by 0482:set_threat_reaction_range_multiplier opcode
static uint16 &distanceMultToCountPedNear; static uint16 &distanceMultToCountPedNear;

View File

@ -21,8 +21,13 @@ void CPlayerPed::ClearWeaponTarget()
ClearPointGunAt(); ClearPointGunAt();
} }
STARTPATCHES class CPlayerPed_ : public CPlayerPed
InjectHook(0x4EFB30, &CPlayerPed::dtor, PATCH_JUMP); {
InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP); public:
void dtor(void) { CPlayerPed::~CPlayerPed(); }
};
STARTPATCHES
InjectHook(0x4EFB30, &CPlayerPed_::dtor, PATCH_JUMP);
InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -41,7 +41,6 @@ public:
~CPlayerPed(); ~CPlayerPed();
void dtor(void) { this->CPlayerPed::~CPlayerPed(); }
void ReApplyMoveAnims(void); void ReApplyMoveAnims(void);
void ClearWeaponTarget(); void ClearWeaponTarget();
}; };

View File

@ -29,6 +29,7 @@ CDraw::FindAspectRatio(void)
switch (FrontEndMenuManager.m_PrefsUseWideScreen) { switch (FrontEndMenuManager.m_PrefsUseWideScreen) {
case AR_AUTO: case AR_AUTO:
return SCREEN_WIDTH / SCREEN_HEIGHT; return SCREEN_WIDTH / SCREEN_HEIGHT;
default:
case AR_4_3: case AR_4_3:
return 4.0f / 3.0f; return 4.0f / 3.0f;
case AR_16_9: case AR_16_9:

View File

@ -1,18 +1,316 @@
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "VisibilityPlugins.h"
#include "HandlingMgr.h"
#include "Automobile.h" #include "Automobile.h"
bool &CAutomobile::m_sAllTaxiLights = *(bool*)0x95CD21;
WRAPPER CAutomobile* CAutomobile::ctor(int, uint8) { EAXJMP(0x52C6B0); }
CAutomobile::CAutomobile(int mi, uint8 owner) CAutomobile::CAutomobile(int mi, uint8 owner)
{ {
ctor(mi, owner); ctor(mi, owner);
} }
WRAPPER CAutomobile* CAutomobile::ctor(int, uint8) { EAXJMP(0x52C6B0); }
WRAPPER void CAutomobile::SetDoorDamage(int32, uint32, bool) { EAXJMP(0x530200); } void
WRAPPER void CAutomobile::SetPanelDamage(int32, uint32, bool) { EAXJMP(0x5301A0); } CAutomobile::SetModelIndex(uint32 id)
WRAPPER void CAutomobile::SetBumperDamage(int32, uint32, bool) { EAXJMP(0x530120); } {
CVehicle::SetModelIndex(id);
SetupModelNodes();
}
WRAPPER void CAutomobile::ProcessControl(void) { EAXJMP(0x531470); }
WRAPPER void CAutomobile::Teleport(CVector v) { EAXJMP(0x535180); }
WRAPPER void CAutomobile::PreRender(void) { EAXJMP(0x535B40); }
WRAPPER void CAutomobile::Render(void) { EAXJMP(0x539EA0); }
WRAPPER void CAutomobile::ProcessControlInputs(uint8) { EAXJMP(0x53B660); }
void
CAutomobile::GetComponentWorldPosition(int32 component, CVector &pos)
{
if(m_aCarNodes[component] == nil){
printf("CarNode missing: %d %d\n", GetModelIndex(), component);
return;
}
RwMatrix *ltm = RwFrameGetLTM(m_aCarNodes[component]);
pos = *RwMatrixGetPos(ltm);
}
bool
CAutomobile::IsComponentPresent(int32 comp)
{
return m_aCarNodes[comp] != nil;
}
void
CAutomobile::SetComponentRotation(int32 component, CVector rotation)
{
CMatrix mat(RwFrameGetMatrix(m_aCarNodes[component]));
CVector pos = *mat.GetPosition();
// BUG: all these set the whole matrix
mat.SetRotateX(DEGTORAD(rotation.x));
mat.SetRotateY(DEGTORAD(rotation.y));
mat.SetRotateZ(DEGTORAD(rotation.z));
*mat.GetPosition() += pos;
mat.UpdateRW();
}
WRAPPER void CAutomobile::OpenDoor(int32, eDoors door, float) { EAXJMP(0x52E750); }
WRAPPER void CAutomobile::ProcessOpenDoor(uint32, uint32, float) { EAXJMP(0x52E910); }
bool
CAutomobile::IsDoorReady(eDoors door)
{
if(Doors[door].IsClosed() || IsDoorMissing(door))
return true;
int doorflag = 0;
// TODO: enum?
switch(door){
case DOOR_FRONT_LEFT: doorflag = 1; break;
case DOOR_FRONT_RIGHT: doorflag = 4; break;
case DOOR_REAR_LEFT: doorflag = 2; break;
case DOOR_REAR_RIGHT: doorflag = 8; break;
}
return (doorflag & m_nGettingInFlags) == 0;
}
bool
CAutomobile::IsDoorFullyOpen(eDoors door)
{
return Doors[door].IsFullyOpen() || IsDoorMissing(door);
}
bool
CAutomobile::IsDoorClosed(eDoors door)
{
return !!Doors[door].IsClosed();
}
bool
CAutomobile::IsDoorMissing(eDoors door)
{
return Damage.GetDoorStatus(door) == DOOR_STATUS_MISSING;
}
void
CAutomobile::RemoveRefsToVehicle(CEntity *ent)
{
int i;
for(i = 0; i < 4; i++)
if(m_aGroundPhysical[i] == ent)
m_aGroundPhysical[i] = nil;
}
WRAPPER void CAutomobile::BlowUpCar(CEntity *ent) { EAXJMP(0x53BC60); }
WRAPPER bool CAutomobile::SetUpWheelColModel(CColModel *colModel) { EAXJMP(0x53BF70); }
WRAPPER void CAutomobile::BurstTyre(uint8 tyre) { EAXJMP(0x53C0E0); }
WRAPPER bool CAutomobile::IsRoomForPedToLeaveCar(uint32, CVector *) { EAXJMP(0x53C5B0); }
float
CAutomobile::GetHeightAboveRoad(void)
{
return m_fHeightAboveRoad;
}
WRAPPER void CAutomobile::PlayCarHorn(void) { EAXJMP(0x53C450); }
WRAPPER void CAutomobile::SpawnFlyingComponent(int32 component, uint32 type) { EAXJMP(0x530300); }
void
CAutomobile::SetPanelDamage(int32 component, ePanels panel, bool noFlyingComponents)
{
int status = Damage.GetPanelStatus(panel);
if(m_aCarNodes[component] == nil)
return;
if(status == PANEL_STATUS_SMASHED1){
// show damaged part
SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_DAM);
}else if(status == PANEL_STATUS_MISSING){
if(!noFlyingComponents)
SpawnFlyingComponent(component, COMPGROUP_PANEL);
// hide both
SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_NONE);
}
}
void
CAutomobile::SetBumperDamage(int32 component, ePanels panel, bool noFlyingComponents)
{
int status = Damage.GetPanelStatus(panel);
if(m_aCarNodes[component] == nil){
printf("Trying to damage component %d of %s\n",
component, CModelInfo::GetModelInfo(GetModelIndex())->GetName());
return;
}
if(status == PANEL_STATUS_SMASHED1){
// show damaged part
SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_DAM);
}else if(status == PANEL_STATUS_MISSING){
if(!noFlyingComponents)
SpawnFlyingComponent(component, COMPGROUP_BUMPER);
// hide both
SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_NONE);
}
}
void
CAutomobile::SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents)
{
int status = Damage.GetDoorStatus(door);
if(m_aCarNodes[component] == nil){
printf("Trying to damage component %d of %s\n",
component, CModelInfo::GetModelInfo(GetModelIndex())->GetName());
return;
}
if(door == DOOR_BOOT && status == DOOR_STATUS_SWINGING && m_handling->Flags & HANDLING_NOSWING_BOOT){
Damage.SetDoorStatus(DOOR_BOOT, DOOR_STATUS_MISSING);
status = DOOR_STATUS_MISSING;
}
if(status == DOOR_STATUS_SMASHED){
// show damaged part
SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_DAM);
}else if(status == DOOR_STATUS_SWINGING){
// turn off angle cull for swinging doors
RwFrameForAllObjects(m_aCarNodes[component], CVehicleModelInfo::SetAtomicFlagCB, (void*)ATOMIC_FLAG_NOCULL);
}else if(status == DOOR_STATUS_MISSING){
if(!noFlyingComponents){
if(door == DOOR_BONNET)
SpawnFlyingComponent(component, COMPGROUP_BONNET);
else if(door == DOOR_BOOT)
SpawnFlyingComponent(component, COMPGROUP_BOOT);
else
SpawnFlyingComponent(component, COMPGROUP_DOOR);
}
// hide both
SetComponentVisibility(m_aCarNodes[component], ATOMIC_FLAG_NONE);
}
}
static RwObject*
SetVehicleAtomicVisibilityCB(RwObject *object, void *data)
{
uint32 flags = (uint32)(uintptr)data;
RpAtomic *atomic = (RpAtomic*)object;
if((CVisibilityPlugins::GetAtomicId(atomic) & (ATOMIC_FLAG_OK|ATOMIC_FLAG_DAM)) == flags)
RpAtomicSetFlags(atomic, rpATOMICRENDER);
else
RpAtomicSetFlags(atomic, 0);
return object;
}
void
CAutomobile::SetComponentVisibility(RwFrame *frame, uint32 flags)
{
HideAllComps();
m_veh_flagC2 = true;
RwFrameForAllObjects(frame, SetVehicleAtomicVisibilityCB, (void*)flags);
}
void
CAutomobile::SetupModelNodes(void)
{
int i;
for(i = 0; i < NUM_CAR_NODES; i++)
m_aCarNodes[i] = nil;
CClumpModelInfo::FillFrameArray((RpClump*)m_rwObject, m_aCarNodes);
}
void
CAutomobile::SetTaxiLight(bool light)
{
bTaxiLight = light;
}
bool
CAutomobile::GetAllWheelsOffGround(void)
{
return m_nWheelsOnGround == 0;
}
void
CAutomobile::HideAllComps(void)
{
// empty
}
void
CAutomobile::ShowAllComps(void)
{
// empty
}
void
CAutomobile::ReduceHornCounter(void)
{
if(m_nCarHornTimer != 0)
m_nCarHornTimer--;
}
void
CAutomobile::SetAllTaxiLights(bool set)
{
m_sAllTaxiLights = set;
}
class CAutomobile_ : public CAutomobile
{
public:
void dtor() { CAutomobile::~CAutomobile(); }
void SetModelIndex_(uint32 id) { CAutomobile::SetModelIndex(id); }
void ProcessControl_(void) { CAutomobile::ProcessControl(); }
void Teleport_(CVector v) { CAutomobile::Teleport(v); }
void PreRender_(void) { CAutomobile::PreRender(); }
void Render_(void) { CAutomobile::Render(); }
void ProcessControlInputs_(uint8 x) { CAutomobile::ProcessControlInputs(x); }
void GetComponentWorldPosition_(int32 component, CVector &pos) { CAutomobile::GetComponentWorldPosition(component, pos); }
bool IsComponentPresent_(int32 component) { return CAutomobile::IsComponentPresent(component); }
void SetComponentRotation_(int32 component, CVector rotation) { CAutomobile::SetComponentRotation(component, rotation); }
void OpenDoor_(int32 component, eDoors door, float ratio) { CAutomobile::OpenDoor(component, door, ratio); }
void ProcessOpenDoor_(uint32 component, uint32 anim, float time) { CAutomobile::ProcessOpenDoor(component, anim, time); }
bool IsDoorReady_(eDoors door) { return CAutomobile::IsDoorReady(door); }
bool IsDoorFullyOpen_(eDoors door) { return CAutomobile::IsDoorFullyOpen(door); }
bool IsDoorClosed_(eDoors door) { return CAutomobile::IsDoorClosed(door); }
bool IsDoorMissing_(eDoors door) { return CAutomobile::IsDoorMissing(door); }
void RemoveRefsToVehicle_(CEntity *ent) { CAutomobile::RemoveRefsToVehicle(ent); }
void BlowUpCar_(CEntity *ent) { CAutomobile::BlowUpCar(ent); }
bool SetUpWheelColModel_(CColModel *colModel) { CAutomobile::SetUpWheelColModel(colModel); }
void BurstTyre_(uint8 tyre) { CAutomobile::BurstTyre(tyre); }
bool IsRoomForPedToLeaveCar_(uint32 door, CVector *pos) { return CAutomobile::IsRoomForPedToLeaveCar(door, pos); }
float GetHeightAboveRoad_(void) { return CAutomobile::GetHeightAboveRoad(); }
void PlayCarHorn_(void) { CAutomobile::PlayCarHorn(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x52D170, &CAutomobile::dtor, PATCH_JUMP); InjectHook(0x52D170, &CAutomobile_::dtor, PATCH_JUMP);
InjectHook(0x52D190, &CAutomobile_::SetModelIndex_, PATCH_JUMP);
InjectHook(0x52E5F0, &CAutomobile_::GetComponentWorldPosition_, PATCH_JUMP);
InjectHook(0x52E660, &CAutomobile_::IsComponentPresent_, PATCH_JUMP);
InjectHook(0x52E680, &CAutomobile_::SetComponentRotation_, PATCH_JUMP);
InjectHook(0x52EF10, &CAutomobile_::IsDoorReady_, PATCH_JUMP);
InjectHook(0x52EF90, &CAutomobile_::IsDoorFullyOpen_, PATCH_JUMP);
InjectHook(0x52EFD0, &CAutomobile_::IsDoorClosed_, PATCH_JUMP);
InjectHook(0x52F000, &CAutomobile_::IsDoorMissing_, PATCH_JUMP);
InjectHook(0x53BF40, &CAutomobile_::RemoveRefsToVehicle_, PATCH_JUMP);
InjectHook(0x437690, &CAutomobile_::GetHeightAboveRoad_, PATCH_JUMP);
InjectHook(0x5301A0, &CAutomobile::SetPanelDamage, PATCH_JUMP);
InjectHook(0x530120, &CAutomobile::SetBumperDamage, PATCH_JUMP);
InjectHook(0x530200, &CAutomobile::SetDoorDamage, PATCH_JUMP);
InjectHook(0x5300E0, &CAutomobile::SetComponentVisibility, PATCH_JUMP);
InjectHook(0x52D1B0, &CAutomobile::SetupModelNodes, PATCH_JUMP);
InjectHook(0x53C420, &CAutomobile::SetTaxiLight, PATCH_JUMP);
InjectHook(0x53BC40, &CAutomobile::GetAllWheelsOffGround, PATCH_JUMP);
InjectHook(0x5308C0, &CAutomobile::ReduceHornCounter, PATCH_JUMP);
InjectHook(0x53C440, &CAutomobile::SetAllTaxiLights, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -15,13 +15,22 @@ public:
float m_aSuspensionSpringRatio[4]; float m_aSuspensionSpringRatio[4];
float m_aSuspensionSpringRatioPrev[4]; float m_aSuspensionSpringRatioPrev[4];
float m_aWheelSkidThing[4]; float m_aWheelSkidThing[4];
int field_49C; float field_49C;
bool m_aWheelSkidmarkMuddy[4]; bool m_aWheelSkidmarkMuddy[4];
bool m_aWheelSkidmarkBloody[4]; bool m_aWheelSkidmarkBloody[4];
float m_aWheelRotation[4]; float m_aWheelRotation[4];
float m_aWheelPosition[4]; float m_aWheelPosition[4];
float m_aWheelSpeed[4]; float m_aWheelSpeed[4];
uint8 stuff3[12]; uint8 field_4D8;
uint8 m_auto_flagA1 : 1;
uint8 m_auto_flagA2 : 1;
uint8 m_auto_flagA4 : 1;
uint8 bTaxiLight : 1;
uint8 m_auto_flagA10 : 1;
uint8 m_auto_flagA20 : 1;
uint8 m_auto_flagA40 : 1;
uint8 m_auto_flagA80 : 1;
uint8 field_4DA[10];
uint32 m_nBusDoorTimerEnd; uint32 m_nBusDoorTimerEnd;
uint32 m_nBusDoorTimerStart; uint32 m_nBusDoorTimerStart;
float m_aSuspensionSpringLength[4]; float m_aSuspensionSpringLength[4];
@ -44,11 +53,52 @@ public:
uint8 stuff5[5]; uint8 stuff5[5];
int32 m_aWheelState[4]; int32 m_aWheelState[4];
static bool &m_sAllTaxiLights;
CAutomobile(int, uint8); CAutomobile(int, uint8);
// from CEntity
void SetModelIndex(uint32 id);
void ProcessControl(void);
void Teleport(CVector v);
void PreRender(void);
void Render(void);
// from CVehicle
void ProcessControlInputs(uint8);
void GetComponentWorldPosition(int32 component, CVector &pos);
bool IsComponentPresent(int32 component);
void SetComponentRotation(int32 component, CVector rotation);
void OpenDoor(int32, eDoors door, float);
void ProcessOpenDoor(uint32, uint32, float);
bool IsDoorReady(eDoors door);
bool IsDoorFullyOpen(eDoors door);
bool IsDoorClosed(eDoors door);
bool IsDoorMissing(eDoors door);
void RemoveRefsToVehicle(CEntity *ent);
void BlowUpCar(CEntity *ent);
bool SetUpWheelColModel(CColModel *colModel);
void BurstTyre(uint8 tyre);
bool IsRoomForPedToLeaveCar(uint32, CVector *);
float GetHeightAboveRoad(void);
void PlayCarHorn(void);
void SpawnFlyingComponent(int32 component, uint32 type);
void SetPanelDamage(int32 component, ePanels panel, bool noFlyingComponents);
void SetBumperDamage(int32 component, ePanels panel, bool noFlyingComponents);
void SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents);
void SetComponentVisibility(RwFrame *frame, uint32 flags);
void SetupModelNodes(void);
void SetTaxiLight(bool light);
bool GetAllWheelsOffGround(void);
void HideAllComps(void);
void ShowAllComps(void);
void ReduceHornCounter(void);
static void SetAllTaxiLights(bool set);
CAutomobile* ctor(int, uint8); CAutomobile* ctor(int, uint8);
void SetDoorDamage(int32, uint32, bool); /* TODO: eDoors */
void SetPanelDamage(int32, uint32, bool); /* TODO: ePanels */
void SetBumperDamage(int32, uint32, bool); /* TODO: ePanels */
void dtor() { this->CAutomobile::~CAutomobile(); }
}; };
static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error"); static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error");

View File

@ -9,6 +9,12 @@ CBoat::CBoat(int mi, uint8 owner)
WRAPPER CBoat* CBoat::ctor(int, uint8) { EAXJMP(0x53E3E0); } WRAPPER CBoat* CBoat::ctor(int, uint8) { EAXJMP(0x53E3E0); }
class CBoat_ : public CBoat
{
public:
void dtor() { CBoat::~CBoat(); };
};
STARTPATCHES STARTPATCHES
InjectHook(0x53E790, &CBoat::dtor, PATCH_JUMP); InjectHook(0x53E790, &CBoat_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -12,6 +12,5 @@ public:
CBoat(int, uint8); CBoat(int, uint8);
CBoat* ctor(int, uint8); CBoat* ctor(int, uint8);
void dtor() { this->CBoat::~CBoat(); };
}; };
static_assert(sizeof(CBoat) == 0x484, "CBoat: error"); static_assert(sizeof(CBoat) == 0x484, "CBoat: error");

View File

@ -1,6 +1,7 @@
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "General.h" #include "General.h"
#include "Vehicle.h"
#include "DamageManager.h" #include "DamageManager.h"

View File

@ -4,6 +4,22 @@
// TODO: move some of this into Vehicle.h // TODO: move some of this into Vehicle.h
enum eDoorStatus
{
DOOR_STATUS_OK,
DOOR_STATUS_SMASHED,
DOOR_STATUS_SWINGING,
DOOR_STATUS_MISSING
};
enum ePanelStatus
{
PANEL_STATUS_OK,
PANEL_STATUS_SMASHED1,
PANEL_STATUS_SMASHED2,
PANEL_STATUS_MISSING,
};
enum tComponent enum tComponent
{ {
COMPONENT_DEFAULT, COMPONENT_DEFAULT,
@ -37,23 +53,7 @@ enum tComponentGroup
COMPGROUP_DEFAULT, COMPGROUP_DEFAULT,
}; };
enum eLights enum eLights;
{
VEHLIGHT_FRONT_LEFT,
VEHLIGHT_FRONT_RIGHT,
VEHLIGHT_REAR_LEFT,
VEHLIGHT_REAR_RIGHT,
};
enum {
VEHPANEL_FRONT_LEFT,
VEHPANEL_FRONT_RIGHT,
VEHPANEL_REAR_LEFT,
VEHPANEL_REAR_RIGHT,
VEHPANEL_WINDSCREEN,
VEHBUMPER_FRONT,
VEHBUMPER_REAR,
};
class CDamageManager class CDamageManager
{ {

View File

@ -10,6 +10,12 @@ CHeli::CHeli(int mi, uint8 owner)
WRAPPER CHeli* CHeli::ctor(int, uint8) { EAXJMP(0x547220); } WRAPPER CHeli* CHeli::ctor(int, uint8) { EAXJMP(0x547220); }
WRAPPER void CHeli::SpecialHeliPreRender(void) { EAXJMP(0x54AE10); } WRAPPER void CHeli::SpecialHeliPreRender(void) { EAXJMP(0x54AE10); }
class CHeli_ : public CHeli
{
public:
void dtor(void) { CHeli::~CHeli(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x5474A0, &CHeli::dtor, PATCH_JUMP); InjectHook(0x5474A0, &CHeli_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -10,7 +10,6 @@ public:
CHeli(int, uint8); CHeli(int, uint8);
CHeli* ctor(int, uint8); CHeli* ctor(int, uint8);
void dtor(void) { this->CHeli::~CHeli(); }
static void SpecialHeliPreRender(void); static void SpecialHeliPreRender(void);
}; };

View File

@ -14,6 +14,12 @@ CPlane::~CPlane()
DeleteRwObject(); DeleteRwObject();
} }
class CPlane_ : public CPlane
{
public:
void dtor(void) { CPlane::~CPlane(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x54B270, &CPlane::dtor, PATCH_JUMP); InjectHook(0x54B270, &CPlane_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -12,7 +12,6 @@ public:
CPlane(int, uint8); CPlane(int, uint8);
~CPlane(void); ~CPlane(void);
CPlane* ctor(int, uint8); CPlane* ctor(int, uint8);
void dtor(void) { this->CPlane::~CPlane(); }
void FlagToDestroyWhenNextProcessed() { bRemoveFromWorld = true; } void FlagToDestroyWhenNextProcessed() { bRemoveFromWorld = true; }
}; };
static_assert(sizeof(CPlane) == 0x29C, "CPlane: error"); static_assert(sizeof(CPlane) == 0x29C, "CPlane: error");

View File

@ -9,6 +9,12 @@ CTrain::CTrain(int mi, uint8 owner)
WRAPPER CTrain* CTrain::ctor(int, uint8) { EAXJMP(0x54E2A0); } WRAPPER CTrain* CTrain::ctor(int, uint8) { EAXJMP(0x54E2A0); }
class CTrain_ : public CTrain
{
public:
void dtor(void) { CTrain::~CTrain(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x54E450, &CTrain::dtor, PATCH_JUMP); InjectHook(0x54E450, &CTrain_::dtor, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -21,6 +21,5 @@ public:
CTrain(int, uint8); CTrain(int, uint8);
CTrain* ctor(int, uint8); CTrain* ctor(int, uint8);
void dtor(void) { this->CTrain::~CTrain(); }
}; };
static_assert(sizeof(CTrain) == 0x2E4, "CTrain: error"); static_assert(sizeof(CTrain) == 0x2E4, "CTrain: error");

View File

@ -460,11 +460,22 @@ CVehicle::IsSphereTouchingVehicle(float sx, float sy, float sz, float radius)
return true; return true;
} }
class CVehicle_ : public CVehicle
{
public:
void dtor(void) { CVehicle::~CVehicle(); }
void SetModelIndex_(uint32 id) { CVehicle::SetModelIndex(id); }
bool SetupLighting_(void) { return CVehicle::SetupLighting(); }
void RemoveLighting_(bool reset) { CVehicle::RemoveLighting(reset); }
float GetHeightAboveRoad_(void) { return CVehicle::GetHeightAboveRoad(); }
};
STARTPATCHES STARTPATCHES
InjectHook(0x551170, &CVehicle::SetModelIndex_, PATCH_JUMP); InjectHook(0x551170, &CVehicle_::SetModelIndex_, PATCH_JUMP);
InjectHook(0x4A7DD0, &CVehicle::SetupLighting_, PATCH_JUMP); InjectHook(0x4A7DD0, &CVehicle_::SetupLighting_, PATCH_JUMP);
InjectHook(0x4A7E60, &CVehicle::RemoveLighting_, PATCH_JUMP); InjectHook(0x4A7E60, &CVehicle_::RemoveLighting_, PATCH_JUMP);
InjectHook(0x417E60, &CVehicle::GetHeightAboveRoad_, PATCH_JUMP); InjectHook(0x417E60, &CVehicle_::GetHeightAboveRoad_, PATCH_JUMP);
InjectHook(0x552880, &CVehicle::IsLawEnforcementVehicle, PATCH_JUMP); InjectHook(0x552880, &CVehicle::IsLawEnforcementVehicle, PATCH_JUMP);
InjectHook(0x552820, &CVehicle::ChangeLawEnforcerState, PATCH_JUMP); InjectHook(0x552820, &CVehicle::ChangeLawEnforcerState, PATCH_JUMP);

View File

@ -69,6 +69,25 @@ enum eDoors
DOOR_REAR_RIGHT DOOR_REAR_RIGHT
}; };
enum ePanels
{
VEHPANEL_FRONT_LEFT,
VEHPANEL_FRONT_RIGHT,
VEHPANEL_REAR_LEFT,
VEHPANEL_REAR_RIGHT,
VEHPANEL_WINDSCREEN,
VEHBUMPER_FRONT,
VEHBUMPER_REAR,
};
enum eLights
{
VEHLIGHT_FRONT_LEFT,
VEHLIGHT_FRONT_RIGHT,
VEHLIGHT_REAR_LEFT,
VEHLIGHT_REAR_RIGHT,
};
class CVehicle : public CPhysical class CVehicle : public CPhysical
{ {
public: public:
@ -115,7 +134,7 @@ public:
uint8 m_veh_flagB80 : 1; uint8 m_veh_flagB80 : 1;
uint8 m_veh_flagC1 : 1; uint8 m_veh_flagC1 : 1;
uint8 m_veh_flagC2 : 1; uint8 m_veh_flagC2 : 1; // bIsDamaged
uint8 m_veh_flagC4 : 1; uint8 m_veh_flagC4 : 1;
uint8 m_veh_flagC8 : 1; uint8 m_veh_flagC8 : 1;
uint8 m_veh_flagC10 : 1; uint8 m_veh_flagC10 : 1;
@ -169,7 +188,7 @@ public:
~CVehicle(void); ~CVehicle(void);
// from CEntity // from CEntity
void SetModelIndex(uint32 i); void SetModelIndex(uint32 id);
bool SetupLighting(void); bool SetupLighting(void);
void RemoveLighting(bool); void RemoveLighting(bool);
void FlagToDestroyWhenNextProcessed(void) {} void FlagToDestroyWhenNextProcessed(void) {}
@ -225,13 +244,6 @@ public:
static bool &bCheat4; static bool &bCheat4;
static bool &bCheat5; static bool &bCheat5;
static bool &m_bDisableMouseSteering; static bool &m_bDisableMouseSteering;
void dtor(void) { CVehicle::~CVehicle(); }
void SetModelIndex_(uint32 id) { CVehicle::SetModelIndex(id); }
bool SetupLighting_(void) { return CVehicle::SetupLighting(); }
void RemoveLighting_(bool reset) { CVehicle::RemoveLighting(reset); }
float GetHeightAboveRoad_(void) { return CVehicle::GetHeightAboveRoad(); }
}; };
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error"); static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");