From 56039fca51ef98a1cb3711e04e8beef2c7243008 Mon Sep 17 00:00:00 2001 From: FileEX Date: Wed, 1 Jan 2025 19:27:29 +0100 Subject: [PATCH] revert --- Client/mods/deathmatch/logic/CClientPad.cpp | 2 ++ Client/mods/deathmatch/logic/CClientPad.h | 18 +++++++++--------- Client/mods/deathmatch/logic/CClientPed.cpp | 2 +- .../logic/CStaticFunctionDefinitions.cpp | 13 +++++-------- .../logic/lua/CLuaFunctionDefs.Input.cpp | 6 ++---- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientPad.cpp b/Client/mods/deathmatch/logic/CClientPad.cpp index 49c17c1226..223028a0c7 100644 --- a/Client/mods/deathmatch/logic/CClientPad.cpp +++ b/Client/mods/deathmatch/logic/CClientPad.cpp @@ -17,6 +17,8 @@ #define CS_NAN -32768 +SFixedArray CClientPad::m_sScriptedStates; +SFixedArray CClientPad::m_bScriptedStatesNextFrameOverride; bool CClientPad::m_bFlyWithMouse; bool CClientPad::m_bSteerWithMouse; diff --git a/Client/mods/deathmatch/logic/CClientPad.h b/Client/mods/deathmatch/logic/CClientPad.h index b0ac746426..348fe5a29b 100644 --- a/Client/mods/deathmatch/logic/CClientPad.h +++ b/Client/mods/deathmatch/logic/CClientPad.h @@ -35,22 +35,22 @@ class CClientPad void DoPulse(CClientPed* pPed); - bool GetAnalogControlState(const char* szName, CControllerState& cs, bool bOnFoot, float& fState, bool bIgnoreOverrides); - bool SetAnalogControlState(const char* szName, float fState, bool bFrameForced); - void RemoveSetAnalogControlState(const char* szName); + static bool GetAnalogControlState(const char* szName, CControllerState& cs, bool bOnFoot, float& fState, bool bIgnoreOverrides); + static bool SetAnalogControlState(const char* szName, float fState, bool bFrameForced); + static void RemoveSetAnalogControlState(const char* szName); - void ProcessSetAnalogControlState(CControllerState& cs, bool bOnFoot); - void ProcessControl(short& usControlValue, unsigned int uiIndex); + static void ProcessSetAnalogControlState(CControllerState& cs, bool bOnFoot); + static void ProcessControl(short& usControlValue, unsigned int uiIndex); static void ProcessAllToggledControls(CControllerState& cs, bool bOnFoot); static bool ProcessToggledControl(const char* szName, CControllerState& cs, bool bOnFoot, bool bEnabled); static bool GetControlState(const char* szName, CControllerState& State, bool bOnFoot); - static bool m_bFlyWithMouse; - static bool m_bSteerWithMouse; + static SFixedArray m_sScriptedStates; + static SFixedArray m_bScriptedStatesNextFrameOverride; + static bool m_bFlyWithMouse; + static bool m_bSteerWithMouse; protected: SFixedArray m_fStates; - SFixedArray m_sScriptedStates; - SFixedArray m_bScriptedStatesNextFrameOverride; }; diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index 9a473b096f..3c8d9081e7 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -2960,7 +2960,7 @@ void CClientPed::ApplyControllerStateFixes(CControllerState& Current) // Process our scripted control settings bool bOnFoot = pVehicle ? false : true; CClientPad::ProcessAllToggledControls(Current, bOnFoot); - m_Pad.ProcessSetAnalogControlState(Current, bOnFoot); + CClientPad::ProcessSetAnalogControlState(Current, bOnFoot); } // Is the player stealth aiming? diff --git a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index 0695f655eb..87521a812a 100644 --- a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -1725,12 +1725,10 @@ bool CStaticFunctionDefinitions::GetPedControlState(CClientPed& Ped, const char* bState = CClientPad::GetControlState(szControl, cs, bOnFoot); float fState = 0; unsigned int uiIndex; - CClientPad pad = Ped.m_Pad; - // Check it's Analog if (CClientPad::GetAnalogControlIndex(szControl, uiIndex)) { - if (pad.GetAnalogControlState(szControl, cs, bOnFoot, fState, false)) + if (CClientPad::GetAnalogControlState(szControl, cs, bOnFoot, fState, false)) { bState = fState > 0; return true; @@ -1767,7 +1765,7 @@ bool CStaticFunctionDefinitions::GetPedAnalogControlState(CClientPed& Ped, const // check it's analog or use binary. if (CClientPad::GetAnalogControlIndex(szControl, uiIndex)) - Ped.m_Pad.GetAnalogControlState(szControl, cs, bOnFoot, fState, bRawInput); + CClientPad::GetAnalogControlState(szControl, cs, bOnFoot, fState, bRawInput); else fState = CClientPad::GetControlState(szControl, cs, bOnFoot) == true ? 1.0f : 0.0f; @@ -7198,7 +7196,7 @@ bool CStaticFunctionDefinitions::GetAnalogControlState(const char* szControl, fl else pLocalPlayer->GetControllerState(cs); - if (pLocalPlayer->m_Pad.GetAnalogControlState(szControl, cs, bOnFoot, fState, bRawInput)) + if (CClientPad::GetAnalogControlState(szControl, cs, bOnFoot, fState, bRawInput)) { return true; } @@ -7225,13 +7223,12 @@ bool CStaticFunctionDefinitions::SetControlState(const char* szControl, bool bSt { assert(szControl); unsigned int uiIndex; - CClientPlayer* pLocalPlayer = m_pPlayerManager->GetLocalPlayer(); if (bState) { if (CClientPad::GetAnalogControlIndex(szControl, uiIndex)) { - if (pLocalPlayer->m_Pad.SetAnalogControlState(szControl, 1.0, false)) + if (CClientPad::SetAnalogControlState(szControl, 1.0, false)) { return true; } @@ -7251,7 +7248,7 @@ bool CStaticFunctionDefinitions::SetControlState(const char* szControl, bool bSt { if (CClientPad::GetAnalogControlIndex(szControl, uiIndex)) { - pLocalPlayer->m_Pad.RemoveSetAnalogControlState(szControl); + CClientPad::RemoveSetAnalogControlState(szControl); return true; } else diff --git a/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Input.cpp b/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Input.cpp index ea24aa2ad5..00256a1f72 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Input.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Input.cpp @@ -308,8 +308,6 @@ int CLuaFunctionDefs::SetAnalogControlState(lua_State* luaVM) CScriptArgReader argStream(luaVM); argStream.ReadString(strControlState); - CClientPlayer* localPlayer = CStaticFunctionDefinitions::GetLocalPlayer(); - if (!argStream.HasErrors()) { if (argStream.NextIsNumber()) @@ -318,7 +316,7 @@ int CLuaFunctionDefs::SetAnalogControlState(lua_State* luaVM) if (argStream.NextIsBool()) argStream.ReadBool(bForceOverrideNextFrame, false); - if (localPlayer->m_Pad.SetAnalogControlState(strControlState, fState, bForceOverrideNextFrame)) + if (CClientPad::SetAnalogControlState(strControlState, fState, bForceOverrideNextFrame)) { lua_pushboolean(luaVM, true); return 1; @@ -326,7 +324,7 @@ int CLuaFunctionDefs::SetAnalogControlState(lua_State* luaVM) } else if (argStream.NextIsNone()) { - localPlayer->m_Pad.RemoveSetAnalogControlState(strControlState); + CClientPad::RemoveSetAnalogControlState(strControlState); lua_pushboolean(luaVM, true); return 1; }