]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Don't show joypad keys in the HUD if no joypad has been detected 320/head
authorterencehill <piuntn@gmail.com>
Tue, 24 May 2016 13:00:26 +0000 (15:00 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 24 May 2016 13:00:26 +0000 (15:00 +0200)
qcsrc/client/main.qc

index 1767b8f2bd76c48d95deb6e4a67c885dcbd4faa3..09f78d2742038a757f4dff17bf7da2c2e4e9881b 100644 (file)
@@ -1188,16 +1188,21 @@ string getcommandkey(string text, string command)
        keys = db_get(binddb, command);
        if (keys == "")
        {
+               bool joy_detected = cvar("joy_detected");
                n = tokenize(findkeysforcommand(command, 0)); // uses '...' strings
                for(j = 0; j < n; ++j)
                {
                        k = stof(argv(j));
                        if(k != -1)
                        {
-                               if ("" == keys)
-                                       keys = keynumtostring(k);
+                               string key = keynumtostring(k);
+                               if(!joy_detected && substring(key, 0, 3) == "JOY")
+                                       continue;
+
+                               if (keys == "")
+                                       keys = key;
                                else
-                                       keys = strcat(keys, ", ", keynumtostring(k));
+                                       keys = strcat(keys, ", ", key);
 
                                ++l;
                                if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit <= l)