diff --git a/source/client/hud.qc b/source/client/hud.qc index d435702..7d2a33a 100644 --- a/source/client/hud.qc +++ b/source/client/hud.qc @@ -981,13 +981,14 @@ void() HUD_Useprint = float argc = tokenize(findkeysforcommandex("+button7")); for (int i = 0; i < argc; i++) { - usebutton = strtoupper(argv(i)); - float bind_is_gamepad = Key_IsControllerGlyph(usebutton); + string temp_button = strtoupper(argv(i)); + float bind_is_gamepad = Key_IsControllerGlyph(temp_button); + // Always display the last button in the last. if (bind_is_gamepad && last_input_was_gamepad) - break; + usebutton = temp_button; else if (!bind_is_gamepad && !last_input_was_gamepad) - break; + usebutton = temp_button; } if (usebutton == "") @@ -1273,16 +1274,16 @@ void() HUD_BouncingBetty = float argc = tokenize(findkeysforcommandex("impulse 33")); - for (int i = 0; i < argc; ++i) - { - betty_key = strtoupper(argv(i)); - float bind_is_gamepad = Key_IsControllerGlyph(betty_key); + for (int i = 0; i < argc; i++) { + string temp_button = strtoupper(argv(i)); + float bind_is_gamepad = Key_IsControllerGlyph(temp_button); - if (bind_is_gamepad && last_input_was_gamepad) - break; - else if (!bind_is_gamepad && !last_input_was_gamepad) - break; - } + // Always display the last button in the last. + if (bind_is_gamepad && last_input_was_gamepad) + betty_key = temp_button; + else if (!bind_is_gamepad && !last_input_was_gamepad) + betty_key = temp_button; + } // If this is a gamepad button, the space we want to reserve // in the betty string should be a fixed width. @@ -1401,13 +1402,14 @@ void() HUD_Crosshair = float argc = tokenize(findkeysforcommandex("impulse 23")); for (int i = 0; i < argc; i++) { - breath_button = strtoupper(argv(i)); - float bind_is_gamepad = Key_IsControllerGlyph(breath_button); + string temp_button = strtoupper(argv(i)); + float bind_is_gamepad = Key_IsControllerGlyph(temp_button); - if (bind_is_gamepad && last_input_was_gamepad) - break; - else if (!bind_is_gamepad && !last_input_was_gamepad) - break; + // Always display the last button in the last. + if (bind_is_gamepad && last_input_was_gamepad) + breath_button = temp_button; + else if (!bind_is_gamepad && !last_input_was_gamepad) + breath_button = temp_button; } if (breath_button == "") @@ -1917,15 +1919,16 @@ void(float x_position, float y_position, string command, string action) HUD_Draw float argc = tokenize(findkeysforcommandex(command)); - for (int i = 0; i < argc; i++) { - bind_button = strtoupper(argv(i)); - float bind_is_gamepad = Key_IsControllerGlyph(bind_button); + for (int i = 0; i < argc; i++) { + string temp_button = strtoupper(argv(i)); + float bind_is_gamepad = Key_IsControllerGlyph(temp_button); - if (bind_is_gamepad && last_input_was_gamepad) - break; - else if (!bind_is_gamepad && !last_input_was_gamepad) - break; - } + // Always display the last button in the last. + if (bind_is_gamepad && last_input_was_gamepad) + bind_button = temp_button; + else if (!bind_is_gamepad && !last_input_was_gamepad) + bind_button = temp_button; + } if (bind_button == "") bind_button = "UNBOUND"; diff --git a/source/menu/menu_bind.qc b/source/menu/menu_bind.qc index 7a1564a..c6cbca6 100644 --- a/source/menu/menu_bind.qc +++ b/source/menu/menu_bind.qc @@ -3,7 +3,7 @@ string menu_bind_buttons[13] = {"bm_jump", "bm_spri", "bm_crou", "bm_wnex", "bm_ float(float keynum) Menu_Bindings_IsGamepad = { - if (keynum >= 816 && keynum <= 839) + if (keynum >= 768 && keynum <= 839) return true; return false; @@ -19,16 +19,16 @@ void(float order, string command) Menu_Bindings_PrintBindForCommand = string bind = ""; float argc = tokenize(findkeysforcommandex(command)); - for (int i = 0; i < argc; i++) { - bind = strtoupper(argv(i)); - float bind_is_gamepad = Menu_Bindings_IsGamepad(stringtokeynum(bind)); + string temp_button = strtoupper(argv(i)); + float bind_is_gamepad = Menu_Bindings_IsGamepad(stringtokeynum(temp_button)); - if (bind_is_gamepad && last_input_was_gamepad) - break; - else if (!bind_is_gamepad && !last_input_was_gamepad) - break; - } + // Always display the last button in the last. + if (bind_is_gamepad && last_input_was_gamepad) + bind = temp_button; + else if (!bind_is_gamepad && !last_input_was_gamepad) + bind = temp_button; + } if (bind == "") bind = "UNBOUND"; diff --git a/source/menu/sui_sys.qc b/source/menu/sui_sys.qc index 7bdda1b..4a1e3b9 100644 --- a/source/menu/sui_sys.qc +++ b/source/menu/sui_sys.qc @@ -784,6 +784,7 @@ void(float scan, string command) _sui_do_keybind = } string keyname = keynumtostring(scan); _sui_unbind(command); + localcmd(sprintf("unbind %s\n", keyname)); localcmd(sprintf("bind %s %s\n", keyname, command)); _sui_binding_command = ""; _sui_binding_command_name = "";