From 061f8625f4ba081551915457a7cbd62edb66b60e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 4 Dec 2022 12:34:17 +0100 Subject: [PATCH] Use `HandleDemoSeeking` for demo skipping To ensure that components are reset when skipping and that envelopes are updated immediately. --- src/game/client/components/menus_demo.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index 28a95b2ac..99cd06283 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -484,7 +484,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) if(DoButton_FontIcon(&s_ResetButton, "\xEF\x81\x8D", false, &Button, IGraphics::CORNER_ALL)) { DemoPlayer()->Pause(); - DemoPlayer()->SeekPercent(0.0f); + PositionToSeek = 0.0f; } GameClient()->m_Tooltips.DoToolTip(&s_ResetButton, &Button, Localize("Stop the current demo")); @@ -575,10 +575,10 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) { if((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) < CurrentTick && absolute(((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) - CurrentTick)) > Threshold) { - DemoPlayer()->SeekPercent((float)(pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) / TotalTicks); + PositionToSeek = (float)(pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) / TotalTicks; break; } - DemoPlayer()->SeekPercent(0.0f); + PositionToSeek = 0.0f; } GameClient()->m_Tooltips.DoToolTip(&s_OneMarkerBackButton, &Button, Localize("Go back one marker")); @@ -591,10 +591,10 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) { if((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) > CurrentTick && absolute(((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) - CurrentTick)) > Threshold) { - DemoPlayer()->SeekPercent((float)(pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) / TotalTicks); + PositionToSeek = (float)(pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) / TotalTicks; break; } - DemoPlayer()->SeekPercent(1.0f); + PositionToSeek = 1.0f; } GameClient()->m_Tooltips.DoToolTip(&s_OneMarkerForwardButton, &Button, Localize("Go forward one marker"));