21 #define KEYBIND_DEF(func, desc) MACRO_BEGIN \ 22 if((KeyBinds_Count < MAX_KEYBINDS)) { \ 23 KeyBinds_Functions[KeyBinds_Count] = strzone(func); \ 24 KeyBinds_Descriptions[KeyBinds_Count] = strzone(desc); \ 29 #define KEYBIND_EMPTY_LINE() KEYBIND_DEF("", "") 30 #define KEYBIND_HEADER(str) KEYBIND_DEF("", str) 32 #define KEYBIND_IS_SPECIAL(func) (substring(func, 0 ,1) == "*") 33 #define KEYBIND_SPECIAL_DEF(key, desc) KEYBIND_DEF(strcat("*", key), desc) 57 KEYBIND_DEF(
"dropweapon" , _(
"drop weapon / throw nade"));
59 #define ADD_TO_W_LIST(pred) \ 60 FOREACH(Weapons, it != WEP_Null, { \ 61 if (it.impulse != imp) continue; \ 62 if (!(pred)) continue; \ 63 w_list = strcat(w_list, it.m_name, " / "); \ 88 KEYBIND_DEF(
"+hud_panel_radar_maximized" , _(
"maximize radar"));
89 KEYBIND_DEF(
"toggle chase_active" , _(
"3rd person view"));
96 KEYBIND_DEF(
"+con_chat_maximize" , _(
"show chat history"));
115 KEYBIND_DEF(
"menu_showteamselect" , _(
"team menu"));
120 KEYBIND_DEF(
"+use" , _(
"drop key/flag, exit vehicle"));
127 for(
int i = 1; i <= 32; ++i)
133 KEYBIND_DEF(
"menu_showsandboxtools" , _(
"sandbox menu"));
134 KEYBIND_DEF(
"+button8" , _(
"drag object (sandbox)"));
135 KEYBIND_DEF(
"wpeditor_menu" , _(
"waypoint editor menu"));
144 me.configureXonoticKeyBinder(me);
151 n =
tokenize(findkeysforcommand(from, 0));
152 for(j = 0; j < n; ++j)
159 cvar_set(
"_hud_showbinds_reload",
"1");
163 me.configureXonoticListBox(me);
180 bool force_initial_selection =
false;
182 force_initial_selection =
true;
185 if(force_initial_selection)
186 me.setSelected(me, 0);
197 me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
198 me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
199 me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
201 me.columnFunctionOrigin = 0;
202 me.columnKeysSize = me.realFontSize.x * 12;
203 me.columnFunctionSize = 1 - me.columnKeysSize - 2 * me.realFontSize.x;
204 me.columnKeysOrigin = me.columnFunctionOrigin + me.columnFunctionSize + me.realFontSize.x;
212 me.keyGrabButton.forcePressed = 1;
213 me.clearButton.disabled = 1;
221 me.keyGrabButton.forcePressed = 0;
222 me.clearButton.disabled = 0;
238 n =
tokenize(findkeysforcommand(func, 0));
240 for(j = 0; j < n; ++j)
248 for(j = 0; j < n; ++j)
261 cvar_set(
"_hud_showbinds_reload",
"1");
277 if(!me.userbindEditDialog)
296 if(!me.userbindEditDialog)
321 n =
tokenize(findkeysforcommand(func, 0));
322 for(j = 0; j < n; ++j)
333 cvar_set(
"_hud_showbinds_reload",
"1");
338 localcmd(
"exec binds-xonotic.cfg\n");
340 cvar_set(
"_hud_showbinds_reload",
"1");
356 if(me.pressed == 0 || me.pressed == 1)
358 if(i > me.previouslySelected)
371 i = me.previouslySelected;
374 me.previouslySelected = i;
375 if(me.userbindEditButton)
415 theColor = SKINCOLOR_KEYGRABBER_TITLES;
416 theAlpha = SKINALPHA_KEYGRABBER_TITLES;
424 draw_Fill(
'0 0 0',
'1 1 0', SKINCOLOR_LISTBOX_WAITING, SKINALPHA_LISTBOX_WAITING);
426 draw_Fill(
'0 0 0',
'1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
430 me.focusedItemAlpha =
getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
431 draw_Fill(
'0 0 0',
'1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
434 theAlpha = SKINALPHA_KEYGRABBER_KEYS;
435 theColor = SKINCOLOR_KEYGRABBER_KEYS;
436 extraMargin = me.realFontSize.x * 0.5;
447 theAlpha *= SKINALPHA_DISABLED;
451 draw_Text(me.realUpperMargin *
eY + extraMargin *
eX, s, me.realFontSize, theColor, theAlpha, 0);
461 bool joy_active =
cvar(
"joy_active");
462 int n =
tokenize(findkeysforcommand(func, 0));
463 for(
int j = 0; j < n; ++j)
478 draw_CenterText(me.realUpperMargin *
eY + (me.columnKeysOrigin + 0.5 * me.columnKeysSize) * eX, s, me.realFontSize, theColor, theAlpha, 0);
string KeyBinds_Descriptions[MAX_KEYBINDS]
void KeyBinder_Bind_Edit(entity btn, entity me)
string KeyBinds_Functions[MAX_KEYBINDS]
#define KEYBIND_DEF(func, desc)
#define KEYBIND_SPECIAL_DEF(key, desc)
void replace_bind(string from, string to)
#define KEYBIND_IS_SPECIAL(func)
void DialogOpenButton_Click(entity button, entity tab)
void KeyBinds_BuildList()
#define ADD_TO_W_LIST(pred)
void XonoticKeyBinder_editUserbind(entity me, string theName, string theCommandPress, string theCommandRelease)
const int WEP_FLAG_HIDDEN
const string KEY_NOT_BOUND_CMD
void XonoticKeyBinder_configureXonoticKeyBinder(entity me)
float XonoticKeyBinder_keyDown(entity me, int key, bool ascii, float shift)
void XonoticKeyBinder_keyGrabbed(entity me, int key, bool ascii)
#define KEYBIND_HEADER(str)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
void XonoticKeyBinder_doubleClickListBoxItem(entity me, float i, vector where)
void XonoticKeyBinder_loadKeyBinds(entity me)
#define startsWith(haystack, needle)
entity makeXonoticKeyBinder()
void XonoticKeyBinder_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
const int WEP_FLAG_SPECIALATTACK
void KeyBinder_Bind_Clear(entity btn, entity me)
#define KEYBIND_EMPTY_LINE()
void KeyBinder_Bind_Change(entity btn, entity me)
void KeyBinder_Bind_Reset_All(entity btn, entity me)
void XonoticKeyBinder_showNotify(entity me)
ERASEABLE string CTX(string s)
const int WEP_FLAG_MUTATORBLOCKED
void XonoticKeyBinder_destroy(entity me)
string translate_key(string key)
void XonoticKeyBinder_setSelected(entity me, int i)
const int MAX_KEYS_PER_FUNCTION
const int WEP_FLAG_SUPERWEAPON