Also skip to beginning and end when there are no demo markers

Previously the buttons to skip to the next/previous demo marker were skipping to the end/beginning respectively, if there is no next/previous marker, but only if there were any map markers. Now the button immediately skip to the beginning/end also when there are no demo markers at all.
This commit is contained in:
Robert Müller 2023-05-15 23:37:46 +02:00
parent 58156c12b9
commit 5501a33148

View file

@ -525,6 +525,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
static CButtonContainer s_OneMarkerBackButton;
if(DoButton_FontIcon(&s_OneMarkerBackButton, FONT_ICON_BACKWARD_STEP, 0, &Button, IGraphics::CORNER_ALL))
{
PositionToSeek = 0.0f;
for(int i = pInfo->m_NumTimelineMarkers - 1; i >= 0; i--)
{
if((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) < CurrentTick && absolute(((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) - CurrentTick)) > Threshold)
@ -532,7 +534,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
PositionToSeek = (float)(pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) / TotalTicks;
break;
}
PositionToSeek = 0.0f;
}
}
GameClient()->m_Tooltips.DoToolTip(&s_OneMarkerBackButton, &Button, Localize("Go back one marker"));
@ -541,6 +543,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
static CButtonContainer s_OneMarkerForwardButton;
if(DoButton_FontIcon(&s_OneMarkerForwardButton, FONT_ICON_FORWARD_STEP, 0, &Button, IGraphics::CORNER_ALL))
{
PositionToSeek = 1.0f;
for(int i = 0; i < pInfo->m_NumTimelineMarkers; i++)
{
if((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) > CurrentTick && absolute(((pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) - CurrentTick)) > Threshold)
@ -548,7 +552,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
PositionToSeek = (float)(pInfo->m_aTimelineMarkers[i] - pInfo->m_FirstTick) / TotalTicks;
break;
}
PositionToSeek = 1.0f;
}
}
GameClient()->m_Tooltips.DoToolTip(&s_OneMarkerForwardButton, &Button, Localize("Go forward one marker"));