Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNormalnij committed Oct 9, 2023
1 parent 4edb200 commit 4dab556
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 30 deletions.
10 changes: 5 additions & 5 deletions Client/game_sa/CModelInfoSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<CTimeModelInfoSAInterface*>(m_pInterface)->timeInfo;
Expand All @@ -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<CTimeModelInfoSAInterface*>(m_pInterface)->timeInfo;
Expand Down Expand Up @@ -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<unsigned short>(m_dwModelID));
break;
default:
Expand Down Expand Up @@ -1804,7 +1804,7 @@ void CModelInfoSA::DeallocateModel(void)
case eModelInfoType::CLUMP:
delete reinterpret_cast<CClumpModelInfoSAInterface*>(ppModelInfo[m_dwModelID]);
break;
case eModelInfoType::TIME:
case eModelInfoType::TIMED_OBJECT:
delete reinterpret_cast<CTimeModelInfoSAInterface*>(ppModelInfo[m_dwModelID]);
break;
default:
Expand Down
22 changes: 11 additions & 11 deletions Client/mods/deathmatch/logic/CClientModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -145,17 +145,17 @@ 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();

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();
Expand All @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions Client/mods/deathmatch/logic/CClientModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; };
Expand All @@ -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
};
25 changes: 24 additions & 1 deletion Client/mods/deathmatch/logic/CClientModelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,30 @@ bool CClientModelManager::AllocateModelFromParent(uint32_t uiNewModelID, uint32_
if (pModel)
return false;

pModel = std::make_shared<CClientModel>(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<CClientModel>(g_pClientGame->GetManager(), uiNewModelID, clientModelType);

Add(pModel);

Expand Down
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/CClientModelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CClientModelManager
std::shared_ptr<CClientModel> FindModelByID(int iModelID);
std::shared_ptr<CClientModel> Request(CClientManager* pManager, int iModelID, eClientModelType eType);

std::vector<std::shared_ptr<CClientModel>> GetModelsByType(eModelInfoType type, const unsigned int minModelID = 0);
std::vector<std::shared_ptr<CClientModel>> GetModelsByType(eClientModelType type, const unsigned int minModelID = 0);

void DeallocateModelsAllocatedByResource(CResource* pResource);
bool AllocateModelFromParent(uint32_t usModelID, uint32_t usParentModel);
Expand Down
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/CClientObjectManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Client/sdk/game/CModelInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ enum class eModelInfoType
{
INVALID = 0,
ATOMIC = 1,
TIME = 3,
TIMED_OBJECT = 3,
WEAPON = 4,
CLUMP = 5,
VEHICLE = 6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4dab556

Please sign in to comment.