Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
keybinder.qh File Reference
#include "listbox.qh"
Include dependency graph for keybinder.qh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  XonoticKeyBinder

Functions

void KeyBinder_Bind_Change (entity btn, entity me)
void KeyBinder_Bind_Clear (entity btn, entity me)
void KeyBinder_Bind_Edit (entity btn, entity me)
void KeyBinder_Bind_Reset_All (entity btn, entity me)
entity makeXonoticKeyBinder ()

Function Documentation

◆ KeyBinder_Bind_Change()

void KeyBinder_Bind_Change ( entity btn,
entity me )

Definition at line 259 of file keybinder.qc.

260{
261 string func = KeyBinds_Functions[me.selectedItem];
262 if (func == "" || KEYBIND_IS_SPECIAL(func))
263 return;
264
265 me.setSelected(me, me.selectedItem); // make it visible if it's hidden
266 me.keyGrabButton.forcePressed = true;
267 me.clearButton.disabled = 1;
268 keyGrabber = me;
269}
string KeyBinds_Functions[MAX_KEYBINDS]
Definition keybinder.qc:14
#define KEYBIND_IS_SPECIAL(func)
Definition keybinder.qc:27
entity keyGrabber
Definition menu.qh:32

References entity(), KEYBIND_IS_SPECIAL, KeyBinds_Functions, and keyGrabber.

Referenced by XonoticKeyBinder::editUserbind(), XonoticInputSettingsTab_fill(), XonoticKeyBinder_doubleClickListBoxItem(), XonoticKeyBinder_keyDown(), and XonoticKeyBinder_keyGrabbed().

◆ KeyBinder_Bind_Clear()

void KeyBinder_Bind_Clear ( entity btn,
entity me )

Definition at line 389 of file keybinder.qc.

390{
391 int n;
392
393 string func = KeyBinds_Functions[me.selectedItem];
394 if (func == "" || KEYBIND_IS_SPECIAL(func))
395 return;
396 else if (KEYBIND_IS_OVERRIDER(func))
397 {
398 n = tokenizebyseparator(func, ";");
399 if (n <= 1)
400 return;
401 func = argv(1);
402 }
403
404 me.setSelected(me, me.selectedItem); // make it visible if it's hidden
405
406 n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
408
410 localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
411 cvar_set("_hud_showbinds_reload", "1");
412}
#define tokenizebyseparator
void KeyBinder_Bind_UnbindAllForFunction(int n)
Definition keybinder.qc:270
#define KEYBIND_IS_OVERRIDER(func)
Definition keybinder.qc:31
void m_play_click_sound(string soundfile)
Definition menu.qc:1106
const string MENU_SOUND_CLEAR
Definition menu.qh:49
void localcmd(string command,...)
void cvar_set(string name, string value)
float tokenize(string s)
string argv(float n)

References argv(), cvar_set(), entity(), KEYBIND_IS_OVERRIDER, KEYBIND_IS_SPECIAL, KeyBinder_Bind_UnbindAllForFunction(), KeyBinds_Functions, localcmd(), m_play_click_sound(), MENU_SOUND_CLEAR, tokenize(), and tokenizebyseparator.

Referenced by XonoticKeyBinder::editUserbind(), XonoticInputSettingsTab_fill(), and XonoticKeyBinder_keyDown().

◆ KeyBinder_Bind_Edit()

void KeyBinder_Bind_Edit ( entity btn,
entity me )

Definition at line 368 of file keybinder.qc.

369{
370 if (!me.userbindEditDialog)
371 return;
372
373 string func = KeyBinds_Functions[me.selectedItem];
374 if (func == "" || KEYBIND_IS_SPECIAL(func))
375 return;
376
377 string descr = KeyBinds_Descriptions[me.selectedItem];
378 if (!KEYBIND_IS_USERBIND(descr))
379 return;
380
381 me.setSelected(me, me.selectedItem); // make it visible if it's hidden
382 descr = substring(descr, 1, strlen(descr) - 1);
383
384 // Hooray! It IS a user bind!
385 me.userbindEditDialog.loadUserBind(me.userbindEditDialog, cvar_string(strcat(descr, "_description")), cvar_string(strcat(descr, "_press")), cvar_string(strcat(descr, "_release")));
386
387 DialogOpenButton_Click(btn, me.userbindEditDialog);
388}
#define strlen
string KeyBinds_Descriptions[MAX_KEYBINDS]
Definition keybinder.qc:17
#define KEYBIND_IS_USERBIND(descr)
Definition keybinder.qc:23
string substring(string s, float start, float length)
const string cvar_string(string name)
void DialogOpenButton_Click(entity button, entity tab)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References cvar_string(), DialogOpenButton_Click(), entity(), KEYBIND_IS_SPECIAL, KEYBIND_IS_USERBIND, KeyBinds_Descriptions, KeyBinds_Functions, strcat(), strlen, and substring().

Referenced by XonoticKeyBinder::editUserbind(), XonoticInputSettingsTab_fill(), and XonoticKeyBinder_keyDown().

◆ KeyBinder_Bind_Reset_All()

void KeyBinder_Bind_Reset_All ( entity btn,
entity me )

Definition at line 413 of file keybinder.qc.

414{
415 localcmd("unbindall\n");
416 localcmd("exec binds-xonotic.cfg\n");
417 localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
418 cvar_set("_hud_showbinds_reload", "1");
419 me.close(me);
420}

References cvar_set(), entity(), and localcmd().

Referenced by XonoticKeyBinder::editUserbind(), and XonoticBindingsResetDialog_fill().

◆ makeXonoticKeyBinder()

entity makeXonoticKeyBinder ( )

Definition at line 196 of file keybinder.qc.

197{
198 entity me;
199 me = NEW(XonoticKeyBinder);
200 me.configureXonoticKeyBinder(me);
201 return me;
202}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define NEW(cname,...)
Definition oo.qh:117

References entity(), and NEW.

Referenced by XonoticKeyBinder::editUserbind(), and XonoticInputSettingsTab_fill().