From 4fd253f52e967a5eeb2ff44cd7c54159b11b752e Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Tue, 6 Aug 2024 19:08:47 +0800 Subject: [PATCH] [saco] Implement/match `CEntity::Remove()` --- saco/game/entity.cpp | 33 +++++++++++++++++++++++++++++++++ saco/game/entity.h | 1 + 2 files changed, 34 insertions(+) diff --git a/saco/game/entity.cpp b/saco/game/entity.cpp index aa86d0b..5a084a1 100644 --- a/saco/game/entity.cpp +++ b/saco/game/entity.cpp @@ -1,7 +1,15 @@ +#include +#include +#include + #include "../main.h" +#include "util.h" #include "entity.h" +extern CGame *pGame; +extern CNetGame *pNetGame; +extern CChatWindow *pChatWindow; //----------------------------------------------------------- @@ -299,3 +307,28 @@ BOOL CEntity::IsAdded() //----------------------------------------------------------- +void CEntity::Remove() +{ + // Check for CPlaceable messup + if(!m_pEntity || m_pEntity->vtable == 0x863C40) + { +#ifdef _DEBUG + OutputDebugString("CEntity::Remove - m_pEntity == NULL or CPlaceable"); +#endif + return; + } + + if(m_pEntity->dwUnkModelRel) { + WorldRemoveEntity((PDWORD)m_pEntity); + +#ifdef _DEBUG + if (IsAdded()) + { + OutputDebugString("CEntity::Remove failed..."); + } +#endif + } +} + +//----------------------------------------------------------- + diff --git a/saco/game/entity.h b/saco/game/entity.h index 3dbf3c7..f2e248a 100644 --- a/saco/game/entity.h +++ b/saco/game/entity.h @@ -32,6 +32,7 @@ public: BOOL FUNC_1009FDE0(); virtual void Add(); + virtual void Remove(); BOOL IsAdded(); VECTOR field_4[5];