mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix demo seeking not working anymore when menu is not active
This commit is contained in:
parent
4dcdba3563
commit
3dc577f24e
|
@ -497,6 +497,7 @@ protected:
|
|||
static bool DemoFilterChat(const void *pData, int Size, void *pUser);
|
||||
bool FetchHeader(CDemoItem &Item);
|
||||
void FetchAllHeaders();
|
||||
void HandleDemoSeeking(float PositionToSeek, float TimeToSeek);
|
||||
void RenderDemoPlayer(CUIRect MainView);
|
||||
void RenderDemoList(CUIRect MainView);
|
||||
|
||||
|
|
|
@ -79,6 +79,21 @@ bool CMenus::DemoFilterChat(const void *pData, int Size, void *pUser)
|
|||
return !Unpacker.Error() && !Sys && Msg == NETMSGTYPE_SV_CHAT;
|
||||
}
|
||||
|
||||
void CMenus::HandleDemoSeeking(float PositionToSeek, float TimeToSeek)
|
||||
{
|
||||
if((PositionToSeek >= 0.0f && PositionToSeek <= 1.0f) || TimeToSeek != 0.0f)
|
||||
{
|
||||
m_pClient->m_SuppressEvents = true;
|
||||
if(TimeToSeek != 0.0f)
|
||||
DemoPlayer()->SeekTime(TimeToSeek);
|
||||
else
|
||||
DemoPlayer()->SeekPercent(PositionToSeek);
|
||||
m_pClient->m_SuppressEvents = false;
|
||||
m_pClient->m_MapLayersBackGround.EnvelopeUpdate();
|
||||
m_pClient->m_MapLayersForeGround.EnvelopeUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void CMenus::RenderDemoPlayer(CUIRect MainView)
|
||||
{
|
||||
const IDemoPlayer::CInfo *pInfo = DemoPlayer()->BaseInfo();
|
||||
|
@ -277,7 +292,10 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
}
|
||||
|
||||
if(!m_MenuActive)
|
||||
{
|
||||
HandleDemoSeeking(PositionToSeek, TimeToSeek);
|
||||
return;
|
||||
}
|
||||
|
||||
MainView.HSplitBottom(TotalHeight, 0, &MainView);
|
||||
MainView.VSplitLeft(50.0f, 0, &MainView);
|
||||
|
@ -526,17 +544,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
s_LastSpeedChange = time_get();
|
||||
}
|
||||
|
||||
if((PositionToSeek >= 0.0f && PositionToSeek <= 1.0f) || TimeToSeek != 0.0f)
|
||||
{
|
||||
m_pClient->m_SuppressEvents = true;
|
||||
if(TimeToSeek != 0.0f)
|
||||
DemoPlayer()->SeekTime(TimeToSeek);
|
||||
else
|
||||
DemoPlayer()->SeekPercent(PositionToSeek);
|
||||
m_pClient->m_SuppressEvents = false;
|
||||
m_pClient->m_MapLayersBackGround.EnvelopeUpdate();
|
||||
m_pClient->m_MapLayersForeGround.EnvelopeUpdate();
|
||||
}
|
||||
HandleDemoSeeking(PositionToSeek, TimeToSeek);
|
||||
}
|
||||
|
||||
static CUIRect gs_ListBoxOriginalView;
|
||||
|
|
Loading…
Reference in a new issue