Skip to content

Fix setPedControlState is aborted when ped created #3916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading