]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
handle F key binds correctly (up event shall not go to CSQC)
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 24 Aug 2008 10:07:57 +0000 (10:07 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 24 Aug 2008 10:07:57 +0000 (10:07 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8469 d7cf8633-e32d-0410-b094-e92efae38249

keys.c

diff --git a/keys.c b/keys.c
index 3b0ea76191f980a96c9e5abfba0f59aa143e4d1d..59f1a745505e28a00afe7ff75d9be5c854994cd8 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -1018,21 +1018,25 @@ Key_Event (int key, char ascii, qboolean down)
 
        // send function keydowns to interpreter no matter what mode is (unless the menu has specifically grabbed the keyboard, for rebinding keys)
        if (keydest != key_menu_grabbed)
-       if (key >= K_F1 && key <= K_F12 && down)
+       if (key >= K_F1 && key <= K_F12)
        {
                // ignore key repeats on F1-F12 binds
                if (keydown[key] > 1)
                        return;
                if (bind)
                {
-                       // button commands add keynum as a parm
-                       if (bind[0] == '+')
-                               Cbuf_AddText (va("%s %i\n", bind, key));
-                       else
+                       if(keydown[key] == 1 && down)
                        {
-                               Cbuf_AddText (bind);
-                               Cbuf_AddText ("\n");
-                       }
+                               // button commands add keynum as a parm
+                               if (bind[0] == '+')
+                                       Cbuf_AddText (va("%s %i\n", bind, key));
+                               else
+                               {
+                                       Cbuf_AddText (bind);
+                                       Cbuf_AddText ("\n");
+                               }
+                       } else if(bind[0] == '+' && !down && keydown[key] == 0)
+                               Cbuf_AddText(va("-%s %i\n", bind + 1, key));
                }
                return;
        }