From d767d9d6e3236510c071da3de37e844ca2c53598 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sun, 5 May 2024 18:30:43 +0800 Subject: [PATCH] [saco] Implement and match `CPlayerPed::SetInitialState()` --- saco/game/playerped.cpp | 32 ++++++++++++++++++++++++++++++++ saco/game/playerped.h | 1 + 2 files changed, 33 insertions(+) diff --git a/saco/game/playerped.cpp b/saco/game/playerped.cpp index ad62988..d644660 100644 --- a/saco/game/playerped.cpp +++ b/saco/game/playerped.cpp @@ -60,6 +60,38 @@ void CPlayerPed::ResetPointers() m_pEntity = (ENTITY_TYPE *)m_pPed; } +//----------------------------------------------------------- + +void CPlayerPed::SetInitialState() +{ + DWORD dwPedPtr = (DWORD)m_pPed; + //int iPlayerNumber = 0; + //DWORD dwPlayerActorID = 0; + + _asm push 0 + _asm mov ecx, dwPedPtr + _asm mov edx, 0x60CD20 ; internal_CPlayerPed_SetInitialState + _asm call edx + + /* DESTROY METHOD + _asm mov ecx, dwPedPtr + _asm mov ebx, [ecx] ; vtable + _asm push 1 + _asm call [ebx] ; destroy + */ + + // CREATE PLAYER + /* + ScriptCommand(&create_player, &iPlayerNumber, x, y, z, &dwPlayerActorID); + ScriptCommand(&create_actor_from_player,&iPlayerNumber,&dwPlayerActorID); + + m_dwGTAId = dwPlayerActorID; + m_pPed = GamePool_Ped_GetAt(m_dwGTAId); + m_bytePlayerNumber = 0; + m_pEntity = (ENTITY_TYPE *)GamePool_Ped_GetAt(m_dwGTAId); + */ +} + void CPlayerPed::GiveWeapon(int iWeaponID, int iAmmo) { if(!m_pPed) return; diff --git a/saco/game/playerped.h b/saco/game/playerped.h index c6836a3..dc16c7d 100644 --- a/saco/game/playerped.h +++ b/saco/game/playerped.h @@ -17,6 +17,7 @@ class CPlayerPed : public CEntity public: void ResetPointers(); + void SetInitialState(); WORD GetAmmo();