Skip to content

Commit 56039fc

Browse files
committed
revert
1 parent c666c8e commit 56039fc

File tree

5 files changed

+19
-22
lines changed

5 files changed

+19
-22
lines changed

Client/mods/deathmatch/logic/CClientPad.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#define CS_NAN -32768
1919

20+
SFixedArray<short, MAX_GTA_CONTROLS> CClientPad::m_sScriptedStates;
21+
SFixedArray<bool, MAX_GTA_ANALOG_CONTROLS> CClientPad::m_bScriptedStatesNextFrameOverride;
2022
bool CClientPad::m_bFlyWithMouse;
2123
bool CClientPad::m_bSteerWithMouse;
2224

Client/mods/deathmatch/logic/CClientPad.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ class CClientPad
3535

3636
void DoPulse(CClientPed* pPed);
3737

38-
bool GetAnalogControlState(const char* szName, CControllerState& cs, bool bOnFoot, float& fState, bool bIgnoreOverrides);
39-
bool SetAnalogControlState(const char* szName, float fState, bool bFrameForced);
40-
void RemoveSetAnalogControlState(const char* szName);
38+
static bool GetAnalogControlState(const char* szName, CControllerState& cs, bool bOnFoot, float& fState, bool bIgnoreOverrides);
39+
static bool SetAnalogControlState(const char* szName, float fState, bool bFrameForced);
40+
static void RemoveSetAnalogControlState(const char* szName);
4141

42-
void ProcessSetAnalogControlState(CControllerState& cs, bool bOnFoot);
43-
void ProcessControl(short& usControlValue, unsigned int uiIndex);
42+
static void ProcessSetAnalogControlState(CControllerState& cs, bool bOnFoot);
43+
static void ProcessControl(short& usControlValue, unsigned int uiIndex);
4444

4545
static void ProcessAllToggledControls(CControllerState& cs, bool bOnFoot);
4646
static bool ProcessToggledControl(const char* szName, CControllerState& cs, bool bOnFoot, bool bEnabled);
4747
static bool GetControlState(const char* szName, CControllerState& State, bool bOnFoot);
4848

49-
static bool m_bFlyWithMouse;
50-
static bool m_bSteerWithMouse;
49+
static SFixedArray<short, MAX_GTA_CONTROLS> m_sScriptedStates;
50+
static SFixedArray<bool, MAX_GTA_ANALOG_CONTROLS> m_bScriptedStatesNextFrameOverride;
51+
static bool m_bFlyWithMouse;
52+
static bool m_bSteerWithMouse;
5153

5254
protected:
5355
SFixedArray<float, MAX_GTA_CONTROLS> m_fStates;
54-
SFixedArray<short, MAX_GTA_CONTROLS> m_sScriptedStates;
55-
SFixedArray<bool, MAX_GTA_ANALOG_CONTROLS> m_bScriptedStatesNextFrameOverride;
5656
};

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2960,7 +2960,7 @@ void CClientPed::ApplyControllerStateFixes(CControllerState& Current)
29602960
// Process our scripted control settings
29612961
bool bOnFoot = pVehicle ? false : true;
29622962
CClientPad::ProcessAllToggledControls(Current, bOnFoot);
2963-
m_Pad.ProcessSetAnalogControlState(Current, bOnFoot);
2963+
CClientPad::ProcessSetAnalogControlState(Current, bOnFoot);
29642964
}
29652965

