Skip to content

Commit

Permalink
Simple solution
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX committed Jan 1, 2025
1 parent e831f62 commit 8e30580
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Client/mods/deathmatch/logic/CClientPad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CClientPad.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
3 changes: 3 additions & 0 deletions Client/mods/deathmatch/logic/CClientPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8e30580

Please sign in to comment.