diff --git a/Client/game_sa/CModelInfoSA.cpp b/Client/game_sa/CModelInfoSA.cpp index e74902ab80..c1cf88de34 100644 --- a/Client/game_sa/CModelInfoSA.cpp +++ b/Client/game_sa/CModelInfoSA.cpp @@ -538,7 +538,7 @@ void CModelInfoSA::SetIdeFlags(unsigned int uiFlags) switch (GetModelType()) { case eModelInfoType::ATOMIC: - case eModelInfoType::TIME: + case eModelInfoType::TIMED_OBJECT: { // SetAtomicModelInfoFlags m_pInterface->bIsRoad = ideFlags.bIsRoad; @@ -842,7 +842,7 @@ bool CModelInfoSA::SetTime(char cHourOn, char cHourOff) if (!m_pInterface) return false; - if (GetModelType() != eModelInfoType::TIME) + if (GetModelType() != eModelInfoType::TIMED_OBJECT) return false; CTimeInfoSAInterface* pTime = &static_cast(m_pInterface)->timeInfo; @@ -861,7 +861,7 @@ bool CModelInfoSA::GetTime(char& cHourOn, char& cHourOff) if (!m_pInterface) return false; - if (GetModelType() != eModelInfoType::TIME) + if (GetModelType() != eModelInfoType::TIMED_OBJECT) return false; CTimeInfoSAInterface* pTime = &static_cast(m_pInterface)->timeInfo; @@ -1498,7 +1498,7 @@ bool CModelInfoSA::SetCustomModel(RpClump* pClump) break; case eModelInfoType::ATOMIC: case eModelInfoType::LOD_ATOMIC: - case eModelInfoType::TIME: + case eModelInfoType::TIMED_OBJECT: success = pGame->GetRenderWare()->ReplaceAllAtomicsInModel(pClump, static_cast(m_dwModelID)); break; default: @@ -1804,7 +1804,7 @@ void CModelInfoSA::DeallocateModel(void) case eModelInfoType::CLUMP: delete reinterpret_cast(ppModelInfo[m_dwModelID]); break; - case eModelInfoType::TIME: + case eModelInfoType::TIMED_OBJECT: delete reinterpret_cast(ppModelInfo[m_dwModelID]); break; default: diff --git a/Client/mods/deathmatch/logic/CClientModel.cpp b/Client/mods/deathmatch/logic/CClientModel.cpp index 01e3aac56c..fb9d447051 100644 --- a/Client/mods/deathmatch/logic/CClientModel.cpp +++ b/Client/mods/deathmatch/logic/CClientModel.cpp @@ -12,7 +12,7 @@ #include "StdInc.h" #include "game/CStreaming.h" -CClientModel::CClientModel(CClientManager* pManager, int iModelID, eModelInfoType eModelType) +CClientModel::CClientModel(CClientManager* pManager, int iModelID, eClientModelType eModelType) { m_pManager = pManager; m_iModelID = iModelID; @@ -42,31 +42,31 @@ bool CClientModel::Allocate(ushort usParentID) switch (m_eModelType) { - case eModelInfoType::PED: + case eClientModelType::PED: pModelInfo->MakePedModel("PSYCHO"); return true; - case eModelInfoType::ATOMIC: + case eClientModelType::OBJECT: if (g_pClientGame->GetObjectManager()->IsValidModel(usParentID)) { pModelInfo->MakeObjectModel(usParentID); return true; } break; - case eModelInfoType::CLUMP: + case eClientModelType::CLUMP: if (g_pClientGame->GetObjectManager()->IsValidModel(usParentID)) { pModelInfo->MakeClumpModel(usParentID); return true; } break; - case eModelInfoType::TIME: + case eClientModelType::TIMED_OBJECT: if (g_pClientGame->GetObjectManager()->IsValidModel(usParentID)) { pModelInfo->MakeTimedObjectModel(usParentID); return true; } break; - case eModelInfoType::VEHICLE: + case eClientModelType::VEHICLE: if (g_pClientGame->GetVehicleManager()->IsValidModel(usParentID)) { pModelInfo->MakeVehicleAutomobile(usParentID); @@ -145,7 +145,7 @@ void CClientModel::RestoreDFF(CModelInfo* pModelInfo) switch (m_eModelType) { - case eModelInfoType::PED: + case eClientModelType::PED: { // If some ped is using this ID, change him to CJ CClientPedManager* pPedManager = g_pClientGame->GetManager()->GetPedManager(); @@ -153,9 +153,9 @@ void CClientModel::RestoreDFF(CModelInfo* pModelInfo) unloadModelsAndCallEvents(pPedManager->IterBegin(), pPedManager->IterEnd(), 0, [](auto& element) { element.SetModel(0); }); break; } - case eModelInfoType::ATOMIC: - case eModelInfoType::CLUMP: - case eModelInfoType::TIME: + case eClientModelType::OBJECT: + case eClientModelType::CLUMP: + case eClientModelType::TIMED_OBJECT: { const auto& objects = &g_pClientGame->GetManager()->GetObjectManager()->GetObjects(); unsigned short usParentID = g_pGame->GetModelInfo(m_iModelID)->GetParentID(); @@ -171,7 +171,7 @@ void CClientModel::RestoreDFF(CModelInfo* pModelInfo) g_pClientGame->GetManager()->GetColModelManager()->RestoreModel(m_iModelID); break; } - case eModelInfoType::VEHICLE: + case eClientModelType::VEHICLE: { CClientVehicleManager* pVehicleManager = g_pClientGame->GetManager()->GetVehicleManager(); unsigned short usParentID = g_pGame->GetModelInfo(m_iModelID)->GetParentID(); diff --git a/Client/mods/deathmatch/logic/CClientModel.h b/Client/mods/deathmatch/logic/CClientModel.h index 34d21306e6..ab263edff4 100644 --- a/Client/mods/deathmatch/logic/CClientModel.h +++ b/Client/mods/deathmatch/logic/CClientModel.h @@ -33,7 +33,7 @@ class CClientModel final friend class CClientModelManager; public: - CClientModel(CClientManager* pManager, int iModelID, eModelInfoType eModelType); + CClientModel(CClientManager* pManager, int iModelID, eClientModelType eModelType); ~CClientModel(); int GetModelID(void) const { return m_iModelID; }; @@ -52,8 +52,8 @@ class CClientModel final protected: CClientManager* m_pManager; - int m_iModelID; - eModelInfoType m_eModelType; - bool m_bAllocatedByUs = false; - CResource* m_pParentResource = nullptr; // Resource that allocated model + int m_iModelID; + eClientModelType m_eModelType; + bool m_bAllocatedByUs = false; + CResource* m_pParentResource = nullptr; // Resource that allocated model }; diff --git a/Client/mods/deathmatch/logic/CClientModelManager.cpp b/Client/mods/deathmatch/logic/CClientModelManager.cpp index b1ff5b645d..8378cd9b52 100644 --- a/Client/mods/deathmatch/logic/CClientModelManager.cpp +++ b/Client/mods/deathmatch/logic/CClientModelManager.cpp @@ -147,7 +147,30 @@ bool CClientModelManager::AllocateModelFromParent(uint32_t uiNewModelID, uint32_ if (pModel) return false; - pModel = std::make_shared(g_pClientGame->GetManager(), uiNewModelID, eModelType); + eClientModelType clientModelType; + + switch (eModelType) + { + case eModelInfoType::ATOMIC: + clientModelType = eClientModelType::OBJECT; + break; + case eModelInfoType::TIMED_OBJECT: + clientModelType = eClientModelType::TIMED_OBJECT; + break; + case eModelInfoType::CLUMP: + clientModelType = eClientModelType::CLUMP; + break; + case eModelInfoType::VEHICLE: + clientModelType = eClientModelType::VEHICLE; + break; + case eModelInfoType::PED: + clientModelType = eClientModelType::PED; + break; + default: + return false; + } + + pModel = std::make_shared(g_pClientGame->GetManager(), uiNewModelID, clientModelType); Add(pModel); diff --git a/Client/mods/deathmatch/logic/CClientModelManager.h b/Client/mods/deathmatch/logic/CClientModelManager.h index 9764ff7d52..18acde2a86 100644 --- a/Client/mods/deathmatch/logic/CClientModelManager.h +++ b/Client/mods/deathmatch/logic/CClientModelManager.h @@ -42,7 +42,7 @@ class CClientModelManager std::shared_ptr FindModelByID(int iModelID); std::shared_ptr Request(CClientManager* pManager, int iModelID, eClientModelType eType); - std::vector> GetModelsByType(eModelInfoType type, const unsigned int minModelID = 0); + std::vector> GetModelsByType(eClientModelType type, const unsigned int minModelID = 0); void DeallocateModelsAllocatedByResource(CResource* pResource); bool AllocateModelFromParent(uint32_t usModelID, uint32_t usParentModel); diff --git a/Client/mods/deathmatch/logic/CClientObjectManager.cpp b/Client/mods/deathmatch/logic/CClientObjectManager.cpp index 45cc2a0408..7b69208f03 100644 --- a/Client/mods/deathmatch/logic/CClientObjectManager.cpp +++ b/Client/mods/deathmatch/logic/CClientObjectManager.cpp @@ -110,7 +110,7 @@ bool CClientObjectManager::IsValidModel(unsigned long ulObjectModel) return false; eModelInfoType eType = pModelInfo->GetModelType(); - return (eType == eModelInfoType::CLUMP || eType == eModelInfoType::ATOMIC || eType == eModelInfoType::WEAPON || eType == eModelInfoType::TIME); + return (eType == eModelInfoType::CLUMP || eType == eModelInfoType::ATOMIC || eType == eModelInfoType::WEAPON || eType == eModelInfoType::TIMED_OBJECT); } bool CClientObjectManager::IsBreakableModel(unsigned long ulObjectModel) diff --git a/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Util.cpp b/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Util.cpp index 2b52a3d286..1217ee5e9e 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Util.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Util.cpp @@ -29,7 +29,7 @@ int CLuaFunctionDefs::GetValidPedModels(lua_State* luaVM) // Gather our custom skin model IDs allocated with engineRequestModel // (there might be some < 313 as well, and since we don't want duplicates, we start at 313, others are already included by the loop above) - for (const auto& model : m_pManager->GetModelManager()->GetModelsByType(eModelInfoType::PED, 313)) + for (const auto& model : m_pManager->GetModelManager()->GetModelsByType(eClientModelType::PED, 313)) { lua_pushnumber(luaVM, ++iIndex); lua_pushnumber(luaVM, model->GetModelID()); diff --git a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp index f47ea11340..f85935fbd3 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp @@ -680,6 +680,7 @@ ADD_ENUM(eClientModelType::OBJECT, "object") ADD_ENUM(eClientModelType::VEHICLE, "vehicle") ADD_ENUM(eClientModelType::TIMED_OBJECT, "timed-object") ADD_ENUM(eClientModelType::CLUMP, "clump") +ADD_ENUM(eClientModelType::TXD, "txd") IMPLEMENT_ENUM_CLASS_END("client-model-type") // Sound effects diff --git a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h index 976dc6d754..a2c4e1f123 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h +++ b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h @@ -82,6 +82,7 @@ DECLARE_ENUM_CLASS(eSoundEffectParams::I3DL2Reverb); DECLARE_ENUM_CLASS(eSoundEffectParams::ParamEq); DECLARE_ENUM_CLASS(eSoundEffectParams::Reverb); DECLARE_ENUM_CLASS(eModelIdeFlag); +DECLARE_ENUM_CLASS(eClientModelType); DECLARE_ENUM_CLASS(_D3DFORMAT); class CRemoteCall; diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp index 1f171fc8dc..2bad482a3f 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp @@ -846,7 +846,7 @@ int CLuaEngineDefs::EngineRestoreModel(lua_State* luaVM) int CLuaEngineDefs::EngineRequestModel(lua_State* luaVM) { - eModelInfoType eModelType; + eClientModelType eModelType; CScriptArgReader argStream(luaVM); argStream.ReadEnumString(eModelType); @@ -872,7 +872,7 @@ int CLuaEngineDefs::EngineRequestModel(lua_State* luaVM) { switch (eModelType) { - case eModelInfoType::PED: + case eClientModelType::PED: usParentID = 7; // male01 break; case eClientModelType::TIMED_OBJECT: @@ -884,7 +884,7 @@ int CLuaEngineDefs::EngineRequestModel(lua_State* luaVM) case eClientModelType::OBJECT: usParentID = 1337; // BinNt07_LA (trash can) break; - case eModelInfoType::VEHICLE: + case eClientModelType::VEHICLE: usParentID = VT_LANDSTAL; break; default: diff --git a/Client/sdk/game/CModelInfo.h b/Client/sdk/game/CModelInfo.h index 49a608b2bc..a7a1fd99ee 100644 --- a/Client/sdk/game/CModelInfo.h +++ b/Client/sdk/game/CModelInfo.h @@ -55,7 +55,7 @@ enum class eModelInfoType { INVALID = 0, ATOMIC = 1, - TIME = 3, + TIMED_OBJECT = 3, WEAPON = 4, CLUMP = 5, VEHICLE = 6, diff --git a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp index 42db5d9eba..3d93557fb8 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp +++ b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp @@ -297,7 +297,7 @@ ADD_ENUM(eModelInfoType::CLUMP, "clump") ADD_ENUM(eModelInfoType::VEHICLE, "vehicle") ADD_ENUM(eModelInfoType::PED, "ped") ADD_ENUM(eModelInfoType::LOD_ATOMIC, "lod-atomic") -IMPLEMENT_ENUM_CLASS_END("model-info-type") +IMPLEMENT_ENUM_CLASS_END("model-type") // // CResource from userdata