3455: Readd round start tick to the calculation r=def- a=Jupeyy

fixes #3454

@bretonium would you be so kind and test this quickly, if everything looks fine again? :D

## Checklist

- [ ] 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: Jupeyy <jupjopjap@gmail.com>
This commit is contained in:
bors[bot] 2020-12-29 11:37:53 +00:00 committed by GitHub
commit 262439b5bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,10 +102,11 @@ void CMapLayers::EnvelopeEval(int TimeOffsetMillis, int Env, float *pChannels, v
if(pItem->m_Version < 2 || pItem->m_Synchronized) if(pItem->m_Version < 2 || pItem->m_Synchronized)
{ {
// get the lerp of the current tick and prev // get the lerp of the current tick and prev
int MinTick = pThis->Client()->PrevGameTick(g_Config.m_ClDummy); int MinTick = pThis->Client()->PrevGameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick;
int CurTick = pThis->Client()->GameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick;
s_Time = (int64)(mix<double>( s_Time = (int64)(mix<double>(
0, 0,
(pThis->Client()->GameTick(g_Config.m_ClDummy) - MinTick), (CurTick - MinTick),
pThis->Client()->IntraGameTick(g_Config.m_ClDummy)) * pThis->Client()->IntraGameTick(g_Config.m_ClDummy)) *
TickToMicroSeconds) + TickToMicroSeconds) +
MinTick * TickToMicroSeconds; MinTick * TickToMicroSeconds;
@ -129,10 +130,11 @@ void CMapLayers::EnvelopeEval(int TimeOffsetMillis, int Env, float *pChannels, v
if(pThis->m_pClient->m_Snap.m_pGameInfoObj) // && !(pThis->m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_PAUSED)) if(pThis->m_pClient->m_Snap.m_pGameInfoObj) // && !(pThis->m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_PAUSED))
{ {
// get the lerp of the current tick and prev // get the lerp of the current tick and prev
int MinTick = pThis->Client()->PrevGameTick(g_Config.m_ClDummy); int MinTick = pThis->Client()->PrevGameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick;
int CurTick = pThis->Client()->GameTick(g_Config.m_ClDummy) - pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick;
s_Time = (int64)(mix<double>( s_Time = (int64)(mix<double>(
0, 0,
(pThis->Client()->GameTick(g_Config.m_ClDummy) - MinTick), (CurTick - MinTick),
pThis->Client()->IntraGameTick(g_Config.m_ClDummy)) * pThis->Client()->IntraGameTick(g_Config.m_ClDummy)) *
TickToMicroSeconds) + TickToMicroSeconds) +
MinTick * TickToMicroSeconds; MinTick * TickToMicroSeconds;