]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/quickmenu.qc
Merge branch 'terencehill/quickmenu_bugfix_2487' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / quickmenu.qc
index e3cfa12dd26953853c9a4b68e98b710c75a72cd1..3c3a5ba864c5ea2a8e0be619c58337d5b20007ad 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;
 }
@@ -441,17 +449,6 @@ bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary)
        // at this point bInputType can only be 0 or 1 (key pressed or released)
        bool key_pressed = (bInputType == 0);
 
-       // allow console bind to work
-       string con_keys = findkeysforcommand("toggleconsole", 0);
-       int keys = tokenize(con_keys); // findkeysforcommand returns data for this
-       bool hit_con_bind = false;
-       int i;
-       for (i = 0; i < keys; ++i)
-       {
-               if(nPrimary == stof(argv(i)))
-                       hit_con_bind = true;
-       }
-
        if(key_pressed)
        {
                if(nPrimary == K_ALT) hudShiftState |= S_ALT;
@@ -465,18 +462,6 @@ bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary)
                if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
        }
 
-       if(nPrimary == K_ESCAPE)
-       {
-               if (!key_pressed)
-                       return true;
-               QuickMenu_Close();
-       }
-       else if(nPrimary >= '0' && nPrimary <= '9')
-       {
-               if (!key_pressed)
-                       return true;
-               QuickMenu_Page_ActiveEntry(stof(chr2str(nPrimary)));
-       }
        if(nPrimary == K_MOUSE1)
        {
                if(key_pressed)
@@ -491,8 +476,29 @@ bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary)
                else
                        mouseClicked -= (mouseClicked & S_MOUSE2);
        }
-       else if(hit_con_bind)
+       else if(nPrimary == K_ESCAPE && key_pressed)
+       {
+               QuickMenu_Close();
+       }
+       else if(nPrimary >= '0' && nPrimary <= '9' && key_pressed)
+       {
+               QuickMenu_Page_ActiveEntry(stof(chr2str(nPrimary)));
+       }
+       else
+       {
+               // allow console bind to work
+               string con_keys = findkeysforcommand("toggleconsole", 0);
+               int keys = tokenize(con_keys); // findkeysforcommand returns data for this
+               int i;
+               for (i = 0; i < keys; ++i)
+               {
+                       if(nPrimary == stof(argv(i)))
+                               return false; // hit console bind
+               }
+               if (key_pressed)
+                       QuickMenu_Close();
                return false;
+       }
 
        return true;
 }