From f8c8d145d601c6bd586f0768ce6c1aeee99485ed Mon Sep 17 00:00:00 2001 From: Uladzislau Nikalayevich Date: Tue, 23 Jul 2024 18:56:12 +0300 Subject: [PATCH] Revert "Make engineRestreamWorld more aggressive (#3602)" This reverts commit a55ad43562b1493b53376658e85626f3b2ee2401. --- Client/game_sa/CGameSA.cpp | 15 --------------- Client/game_sa/CGameSA.h | 2 -- Client/game_sa/CModelInfoSA.cpp | 5 +++++ Client/game_sa/CModelInfoSA.h | 2 +- Client/mods/deathmatch/logic/CClientGame.cpp | 2 -- Client/sdk/game/CGame.h | 1 - Client/sdk/game/CModelInfo.h | 2 +- 7 files changed, 7 insertions(+), 22 deletions(-) diff --git a/Client/game_sa/CGameSA.cpp b/Client/game_sa/CGameSA.cpp index 572d4bcbd0..abfb822816 100644 --- a/Client/game_sa/CGameSA.cpp +++ b/Client/game_sa/CGameSA.cpp @@ -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() { diff --git a/Client/game_sa/CGameSA.h b/Client/game_sa/CGameSA.h index 21a097cfc8..f22b5748f7 100644 --- a/Client/game_sa/CGameSA.h +++ b/Client/game_sa/CGameSA.h @@ -308,8 +308,6 @@ class CGameSA : public CGame bool SetBuildingPoolSize(size_t size); - void UnloadUnusedModels(); - private: CPools* m_pPools; CPlayerInfo* m_pPlayerInfo; diff --git a/Client/game_sa/CModelInfoSA.cpp b/Client/game_sa/CModelInfoSA.cpp index 27172ab58e..5dc00712da 100644 --- a/Client/game_sa/CModelInfoSA.cpp +++ b/Client/game_sa/CModelInfoSA.cpp @@ -1067,6 +1067,11 @@ void CModelInfoSA::ModelAddRef(EModelRequestType requestType, const char* szTag) m_dwReferences++; } +int CModelInfoSA::GetRefCount() +{ + return static_cast(m_dwReferences); +} + void CModelInfoSA::RemoveRef(bool bRemoveExtraGTARef) { // Decrement the references diff --git a/Client/game_sa/CModelInfoSA.h b/Client/game_sa/CModelInfoSA.h index 5d91087bf6..329d2e3e50 100644 --- a/Client/game_sa/CModelInfoSA.h +++ b/Client/game_sa/CModelInfoSA.h @@ -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(m_dwReferences); }; + int GetRefCount(); void RemoveRef(bool bRemoveExtraGTARef = false); bool ForceUnload(); diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index e948645825..eea07ffd33 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -6829,8 +6829,6 @@ void CClientGame::RestreamWorld(bool removeBigBuildings) g_pGame->GetStreaming()->RemoveBigBuildings(); g_pGame->GetStreaming()->ReinitStreaming(); - - g_pGame->UnloadUnusedModels(); } void CClientGame::ReinitMarkers() diff --git a/Client/sdk/game/CGame.h b/Client/sdk/game/CGame.h index dfc908cfb5..215141ee23 100644 --- a/Client/sdk/game/CGame.h +++ b/Client/sdk/game/CGame.h @@ -273,5 +273,4 @@ class __declspec(novtable) CGame virtual bool SetBuildingPoolSize(size_t size) = 0; - virtual void UnloadUnusedModels() = 0; }; diff --git a/Client/sdk/game/CModelInfo.h b/Client/sdk/game/CModelInfo.h index e5d57216a8..440f079be6 100644 --- a/Client/sdk/game/CModelInfo.h +++ b/Client/sdk/game/CModelInfo.h @@ -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;