Merge pull request #540 from Speedy-Consoles/master

Reliable 1-tick unfreeze
This commit is contained in:
Dennis Felsing 2016-08-28 10:10:06 +02:00 committed by GitHub
commit f3f6338ed1
2 changed files with 4 additions and 1 deletions

View file

@ -685,10 +685,11 @@ void CCharacter::SetEmote(int Emote, int Tick)
void CCharacter::OnPredictedInput(CNetObj_PlayerInput *pNewInput)
{
// check for changes
if(mem_comp(&m_Input, pNewInput, sizeof(CNetObj_PlayerInput)) != 0)
if(mem_comp(&m_SavedInput, pNewInput, sizeof(CNetObj_PlayerInput)) != 0)
m_LastAction = Server()->Tick();
// copy new input
mem_copy(&m_SavedInput, pNewInput, sizeof(m_SavedInput));
mem_copy(&m_Input, pNewInput, sizeof(m_Input));
m_NumInputs++;
@ -1994,6 +1995,7 @@ void CCharacter::SendZoneMsgs()
void CCharacter::DDRaceTick()
{
mem_copy(&m_Input, &m_SavedInput, sizeof(m_Input));
m_Armor=(m_FreezeTime >= 0)?10-(m_FreezeTime/15):0;
if(m_Input.m_Direction != 0 || m_Input.m_Jump != 0)
m_LastMove = Server()->Tick();

View file

@ -130,6 +130,7 @@ private:
// input
CNetObj_PlayerInput m_PrevInput;
CNetObj_PlayerInput m_Input;
CNetObj_PlayerInput m_SavedInput;
int m_NumInputs;
int m_Jumped;