Skip to content

Commit 8117ebc

Browse files
authored
Fix setPedControlState reset from ped constructor (PR #3916, Fixes #1201)
1 parent 3f957b8 commit 8117ebc

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Client/mods/deathmatch/logic/CClientPad.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,6 @@ CClientPad::CClientPad()
116116
{
117117
m_fStates[i] = 0.0f;
118118
}
119-
120-
// Initialise our analog control states
121-
for (unsigned int i = 0; i < MAX_GTA_ANALOG_CONTROLS; i++)
122-
{
123-
m_sScriptedStates[i] = CS_NAN;
124-
m_bScriptedStatesNextFrameOverride[i] = false;
125-
}
126119
}
127120

128121
bool CClientPad::GetControlState(const char* szName, bool& bState)
@@ -468,6 +461,16 @@ bool CClientPad::GetAnalogControlIndex(const char* szName, unsigned int& uiIndex
468461
return false;
469462
}
470463

464+
void CClientPad::InitAnalogControlStates()
465+
{
466+
// Initialise our analog control states
467+
for (unsigned int i = 0; i < MAX_GTA_ANALOG_CONTROLS; i++)
468+
{
469+
m_sScriptedStates[i] = CS_NAN;
470+
m_bScriptedStatesNextFrameOverride[i] = false;
471+
}
472+
}
473+
471474
// Get the analog control state directly from a pad state. Use for players.
472475
bool CClientPad::GetAnalogControlState(const char* szName, CControllerState& cs, bool bOnFoot, float& fState, bool bIgnoreOverrides)
473476
{

Client/mods/deathmatch/logic/CClientPad.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class CClientPad
2323
static const char* GetControlName(unsigned int uiIndex);
2424

2525
static bool GetAnalogControlIndex(const char* szName, unsigned int& uiIndex);
26+
static void InitAnalogControlStates();
2627

2728
CClientPad();
2829

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ void CClientPed::Init(CClientManager* pManager, unsigned long ulModelID, bool bI
251251
// Init the local player
252252
_CreateLocalModel();
253253

254+
// Init default analog control states
255+
CClientPad::InitAnalogControlStates();
256+
254257
// Give full health, no armor, no weapons and put him at a safe location
255258
SetHealth(GetMaxHealth());
256259
SetArmor(0);

0 commit comments

Comments
 (0)