diff options
Diffstat (limited to 'src/modelinfo')
-rw-r--r-- | src/modelinfo/BaseModelInfo.cpp | 24 | ||||
-rw-r--r-- | src/modelinfo/ClumpModelInfo.cpp | 29 | ||||
-rw-r--r-- | src/modelinfo/MloModelInfo.cpp | 2 | ||||
-rw-r--r-- | src/modelinfo/ModelIndices.cpp | 9 | ||||
-rw-r--r-- | src/modelinfo/ModelIndices.h | 9 | ||||
-rw-r--r-- | src/modelinfo/ModelInfo.cpp | 19 | ||||
-rw-r--r-- | src/modelinfo/ModelInfo.h | 2 | ||||
-rw-r--r-- | src/modelinfo/PedModelInfo.cpp | 16 | ||||
-rw-r--r-- | src/modelinfo/SimpleModelInfo.cpp | 27 | ||||
-rw-r--r-- | src/modelinfo/TimeModelInfo.cpp | 6 | ||||
-rw-r--r-- | src/modelinfo/VehicleModelInfo.cpp | 78 | ||||
-rw-r--r-- | src/modelinfo/VehicleModelInfo.h | 10 |
12 files changed, 32 insertions, 199 deletions
diff --git a/src/modelinfo/BaseModelInfo.cpp b/src/modelinfo/BaseModelInfo.cpp index 830ead51..e8d2601f 100644 --- a/src/modelinfo/BaseModelInfo.cpp +++ b/src/modelinfo/BaseModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "templates.h" #include "TxdStore.h" #include "2dEffect.h" @@ -99,25 +99,3 @@ CBaseModelInfo::Get2dEffect(int n) else return nil; } - - -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(0x4F6AC0, &CBaseModelInfo::DeleteCollisionModel, PATCH_JUMP); - InjectHook(0x4F6B70, &CBaseModelInfo::ClearTexDictionary, PATCH_JUMP); - InjectHook(0x4F6BA0, &CBaseModelInfo::AddRef, PATCH_JUMP); - InjectHook(0x4F6BB0, &CBaseModelInfo::RemoveRef, PATCH_JUMP); - InjectHook(0x4F6B40, &CBaseModelInfo::SetTexDictionary, PATCH_JUMP); - InjectHook(0x4F6B80, &CBaseModelInfo::AddTexDictionaryRef, PATCH_JUMP); - InjectHook(0x4F6B90, &CBaseModelInfo::RemoveTexDictionaryRef, PATCH_JUMP); - InjectHook(0x4F6B20, &CBaseModelInfo::Add2dEffect, PATCH_JUMP); - InjectHook(0x4F6AF0, &CBaseModelInfo::Init2dEffects, PATCH_JUMP); - InjectHook(0x4F6B00, &CBaseModelInfo::Get2dEffect, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/ClumpModelInfo.cpp b/src/modelinfo/ClumpModelInfo.cpp index c6a6d5d0..464bda61 100644 --- a/src/modelinfo/ClumpModelInfo.cpp +++ b/src/modelinfo/ClumpModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "NodeName.h" #include "VisibilityPlugins.h" @@ -138,30 +138,3 @@ CClumpModelInfo::GetFrameFromId(RpClump *clump, int32 id) RwFrameForAllChildren(RpClumpGetFrame(clump), FindFrameFromIdCB, &assoc); return assoc.frame; } - - -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(0x4F8940, &CClumpModelInfo::SetAtomicRendererCB, PATCH_JUMP); - InjectHook(0x4F8960, &CClumpModelInfo::FindFrameFromNameCB, PATCH_JUMP); - InjectHook(0x4F8A10, &CClumpModelInfo::FindFrameFromNameWithoutIdCB, PATCH_JUMP); - InjectHook(0x4F8AD0, &CClumpModelInfo::FindFrameFromIdCB, PATCH_JUMP); - InjectHook(0x4F8BB0, &CClumpModelInfo::SetFrameIds, PATCH_JUMP); - InjectHook(0x4F8B20, &CClumpModelInfo::FillFrameArrayCB, PATCH_JUMP); - InjectHook(0x4F8B90, &CClumpModelInfo::FillFrameArray, PATCH_JUMP); - InjectHook(0x4F8B50, &CClumpModelInfo::GetFrameFromId, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/MloModelInfo.cpp b/src/modelinfo/MloModelInfo.cpp index 746d9db4..7535e6c5 100644 --- a/src/modelinfo/MloModelInfo.cpp +++ b/src/modelinfo/MloModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "VisibilityPlugins.h" #include "ModelInfo.h" diff --git a/src/modelinfo/ModelIndices.cpp b/src/modelinfo/ModelIndices.cpp index ec039a0b..9a6a74d0 100644 --- a/src/modelinfo/ModelIndices.cpp +++ b/src/modelinfo/ModelIndices.cpp @@ -1,9 +1,9 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "ModelIndices.h" -#define X(name, var, addr) int16 &var = *(int16*)addr; +#define X(name, var, addr) int16 var; MODELINDICES #undef X @@ -32,8 +32,3 @@ TestModelIndices(void) { ; } - -STARTPATCHES - InjectHook(0x48EB60, InitModelIndices, PATCH_JUMP); - InjectHook(0x48F030, MatchModelString, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index 309fa1bb..8e117882 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -158,7 +158,7 @@ X("subplatform_sub", MI_SUBPLATFORM_SUB2, 0x5F5BC0) \ X("files", MI_FILES, 0x5F5BC4) -#define X(name, var, addr) extern int16 &var; +#define X(name, var, addr) extern int16 var; MODELINDICES #undef X @@ -496,4 +496,11 @@ IsExplosiveThingModel(int16 id) { return id == MI_EXPLODINGBARREL || id == MI_PETROLPUMP; +} + +inline bool +IsFence(int16 id) +{ + return id == MI_FENCE || + id == MI_FENCE2; }
\ No newline at end of file diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp index b6a95992..c1ae692f 100644 --- a/src/modelinfo/ModelInfo.cpp +++ b/src/modelinfo/ModelInfo.cpp @@ -1,15 +1,12 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "TempColModels.h" #include "ModelIndices.h" #include "ModelInfo.h" -CBaseModelInfo **CModelInfo::ms_modelInfoPtrs = (CBaseModelInfo**)0x83D408; +CBaseModelInfo *CModelInfo::ms_modelInfoPtrs[MODELINFOSIZE]; -//CStore<CSimpleModelInfo, SIMPLEMODELSIZE> &CModelInfo::ms_simpleModelStore = *(CStore<CSimpleModelInfo, SIMPLEMODELSIZE>*)0x885BB4; -//CStore<CTimeModelInfo, TIMEMODELSIZE> &CModelInfo::ms_timeModelStore = *(CStore<CTimeModelInfo, TIMEMODELSIZE>*)0x94076C; -//CStore<C2dEffect, TWODFXSIZE> &CModelInfo::ms_2dEffectStore = *(CStore<C2dEffect, TWODFXSIZE>*)0x9434F8; CStore<CSimpleModelInfo, SIMPLEMODELSIZE> CModelInfo::ms_simpleModelStore; CStore<CMloModelInfo, MLOMODELSIZE> CModelInfo::ms_mloModelStore; CStore<CInstance, MLOINSTANCESIZE> CModelInfo::ms_mloInstanceStore; @@ -251,15 +248,3 @@ CModelInfo::ReInit2dEffects() ms_modelInfoPtrs[i]->Init2dEffects(); } } - -STARTPATCHES - InjectHook(0x50B310, CModelInfo::Initialise, PATCH_JUMP); - InjectHook(0x50B5B0, CModelInfo::ShutDown, PATCH_JUMP); - InjectHook(0x50B920, CModelInfo::AddSimpleModel, PATCH_JUMP); - InjectHook(0x50B9C0, CModelInfo::AddTimeModel, PATCH_JUMP); - InjectHook(0x50BA10, CModelInfo::AddClumpModel, PATCH_JUMP); - InjectHook(0x50BAD0, CModelInfo::AddPedModel, PATCH_JUMP); - InjectHook(0x50BA60, CModelInfo::AddVehicleModel, PATCH_JUMP); - InjectHook(0x50B860, (CBaseModelInfo *(*)(const char*, int*))CModelInfo::GetModelInfo, PATCH_JUMP); - InjectHook(0x50BBC0, CModelInfo::RemoveColModelsFromOtherLevels, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/ModelInfo.h b/src/modelinfo/ModelInfo.h index e6dec1d8..65cfa4e7 100644 --- a/src/modelinfo/ModelInfo.h +++ b/src/modelinfo/ModelInfo.h @@ -13,7 +13,7 @@ class CModelInfo { - static CBaseModelInfo **ms_modelInfoPtrs; //[MODELINFOSIZE]; + static CBaseModelInfo *ms_modelInfoPtrs[MODELINFOSIZE]; static CStore<CSimpleModelInfo, SIMPLEMODELSIZE> ms_simpleModelStore; static CStore<CMloModelInfo, MLOMODELSIZE> ms_mloModelStore; static CStore<CInstance, MLOINSTANCESIZE> ms_mloInstanceStore; diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index 015c6949..5c801a2b 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "Ped.h" #include "NodeName.h" @@ -229,17 +229,3 @@ CPedModelInfo::AnimatePedColModel(CColModel* colmodel, RwFrame* frame) return 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(0x510390, &CPedModelInfo::SetLowDetailClump, PATCH_JUMP); - InjectHook(0x5104D0, &CPedModelInfo::CreateHitColModel, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp index f8742f1e..2fb2adeb 100644 --- a/src/modelinfo/SimpleModelInfo.cpp +++ b/src/modelinfo/SimpleModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "General.h" #include "Camera.h" #include "ModelInfo.h" @@ -154,28 +154,3 @@ CSimpleModelInfo::SetupBigBuilding(void) m_lodDistances[2] = 100.0f; } } - -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(0x517990, &CSimpleModelInfo::Init, PATCH_JUMP); - InjectHook(0x517C60, &CSimpleModelInfo::IncreaseAlpha, PATCH_JUMP); - InjectHook(0x517950, &CSimpleModelInfo::SetAtomic, PATCH_JUMP); - InjectHook(0x517AA0, &CSimpleModelInfo::SetLodDistances, PATCH_JUMP); - InjectHook(0x517A90, &CSimpleModelInfo::GetNearDistance, PATCH_JUMP); - InjectHook(0x517A60, &CSimpleModelInfo::GetLargestLodDistance, PATCH_JUMP); - InjectHook(0x517A00, &CSimpleModelInfo::GetAtomicFromDistance, PATCH_JUMP); - InjectHook(0x517C00, &CSimpleModelInfo::FindRelatedModel, PATCH_JUMP); - InjectHook(0x517B90, &CSimpleModelInfo::SetupBigBuilding, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/TimeModelInfo.cpp b/src/modelinfo/TimeModelInfo.cpp index 3ab3e13a..fec3f6e5 100644 --- a/src/modelinfo/TimeModelInfo.cpp +++ b/src/modelinfo/TimeModelInfo.cpp @@ -1,5 +1,5 @@ #include "common.h" -#include "patcher.h" + #include "Camera.h" #include "ModelInfo.h" @@ -30,7 +30,3 @@ CTimeModelInfo::FindOtherTimeModel(void) } return nil; } - -STARTPATCHES - InjectHook(0x517C80, &CTimeModelInfo::FindOtherTimeModel, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index 0c45aa12..0c3a7720 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -1,6 +1,6 @@ #include "common.h" #include <rpmatfx.h> -#include "patcher.h" + #include "RwHelper.h" #include "General.h" #include "NodeName.h" @@ -19,14 +19,14 @@ #include "ModelIndices.h" #include "ModelInfo.h" -int8 *CVehicleModelInfo::ms_compsToUse = (int8*)0x5FF2EC; // -2, -2 -int8 *CVehicleModelInfo::ms_compsUsed = (int8*)0x95CCB2; -RwTexture **CVehicleModelInfo::ms_pEnvironmentMaps = (RwTexture **)0x8F1A30; -RwRGBA *CVehicleModelInfo::ms_vehicleColourTable = (RwRGBA*)0x86BA88; -RwTexture **CVehicleModelInfo::ms_colourTextureTable = (RwTexture**)0x711C40; +int8 CVehicleModelInfo::ms_compsToUse[2] = { -2, -2 }; +int8 CVehicleModelInfo::ms_compsUsed[2]; +RwTexture *CVehicleModelInfo::ms_pEnvironmentMaps[NUM_VEHICLE_ENVMAPS]; +RwRGBA CVehicleModelInfo::ms_vehicleColourTable[256]; +RwTexture *CVehicleModelInfo::ms_colourTextureTable[256]; -RwTexture *&gpWhiteTexture = *(RwTexture**)0x64C4F8; -RwFrame *&pMatFxIdentityFrame = *(RwFrame**)0x64C510; +RwTexture *gpWhiteTexture; +RwFrame *pMatFxIdentityFrame; enum { VEHICLE_FLAG_COLLAPSE = 0x2, @@ -1104,65 +1104,3 @@ 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(0x427820, &CVehicleModelInfo::SetComponentsToUse, 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); - InjectHook(0x51FE70, &CVehicleModelInfo::HideDamagedAtomicCB, PATCH_JUMP); - InjectHook(0x51FED0, &CVehicleModelInfo::HideAllComponentsAtomicCB, PATCH_JUMP); - InjectHook(0x51FEF0, &CVehicleModelInfo::HasAlphaMaterialCB, PATCH_JUMP); - - InjectHook(0x51FF10, &CVehicleModelInfo::SetAtomicRendererCB, PATCH_JUMP); - InjectHook(0x520030, &CVehicleModelInfo::SetAtomicRendererCB_BigVehicle, PATCH_JUMP); - InjectHook(0x520230, &CVehicleModelInfo::SetAtomicRendererCB_Train, PATCH_JUMP); - InjectHook(0x520120, &CVehicleModelInfo::SetAtomicRendererCB_Boat, PATCH_JUMP); - InjectHook(0x520210, &CVehicleModelInfo::SetAtomicRendererCB_Heli, PATCH_JUMP); - InjectHook(0x5202C0, &CVehicleModelInfo::SetAtomicRenderCallbacks, PATCH_JUMP); - - InjectHook(0x520340, &CVehicleModelInfo::SetAtomicFlagCB, PATCH_JUMP); - InjectHook(0x520360, &CVehicleModelInfo::ClearAtomicFlagCB, PATCH_JUMP); - - InjectHook(0x5204D0, &CVehicleModelInfo::PreprocessHierarchy, PATCH_JUMP); - InjectHook(0x5203C0, &CVehicleModelInfo::SetVehicleComponentFlags, PATCH_JUMP); - - InjectHook(0x520840, &CVehicleModelInfo::GetWheelPosn, PATCH_JUMP); - - InjectHook(0x520880, IsValidCompRule, PATCH_JUMP); - InjectHook(0x520990, CountCompsInRule, PATCH_JUMP); - InjectHook(0x5209C0, ChooseComponent, PATCH_JUMP); - InjectHook(0x5208C0, GetListOfComponentsNotUsedByRules, PATCH_JUMP); - InjectHook(0x520AB0, &CVehicleModelInfo::ChooseComponent, PATCH_JUMP); - InjectHook(0x520BE0, &CVehicleModelInfo::ChooseSecondComponent, PATCH_JUMP); - - InjectHook(0x520DC0, (RpAtomic *(*)(RpAtomic*, void*))CVehicleModelInfo::GetEditableMaterialListCB, PATCH_JUMP); - InjectHook(0x520D30, (RpMaterial *(*)(RpMaterial*, void*))CVehicleModelInfo::GetEditableMaterialListCB, PATCH_JUMP); - InjectHook(0x520DE0, &CVehicleModelInfo::FindEditableMaterialList, PATCH_JUMP); - InjectHook(0x520E70, &CVehicleModelInfo::SetVehicleColour, PATCH_JUMP); - InjectHook(0x520FD0, &CVehicleModelInfo::ChooseVehicleColour, PATCH_JUMP); - InjectHook(0x5210A0, &CVehicleModelInfo::AvoidSameVehicleColour, PATCH_JUMP); - InjectHook(0x521260, &CVehicleModelInfo::LoadVehicleColours, PATCH_JUMP); - InjectHook(0x521650, &CVehicleModelInfo::DeleteVehicleColourTextures, PATCH_JUMP); - - InjectHook(0x5219D0, &CVehicleModelInfo::GetMaximumNumberOfPassengersFromNumberOfDoors, PATCH_JUMP); - - InjectHook(0x521820, (RpAtomic *(*)(RpAtomic*, void*))CVehicleModelInfo::SetEnvironmentMapCB, PATCH_JUMP); - InjectHook(0x5217A0, (RpMaterial *(*)(RpMaterial*, void*))CVehicleModelInfo::SetEnvironmentMapCB, PATCH_JUMP); - InjectHook(0x521770, CVehicleModelInfo::HasSpecularMaterialCB, PATCH_JUMP); - InjectHook(0x521890, &CVehicleModelInfo::SetEnvironmentMap, PATCH_JUMP); - InjectHook(0x521680, CVehicleModelInfo::LoadEnvironmentMaps, PATCH_JUMP); - InjectHook(0x521720, CVehicleModelInfo::ShutdownEnvironmentMaps, PATCH_JUMP); -ENDPATCHES diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index 5969c4ca..9992ab98 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -81,11 +81,11 @@ public: RpAtomic *m_comps[6]; int32 m_numComps; - static int8 *ms_compsToUse; // [2]; - static int8 *ms_compsUsed; // [2]; - static RwTexture **ms_pEnvironmentMaps; // [NUM_VEHICLE_ENVMAPS] - static RwRGBA *ms_vehicleColourTable; // [256] - static RwTexture **ms_colourTextureTable; // [256] + static int8 ms_compsToUse[2]; + static int8 ms_compsUsed[2]; + static RwTexture *ms_pEnvironmentMaps[NUM_VEHICLE_ENVMAPS]; + static RwRGBA ms_vehicleColourTable[256]; + static RwTexture *ms_colourTextureTable[256]; static RwObjectNameIdAssocation *ms_vehicleDescs[NUM_VEHICLE_TYPES]; CVehicleModelInfo(void); |