-string Xonotic_KeyBinds_Functions[MAX_KEYBINDS];
-string Xonotic_KeyBinds_Descriptions[MAX_KEYBINDS];
-int Xonotic_KeyBinds_Count = -1;
+string KeyBinds_Functions[MAX_KEYBINDS];
+string KeyBinds_Descriptions[MAX_KEYBINDS];
+int KeyBinds_Count = -1;
- #define KEYBIND_DEF(func, desc) MACRO_BEGIN { \
- if((Xonotic_KeyBinds_Count < MAX_KEYBINDS)) { \
- Xonotic_KeyBinds_Functions[Xonotic_KeyBinds_Count] = strzone(func); \
- Xonotic_KeyBinds_Descriptions[Xonotic_KeyBinds_Count] = strzone(desc); \
- ++Xonotic_KeyBinds_Count; \
+ #define KEYBIND_DEF(func, desc) MACRO_BEGIN \
+ if((KeyBinds_Count < MAX_KEYBINDS)) { \
+ KeyBinds_Functions[KeyBinds_Count] = strzone(func); \
+ KeyBinds_Descriptions[KeyBinds_Count] = strzone(desc); \
+ ++KeyBinds_Count; \
- KEYBIND_DEF("" , _("Moving"));
+ #define KEYBIND_EMPTY_LINE() KEYBIND_DEF("", "")
+ #define KEYBIND_HEADER(str) KEYBIND_DEF("", str)
+
+ #define KEYBIND_IS_SPECIAL(func) (substring(func, 0 ,1) == "*")
+ #define KEYBIND_SPECIAL_DEF(key) KEYBIND_DEF(strcat("*", key), "")
+
+ KEYBIND_HEADER(_("Moving"));
KEYBIND_DEF("+forward" , _("forward"));
KEYBIND_DEF("+back" , _("backpedal"));
KEYBIND_DEF("+moveleft" , _("strafe left"));
KEYBIND_DEF("+forward" , _("forward"));
KEYBIND_DEF("+back" , _("backpedal"));
KEYBIND_DEF("+moveleft" , _("strafe left"));
KEYBIND_DEF("+crouch" , _("crouch / sink"));
KEYBIND_DEF("+hook" , _("off-hand hook"));
KEYBIND_DEF("+jetpack" , _("jetpack"));
KEYBIND_DEF("+crouch" , _("crouch / sink"));
KEYBIND_DEF("+hook" , _("off-hand hook"));
KEYBIND_DEF("+jetpack" , _("jetpack"));
KEYBIND_DEF("+fire" , _("primary fire"));
KEYBIND_DEF("+fire2" , _("secondary fire"));
KEYBIND_DEF("+fire" , _("primary fire"));
KEYBIND_DEF("+fire2" , _("secondary fire"));
KEYBIND_DEF("weapprev" , CTX(_("WEAPON^previous")));
KEYBIND_DEF("weapnext" , CTX(_("WEAPON^next")));
KEYBIND_DEF("weaplast" , CTX(_("WEAPON^previously used")));
KEYBIND_DEF("weapprev" , CTX(_("WEAPON^previous")));
KEYBIND_DEF("weapnext" , CTX(_("WEAPON^next")));
KEYBIND_DEF("weaplast" , CTX(_("WEAPON^previously used")));
if(w_list)
KEYBIND_DEF(strcat("weapon_group_", itos(imp)), substring(w_list, 0, -4));
if(imp == 0)
if(w_list)
KEYBIND_DEF(strcat("weapon_group_", itos(imp)), substring(w_list, 0, -4));
if(imp == 0)
KEYBIND_DEF("+zoom" , _("hold zoom"));
KEYBIND_DEF("togglezoom" , _("toggle zoom"));
KEYBIND_DEF("+showscores" , _("show scores"));
KEYBIND_DEF("+zoom" , _("hold zoom"));
KEYBIND_DEF("togglezoom" , _("toggle zoom"));
KEYBIND_DEF("+showscores" , _("show scores"));
KEYBIND_DEF("+hud_panel_radar_maximized" , _("maximize radar"));
KEYBIND_DEF("toggle chase_active" , _("3rd person view"));
KEYBIND_DEF("spec" , _("enter spectator mode"));
KEYBIND_DEF("+hud_panel_radar_maximized" , _("maximize radar"));
KEYBIND_DEF("toggle chase_active" , _("3rd person view"));
KEYBIND_DEF("spec" , _("enter spectator mode"));
KEYBIND_DEF("messagemode" , _("public chat"));
KEYBIND_DEF("messagemode2" , _("team chat"));
KEYBIND_DEF("+con_chat_maximize" , _("show chat history"));
KEYBIND_DEF("vyes" , _("vote YES"));
KEYBIND_DEF("vno" , _("vote NO"));
KEYBIND_DEF("ready" , _("ready"));
KEYBIND_DEF("messagemode" , _("public chat"));
KEYBIND_DEF("messagemode2" , _("team chat"));
KEYBIND_DEF("+con_chat_maximize" , _("show chat history"));
KEYBIND_DEF("vyes" , _("vote YES"));
KEYBIND_DEF("vno" , _("vote NO"));
KEYBIND_DEF("ready" , _("ready"));
KEYBIND_DEF("disconnect" , _("disconnect"));
KEYBIND_DEF("menu_showquitdialog" , _("quit"));
KEYBIND_DEF("disconnect" , _("disconnect"));
KEYBIND_DEF("menu_showquitdialog" , _("quit"));
KEYBIND_DEF("messagemode2" , _("team chat"));
KEYBIND_DEF("team_auto" , _("auto-join team"));
KEYBIND_DEF("menu_showteamselect" , _("team menu"));
KEYBIND_DEF("+use" , _("drop key / drop flag"));
KEYBIND_DEF("messagemode2" , _("team chat"));
KEYBIND_DEF("team_auto" , _("auto-join team"));
KEYBIND_DEF("menu_showteamselect" , _("team menu"));
KEYBIND_DEF("+use" , _("drop key / drop flag"));
KEYBIND_DEF("quickmenu" , _("quick menu"));
KEYBIND_DEF("menu_showsandboxtools" , _("sandbox menu"));
KEYBIND_DEF("quickmenu" , _("quick menu"));
KEYBIND_DEF("menu_showsandboxtools" , _("sandbox menu"));
for(i = 1; i <= 32; ++i)
KEYBIND_DEF(strcat("+userbind ", itos(i)), strcat("$userbind", itos(i)));
for(i = 1; i <= 32; ++i)
KEYBIND_DEF(strcat("+userbind ", itos(i)), strcat("$userbind", itos(i)));
}
void XonoticKeyBinder_editUserbind(entity me, string theName, string theCommandPress, string theCommandRelease)
{
}
void XonoticKeyBinder_editUserbind(entity me, string theName, string theCommandPress, string theCommandRelease)
{
if(substring(descr, 0, 1) != "$")
return;
descr = substring(descr, 1, strlen(descr) - 1);
if(substring(descr, 0, 1) != "$")
return;
descr = substring(descr, 1, strlen(descr) - 1);
if(substring(descr, 0, 1) != "$")
return;
descr = substring(descr, 1, strlen(descr) - 1);
if(substring(descr, 0, 1) != "$")
return;
descr = substring(descr, 1, strlen(descr) - 1);
localcmd("exec binds-xonotic.cfg\n");
localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
cvar_set("_hud_showbinds_reload", "1");
localcmd("exec binds-xonotic.cfg\n");
localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
cvar_set("_hud_showbinds_reload", "1");
{
// handling of "unselectable" items
i = floor(0.5 + bound(0, i, me.nItems - 1));
{
// handling of "unselectable" items
i = floor(0.5 + bound(0, i, me.nItems - 1));
if(me.pressed == 0 || me.pressed == 1) // keyboard or scrolling - skip unselectable items
{
if(i > me.previouslySelected)
{
if(me.pressed == 0 || me.pressed == 1) // keyboard or scrolling - skip unselectable items
{
if(i > me.previouslySelected)
{
SUPER(XonoticKeyBinder).setSelected(me, i);
}
float XonoticKeyBinder_keyDown(entity me, int key, bool ascii, float shift)
SUPER(XonoticKeyBinder).setSelected(me, i);
}
float XonoticKeyBinder_keyDown(entity me, int key, bool ascii, float shift)
void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
string s;
void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
string s;
s = draw_TextShortenToWidth(descr, me.columnFunctionSize, 0, me.realFontSize);
draw_Text(me.realUpperMargin * eY + extraMargin * eX, s, me.realFontSize, theColor, theAlpha, 0);
s = draw_TextShortenToWidth(descr, me.columnFunctionSize, 0, me.realFontSize);
draw_Text(me.realUpperMargin * eY + extraMargin * eX, s, me.realFontSize, theColor, theAlpha, 0);
- s = draw_TextShortenToWidth(s, me.columnKeysSize, 0, me.realFontSize);
- draw_CenterText(me.realUpperMargin * eY + (me.columnKeysOrigin + 0.5 * me.columnKeysSize) * eX, s, me.realFontSize, theColor, theAlpha, 0);
+ s = draw_TextShortenToWidth(s, me.columnKeysSize, 0, me.realFontSize);
+ draw_CenterText(me.realUpperMargin * eY + (me.columnKeysOrigin + 0.5 * me.columnKeysSize) * eX, s, me.realFontSize, theColor, theAlpha, 0);