summaryrefslogtreecommitdiffstats
path: root/src/modelinfo
diff options
context:
space:
mode:
authorFire_Head <Fire-Head@users.noreply.github.com>2019-07-11 02:48:36 +0200
committerGitHub <noreply@github.com>2019-07-11 02:48:36 +0200
commitaa449b6fe162d8960351c5fe164a9120b8572652 (patch)
treefa82496d356ac2b77ffa1ab00684b0150907f009 /src/modelinfo
parentfixfixfix (diff)
parentMerge pull request #129 from erorcun/erorcun (diff)
downloadre3-aa449b6fe162d8960351c5fe164a9120b8572652.tar
re3-aa449b6fe162d8960351c5fe164a9120b8572652.tar.gz
re3-aa449b6fe162d8960351c5fe164a9120b8572652.tar.bz2
re3-aa449b6fe162d8960351c5fe164a9120b8572652.tar.lz
re3-aa449b6fe162d8960351c5fe164a9120b8572652.tar.xz
re3-aa449b6fe162d8960351c5fe164a9120b8572652.tar.zst
re3-aa449b6fe162d8960351c5fe164a9120b8572652.zip
Diffstat (limited to 'src/modelinfo')
-rw-r--r--src/modelinfo/BaseModelInfo.cpp8
-rw-r--r--src/modelinfo/BaseModelInfo.h2
-rw-r--r--src/modelinfo/ClumpModelInfo.cpp20
-rw-r--r--src/modelinfo/ClumpModelInfo.h7
-rw-r--r--src/modelinfo/MloInstance.cpp7
-rw-r--r--src/modelinfo/MloInstance.h9
-rw-r--r--src/modelinfo/ModelIndices.h3
-rw-r--r--src/modelinfo/PedModelInfo.cpp12
-rw-r--r--src/modelinfo/PedModelInfo.h4
-rw-r--r--src/modelinfo/SimpleModelInfo.cpp16
-rw-r--r--src/modelinfo/SimpleModelInfo.h5
-rw-r--r--src/modelinfo/VehicleModelInfo.cpp22
-rw-r--r--src/modelinfo/VehicleModelInfo.h7
13 files changed, 64 insertions, 58 deletions
diff --git a/src/modelinfo/BaseModelInfo.cpp b/src/modelinfo/BaseModelInfo.cpp
index 37f94c93..830ead51 100644
--- a/src/modelinfo/BaseModelInfo.cpp
+++ b/src/modelinfo/BaseModelInfo.cpp
@@ -101,9 +101,15 @@ CBaseModelInfo::Get2dEffect(int n)
}
+class CBaseModelInfo_ : public CBaseModelInfo
+{
+public:
+ void Shutdown_(void) { CBaseModelInfo::Shutdown(); }
+};
STARTPATCHES
// 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(0x4F6B70, &CBaseModelInfo::ClearTexDictionary, PATCH_JUMP);
InjectHook(0x4F6BA0, &CBaseModelInfo::AddRef, PATCH_JUMP);
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h
index da72990f..a9bafb64 100644
--- a/src/modelinfo/BaseModelInfo.h
+++ b/src/modelinfo/BaseModelInfo.h
@@ -62,8 +62,6 @@ public:
void Init2dEffects(void);
void Add2dEffect(C2dEffect *fx);
C2dEffect *Get2dEffect(int n);
-
- void Shutdown_(void) { this->CBaseModelInfo::Shutdown(); }
};
static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error");
diff --git a/src/modelinfo/ClumpModelInfo.cpp b/src/modelinfo/ClumpModelInfo.cpp
index 24deed38..d666313b 100644
--- a/src/modelinfo/ClumpModelInfo.cpp
+++ b/src/modelinfo/ClumpModelInfo.cpp
@@ -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
- InjectHook(0x4F8800, &CClumpModelInfo::DeleteRwObject_, PATCH_JUMP);
- InjectHook(0x4F8920, &CClumpModelInfo::CreateInstance_1, PATCH_JUMP);
- InjectHook(0x4F88A0, &CClumpModelInfo::CreateInstance_2, PATCH_JUMP);
- InjectHook(0x50C1C0, &CClumpModelInfo::GetRwObject_, PATCH_JUMP);
- InjectHook(0x4F8830, &CClumpModelInfo::SetClump_, PATCH_JUMP);
+ InjectHook(0x4F8800, &CClumpModelInfo_::DeleteRwObject_, PATCH_JUMP);
+ InjectHook(0x4F8920, &CClumpModelInfo_::CreateInstance_1, PATCH_JUMP);
+ InjectHook(0x4F88A0, &CClumpModelInfo_::CreateInstance_2, PATCH_JUMP);
+ InjectHook(0x50C1C0, &CClumpModelInfo_::GetRwObject_, PATCH_JUMP);
+ InjectHook(0x4F8830, &CClumpModelInfo_::SetClump_, PATCH_JUMP);
InjectHook(0x4F8940, &CClumpModelInfo::SetAtomicRendererCB, PATCH_JUMP);
InjectHook(0x4F8960, &CClumpModelInfo::FindFrameFromNameCB, PATCH_JUMP);
InjectHook(0x4F8A10, &CClumpModelInfo::FindFrameFromNameWithoutIdCB, PATCH_JUMP);
diff --git a/src/modelinfo/ClumpModelInfo.h b/src/modelinfo/ClumpModelInfo.h
index 909d241b..d491bdb9 100644
--- a/src/modelinfo/ClumpModelInfo.h
+++ b/src/modelinfo/ClumpModelInfo.h
@@ -49,12 +49,5 @@ public:
static void FillFrameArray(RpClump *clump, RwFrame **frames);
static RwFrame *FillFrameArrayCB(RwFrame *frame, void *data);
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");
diff --git a/src/modelinfo/MloInstance.cpp b/src/modelinfo/MloInstance.cpp
deleted file mode 100644
index dbd83727..00000000
--- a/src/modelinfo/MloInstance.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "common.h"
-#include "patcher.h"
-#include "MloInstance.h"
-
-STARTPATCHES
-InjectHook(0x50BE90, &CMloInstance::dtor, PATCH_JUMP);
-ENDPATCHES \ No newline at end of file
diff --git a/src/modelinfo/MloInstance.h b/src/modelinfo/MloInstance.h
deleted file mode 100644
index 00afc379..00000000
--- a/src/modelinfo/MloInstance.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-
-#include "Placeable.h"
-
-class CMloInstance : CPlaceable
-{
-public:
- void dtor() { this->CMloInstance::~CMloInstance(); }
-}; \ No newline at end of file
diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h
index 95b5eb43..0d9ffb53 100644
--- a/src/modelinfo/ModelIndices.h
+++ b/src/modelinfo/ModelIndices.h
@@ -164,7 +164,8 @@
// expand as needed
enum
{
- MI_COP = 1,
+ MI_PLAYER = 0,
+ MI_COP,
MI_SWAT,
MI_FBI,
MI_ARMY,
diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp
index 775148c9..747cbc99 100644
--- a/src/modelinfo/PedModelInfo.cpp
+++ b/src/modelinfo/PedModelInfo.cpp
@@ -189,9 +189,17 @@ CPedModelInfo::CreateHitColModel(void)
m_hitColModel = colmodel;
}
+
+class CPedModelInfo_ : public CPedModelInfo
+{
+public:
+ void DeleteRwObject_(void) { CPedModelInfo::DeleteRwObject(); }
+ void SetClump_(RpClump *clump) { CPedModelInfo::SetClump(clump); }
+};
+
STARTPATCHES
- InjectHook(0x510210, &CPedModelInfo::SetClump_, PATCH_JUMP);
- InjectHook(0x510280, &CPedModelInfo::DeleteRwObject_, PATCH_JUMP);
+ InjectHook(0x510210, &CPedModelInfo_::SetClump_, PATCH_JUMP);
+ InjectHook(0x510280, &CPedModelInfo_::DeleteRwObject_, PATCH_JUMP);
InjectHook(0x510390, &CPedModelInfo::SetLowDetailClump, PATCH_JUMP);
InjectHook(0x5104D0, &CPedModelInfo::CreateHitColModel, PATCH_JUMP);
ENDPATCHES
diff --git a/src/modelinfo/PedModelInfo.h b/src/modelinfo/PedModelInfo.h
index 7be2c195..bec46b4e 100644
--- a/src/modelinfo/PedModelInfo.h
+++ b/src/modelinfo/PedModelInfo.h
@@ -39,9 +39,5 @@ public:
void SetLowDetailClump(RpClump*);
void CreateHitColModel(void);
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");
diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp
index ea7a3f9e..dd5010fa 100644
--- a/src/modelinfo/SimpleModelInfo.cpp
+++ b/src/modelinfo/SimpleModelInfo.cpp
@@ -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
- InjectHook(0x5179B0, &CSimpleModelInfo::DeleteRwObject_, PATCH_JUMP);
- InjectHook(0x517B60, &CSimpleModelInfo::CreateInstance_1, PATCH_JUMP);
- InjectHook(0x517AC0, &CSimpleModelInfo::CreateInstance_2, PATCH_JUMP);
- InjectHook(0x4A9BA0, &CSimpleModelInfo::GetRwObject_, PATCH_JUMP);
+ InjectHook(0x5179B0, &CSimpleModelInfo_::DeleteRwObject_, PATCH_JUMP);
+ InjectHook(0x517B60, &CSimpleModelInfo_::CreateInstance_1, PATCH_JUMP);
+ InjectHook(0x517AC0, &CSimpleModelInfo_::CreateInstance_2, PATCH_JUMP);
+ InjectHook(0x4A9BA0, &CSimpleModelInfo_::GetRwObject_, PATCH_JUMP);
InjectHook(0x517990, &CSimpleModelInfo::Init, PATCH_JUMP);
InjectHook(0x517C60, &CSimpleModelInfo::IncreaseAlpha, PATCH_JUMP);
InjectHook(0x517950, &CSimpleModelInfo::SetAtomic, PATCH_JUMP);
diff --git a/src/modelinfo/SimpleModelInfo.h b/src/modelinfo/SimpleModelInfo.h
index d5b572a6..35d48669 100644
--- a/src/modelinfo/SimpleModelInfo.h
+++ b/src/modelinfo/SimpleModelInfo.h
@@ -48,10 +48,5 @@ public:
return (CSimpleModelInfo*)m_atomics[2]; }
void SetRelatedModel(CSimpleModelInfo *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");
diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp
index f112d546..9b2924e9 100644
--- a/src/modelinfo/VehicleModelInfo.cpp
+++ b/src/modelinfo/VehicleModelInfo.cpp
@@ -414,11 +414,13 @@ CVehicleModelInfo::SetAtomicFlagCB(RwObject *object, void *data)
return object;
}
-RpAtomic*
-CVehicleModelInfo::ClearAtomicFlagCB(RpAtomic *atomic, void *data)
+RwObject*
+CVehicleModelInfo::ClearAtomicFlagCB(RwObject *object, void *data)
{
+ RpAtomic *atomic = (RpAtomic*)object;
+ assert(RwObjectGetType(object) == rpATOMIC);
CVisibilityPlugins::ClearAtomicFlag(atomic, (int)data);
- return atomic;
+ return object;
}
RwObject*
@@ -1098,10 +1100,18 @@ CVehicleModelInfo::GetMaximumNumberOfPassengersFromNumberOfDoors(int id)
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
- InjectHook(0x51FDC0, &CVehicleModelInfo::DeleteRwObject_, PATCH_JUMP);
- InjectHook(0x51FCB0, &CVehicleModelInfo::CreateInstance_, PATCH_JUMP);
- InjectHook(0x51FC60, &CVehicleModelInfo::SetClump_, PATCH_JUMP);
+ InjectHook(0x51FDC0, &CVehicleModelInfo_::DeleteRwObject_, PATCH_JUMP);
+ InjectHook(0x51FCB0, &CVehicleModelInfo_::CreateInstance_, PATCH_JUMP);
+ InjectHook(0x51FC60, &CVehicleModelInfo_::SetClump_, PATCH_JUMP);
InjectHook(0x51FE10, &CVehicleModelInfo::CollapseFramesCB, PATCH_JUMP);
InjectHook(0x51FE50, &CVehicleModelInfo::MoveObjectsCB, PATCH_JUMP);
diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h
index 2e2f1be2..37f47489 100644
--- a/src/modelinfo/VehicleModelInfo.h
+++ b/src/modelinfo/VehicleModelInfo.h
@@ -10,6 +10,7 @@ enum {
};
enum {
+ ATOMIC_FLAG_NONE = 0x0,
ATOMIC_FLAG_OK = 0x1,
ATOMIC_FLAG_DAM = 0x2,
ATOMIC_FLAG_LEFT = 0x4,
@@ -106,7 +107,7 @@ public:
void SetAtomicRenderCallbacks(void);
static RwObject *SetAtomicFlagCB(RwObject *object, void *data);
- static RpAtomic *ClearAtomicFlagCB(RpAtomic *atomic, void *data);
+ static RwObject *ClearAtomicFlagCB(RwObject *atomic, void *data);
void SetVehicleComponentFlags(RwFrame *frame, uint32 flags);
void PreprocessHierarchy(void);
void GetWheelPosn(int32 n, CVector &pos);
@@ -131,9 +132,5 @@ public:
static void ShutdownEnvironmentMaps(void);
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");