From 8e30580446e179f9ecc6c496d04eacbda8ae3360 Mon Sep 17 00:00:00 2001 From: FileEX Date: Wed, 1 Jan 2025 19:19:44 +0100 Subject: [PATCH] Simple solution --- Client/mods/deathmatch/logic/CClientPad.cpp | 17 ++++++++++------- Client/mods/deathmatch/logic/CClientPad.h | 1 + Client/mods/deathmatch/logic/CClientPed.cpp | 3 +++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientPad.cpp b/Client/mods/deathmatch/logic/CClientPad.cpp index 2f68b90baf..223028a0c7 100644 --- a/Client/mods/deathmatch/logic/CClientPad.cpp +++ b/Client/mods/deathmatch/logic/CClientPad.cpp @@ -116,13 +116,6 @@ CClientPad::CClientPad() { m_fStates[i] = 0.0f; } - - // Initialise our analog control states - for (unsigned int i = 0; i < MAX_GTA_ANALOG_CONTROLS; i++) - { - m_sScriptedStates[i] = CS_NAN; - m_bScriptedStatesNextFrameOverride[i] = false; - } } bool CClientPad::GetControlState(const char* szName, bool& bState) @@ -468,6 +461,16 @@ bool CClientPad::GetAnalogControlIndex(const char* szName, unsigned int& uiIndex return false; } +void CClientPad::InitAnalogControlStates() +{ + // Initialise our analog control states + for (unsigned int i = 0; i < MAX_GTA_ANALOG_CONTROLS; i++) + { + m_sScriptedStates[i] = CS_NAN; + m_bScriptedStatesNextFrameOverride[i] = false; + } +} + // Get the analog control state directly from a pad state. Use for players. bool CClientPad::GetAnalogControlState(const char* szName, CControllerState& cs, bool bOnFoot, float& fState, bool bIgnoreOverrides) { diff --git a/Client/mods/deathmatch/logic/CClientPad.h b/Client/mods/deathmatch/logic/CClientPad.h index db6bac04e0..348fe5a29b 100644 --- a/Client/mods/deathmatch/logic/CClientPad.h +++ b/Client/mods/deathmatch/logic/CClientPad.h @@ -23,6 +23,7 @@ class CClientPad static const char* GetControlName(unsigned int uiIndex); static bool GetAnalogControlIndex(const char* szName, unsigned int& uiIndex); + static void InitAnalogControlStates(); CClientPad(); diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index c3d2f27f91..3c8d9081e7 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -251,6 +251,9 @@ void CClientPed::Init(CClientManager* pManager, unsigned long ulModelID, bool bI // Init the local player _CreateLocalModel(); + // Init default analog control states + CClientPad::InitAnalogControlStates(); + // Give full health, no armor, no weapons and put him at a safe location SetHealth(GetMaxHealth()); SetArmor(0);