Demo viewer: Ignore shortcuts when popup is open

As reported by Shyzo on Discord
This commit is contained in:
def 2020-09-18 07:57:36 +02:00
parent 28d0f2c842
commit 427450ddc3

View file

@ -458,7 +458,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
// close button // close button
ButtonBar.VSplitRight(ButtonbarHeight*3, &ButtonBar, &Button); ButtonBar.VSplitRight(ButtonbarHeight*3, &ButtonBar, &Button);
static int s_ExitButton = 0; static int s_ExitButton = 0;
if(DoButton_DemoPlayer(&s_ExitButton, Localize("Close"), 0, &Button) || Input()->KeyPress(KEY_C)) if(DoButton_DemoPlayer(&s_ExitButton, Localize("Close"), 0, &Button) || (Input()->KeyPress(KEY_C) && m_pClient->m_pGameConsole->IsClosed() && m_DemoPlayerState == DEMOPLAYER_NONE))
{ {
Client()->Disconnect(); Client()->Disconnect();
DemolistOnUpdate(false); DemolistOnUpdate(false);
@ -1251,7 +1251,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
} }
static int s_PlayButton = 0; static int s_PlayButton = 0;
if(DoButton_Menu(&s_PlayButton, m_DemolistSelectedIsDir ? Localize("Open") : Localize("Play", "Demo browser"), 0, &PlayRect) || Activated || Input()->KeyPress(KEY_P)) if(DoButton_Menu(&s_PlayButton, m_DemolistSelectedIsDir ? Localize("Open") : Localize("Play", "Demo browser"), 0, &PlayRect) || Activated || (Input()->KeyPress(KEY_P) && m_pClient->m_pGameConsole->IsClosed() && m_DemoPlayerState == DEMOPLAYER_NONE))
{ {
if(m_DemolistSelectedIndex >= 0) if(m_DemolistSelectedIndex >= 0)
{ {
@ -1288,7 +1288,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
if(!m_DemolistSelectedIsDir) if(!m_DemolistSelectedIsDir)
{ {
static int s_DeleteButton = 0; static int s_DeleteButton = 0;
if(DoButton_Menu(&s_DeleteButton, Localize("Delete"), 0, &DeleteRect) || m_DeletePressed || Input()->KeyPress(KEY_D)) if(DoButton_Menu(&s_DeleteButton, Localize("Delete"), 0, &DeleteRect) || m_DeletePressed || (Input()->KeyPress(KEY_D) && m_pClient->m_pGameConsole->IsClosed()))
{ {
if(m_DemolistSelectedIndex >= 0) if(m_DemolistSelectedIndex >= 0)
{ {
@ -1312,7 +1312,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
#if defined(CONF_VIDEORECORDER) #if defined(CONF_VIDEORECORDER)
static int s_RenderButton = 0; static int s_RenderButton = 0;
if(DoButton_Menu(&s_RenderButton, Localize("Render"), 0, &RenderRect) || Input()->KeyPress(KEY_R)) if(DoButton_Menu(&s_RenderButton, Localize("Render"), 0, &RenderRect) || (Input()->KeyPress(KEY_R) && m_pClient->m_pGameConsole->IsClosed()))
{ {
if(m_DemolistSelectedIndex >= 0) if(m_DemolistSelectedIndex >= 0)
{ {