From b91e9961541ef0b318517dd8e9dbd3b8fbd69d53 Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 9 Sep 2021 23:40:07 +0200 Subject: [PATCH] Quickmenu: unset the player's buttons as soon as it gets opened and make so that pressing an unused key closes it (like the clickable radar does) --- qcsrc/client/hud/panel/quickmenu.qc | 32 ++++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/qcsrc/client/hud/panel/quickmenu.qc b/qcsrc/client/hud/panel/quickmenu.qc index 5a2df710f..d2e5c7224 100644 --- a/qcsrc/client/hud/panel/quickmenu.qc +++ b/qcsrc/client/hud/panel/quickmenu.qc @@ -189,8 +189,16 @@ bool QuickMenu_Open(string mode, string submenu, string file) else QuickMenu_Page_Load("", 0); + mouseClicked = 0; hudShiftState = 0; + // we must unset the player's buttons, as they aren't released elsewhere + localcmd("-fire\n"); + localcmd("-fire2\n"); + localcmd("-use\n"); + localcmd("-hook\n"); + localcmd("-jump\n"); + QuickMenu_TimeOut_Set(); return true; } @@ -465,17 +473,15 @@ bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary) if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT); } - if(nPrimary == K_ESCAPE) + if(nPrimary == K_ESCAPE && key_pressed) { - if (key_pressed) - QuickMenu_Close(); + QuickMenu_Close(); } - else if(nPrimary >= '0' && nPrimary <= '9') + else if(nPrimary >= '0' && nPrimary <= '9' && key_pressed) { - if (key_pressed) - QuickMenu_Page_ActiveEntry(stof(chr2str(nPrimary))); + QuickMenu_Page_ActiveEntry(stof(chr2str(nPrimary))); } - if(nPrimary == K_MOUSE1) + else if(nPrimary == K_MOUSE1) { if(key_pressed) mouseClicked |= S_MOUSE1; @@ -489,12 +495,14 @@ bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary) else mouseClicked -= (mouseClicked & S_MOUSE2); } - else if(hit_con_bind) - return false; - - // let the engine handle all release key events so that it's possible to stop movement, weapon fire, etc... - if(!key_pressed) + else + { + if(hit_con_bind) + return false; + if (key_pressed) + QuickMenu_Close(); return false; + } return true; } -- 2.39.2