Make the evolve limit more visible

This is to make sure that modders don't start to rely on the fact that
we clamp the evolve duration to 3 seconds.
This commit is contained in:
heinrich5991 2022-02-07 12:16:39 +01:00
parent 4d2505284b
commit a203478809

View file

@ -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;