From c905d1dfb4ef472668c705b2d87341267471d234 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Fri, 3 May 2024 21:48:31 +0800 Subject: [PATCH] [saco] Implement `CPlayerPed::HasGoggles()` --- saco/game/common.h | 5 +++++ saco/game/playerped.cpp | 10 +++++++++- saco/game/playerped.h | 5 ++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/saco/game/common.h b/saco/game/common.h index c2c37d6..2184563 100644 --- a/saco/game/common.h +++ b/saco/game/common.h @@ -78,6 +78,10 @@ typedef struct _PED_TYPE PED_TASKS_TYPE *Tasks; // 1148-1152 + char _gap480[128]; + + DWORD dwActiveVision; // 1280-1284 + } PED_TYPE; //----------------------------------------------------------- @@ -94,6 +98,7 @@ typedef struct _VEHICLE_TYPE #define TRAIN_FREIGHT 570 #define TRAIN_TRAM 449 #define HYDRA 520 + //----------------------------------------------------------- // ---- weapon id defines ---- diff --git a/saco/game/playerped.cpp b/saco/game/playerped.cpp index 7d59bf1..3953742 100644 --- a/saco/game/playerped.cpp +++ b/saco/game/playerped.cpp @@ -26,7 +26,7 @@ CPlayerPed::CPlayerPed() field_2DE = 0; field_2E2 = 0; field_48 = 0; - field_2E6 = 0; + m_bGoggleState = FALSE; field_2C1 = 0; field_2C5 = 0; field_2C9 = 0; @@ -45,3 +45,11 @@ CPlayerPed::CPlayerPed() } //----------------------------------------------------------- + +BOOL CPlayerPed::HasGoggles() +{ + if (!m_pPed) return FALSE; + return (BOOL)(m_pPed->dwActiveVision != 0 || m_bGoggleState); +} + +//----------------------------------------------------------- diff --git a/saco/game/playerped.h b/saco/game/playerped.h index 0f2d820..6bf2f98 100644 --- a/saco/game/playerped.h +++ b/saco/game/playerped.h @@ -13,6 +13,9 @@ struct struc_97 class CPlayerPed : public CEntity { public: + + BOOL HasGoggles(); + CPlayerPed(); int field_48; @@ -43,7 +46,7 @@ public: int field_2DE; int field_2E2; - int field_2E6; + BOOL m_bGoggleState; char _gap2EA[8];