about summary refs log tree commit diff
path: root/src/game/server/entities
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-06-09 22:30:03 +0200
committeroy <Tom_Adams@web.de>2011-06-09 22:30:03 +0200
commit2cc10fd6f02696f9657ffcde27be076942bf443b (patch)
tree544ed86d37a400a1b2236da11b576020908bdffb /src/game/server/entities
parentb48c59225acfe59152d8293172557b2083d2207b (diff)
downloadzcatch-2cc10fd6f02696f9657ffcde27be076942bf443b.tar.gz
zcatch-2cc10fd6f02696f9657ffcde27be076942bf443b.zip
fixed that the player keeps action when activating chat. Closes #719
Diffstat (limited to 'src/game/server/entities')
-rw-r--r--src/game/server/entities/character.cpp12
-rw-r--r--src/game/server/entities/character.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp
index 8ab41df3..e5cca2b8 100644
--- a/src/game/server/entities/character.cpp
+++ b/src/game/server/entities/character.cpp
@@ -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)
diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h
index 611dc427..02a779bb 100644
--- a/src/game/server/entities/character.h
+++ b/src/game/server/entities/character.h
@@ -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);