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

View file

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