diff options
| author | oy <Tom_Adams@web.de> | 2011-12-04 14:04:12 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-12-04 14:04:12 +0100 |
| commit | b99ac459bea247f2a2474b345b1dd69e4bd59a69 (patch) | |
| tree | 679baad0e407cc257a6601c02f5399d33603b322 /src/game | |
| parent | e411d8f5917ac3b47f6b5f10432d045dda62e814 (diff) | |
| download | zcatch-b99ac459bea247f2a2474b345b1dd69e4bd59a69.tar.gz zcatch-b99ac459bea247f2a2474b345b1dd69e4bd59a69.zip | |
fixed envelope rendering when seeking in the demo player
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/components/maplayers.cpp | 30 | ||||
| -rw-r--r-- | src/game/client/components/maplayers.h | 5 | ||||
| -rw-r--r-- | src/game/client/components/menus_demo.cpp | 3 | ||||
| -rw-r--r-- | src/game/client/gameclient.cpp | 2 | ||||
| -rw-r--r-- | src/game/client/gameclient.h | 2 |
5 files changed, 33 insertions, 9 deletions
diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp index 3d9c42e7..48f11f26 100644 --- a/src/game/client/components/maplayers.cpp +++ b/src/game/client/components/maplayers.cpp @@ -22,6 +22,9 @@ CMapLayers::CMapLayers(int t) { m_Type = t; m_pLayers = 0; + m_CurrentLocalTick = 0; + m_LastLocalTick = 0; + m_EnvelopeUpdate = false; } void CMapLayers::OnInit() @@ -29,6 +32,17 @@ void CMapLayers::OnInit() m_pLayers = Layers(); } +void CMapLayers::EnvelopeUpdate() +{ + if(Client()->State() == IClient::STATE_DEMOPLAYBACK) + { + const IDemoPlayer::CInfo *pInfo = DemoPlayer()->BaseInfo(); + m_CurrentLocalTick = pInfo->m_CurrentTick; + m_LastLocalTick = pInfo->m_CurrentTick; + m_EnvelopeUpdate = true; + } +} + void CMapLayers::MapScreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup) { @@ -67,19 +81,17 @@ void CMapLayers::EnvelopeEval(float TimeOffset, int Env, float *pChannels, void if(pThis->Client()->State() == IClient::STATE_DEMOPLAYBACK) { const IDemoPlayer::CInfo *pInfo = pThis->DemoPlayer()->BaseInfo(); - static int CurrentLocalTick = pInfo->m_CurrentTick; - static int LastLocalTick = pInfo->m_CurrentTick; - - if(!pInfo->m_Paused) + + if(!pInfo->m_Paused || pThis->m_EnvelopeUpdate) { - if(CurrentLocalTick != pInfo->m_CurrentTick) + if(pThis->m_CurrentLocalTick != pInfo->m_CurrentTick) { - LastLocalTick = CurrentLocalTick; - CurrentLocalTick = pInfo->m_CurrentTick; + pThis->m_LastLocalTick = pThis->m_CurrentLocalTick; + pThis->m_CurrentLocalTick = pInfo->m_CurrentTick; } - Time = mix(LastLocalTick / (float)pThis->Client()->GameTickSpeed(), - CurrentLocalTick / (float)pThis->Client()->GameTickSpeed(), + Time = mix(pThis->m_LastLocalTick / (float)pThis->Client()->GameTickSpeed(), + pThis->m_CurrentLocalTick / (float)pThis->Client()->GameTickSpeed(), pThis->Client()->IntraGameTick()); } diff --git a/src/game/client/components/maplayers.h b/src/game/client/components/maplayers.h index 694633ee..d0efcfc7 100644 --- a/src/game/client/components/maplayers.h +++ b/src/game/client/components/maplayers.h @@ -8,6 +8,9 @@ class CMapLayers : public CComponent { CLayers *m_pLayers; // todo refactor: maybe remove it and access it through client* int m_Type; + int m_CurrentLocalTick; + int m_LastLocalTick; + bool m_EnvelopeUpdate; void MapScreenToGroup(float CenterX, float CenterY, CMapItemGroup *pGroup); static void EnvelopeEval(float TimeOffset, int Env, float *pChannels, void *pUser); @@ -21,6 +24,8 @@ public: CMapLayers(int Type); virtual void OnInit(); virtual void OnRender(); + + void EnvelopeUpdate(); }; #endif diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index f3a75f0c..ec3e648c 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -17,6 +17,7 @@ #include <game/generated/client_data.h> +#include "maplayers.h" #include "menus.h" int CMenus::DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect) @@ -117,6 +118,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) m_pClient->m_SuppressEvents = true; DemoPlayer()->SetPos(Amount); m_pClient->m_SuppressEvents = false; + m_pClient->m_pMapLayersBackGround->EnvelopeUpdate(); + m_pClient->m_pMapLayersForeGround->EnvelopeUpdate(); } } } diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index d110bfe7..2fd1c2f3 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -126,6 +126,8 @@ void CGameClient::OnConsoleInit() m_pVoting = &::gs_Voting; m_pScoreboard = &::gs_Scoreboard; m_pItems = &::gs_Items; + m_pMapLayersBackGround = &::gs_MapLayersBackGround; + m_pMapLayersForeGround = &::gs_MapLayersForeGround; // make a list of all the systems, make sure to add them in the corrent render order m_All.Add(m_pSkins); diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 0dff77d4..e8c7e7bd 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -242,6 +242,8 @@ public: class CVoting *m_pVoting; class CScoreboard *m_pScoreboard; class CItems *m_pItems; + class CMapLayers *m_pMapLayersBackGround; + class CMapLayers *m_pMapLayersForeGround; }; |