mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 09:34:19 +00:00
fixed that the player keeps action when activating chat. Closes #719
This commit is contained in:
parent
b48c59225a
commit
2cc10fd6f0
|
@ -527,6 +527,18 @@ void CCharacter::OnDirectInput(CNetObj_PlayerInput *pNewInput)
|
|||
mem_copy(&m_LatestPrevInput, &m_LatestInput, sizeof(m_LatestInput));
|
||||
}
|
||||
|
||||
void CCharacter::ResetInput()
|
||||
{
|
||||
m_Input.m_Direction = 0;
|
||||
m_Input.m_Hook = 0;
|
||||
// simulate releasing the fire button
|
||||
if((m_Input.m_Fire&1) != 0)
|
||||
m_Input.m_Fire++;
|
||||
m_Input.m_Fire &= INPUT_STATE_MASK;
|
||||
m_Input.m_Jump = 0;
|
||||
m_LatestPrevInput = m_LatestInput = m_Input;
|
||||
}
|
||||
|
||||
void CCharacter::Tick()
|
||||
{
|
||||
if(m_pPlayer->m_ForceBalanced)
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
|
||||
void OnPredictedInput(CNetObj_PlayerInput *pNewInput);
|
||||
void OnDirectInput(CNetObj_PlayerInput *pNewInput);
|
||||
void ResetInput();
|
||||
void FireWeapon();
|
||||
|
||||
void Die(int Killer, int Weapon);
|
||||
|
|
|
@ -170,9 +170,19 @@ void CPlayer::OnPredictedInput(CNetObj_PlayerInput *NewInput)
|
|||
|
||||
void CPlayer::OnDirectInput(CNetObj_PlayerInput *NewInput)
|
||||
{
|
||||
// skip the input if chat is active
|
||||
if((m_PlayerFlags&PLAYERFLAG_CHATTING) && (NewInput->m_PlayerFlags&PLAYERFLAG_CHATTING))
|
||||
return;
|
||||
if(NewInput->m_PlayerFlags&PLAYERFLAG_CHATTING)
|
||||
{
|
||||
// skip the input if chat is active
|
||||
if(m_PlayerFlags&PLAYERFLAG_CHATTING)
|
||||
return;
|
||||
|
||||
// reset input
|
||||
if(m_pCharacter)
|
||||
m_pCharacter->ResetInput();
|
||||
|
||||
m_PlayerFlags = NewInput->m_PlayerFlags;
|
||||
return;
|
||||
}
|
||||
|
||||
m_PlayerFlags = NewInput->m_PlayerFlags;
|
||||
|
||||
|
|
Loading…
Reference in a new issue