Fix invalid demo cutting, Add slice highlighting

Remove option (again)
This commit is contained in:
VoxelDoesCode 2022-11-19 15:02:56 -05:00
parent 56088cb4b0
commit 0761f4a8ae

View file

@ -353,6 +353,20 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
FilledBar.w = 10.0f + (FilledBar.w - 10.0f) * Amount;
FilledBar.Draw(ColorRGBA(1, 1, 1, 0.5f), IGraphics::CORNER_ALL, 5.0f);
// draw highlighting
if(g_Config.m_ClDemoSliceBegin != -1 && g_Config.m_ClDemoSliceEnd != -1)
{
float RatioBegin = (g_Config.m_ClDemoSliceBegin - pInfo->m_FirstTick) / (float)TotalTicks;
float RatioEnd = (g_Config.m_ClDemoSliceEnd - pInfo->m_FirstTick) / (float)TotalTicks;
float Span = ((SeekBar.w - 10.0f) * RatioEnd) - ((SeekBar.w - 10.0f) * RatioBegin);
Graphics()->TextureClear();
Graphics()->QuadsBegin();
Graphics()->SetColor(1.0f, 0.0f, 0.0f, 0.25f);
IGraphics::CQuadItem QuadItem(10.0f + SeekBar.x + (SeekBar.w - 10.0f) * RatioBegin, SeekBar.y, Span, SeekBar.h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
}
// draw markers
for(int i = 0; i < pInfo->m_NumTimelineMarkers; i++)
{
@ -498,7 +512,10 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
static CButtonContainer s_SliceBeginButton;
if(DoButton_FontIcon(&s_SliceBeginButton, "\xEF\x8B\xB5", 0, &Button, IGraphics::CORNER_ALL))
{
if(CurrentTick < (g_Config.m_ClDemoSliceEnd - pInfo->m_FirstTick) || g_Config.m_ClDemoSliceEnd == -1)
Client()->DemoSliceBegin();
}
GameClient()->m_Tooltips.DoToolTip(&s_SliceBeginButton, &Button, Localize("Mark the beginning of a cut"));
// slice end button
@ -506,7 +523,10 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar);
static CButtonContainer s_SliceEndButton;
if(DoButton_FontIcon(&s_SliceEndButton, "\xEF\x8B\xB6", 0, &Button, IGraphics::CORNER_ALL))
{
if(CurrentTick > (g_Config.m_ClDemoSliceBegin - pInfo->m_FirstTick) || g_Config.m_ClDemoSliceBegin == -1)
Client()->DemoSliceEnd();
}
GameClient()->m_Tooltips.DoToolTip(&s_SliceEndButton, &Button, Localize("Mark the end of a cut"));
// slice save button