diff --git a/Client/game_sa/CBuildingsPoolSA.cpp b/Client/game_sa/CBuildingsPoolSA.cpp index 7cd8e887ae..683330ed3c 100644 --- a/Client/game_sa/CBuildingsPoolSA.cpp +++ b/Client/game_sa/CBuildingsPoolSA.cpp @@ -138,18 +138,11 @@ void CBuildingsPoolSA::RemoveBuilding(CBuilding* pBuilding) --m_buildingPool.count; } -void CBuildingsPoolSA::RemoveAllBuildings() +void CBuildingsPoolSA::RemoveAllWithBackup() { if (m_pOriginalBuildingsBackup) return; - pGame->GetCoverManager()->RemoveAllCovers(); - pGame->GetPlantManager()->RemoveAllPlants(); - - // Remove all shadows - using CStencilShadowObjects_dtorAll = void* (*)(); - ((CStencilShadowObjects_dtorAll)0x711390)(); - m_pOriginalBuildingsBackup = std::make_unique, MAX_BUILDINGS>>(); auto pBuildsingsPool = (*m_ppBuildingPoolInterface); @@ -176,7 +169,7 @@ void CBuildingsPoolSA::RemoveAllBuildings() } } -void CBuildingsPoolSA::RestoreAllBuildings() +void CBuildingsPoolSA::RestoreBackup() { if (!m_pOriginalBuildingsBackup) return; @@ -202,10 +195,7 @@ void CBuildingsPoolSA::RemoveBuildingFromWorld(CBuildingSAInterface* pBuilding) { // Remove building from world pGame->GetWorld()->Remove(pBuilding, CBuildingPool_Destructor); - - pBuilding->DeleteRwObject(); - pBuilding->ResolveReferences(); - pBuilding->RemoveShadows(); + pBuilding->RemoveRWObjectWithReferencesCleanup(); } bool CBuildingsPoolSA::Resize(int size) @@ -254,7 +244,7 @@ bool CBuildingsPoolSA::Resize(int size) newBytemap[i].bEmpty = true; } - const uint32_t offset = (uint32_t)newObjects - (uint32_t)oldPool; + const std::uint32_t offset = (std::uint32_t)newObjects - (std::uint32_t)oldPool; if (oldPool != nullptr) { UpdateIplEntrysPointers(offset); @@ -265,7 +255,7 @@ bool CBuildingsPoolSA::Resize(int size) UpdateBackupLodPointers(offset); } - pGame->GetPools()->GetDummyPool().UpdateBuildingLods(oldPool, newObjects); + pGame->GetPools()->GetDummyPool().UpdateBuildingLods(offset); RemoveVehicleDamageLinks(); RemovePedsContactEnityLinks(); diff --git a/Client/game_sa/CBuildingsPoolSA.h b/Client/game_sa/CBuildingsPoolSA.h index 5ce719bd73..38e64970f1 100644 --- a/Client/game_sa/CBuildingsPoolSA.h +++ b/Client/game_sa/CBuildingsPoolSA.h @@ -26,8 +26,8 @@ class CBuildingsPoolSA : public CBuildingsPool void RemoveBuilding(CBuilding* pBuilding); bool HasFreeBuildingSlot(); - void RemoveAllBuildings() override; - void RestoreAllBuildings() override; + void RemoveAllWithBackup() override; + void RestoreBackup() override; bool Resize(int size) override; int GetSize() const override { return (*m_ppBuildingPoolInterface)->m_nSize; }; @@ -40,8 +40,8 @@ class CBuildingsPoolSA : public CBuildingsPool void RemovePedsContactEnityLinks(); private: - SVectorPoolData m_buildingPool{MAX_BUILDINGS}; - CPoolSAInterface** m_ppBuildingPoolInterface; + SVectorPoolData m_buildingPool{MAX_BUILDINGS}; + CPoolSAInterface** m_ppBuildingPoolInterface; std::unique_ptr, MAX_BUILDINGS>> m_pOriginalBuildingsBackup; }; diff --git a/Client/game_sa/CDummyPoolSA.cpp b/Client/game_sa/CDummyPoolSA.cpp index 7f9b539a40..6a67cdb900 100644 --- a/Client/game_sa/CDummyPoolSA.cpp +++ b/Client/game_sa/CDummyPoolSA.cpp @@ -1,6 +1,6 @@ /***************************************************************************** * - * PROJECT: Multi Theft Auto v1.0 + * PROJECT: Multi Theft Auto * LICENSE: See LICENSE in the top level directory * FILE: game_sa/CDummyPoolSA.cpp * PURPOSE: Dummy pool class @@ -13,64 +13,96 @@ #include "StdInc.h" #include "CDummyPoolSA.h" +#include "CGameSA.h" +#include + +extern CGameSA* pGame; CDummyPoolSA::CDummyPoolSA() { m_ppDummyPoolInterface = (CPoolSAInterface**)0xB744A0; } -void CDummyPoolSA::RemoveAllBuildingLods() +void CDummyPoolSA::RemoveAllWithBackup() { - if (m_pLodBackup) + if (m_pOriginalElementsBackup) return; - m_pLodBackup = std::make_unique>(); + m_pOriginalElementsBackup = std::make_unique(); - for (int i = 0; i < MAX_DUMMIES; i++) + auto pDummyPool = (*m_ppDummyPoolInterface); + for (auto i = 0; i < MAX_DUMMIES_DEFAULT; i++) { - CEntitySAInterface* object = (*m_ppDummyPoolInterface)->GetObject(i); - (*m_pLodBackup)[i] = object->m_pLod; - object->m_pLod = nullptr; + if (pDummyPool->IsContains(i)) + { + CEntitySAInterface* building = pDummyPool->GetObject(i); + + pGame->GetWorld()->Remove(building, CDummyPool_Destructor); + building->RemoveRWObjectWithReferencesCleanup(); + + pDummyPool->Release(i); + + (*m_pOriginalElementsBackup)[i].first = true; + (*m_pOriginalElementsBackup)[i].second = *building; + } + else + { + (*m_pOriginalElementsBackup)[i].first = false; + } } } -void CDummyPoolSA::RestoreAllBuildingsLods() +void CDummyPoolSA::RestoreBackup() { - if (!m_pLodBackup) + if (!m_pOriginalElementsBackup) return; - for (int i = 0; i < MAX_DUMMIES; i++) + auto& originalData = *m_pOriginalElementsBackup; + auto pDummyPool = (*m_ppDummyPoolInterface); + for (auto i = 0; i < MAX_DUMMIES_DEFAULT; i++) { - CEntitySAInterface* object = (*m_ppDummyPoolInterface)->GetObject(i); - object->m_pLod = (*m_pLodBackup)[i]; + if (originalData[i].first) + { + pDummyPool->AllocateAt(i); + auto pDummy = pDummyPool->GetObject(i); + *pDummy = originalData[i].second; + + pGame->GetWorld()->Add(pDummy, CDummyPool_Constructor); + } } - m_pLodBackup.release(); + m_pOriginalElementsBackup = nullptr; } -void CDummyPoolSA::UpdateBuildingLods(void* oldPool, void* newPool) +void CDummyPoolSA::UpdateBuildingLods(const std::uint32_t offset) { - const uint32_t offset = (uint32_t)newPool - (uint32_t)oldPool; + if (m_pOriginalElementsBackup) + UpdateBackupLodOffset(offset); + else + UpdateLodsOffestInPool(offset); +} - if (m_pLodBackup) +void CDummyPoolSA::UpdateBackupLodOffset(const std::uint32_t offset) +{ + for (auto& it : *m_pOriginalElementsBackup) { - for (int i = 0; i < MAX_DUMMIES; i++) + if (it.first) { - if ((*m_pLodBackup)[i] != nullptr) - { - (*m_pLodBackup)[i] = (CEntitySAInterface*)((uint32_t)(*m_pLodBackup)[i] + offset); - } + CEntitySAInterface* object = &it.second; + CEntitySAInterface* lod = object->GetLod(); + if (lod) + object->SetLod((CEntitySAInterface*)((std::uint32_t)lod + offset)); } } - else +} + +void CDummyPoolSA::UpdateLodsOffestInPool(const std::uint32_t offset) +{ + for (auto i = 0; i < (*m_ppDummyPoolInterface)->Size(); i++) { - for (int i = 0; i < MAX_DUMMIES; i++) - { - CEntitySAInterface* object = (*m_ppDummyPoolInterface)->GetObject(i); - if (object->m_pLod) - { - object->m_pLod = (CEntitySAInterface*)((uint32_t)object->m_pLod + offset); - } - } + CEntitySAInterface* object = (*m_ppDummyPoolInterface)->GetObject(i); + CEntitySAInterface* lod = object->GetLod(); + if (lod) + object->SetLod((CEntitySAInterface*)((std::uint32_t)lod + offset)); } } diff --git a/Client/game_sa/CDummyPoolSA.h b/Client/game_sa/CDummyPoolSA.h index 95d00b19f3..8f42d98c7c 100644 --- a/Client/game_sa/CDummyPoolSA.h +++ b/Client/game_sa/CDummyPoolSA.h @@ -1,6 +1,6 @@ /***************************************************************************** * - * PROJECT: Multi Theft Auto v1.0 + * PROJECT: Multi Theft Auto * LICENSE: See LICENSE in the top level directory * FILE: game_sa/CDummyPoolSA.h * PURPOSE: Dummy pool class @@ -16,18 +16,25 @@ #include "CPoolSAInterface.h" #include -class CDummyPoolSA : public CDummyPool +constexpr std::size_t MAX_DUMMIES_DEFAULT = 2500; + +class CDummyPoolSA final : public CDummyPool { public: CDummyPoolSA(); ~CDummyPoolSA() = default; - void RemoveAllBuildingLods(); - void RestoreAllBuildingsLods(); - void UpdateBuildingLods(void* oldPool, void* newPool); + void RemoveAllWithBackup() override; + void RestoreBackup() override; + void UpdateBuildingLods(const std::uint32_t offset); + +private: + void UpdateBackupLodOffset(const std::uint32_t offest); + void UpdateLodsOffestInPool(const std::uint32_t offset); private: CPoolSAInterface** m_ppDummyPoolInterface; - std::unique_ptr> m_pLodBackup; + using pool_backup_t = std::array, MAX_DUMMIES_DEFAULT>; + std::unique_ptr m_pOriginalElementsBackup; }; diff --git a/Client/game_sa/CEntitySA.h b/Client/game_sa/CEntitySA.h index ead219d904..55bb6d9a16 100644 --- a/Client/game_sa/CEntitySA.h +++ b/Client/game_sa/CEntitySA.h @@ -202,6 +202,9 @@ class CEntitySAInterface // Functions to hide member variable misuse // + void SetLod(CEntitySAInterface* pLod) noexcept { m_pLod = pLod; }; + CEntitySAInterface* GetLod() const noexcept { return m_pLod; }; + // Sets void SetIsLowLodEntity() { numLodChildrenRendered = 0x40; } @@ -243,9 +246,16 @@ class CEntitySAInterface ((vtbl_DeleteRwObject)this->vtbl->DeleteRwObject)(this); }; + void RemoveRWObjectWithReferencesCleanup() { + DeleteRwObject(); + ResolveReferences(); + RemoveShadows(); + } + bool HasMatrix() const noexcept { return Placeable.matrix != nullptr; } void RemoveMatrix() { ((void(__thiscall*)(void*))0x54F3B0)(this); } + }; static_assert(sizeof(CEntitySAInterface) == 0x38, "Invalid size for CEntitySAInterface"); diff --git a/Client/game_sa/CGameSA.cpp b/Client/game_sa/CGameSA.cpp index bbcea89897..744993584e 100644 --- a/Client/game_sa/CGameSA.cpp +++ b/Client/game_sa/CGameSA.cpp @@ -465,7 +465,7 @@ void CGameSA::Reset() CModelInfoSA::StaticResetTextureDictionaries(); // Restore default world state - RestoreGameBuildings(); + RestoreGameWorld(); } } @@ -1059,46 +1059,45 @@ void CGameSA::GetShaderReplacementStats(SShaderReplacementStats& outStats) m_pRenderWare->GetShaderReplacementStats(outStats); } -void CGameSA::RemoveAllBuildings() +void CGameSA::RemoveGameWorld() { m_pIplStore->SetDynamicIplStreamingEnabled(false); - m_Pools->GetDummyPool().RemoveAllBuildingLods(); - m_Pools->GetBuildingsPool().RemoveAllBuildings(); + m_pCoverManager->RemoveAllCovers(); + m_pPlantManager->RemoveAllPlants(); - auto pBuildingRemoval = static_cast(m_pBuildingRemoval); - pBuildingRemoval->DropCaches(); + // Remove all shadows in CStencilShadowObjects::dtorAll + ((void* (*)())0x711390)(); - m_isBuildingsRemoved = true; + m_Pools->GetDummyPool().RemoveAllWithBackup(); + m_Pools->GetBuildingsPool().RemoveAllWithBackup(); + + static_cast(m_pBuildingRemoval)->DropCaches(); + + m_isGameWorldRemoved = true; } -void CGameSA::RestoreGameBuildings() +void CGameSA::RestoreGameWorld() { - m_Pools->GetBuildingsPool().RestoreAllBuildings(); - m_Pools->GetDummyPool().RestoreAllBuildingsLods(); + m_Pools->GetBuildingsPool().RestoreBackup(); + m_Pools->GetDummyPool().RestoreBackup(); m_pIplStore->SetDynamicIplStreamingEnabled(true, [](CIplSAInterface* ipl) { return memcmp("barriers", ipl->name, 8) != 0; }); - m_isBuildingsRemoved = false; + m_isGameWorldRemoved = false; } bool CGameSA::SetBuildingPoolSize(size_t size) { - const bool shouldRemoveBuilding = !m_isBuildingsRemoved; - if (shouldRemoveBuilding) - { - RemoveAllBuildings(); - } + const bool shouldRemoveWorld = !m_isGameWorldRemoved; + if (shouldRemoveWorld) + RemoveGameWorld(); else - { static_cast(m_pBuildingRemoval)->DropCaches(); - } bool status = m_Pools->GetBuildingsPool().Resize(size); - if (shouldRemoveBuilding) - { - RestoreGameBuildings(); - } + if (shouldRemoveWorld) + RestoreGameWorld(); return status; } diff --git a/Client/game_sa/CGameSA.h b/Client/game_sa/CGameSA.h index 54ab9597e4..5c659d458d 100644 --- a/Client/game_sa/CGameSA.h +++ b/Client/game_sa/CGameSA.h @@ -310,8 +310,8 @@ class CGameSA : public CGame PostWeaponFireHandler* m_pPostWeaponFireHandler; TaskSimpleBeHitHandler* m_pTaskSimpleBeHitHandler; - void RemoveAllBuildings(); - void RestoreGameBuildings(); + void RemoveGameWorld(); + void RestoreGameWorld(); bool SetBuildingPoolSize(size_t size); @@ -381,7 +381,7 @@ class CGameSA : public CGame bool m_isBurnFlippedCarsEnabled{true}; bool m_isFireballDestructEnabled{true}; bool m_isRoadSignsTextEnabled{true}; - bool m_isBuildingsRemoved{false}; + bool m_isGameWorldRemoved{false}; bool m_isExtendedWaterCannonsEnabled{false}; bool m_isIgnoreFireStateEnabled{false}; diff --git a/Client/game_sa/CPoolSAInterface.h b/Client/game_sa/CPoolSAInterface.h index 9f48bc63d3..0416b90a34 100644 --- a/Client/game_sa/CPoolSAInterface.h +++ b/Client/game_sa/CPoolSAInterface.h @@ -114,8 +114,9 @@ class CPoolSAInterface void Delete(uint index) { Release(index); } - bool IsEmpty(std::int32_t objectIndex) { return m_byteMap[objectIndex].bEmpty; } - bool IsContains(uint index) + std::int32_t Size() const noexcept { return m_nSize; }; + bool IsEmpty(std::int32_t objectIndex) const { return m_byteMap[objectIndex].bEmpty; } + bool IsContains(uint index) const { if (m_nSize <= index) return false; diff --git a/Client/game_sa/CPoolsSA.h b/Client/game_sa/CPoolsSA.h index 27eeec68bc..e190c2fbd6 100644 --- a/Client/game_sa/CPoolsSA.h +++ b/Client/game_sa/CPoolsSA.h @@ -22,6 +22,8 @@ #define INVALID_POOL_ARRAY_ID 0xFFFFFFFF class CClientEntity; +class CClientVehicle; +class CClientObject; class CPoolsSA : public CPools { diff --git a/Client/mods/deathmatch/logic/CClientBuildingManager.cpp b/Client/mods/deathmatch/logic/CClientBuildingManager.cpp index a09df6a226..627f432e09 100644 --- a/Client/mods/deathmatch/logic/CClientBuildingManager.cpp +++ b/Client/mods/deathmatch/logic/CClientBuildingManager.cpp @@ -108,6 +108,21 @@ void CClientBuildingManager::RestoreDestroyed() } } +void CClientBuildingManager::RestoreDestroyedSafe() +{ + // Resize the building pool if we need + const int currentUsed = g_pGame->GetPools()->GetNumberOfUsedSpaces(ePools::BUILDING_POOL) + m_List.size(); + const int currentCapacity = g_pGame->GetPools()->GetPoolCapacity(ePools::BUILDING_POOL); + + if (currentCapacity - currentUsed < PRESERVED_POOL_SIZE) + { + DoPoolResize(currentUsed + PRESERVED_POOL_SIZE); + } + + // Restore + RestoreDestroyed(); +} + void CClientBuildingManager::ResizePoolIfNeeds() { const int currentUsed = g_pGame->GetPools()->GetNumberOfUsedSpaces(ePools::BUILDING_POOL); @@ -139,38 +154,3 @@ bool CClientBuildingManager::DoPoolResize(size_t newCapacity) return success; } - - -void CClientBuildingManager::RemoveAllGameBuildings() -{ - // We do not want to remove scripted buildings - // But we need remove them from the buildings pool for a bit... - DestroyAllForABit(); - - // This function makes buildings backup without scripted buildings - g_pGame->RemoveAllBuildings(); - - // ... And restore here - RestoreDestroyed(); -} - -void CClientBuildingManager::RestoreAllGameBuildings() -{ - // We want to restore the game buildings to the same positions as they were before the backup. - // Remove scripted buildings for a bit - DestroyAllForABit(); - - g_pGame->RestoreGameBuildings(); - - // Resize the building pool if we need - const int currentUsed = g_pGame->GetPools()->GetNumberOfUsedSpaces(ePools::BUILDING_POOL) + m_List.size(); - const int currentCapacity = g_pGame->GetPools()->GetPoolCapacity(ePools::BUILDING_POOL); - - if (currentCapacity - currentUsed < PRESERVED_POOL_SIZE) - { - DoPoolResize(currentUsed + PRESERVED_POOL_SIZE); - } - - // Restore - RestoreDestroyed(); -} diff --git a/Client/mods/deathmatch/logic/CClientBuildingManager.h b/Client/mods/deathmatch/logic/CClientBuildingManager.h index 050cff9f96..d44cc7d70f 100644 --- a/Client/mods/deathmatch/logic/CClientBuildingManager.h +++ b/Client/mods/deathmatch/logic/CClientBuildingManager.h @@ -34,13 +34,11 @@ class CClientBuildingManager void ResizePoolIfNeeds(); bool SetPoolCapacity(size_t newCapacity); - void RemoveAllGameBuildings(); - void RestoreAllGameBuildings(); - -private: void DestroyAllForABit(); void RestoreDestroyed(); + void RestoreDestroyedSafe(); +private: bool DoPoolResize(size_t newCapacity); void AddToList(CClientBuilding* pBuilding) { m_List.push_back(pBuilding); } void RemoveFromList(CClientBuilding* pBuilding); diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaBuildingDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaBuildingDefs.cpp index bcb765e712..a622b3c54d 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaBuildingDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaBuildingDefs.cpp @@ -63,12 +63,14 @@ CClientBuilding* CLuaBuildingDefs::CreateBuilding(lua_State* const luaVM, std::u return pBuilding; } +// Deprecated void CLuaBuildingDefs::RemoveAllGameBuildings() { - m_pBuildingManager->RemoveAllGameBuildings(); + CLuaWorldDefs::RemoveGameWorld(); } +// Deprecated void CLuaBuildingDefs::RestoreGameBuildings() { - m_pBuildingManager->RestoreAllGameBuildings(); + CLuaWorldDefs::RestoreGameWorld(); } diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp index 185b0ae44b..32d838a332 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp @@ -101,13 +101,19 @@ void CLuaWorldDefs::LoadFunctions() {"setFPSLimit", SetFPSLimit}, {"setCoronaReflectionsEnabled", ArgumentParser}, {"setWorldProperty", ArgumentParser}, + + // World remove/restore functions {"removeWorldModel", RemoveWorldBuilding}, {"restoreAllWorldModels", RestoreWorldBuildings}, {"restoreWorldModel", RestoreWorldBuilding}, + {"removeGameWorld", ArgumentParser}, + {"restoreGameWorld", ArgumentParser}, + {"setTimeFrozen", ArgumentParser}, {"setVolumetricShadowsEnabled", ArgumentParser}, {"setDynamicPedShadowsEnabled", ArgumentParser}, + // World create funcs {"createSWATRope", CreateSWATRope}, {"createExplosion", CreateExplosion}, @@ -2262,6 +2268,31 @@ bool CLuaWorldDefs::ResetTimeFrozen() noexcept return g_pGame->GetClock()->ResetTimeFrozen(); } +void CLuaWorldDefs::RemoveGameWorld() +{ + // We do not want to remove scripted buildings + // But we need remove them from the buildings pool for a bit... + m_pBuildingManager->DestroyAllForABit(); + + // This function makes buildings backup without scripted buildings + g_pGame->RemoveGameWorld(); + + // ... And restore here + m_pBuildingManager->RestoreDestroyed(); +} + +void CLuaWorldDefs::RestoreGameWorld() +{ + // We want to restore the game buildings to the same positions as they were before the backup. + // Remove scripted buildings for a bit + m_pBuildingManager->DestroyAllForABit(); + + g_pGame->RestoreGameWorld(); + + // ... And restore here + m_pBuildingManager->RestoreDestroyedSafe(); +} + bool CLuaWorldDefs::SetVolumetricShadowsEnabled(bool enable) noexcept { g_pGame->GetSettings()->SetVolumetricShadowsEnabled(enable); diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h index 3c19ed8857..7cf1eb91d7 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h @@ -147,5 +147,6 @@ class CLuaWorldDefs : public CLuaDefs static CLuaMultiReturn TestSphereAgainstWorld(CVector sphereCenter, float radius, std::optional ignoredEntity, std::optional checkBuildings, std::optional checkVehicles, std::optional checkPeds, std::optional checkObjects, std::optional checkDummies, std::optional cameraIgnore); + static void RemoveGameWorld(); + static void RestoreGameWorld(); }; - diff --git a/Client/sdk/game/CBuildingsPool.h b/Client/sdk/game/CBuildingsPool.h index d490c162f7..84f5c9b67e 100644 --- a/Client/sdk/game/CBuildingsPool.h +++ b/Client/sdk/game/CBuildingsPool.h @@ -1,6 +1,6 @@ /***************************************************************************** * - * PROJECT: Multi Theft Auto v1.0 + * PROJECT: Multi Theft Auto * LICENSE: See LICENSE in the top level directory * FILE: sdk/game/CBuildingsPool.h * PURPOSE: Buildings pool interface @@ -22,12 +22,12 @@ class CBuildingsPool public: // Buildings pool - virtual CBuilding* AddBuilding(class CClientBuilding*, uint16_t modelId, CVector* vPos, CVector4D* vRot, uint8_t interior) = 0; + virtual CBuilding* AddBuilding(class CClientBuilding*, std::uint16_t modelId, CVector* vPos, CVector4D* vRot, std::uint8_t interior) = 0; virtual void RemoveBuilding(CBuilding* pObject) = 0; virtual bool HasFreeBuildingSlot() = 0; virtual bool Resize(int size) = 0; virtual int GetSize() const = 0; - virtual void RemoveAllBuildings() = 0; - virtual void RestoreAllBuildings() = 0; + virtual void RemoveAllWithBackup() = 0; + virtual void RestoreBackup() = 0; }; diff --git a/Client/sdk/game/CDummyPool.h b/Client/sdk/game/CDummyPool.h index 46308c304f..08ca6f7256 100644 --- a/Client/sdk/game/CDummyPool.h +++ b/Client/sdk/game/CDummyPool.h @@ -1,6 +1,6 @@ /***************************************************************************** * - * PROJECT: Multi Theft Auto v1.0 + * PROJECT: Multi Theft Auto * LICENSE: See LICENSE in the top level directory * FILE: sdk/game/CDummyPool.h * PURPOSE: Dummy pool interface @@ -16,7 +16,7 @@ class CDummyPool { public: - virtual void RemoveAllBuildingLods() = 0; - virtual void RestoreAllBuildingsLods() = 0; - virtual void UpdateBuildingLods(void* oldPool, void* newPool) = 0; + virtual void RemoveAllWithBackup() = 0; + virtual void RestoreBackup() = 0; + virtual void UpdateBuildingLods(const std::uint32_t offset) = 0; }; diff --git a/Client/sdk/game/CGame.h b/Client/sdk/game/CGame.h index b9e9e48f1d..a87225a024 100644 --- a/Client/sdk/game/CGame.h +++ b/Client/sdk/game/CGame.h @@ -277,8 +277,8 @@ class __declspec(novtable) CGame virtual int32_t GetBaseIDforSCM() = 0; virtual int32_t GetCountOfAllFileIDs() = 0; - virtual void RemoveAllBuildings() = 0; - virtual void RestoreGameBuildings() = 0; + virtual void RemoveGameWorld() = 0; + virtual void RestoreGameWorld() = 0; virtual bool SetBuildingPoolSize(size_t size) = 0; diff --git a/Client/sdk/game/CWorld.h b/Client/sdk/game/CWorld.h index c22762f7a8..276567c364 100644 --- a/Client/sdk/game/CWorld.h +++ b/Client/sdk/game/CWorld.h @@ -99,6 +99,8 @@ enum eDebugCaller CBuildingPool_Constructor, CBuildingPool_Destructor, CBuilding_SetLod, + CDummyPool_Constructor, + CDummyPool_Destructor, }; enum eSurfaceProperties diff --git a/Server/mods/deathmatch/logic/CResourceChecker.Data.h b/Server/mods/deathmatch/logic/CResourceChecker.Data.h index b5ace221e1..6c22ecff13 100644 --- a/Server/mods/deathmatch/logic/CResourceChecker.Data.h +++ b/Server/mods/deathmatch/logic/CResourceChecker.Data.h @@ -174,7 +174,10 @@ namespace {false, "getHelicopterRotorSpeed", "getVehicleRotorSpeed"}, {false, "setPedOnFire", "setElementOnFire"}, - {false, "isPedOnFire", "isElementOnFire"} + {false, "isPedOnFire", "isElementOnFire"}, + + {false, "removeAllGameBuildings", "removeGameWorld"}, + {false, "restoreAllGameBuildings", "restoreGameWorld"}, }; SDeprecatedItem serverDeprecatedList[] = {