mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #4672
4672: Make the evolve limit more visible r=def- a=heinrich5991 This is to make sure that modders don't start to rely on the fact that we clamp the evolve duration to 3 seconds. CC #4624 ## Checklist - [x] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
commit
3de74a9cbc
|
@ -1259,11 +1259,11 @@ void CGameClient::OnNewSnapshot()
|
|||
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));
|
||||
bool EvolvePrev = Client()->PrevGameTick(g_Config.m_ClDummy) - m_Snap.m_aCharacters[Item.m_ID].m_Prev.m_Tick <= 3 * Client()->GameTickSpeed();
|
||||
bool EvolveCur = Client()->GameTick(g_Config.m_ClDummy) - m_Snap.m_aCharacters[Item.m_ID].m_Cur.m_Tick <= 3 * Client()->GameTickSpeed();
|
||||
|
||||
// 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 == EvolvePrevTick)
|
||||
if(EvolveCur && m_aClients[Item.m_ID].m_Evolved.m_Tick == Client()->PrevGameTick(g_Config.m_ClDummy))
|
||||
{
|
||||
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;
|
||||
|
@ -1271,10 +1271,10 @@ void CGameClient::OnNewSnapshot()
|
|||
m_Snap.m_aCharacters[Item.m_ID].m_Cur = m_aClients[Item.m_ID].m_Evolved;
|
||||
}
|
||||
|
||||
if(m_Snap.m_aCharacters[Item.m_ID].m_Prev.m_Tick)
|
||||
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, EvolveCurTick);
|
||||
if(EvolveCur && 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));
|
||||
if(EvolvePrev && 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));
|
||||
|
||||
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