From: terencehill Date: Sun, 16 Sep 2018 17:01:06 +0000 (+0200) Subject: Forcedly close the quickmenu if a minigame or the map vote is active X-Git-Tag: xonotic-v0.8.5~1843^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b5183381a035603863e3b2c04df3d1c67499bea8;p=xonotic%2Fxonotic-data.pk3dir.git Forcedly close the quickmenu if a minigame or the map vote is active --- diff --git a/qcsrc/client/hud/hud.qh b/qcsrc/client/hud/hud.qh index 8b1c4fd6c..d2349a6a5 100644 --- a/qcsrc/client/hud/hud.qh +++ b/qcsrc/client/hud/hud.qh @@ -228,7 +228,7 @@ REGISTER_HUD_PANEL(MINIGAMEHELP, HUD_MinigameHelp, PANEL_CONFIG_NO REGISTER_HUD_PANEL(MINIGAMEMENU, HUD_MinigameMenu, PANEL_CONFIG_NO , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // MINIGAMEMENU REGISTER_HUD_PANEL(MAPVOTE, MapVote_Draw, PANEL_CONFIG_NO , PANEL_SHOW_MAPVOTE ) // MAPVOTE REGISTER_HUD_PANEL(ITEMSTIME, HUD_ItemsTime, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME ) // ITEMSTIME -REGISTER_HUD_PANEL(QUICKMENU, HUD_QuickMenu, PANEL_CONFIG_MAIN , PANEL_SHOW_MAINGAME ) // QUICKMENU +REGISTER_HUD_PANEL(QUICKMENU, HUD_QuickMenu, PANEL_CONFIG_MAIN , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME ) // QUICKMENU REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, PANEL_CONFIG_NO , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // SCOREBOARD // always add new panels to the end of list diff --git a/qcsrc/client/hud/panel/quickmenu.qc b/qcsrc/client/hud/panel/quickmenu.qc index 40342a63c..a3141c225 100644 --- a/qcsrc/client/hud/panel/quickmenu.qc +++ b/qcsrc/client/hud/panel/quickmenu.qc @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -57,8 +58,21 @@ void QuickMenu_Page_ClearEntry(int i) QuickMenu_Page_Command_Type[i] = 0; } +bool HUD_QuickMenu_Forbidden() +{ + return (mv_active + || (hud_configure_prev && hud_configure_prev != -1) + || HUD_MinigameMenu_IsOpened() + || (QuickMenu_TimeOut && time > QuickMenu_TimeOut)); +} + +// returns true if succeded, false otherwise bool QuickMenu_Open(string mode, string submenu, string file) { + QuickMenu_TimeOut = 0; + if (HUD_QuickMenu_Forbidden()) + return false; + int fh = -1; string s; @@ -556,15 +570,10 @@ void HUD_QuickMenu() { if(!autocvar__hud_configure) { - if (hud_configure_prev && hud_configure_prev != -1) - QuickMenu_Close(); - - if(!hud_draw_maximized) return; - if(mv_active) return; - if (!QuickMenu_IsOpened()) return; + if (!hud_draw_maximized || !QuickMenu_IsOpened()) + return; - if(QuickMenu_TimeOut) - if(time > QuickMenu_TimeOut) + if (HUD_QuickMenu_Forbidden()) { QuickMenu_Close(); return;