Fix automatic demo rewind not working when menu is not active

This commit is contained in:
Robert Müller 2022-08-28 12:26:20 +02:00
parent 3dc577f24e
commit 1da597ff1a

View file

@ -291,6 +291,15 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
TextRender()->Text(0, 120.0f, Screen.y + Screen.h - 120.0f - TotalHeight, 60.0f, aSpeedBuf, -1.0f);
}
const int CurrentTick = pInfo->m_CurrentTick - pInfo->m_FirstTick;
const int TotalTicks = pInfo->m_LastTick - pInfo->m_FirstTick;
if(CurrentTick == TotalTicks)
{
DemoPlayer()->Pause();
PositionToSeek = 0.0f;
}
if(!m_MenuActive)
{
HandleDemoSeeking(PositionToSeek, TimeToSeek);
@ -307,9 +316,6 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
CUIRect SeekBar, ButtonBar, NameBar;
int CurrentTick = pInfo->m_CurrentTick - pInfo->m_FirstTick;
int TotalTicks = pInfo->m_LastTick - pInfo->m_FirstTick;
MainView.HSplitTop(SeekBarHeight, &SeekBar, &ButtonBar);
ButtonBar.HSplitTop(Margins, 0, &ButtonBar);
ButtonBar.HSplitBottom(NameBarHeight, &ButtonBar, &NameBar);
@ -415,12 +421,6 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
UI()->SetHotItem(pId);
}
if(CurrentTick == TotalTicks)
{
DemoPlayer()->Pause();
PositionToSeek = 0.0f;
}
bool IncreaseDemoSpeed = false, DecreaseDemoSpeed = false;
// do buttons