Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed envelope rendering when seeking in the demo player

  • Loading branch information...
commit b99ac459bea247f2a2474b345b1dd69e4bd59a69 1 parent e411d8f
@oy oy authored
View
30 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());
}
View
5 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 @@ class CMapLayers : public CComponent
CMapLayers(int Type);
virtual void OnInit();
virtual void OnRender();
+
+ void EnvelopeUpdate();
};
#endif
View
3  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();
}
}
}
View
2  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);
View
2  src/game/client/gameclient.h
@@ -242,6 +242,8 @@ class CGameClient : public IGameClient
class CVoting *m_pVoting;
class CScoreboard *m_pScoreboard;
class CItems *m_pItems;
+ class CMapLayers *m_pMapLayersBackGround;
+ class CMapLayers *m_pMapLayersForeGround;
};
Please sign in to comment.
Something went wrong with that request. Please try again.