mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Limit evolving to 3 seconds
Took from upstream
5d44714e92 (diff-597779b4eb51af9adfedd04b8a235afff01091a4ba741daa604cb5cbeda4e3daR1306-R1321)
This commit is contained in:
parent
aaea2636c0
commit
41fd1639d9
|
@ -1247,8 +1247,12 @@ void CGameClient::OnNewSnapshot()
|
|||
m_Snap.m_aCharacters[Item.m_ID].m_Active = true;
|
||||
m_Snap.m_aCharacters[Item.m_ID].m_Prev = *((const CNetObj_Character *)pOld);
|
||||
|
||||
// limit evolving to 3 seconds
|
||||
int EvolvePrevTick = minimum(m_Snap.m_aCharacters[Item.m_ID].m_Prev.m_Tick + Client()->GameTickSpeed() * 3, Client()->PrevGameTick(g_Config.m_ClDummy));
|
||||
int EvolveCurTick = minimum(m_Snap.m_aCharacters[Item.m_ID].m_Cur.m_Tick + Client()->GameTickSpeed() * 3, Client()->GameTick(g_Config.m_ClDummy));
|
||||
|
||||
// reuse the result from the previous evolve if the snapped character didn't change since the previous snapshot
|
||||
if(m_aClients[Item.m_ID].m_Evolved.m_Tick == Client()->PrevGameTick(g_Config.m_ClDummy))
|
||||
if(m_aClients[Item.m_ID].m_Evolved.m_Tick == EvolvePrevTick)
|
||||
{
|
||||
if(mem_comp(&m_Snap.m_aCharacters[Item.m_ID].m_Prev, &m_aClients[Item.m_ID].m_Snapped, sizeof(CNetObj_Character)) == 0)
|
||||
m_Snap.m_aCharacters[Item.m_ID].m_Prev = m_aClients[Item.m_ID].m_Evolved;
|
||||
|
@ -1257,9 +1261,9 @@ void CGameClient::OnNewSnapshot()
|
|||
}
|
||||
|
||||
if(m_Snap.m_aCharacters[Item.m_ID].m_Prev.m_Tick)
|
||||
Evolve(&m_Snap.m_aCharacters[Item.m_ID].m_Prev, Client()->PrevGameTick(g_Config.m_ClDummy));
|
||||
Evolve(&m_Snap.m_aCharacters[Item.m_ID].m_Prev, EvolvePrevTick);
|
||||
if(m_Snap.m_aCharacters[Item.m_ID].m_Cur.m_Tick)
|
||||
Evolve(&m_Snap.m_aCharacters[Item.m_ID].m_Cur, Client()->GameTick(g_Config.m_ClDummy));
|
||||
Evolve(&m_Snap.m_aCharacters[Item.m_ID].m_Cur, EvolveCurTick);
|
||||
|
||||
m_aClients[Item.m_ID].m_Snapped = *((const CNetObj_Character *)pData);
|
||||
m_aClients[Item.m_ID].m_Evolved = m_Snap.m_aCharacters[Item.m_ID].m_Cur;
|
||||
|
|
Loading…
Reference in a new issue