Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX committed Jan 1, 2025
1 parent c666c8e commit 56039fc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
2 changes: 2 additions & 0 deletions Client/mods/deathmatch/logic/CClientPad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#define CS_NAN -32768

SFixedArray<short, MAX_GTA_CONTROLS> CClientPad::m_sScriptedStates;
SFixedArray<bool, MAX_GTA_ANALOG_CONTROLS> CClientPad::m_bScriptedStatesNextFrameOverride;
bool CClientPad::m_bFlyWithMouse;
bool CClientPad::m_bSteerWithMouse;

Expand Down
18 changes: 9 additions & 9 deletions Client/mods/deathmatch/logic/CClientPad.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<short, MAX_GTA_CONTROLS> m_sScriptedStates;
static SFixedArray<bool, MAX_GTA_ANALOG_CONTROLS> m_bScriptedStatesNextFrameOverride;
static bool m_bFlyWithMouse;
static bool m_bSteerWithMouse;

protected:
SFixedArray<float, MAX_GTA_CONTROLS> m_fStates;
SFixedArray<short, MAX_GTA_CONTROLS> m_sScriptedStates;
SFixedArray<bool, MAX_GTA_ANALOG_CONTROLS> m_bScriptedStatesNextFrameOverride;
};
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/CClientPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
13 changes: 5 additions & 8 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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
Expand Down
6 changes: 2 additions & 4 deletions Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -318,15 +316,15 @@ 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;
}
}
else if (argStream.NextIsNone())
{
localPlayer->m_Pad.RemoveSetAnalogControlState(strControlState);
CClientPad::RemoveSetAnalogControlState(strControlState);
lua_pushboolean(luaVM, true);
return 1;
}
Expand Down

0 comments on commit 56039fc

Please sign in to comment.