]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Quickmenu: unset the player's buttons as soon as it gets opened and make so that...
authorterencehill <piuntn@gmail.com>
Thu, 9 Sep 2021 21:40:07 +0000 (23:40 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 9 Sep 2021 21:40:07 +0000 (23:40 +0200)
qcsrc/client/hud/panel/quickmenu.qc

index 5a2df710fa733fa286b69c686859316874943332..d2e5c722453cb3f06a2e0390df3b211c6466b27c 100644 (file)
@@ -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;
 }