#define KEYBIND_EMPTY_LINE() KEYBIND_DEF("", "")
#define KEYBIND_HEADER(str) KEYBIND_DEF("", str)
+ // Special keybinds can't be edited or selected
+ // If a special keybind description matches the previous one
+ // then it's considered as an alternative keybind of the previous one
#define KEYBIND_IS_SPECIAL(func) (substring(func, 0 ,1) == "*")
#define KEYBIND_SPECIAL_DEF(key, desc) KEYBIND_DEF(strcat("*", key), desc)
// non-English keyboard layouts, unlike default keys (` and ~)
KEYBIND_DEF("toggleconsole" , _("enter console"));
string console_shortcut = strcat(translate_key("SHIFT"), "+", translate_key("ESCAPE"));
- KEYBIND_SPECIAL_DEF(console_shortcut, _("enter console"));
+ KEYBIND_SPECIAL_DEF(console_shortcut , _("enter console"));
KEYBIND_DEF("menu_showquitdialog" , _("quit"));
KEYBIND_EMPTY_LINE();
KEYBIND_DEF("+use" , _("drop key/flag, exit vehicle"));
KEYBIND_DEF("kill" , _("suicide / respawn"));
KEYBIND_DEF("quickmenu" , _("quick menu"));
+ string scoreboard_ui_shortcut = strcat(translate_key("TAB"), "+", translate_key("ESCAPE"));
+ KEYBIND_SPECIAL_DEF(scoreboard_ui_shortcut , _("scoreboard user interface"));
KEYBIND_EMPTY_LINE();
KEYBIND_HEADER(_("User defined"));
if(func == "" || KEYBIND_IS_SPECIAL(func))
return;
+ me.setSelected(me, me.selectedItem); // make it visible if it's hidden
me.keyGrabButton.forcePressed = 1;
me.clearButton.disabled = 1;
keyGrabber = me;
string descr = KeyBinds_Descriptions[me.selectedItem];
if(substring(descr, 0, 1) != "$")
return;
+
+ me.setSelected(me, me.selectedItem); // make it visible if it's hidden
descr = substring(descr, 1, strlen(descr) - 1);
// Hooray! It IS a user bind!
if(func == "" || KEYBIND_IS_SPECIAL(func))
return;
+ me.setSelected(me, me.selectedItem); // make it visible if it's hidden
+
n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
for(j = 0; j < n; ++j)
{
i = floor(0.5 + bound(0, i, me.nItems - 1));
if (KEYBIND_IS_SPECIAL(KeyBinds_Functions[i]))
{
- SUPER(XonoticKeyBinder).setSelected(me, i - 1);
+ if (i > 0 && KeyBinds_Descriptions[i] == KeyBinds_Descriptions[i - 1])
+ SUPER(XonoticKeyBinder).setSelected(me, i - 1);
return;
}
if(me.pressed == 0 || me.pressed == 1) // keyboard or scrolling - skip unselectable items