From 6632d8ece4d2bbb8a60029fbdb3581a7a5738e83 Mon Sep 17 00:00:00 2001 From: ricardoofnl Date: Sun, 30 Aug 2026 12:53:24 +0700 Subject: [PATCH] [saco] Implement/match `CWorld__ProcessAttachedEntities__PositionAttachedEntity_Hook` --- saco/game/entity.h | 2 ++ saco/game/hooks.cpp | 34 ++++++++++++++++++++++++++++++++-- saco/net/objectpool.h | 2 ++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/saco/game/entity.h b/saco/game/entity.h index f6f98f3..ad2c99c 100644 --- a/saco/game/entity.h +++ b/saco/game/entity.h @@ -49,6 +49,8 @@ public: DWORD GetWorldBoundRadius(); void SetEulerAngles(float fX, float fY, float fZ); + void FUNC_100A7E20(); // .text:100A7E20 + virtual void Add(); virtual void Remove(); BOOL IsAdded(); diff --git a/saco/game/hooks.cpp b/saco/game/hooks.cpp index 6ee0aed..ef3f05e 100644 --- a/saco/game/hooks.cpp +++ b/saco/game/hooks.cpp @@ -1050,10 +1050,40 @@ NUDE CAutomobile__BreakTowLink_Hook() //----------------------------------------------------------- +ENTITY_TYPE *_pAttachedEntity; +CEntity *_pAttachedObject; +DWORD _dwAttachedEntityEsp; +DWORD _dwAttachedEntityResult; + NUDE CWorld__ProcessAttachedEntities__PositionAttachedEntity_Hook() { - // TODO: CWorld__ProcessAttachedEntities__PositionAttachedEntity_Hook -} + __asm + { + mov _dwAttachedEntityEsp, esp + mov _pAttachedEntity, ecx + + pushad + + // call original CEntity::PositionAttachedEntity + mov ecx, _pAttachedEntity + mov ebx, 0x546FF0 + call ebx + + mov _dwAttachedEntityResult, eax + } + + if (pNetGame && pNetGame->GetObjectPool()) + { + _pAttachedObject = pNetGame->GetObjectPool()->FUNC_100129D0(_pAttachedEntity); + if (_pAttachedObject) _pAttachedObject->FUNC_100A7E20(); + } + + __asm + { + popad + mov eax, _dwAttachedEntityResult + retn + }} //----------------------------------------------------------- diff --git a/saco/net/objectpool.h b/saco/net/objectpool.h index d5bde9c..8db28c2 100644 --- a/saco/net/objectpool.h +++ b/saco/net/objectpool.h @@ -8,6 +8,8 @@ private: int field_4[MAX_OBJECTS]; int field_FA4[MAX_OBJECTS]; public: + CEntity * FUNC_100129D0(ENTITY_TYPE *pEntity); // .text:100129D0 + CObjectPool(); void FUNC_10012B90(); // .text:10012B90