Skip to content

Commit

Permalink
Revert "Make engineRestreamWorld more aggressive (multitheftauto#3602)"
Browse files Browse the repository at this point in the history
This reverts commit a55ad43.
  • Loading branch information
TheNormalnij committed Jul 23, 2024
1 parent 2bdac16 commit f8c8d14
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 22 deletions.
15 changes: 0 additions & 15 deletions Client/game_sa/CGameSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,21 +1053,6 @@ bool CGameSA::SetBuildingPoolSize(size_t size)
return status;
}

void CGameSA::UnloadUnusedModels()
{
for (size_t id = 0; id < GetBaseIDforCOL(); id++)
{
CStreamingInfo* streamingInfo = m_pStreaming->GetStreamingInfo(id);
if (streamingInfo->loadState != 0 && streamingInfo->sizeInBlocks > 0)
{
if (ModelInfo[id].GetRefCount() == 0)
{
m_pStreaming->RemoveModel(id);
}
};
}
}

// Ensure models have the default lod distances
void CGameSA::ResetModelLodDistances()
{
Expand Down
2 changes: 0 additions & 2 deletions Client/game_sa/CGameSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,6 @@ class CGameSA : public CGame

bool SetBuildingPoolSize(size_t size);

void UnloadUnusedModels();

private:
CPools* m_pPools;
CPlayerInfo* m_pPlayerInfo;
Expand Down
5 changes: 5 additions & 0 deletions Client/game_sa/CModelInfoSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,11 @@ void CModelInfoSA::ModelAddRef(EModelRequestType requestType, const char* szTag)
m_dwReferences++;
}

int CModelInfoSA::GetRefCount()
{
return static_cast<int>(m_dwReferences);
}

void CModelInfoSA::RemoveRef(bool bRemoveExtraGTARef)
{
// Decrement the references
Expand Down
2 changes: 1 addition & 1 deletion Client/game_sa/CModelInfoSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ class CModelInfoSA : public CModelInfo
static void StaticResetAlphaTransparencies();

void ModelAddRef(EModelRequestType requestType, const char* szTag);
int GetRefCount() const override { return static_cast<int>(m_dwReferences); };
int GetRefCount();
void RemoveRef(bool bRemoveExtraGTARef = false);
bool ForceUnload();

Expand Down
2 changes: 0 additions & 2 deletions Client/mods/deathmatch/logic/CClientGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6829,8 +6829,6 @@ void CClientGame::RestreamWorld(bool removeBigBuildings)
g_pGame->GetStreaming()->RemoveBigBuildings();

g_pGame->GetStreaming()->ReinitStreaming();

g_pGame->UnloadUnusedModels();
}

void CClientGame::ReinitMarkers()
Expand Down
1 change: 0 additions & 1 deletion Client/sdk/game/CGame.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,5 +273,4 @@ class __declspec(novtable) CGame

virtual bool SetBuildingPoolSize(size_t size) = 0;

virtual void UnloadUnusedModels() = 0;
};
2 changes: 1 addition & 1 deletion Client/sdk/game/CModelInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class CModelInfo

virtual void ModelAddRef(EModelRequestType requestType, const char* szTag /* = NULL*/) = 0;
virtual void RemoveRef(bool bRemoveExtraGTARef = false) = 0;
virtual int GetRefCount() const = 0;
virtual int GetRefCount() = 0;
virtual bool ForceUnload() = 0;
virtual void DeallocateModel() = 0;

Expand Down

0 comments on commit f8c8d14

Please sign in to comment.