29662966
// Is the player stealth aiming?

Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,12 +1725,10 @@ bool CStaticFunctionDefinitions::GetPedControlState(CClientPed& Ped, const char*
17251725
bState = CClientPad::GetControlState(szControl, cs, bOnFoot);
17261726
float fState = 0;
17271727
unsigned int uiIndex;
1728-
CClientPad pad = Ped.m_Pad;
1729-
17301728
// Check it's Analog
17311729
if (CClientPad::GetAnalogControlIndex(szControl, uiIndex))
17321730
{
1733-
if (pad.GetAnalogControlState(szControl, cs, bOnFoot, fState, false))
1731+
if (CClientPad::GetAnalogControlState(szControl, cs, bOnFoot, fState, false))
17341732
{
17351733
bState = fState > 0;
17361734
return true;
@@ -1767,7 +1765,7 @@ bool CStaticFunctionDefinitions::GetPedAnalogControlState(CClientPed& Ped, const
17671765

17681766
// check it's analog or use binary.
17691767
if (CClientPad::GetAnalogControlIndex(szControl, uiIndex))
1770-
Ped.m_Pad.GetAnalogControlState(szControl, cs, bOnFoot, fState, bRawInput);
1768+
CClientPad::GetAnalogControlState(szControl, cs, bOnFoot, fState, bRawInput);
17711769
else
17721770
fState = CClientPad::GetControlState(szControl, cs, bOnFoot) == true ? 1.0f : 0.0f;
17731771

@@ -7198,7 +7196,7 @@ bool CStaticFunctionDefinitions::GetAnalogControlState(const char* szControl, fl
71987196
else
71997197
pLocalPlayer->GetControllerState(cs);
72007198

7201-
if (pLocalPlayer->m_Pad.GetAnalogControlState(szControl, cs, bOnFoot, fState, bRawInput))
7199+
if (CClientPad::GetAnalogControlState(szControl, cs, bOnFoot, fState, bRawInput))
72027200
{
72037201
return true;
72047202
}
@@ -7225,13 +7223,12 @@ bool CStaticFunctionDefinitions::SetControlState(const char* szControl, bool bSt
72257223
{
72267224
assert(szControl);
72277225
unsigned int uiIndex;
7228-
CClientPlayer* pLocalPlayer = m_pPlayerManager->GetLocalPlayer();
72297226

72307227
if (bState)
72317228
{
72327229
if (CClientPad::GetAnalogControlIndex(szControl, uiIndex))
72337230
{
7234-
if (pLocalPlayer->m_Pad.SetAnalogControlState(szControl, 1.0, false))
7231+
if (CClientPad::SetAnalogControlState(szControl, 1.0, false))
72357232
{
72367233
return true;
72377234
}
@@ -7251,7 +7248,7 @@ bool CStaticFunctionDefinitions::SetControlState(const char* szControl, bool bSt
72517248
{
72527249
if (CClientPad::GetAnalogControlIndex(szControl, uiIndex))
72537250
{
7254-
pLocalPlayer->m_Pad.RemoveSetAnalogControlState(szControl);
7251+
CClientPad::RemoveSetAnalogControlState(szControl);
72557252
return true;
72567253
}
72577254
else

Client/mods/deathmatch/logic/lua/CLuaFunctionDefs.Input.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,6 @@ int CLuaFunctionDefs::SetAnalogControlState(lua_State* luaVM)
308308
CScriptArgReader argStream(luaVM);
309309
argStream.ReadString(strControlState);
310310

311-
CClientPlayer* localPlayer = CStaticFunctionDefinitions::GetLocalPlayer();
312-
313311
if (!argStream.HasErrors())
314312
{
315313
if (argStream.NextIsNumber())
@@ -318,15 +316,15 @@ int CLuaFunctionDefs::SetAnalogControlState(lua_State* luaVM)
318316
if (argStream.NextIsBool())
319317
argStream.ReadBool(bForceOverrideNextFrame, false);
320318

321-
if (localPlayer->m_Pad.SetAnalogControlState(strControlState, fState, bForceOverrideNextFrame))
319+
if (CClientPad::SetAnalogControlState(strControlState, fState, bForceOverrideNextFrame))
322320
{
323321
lua_pushboolean(luaVM, true);
324322
return 1;
325323
}
326324
}
327325
else if (argStream.NextIsNone())
328326
{
329-
localPlayer->m_Pad.RemoveSetAnalogControlState(strControlState);
327+
CClientPad::RemoveSetAnalogControlState(strControlState);
330328
lua_pushboolean(luaVM, true);
331329
return 1;
332330
}

0 commit comments

Comments
 (0)