diff options
| author | Choupom <andycootlapin@hotmail.fr> | 2011-04-17 22:07:59 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-05-03 18:12:32 +0200 |
| commit | 7b87cfa68a79117e5e3f8ad82a0c830693d18337 (patch) | |
| tree | 98f478d26068b430d31c8b0da3f8b54a76eed244 /src/game/client/components/maplayers.cpp | |
| parent | e85c4cb5dbe19cebbcde41b2387be7816e760c7a (diff) | |
| download | zcatch-7b87cfa68a79117e5e3f8ad82a0c830693d18337.tar.gz zcatch-7b87cfa68a79117e5e3f8ad82a0c830693d18337.zip | |
made envelopes synchronized with other clients
Diffstat (limited to 'src/game/client/components/maplayers.cpp')
| -rw-r--r-- | src/game/client/components/maplayers.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp index 848651ca..b9a2af16 100644 --- a/src/game/client/components/maplayers.cpp +++ b/src/game/client/components/maplayers.cpp @@ -63,21 +63,25 @@ void CMapLayers::EnvelopeEval(float TimeOffset, int Env, float *pChannels, void CMapItemEnvelope *pItem = (CMapItemEnvelope *)pThis->m_pLayers->Map()->GetItem(Start+Env, 0, 0); + static float Time = 0; if(pThis->Client()->State() == IClient::STATE_DEMOPLAYBACK) { const IDemoPlayer::CInfo *pInfo = pThis->DemoPlayer()->BaseInfo(); - static float Time = 0; - static float LastLocalTime = pThis->Client()->LocalTime(); + static int LastLocalTick = pInfo->m_CurrentTick; if(!pInfo->m_Paused) - Time += (pThis->Client()->LocalTime()-LastLocalTime)*pInfo->m_Speed; + Time += (pInfo->m_CurrentTick-LastLocalTick) / (float)pThis->Client()->GameTickSpeed() * pInfo->m_Speed; pThis->RenderTools()->RenderEvalEnvelope(pPoints+pItem->m_StartPoint, pItem->m_NumPoints, 4, Time+TimeOffset, pChannels); - LastLocalTime = pThis->Client()->LocalTime(); + LastLocalTick = pInfo->m_CurrentTick; } else - pThis->RenderTools()->RenderEvalEnvelope(pPoints+pItem->m_StartPoint, pItem->m_NumPoints, 4, pThis->Client()->LocalTime()+TimeOffset, pChannels); + { + if(pThis->m_pClient->m_Snap.m_pGameInfoObj) + Time = (pThis->Client()->GameTick()-pThis->m_pClient->m_Snap.m_pGameInfoObj->m_RoundStartTick) / (float)pThis->Client()->GameTickSpeed(); + pThis->RenderTools()->RenderEvalEnvelope(pPoints+pItem->m_StartPoint, pItem->m_NumPoints, 4, Time+TimeOffset, pChannels); + } } void CMapLayers::OnRender() |