fixed that the player keeps action when activating chat. Closes #719

This commit is contained in:
oy 2011-06-09 22:30:03 +02:00
parent b48c59225a
commit 2cc10fd6f0
3 changed files with 26 additions and 3 deletions

View file

@ -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)

View file

@ -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);

View file

@ -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;