diff options
author | aap <aap@papnet.eu> | 2019-06-17 10:30:02 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-06-17 22:40:15 +0200 |
commit | b5fba778c4a307f0a5721c9b3b0efb38be96634b (patch) | |
tree | 9fe0738d1d6dcf4677aac12e1efadff18887f7b4 /src/modelinfo | |
parent | Merge pull request #20 from gennariarmando/master (diff) | |
download | re3-b5fba778c4a307f0a5721c9b3b0efb38be96634b.tar re3-b5fba778c4a307f0a5721c9b3b0efb38be96634b.tar.gz re3-b5fba778c4a307f0a5721c9b3b0efb38be96634b.tar.bz2 re3-b5fba778c4a307f0a5721c9b3b0efb38be96634b.tar.lz re3-b5fba778c4a307f0a5721c9b3b0efb38be96634b.tar.xz re3-b5fba778c4a307f0a5721c9b3b0efb38be96634b.tar.zst re3-b5fba778c4a307f0a5721c9b3b0efb38be96634b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/modelinfo/BaseModelInfo.h | 3 | ||||
-rw-r--r-- | src/modelinfo/ModelIndices.h | 5 | ||||
-rw-r--r-- | src/modelinfo/ModelInfo.cpp | 68 | ||||
-rw-r--r-- | src/modelinfo/ModelInfo.h | 4 | ||||
-rw-r--r-- | src/modelinfo/PedModelInfo.h | 2 | ||||
-rw-r--r-- | src/modelinfo/SimpleModelInfo.cpp | 12 | ||||
-rw-r--r-- | src/modelinfo/SimpleModelInfo.h | 6 | ||||
-rw-r--r-- | src/modelinfo/TimeModelInfo.h | 2 | ||||
-rw-r--r-- | src/modelinfo/VehicleModelInfo.h | 11 |
9 files changed, 94 insertions, 19 deletions
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h index fadea18a..b6c6c62e 100644 --- a/src/modelinfo/BaseModelInfo.h +++ b/src/modelinfo/BaseModelInfo.h @@ -41,6 +41,9 @@ public: virtual RwObject *GetRwObject(void) = 0; bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME; } + bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE || + m_type == MITYPE_MLO || m_type == MITYPE_XTRACOMPS; // unused but what the heck + } char *GetName(void) { return m_name; } void SetName(const char *name) { strncpy(m_name, name, 24); } void SetColModel(CColModel *col, bool free = false){ diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index 7567c0db..be091e9b 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -320,9 +320,12 @@ enum MI_CAR_PANEL, MI_CAR_BONNET, MI_CAR_BOOT, - MI_CAR_WEEL, + MI_CAR_WHEEL, MI_BODYPARTA, MI_BODYPARTB, + + MI_AIRTRAIN_VLO = 198, + MI_LOPOLYGUY, }; void InitModelIndices(void); diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp index 89fcdee5..ca36aa61 100644 --- a/src/modelinfo/ModelInfo.cpp +++ b/src/modelinfo/ModelInfo.cpp @@ -1,5 +1,7 @@ #include "common.h" #include "patcher.h" +#include "TempColModels.h" +#include "ModelIndices.h" #include "ModelInfo.h" CBaseModelInfo **CModelInfo::ms_modelInfoPtrs = (CBaseModelInfo**)0x83D408; @@ -18,6 +20,8 @@ void CModelInfo::Initialise(void) { int i; + CSimpleModelInfo *m; + for(i = 0; i < MODELINFOSIZE; i++) ms_modelInfoPtrs[i] = nil; ms_2dEffectStore.clear(); @@ -26,10 +30,58 @@ CModelInfo::Initialise(void) ms_clumpModelStore.clear(); ms_pedModelStore.clear(); ms_vehicleModelStore.clear(); + + m = AddSimpleModel(MI_CAR_DOOR); + m->SetColModel(&CTempColModels::ms_colModelDoor1); + m->SetTexDictionary("generic"); + m->SetNumAtomics(1); + m->m_lodDistances[0] = 80.0f; + + m = AddSimpleModel(MI_CAR_BUMPER); + m->SetColModel(&CTempColModels::ms_colModelBumper1); + m->SetTexDictionary("generic"); + m->SetNumAtomics(1); + m->m_lodDistances[0] = 80.0f; + + m = AddSimpleModel(MI_CAR_PANEL); + m->SetColModel(&CTempColModels::ms_colModelPanel1); + m->SetTexDictionary("generic"); + m->SetNumAtomics(1); + m->m_lodDistances[0] = 80.0f; + + m = AddSimpleModel(MI_CAR_BONNET); + m->SetColModel(&CTempColModels::ms_colModelBonnet1); + m->SetTexDictionary("generic"); + m->SetNumAtomics(1); + m->m_lodDistances[0] = 80.0f; + + m = AddSimpleModel(MI_CAR_BOOT); + m->SetColModel(&CTempColModels::ms_colModelBoot1); + m->SetTexDictionary("generic"); + m->SetNumAtomics(1); + m->m_lodDistances[0] = 80.0f; + + m = AddSimpleModel(MI_CAR_WHEEL); + m->SetColModel(&CTempColModels::ms_colModelWheel1); + m->SetTexDictionary("generic"); + m->SetNumAtomics(1); + m->m_lodDistances[0] = 80.0f; + + m = AddSimpleModel(MI_BODYPARTA); + m->SetColModel(&CTempColModels::ms_colModelBodyPart1); + m->SetTexDictionary("generic"); + m->SetNumAtomics(1); + m->m_lodDistances[0] = 80.0f; + + m = AddSimpleModel(MI_BODYPARTB); + m->SetColModel(&CTempColModels::ms_colModelBodyPart2); + m->SetTexDictionary("generic"); + m->SetNumAtomics(1); + m->m_lodDistances[0] = 80.0f; } void -CModelInfo::Shutdown(void) +CModelInfo::ShutDown(void) { int i; for(i = 0; i < ms_simpleModelStore.allocPtr; i++) @@ -42,6 +94,8 @@ CModelInfo::Shutdown(void) ms_pedModelStore.store[i].Shutdown(); for(i = 0; i < ms_vehicleModelStore.allocPtr; i++) ms_vehicleModelStore.store[i].Shutdown(); + for(i = 0; i < ms_2dEffectStore.allocPtr; i++) + ms_2dEffectStore.store[i].Shutdown(); } CSimpleModelInfo* @@ -115,10 +169,12 @@ CModelInfo::GetModelInfo(const char *name, int *id) } STARTPATCHES -// 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::AddPedModel, PATCH_JUMP); + 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); ENDPATCHES diff --git a/src/modelinfo/ModelInfo.h b/src/modelinfo/ModelInfo.h index a0d30dea..4ab633bf 100644 --- a/src/modelinfo/ModelInfo.h +++ b/src/modelinfo/ModelInfo.h @@ -20,7 +20,7 @@ class CModelInfo public: static void Initialise(void); - static void Shutdown(void); + static void ShutDown(void); static CSimpleModelInfo *AddSimpleModel(int id); static CTimeModelInfo *AddTimeModel(int id); @@ -28,6 +28,8 @@ public: static CPedModelInfo *AddPedModel(int id); static CVehicleModelInfo *AddVehicleModel(int id); + static CStore<C2dEffect, TWODFXSIZE> &Get2dEffectStore(void) { return ms_2dEffectStore; } + static CBaseModelInfo *GetModelInfo(const char *name, int *id); static CBaseModelInfo *GetModelInfo(int id){ return ms_modelInfoPtrs[id]; diff --git a/src/modelinfo/PedModelInfo.h b/src/modelinfo/PedModelInfo.h index 95d49090..d0b93323 100644 --- a/src/modelinfo/PedModelInfo.h +++ b/src/modelinfo/PedModelInfo.h @@ -21,7 +21,7 @@ enum PedNode { class CPedModelInfo : public CClumpModelInfo { public: - void *m_animGroup; // TODO + int32 m_animGroup; int32 m_pedType; int32 m_pedStatType; uint32 m_carsCanDrive; diff --git a/src/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp index a5853d6f..ea7a3f9e 100644 --- a/src/modelinfo/SimpleModelInfo.cpp +++ b/src/modelinfo/SimpleModelInfo.cpp @@ -53,7 +53,7 @@ CSimpleModelInfo::Init(void) m_atomics[1] = nil; m_atomics[2] = nil; m_numAtomics = 0; - m_furthest = 0; + m_firstDamaged = 0; m_normalCull = 0; m_isDamaged = 0; m_isBigBuilding = 0; @@ -103,11 +103,10 @@ float CSimpleModelInfo::GetLargestLodDistance(void) { float d; - // TODO: what exactly is going on here? - if(m_furthest != 0 && !m_isDamaged) - d = m_lodDistances[m_furthest-1]; - else + if(m_firstDamaged == 0 || m_isDamaged) d = m_lodDistances[m_numAtomics-1]; + else + d = m_lodDistances[m_firstDamaged-1]; return d * TheCamera.LODDistMultiplier; } @@ -116,9 +115,8 @@ CSimpleModelInfo::GetAtomicFromDistance(float dist) { int i; i = 0; - // TODO: what exactly is going on here? if(m_isDamaged) - i = m_furthest; + i = m_firstDamaged; for(; i < m_numAtomics; i++) if(dist < m_lodDistances[i] *TheCamera.LODDistMultiplier) return m_atomics[i]; diff --git a/src/modelinfo/SimpleModelInfo.h b/src/modelinfo/SimpleModelInfo.h index 186a517c..d5b572a6 100644 --- a/src/modelinfo/SimpleModelInfo.h +++ b/src/modelinfo/SimpleModelInfo.h @@ -11,9 +11,9 @@ public: float m_lodDistances[3]; uint8 m_numAtomics; uint8 m_alpha; - uint16 m_furthest : 2; // 0: numAtomics-1 is furthest visible - // 1: atomic 0 is furthest - // 2: atomic 1 is furthest + uint16 m_firstDamaged : 2; // 0: no damage model + // 1: 1 and 2 are damage models + // 2: 2 is damage model uint16 m_normalCull : 1; uint16 m_isDamaged : 1; uint16 m_isBigBuilding : 1; diff --git a/src/modelinfo/TimeModelInfo.h b/src/modelinfo/TimeModelInfo.h index 08e46bd3..f8b7c8ff 100644 --- a/src/modelinfo/TimeModelInfo.h +++ b/src/modelinfo/TimeModelInfo.h @@ -12,7 +12,9 @@ public: int32 GetTimeOn(void) { return m_timeOn; } int32 GetTimeOff(void) { return m_timeOff; } + void SetTimes(int32 on, int32 off) { m_timeOn = on; m_timeOff = off; } int32 GetOtherTimeModel(void) { return m_otherTimeModelID; } + void SetOtherTimeModel(int32 other) { m_otherTimeModelID = other; } CTimeModelInfo *FindOtherTimeModel(void); }; static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error"); diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index f69760b8..3f89414d 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -35,6 +35,17 @@ enum { NUM_VEHICLE_TYPES }; +enum { + VEHICLE_CLASS_POOR, + VEHICLE_CLASS_RICH, + VEHICLE_CLASS_EXECUTIVE, + VEHICLE_CLASS_WORKER, + VEHICLE_CLASS_SPECIAL, + VEHICLE_CLASS_BIG, + VEHICLE_CLASS_TAXI, + NUM_VEHICLE_CLASSES +}; + class CVehicleModelInfo : public CClumpModelInfo { public: |