From 1b40db7cb5b63966ee97d0cbe79190360e1d32a0 Mon Sep 17 00:00:00 2001 From: TEDERIs Date: Fri, 23 Feb 2024 03:49:53 +0700 Subject: [PATCH] Fix buildings removal (#3319) --- Client/game_sa/CWorldSA.cpp | 2 +- Client/sdk/game/CWorld.h | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Client/game_sa/CWorldSA.cpp b/Client/game_sa/CWorldSA.cpp index b946b7e3c1..c2c7376e6e 100644 --- a/Client/game_sa/CWorldSA.cpp +++ b/Client/game_sa/CWorldSA.cpp @@ -1069,7 +1069,7 @@ bool CWorldSA::IsRemovedModelInRadius(SIPLInst* pInst) float fDistance = sqrt(fDistanceX * fDistanceX + fDistanceY * fDistanceY + fDistanceZ * fDistanceZ); // is it in the removal spheres radius if so return else keep looking - if (fDistance <= pFind->m_fRadius && (pFind->m_cInterior == -1 || pFind->m_cInterior == pInst->m_nInterior)) + if (fDistance <= pFind->m_fRadius && (pFind->m_cInterior == -1 || pFind->m_cInterior == pInst->m_nAreaCode)) { return true; } diff --git a/Client/sdk/game/CWorld.h b/Client/sdk/game/CWorld.h index c2319988d9..828873d762 100644 --- a/Client/sdk/game/CWorld.h +++ b/Client/sdk/game/CWorld.h @@ -95,15 +95,27 @@ struct SBuildingRemoval std::list* m_pBinaryRemoveList; std::list* m_pDataRemoveList; }; + struct SIPLInst { - CVector m_pPosition; - CVector m_pRotation; - float m_fRotationCont; - WORD m_nModelIndex; - BYTE m_nInterior; - BYTE m_bLOD; + CVector m_pPosition; + CVector4D m_pRotation; + int32_t m_nModelIndex; + union { + struct { + uint32_t m_nAreaCode : 8; + uint32_t m_bRedundantStream : 1; + uint32_t m_bDontStream : 1; + uint32_t m_bUnderwater : 1; + uint32_t m_bTunnel : 1; + uint32_t m_bTunnelTransition : 1; + uint32_t m_nReserved : 19; + }; + uint32_t m_nInstanceType; + }; + int32_t m_nLodInstanceIndex; }; +static_assert(sizeof(SIPLInst) == 0x28, "Invalid sizeof(SIPLInst)"); struct sDataBuildingRemovalItem {