From 9894fd3ec73071c29a2cac35b2a78aefcf5316fb Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Fri, 3 May 2024 22:10:08 +0800 Subject: [PATCH] [saco] Implement `CPlayerPed::StartGoggles()` --- saco/game/playerped.cpp | 14 ++++++++++++++ saco/game/playerped.h | 1 + 2 files changed, 15 insertions(+) diff --git a/saco/game/playerped.cpp b/saco/game/playerped.cpp index 1d024e7..9a0cf63 100644 --- a/saco/game/playerped.cpp +++ b/saco/game/playerped.cpp @@ -2,6 +2,7 @@ #include "../main.h" #include "util.h" #include "keystuff.h" +#include "task.h" extern CGame *pGame; @@ -165,6 +166,19 @@ WEAPON_SLOT_TYPE * CPlayerPed::FindWeaponSlot(DWORD dwWeapon) //----------------------------------------------------------- +void CPlayerPed::StartGoggles() +{ + if (HasGoggles()) return; + if (FindWeaponSlot( 44 ) == NULL && FindWeaponSlot( 45 ) == NULL) + GiveWeapon( 44, 1 ); // Prevents crashing due to lack of animations. + + CTaskGoggles* pGoggles = new CTaskGoggles(); + pGoggles->ApplyToPed( this ); + m_bGoggleState = TRUE; +} + +//----------------------------------------------------------- + void CPlayerPed::StopGoggles() { if (!m_pPed || !HasGoggles()) return; diff --git a/saco/game/playerped.h b/saco/game/playerped.h index cdd22de..6779d89 100644 --- a/saco/game/playerped.h +++ b/saco/game/playerped.h @@ -23,6 +23,7 @@ public: WEAPON_SLOT_TYPE * GetCurrentWeaponSlot(); WEAPON_SLOT_TYPE * FindWeaponSlot(DWORD dwWeapon); + void StartGoggles(); void StopGoggles(); BOOL HasGoggles();