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 258 of file keybinder.qc.

259{
260 string func = KeyBinds_Functions[me.selectedItem];
261 if (func == "" || KEYBIND_IS_SPECIAL(func))
262 return;
263
264 me.setSelected(me, me.selectedItem); // make it visible if it's hidden
265 me.keyGrabButton.forcePressed = true;
266 me.clearButton.disabled = 1;
267 keyGrabber = me;
268}
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 388 of file keybinder.qc.

389{
390 int n;
391
392 string func = KeyBinds_Functions[me.selectedItem];
393 if (func == "" || KEYBIND_IS_SPECIAL(func))
394 return;
395 else if (KEYBIND_IS_OVERRIDER(func))
396 {
397 n = tokenizebyseparator(func, ";");
398 if (n <= 1)
399 return;
400 func = argv(1);
401 }
402
403 me.setSelected(me, me.selectedItem); // make it visible if it's hidden
404
405 n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
407
409 localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
410 cvar_set("_hud_showbinds_reload", "1");
411}
#define tokenizebyseparator
void KeyBinder_Bind_UnbindAllForFunction(int n)
Definition keybinder.qc:269
#define KEYBIND_IS_OVERRIDER(func)
Definition keybinder.qc:31
void m_play_click_sound(string soundfile)
Definition menu.qc:1111
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 367 of file keybinder.qc.

368{
369 if (!me.userbindEditDialog)
370 return;
371
372 string func = KeyBinds_Functions[me.selectedItem];
373 if (func == "" || KEYBIND_IS_SPECIAL(func))
374 return;
375
376 string descr = KeyBinds_Descriptions[me.selectedItem];
377 if (!KEYBIND_IS_USERBIND(descr))
378 return;
379
380 me.setSelected(me, me.selectedItem); // make it visible if it's hidden
381 descr = substring(descr, 1, strlen(descr) - 1);
382
383 // Hooray! It IS a user bind!
384 me.userbindEditDialog.loadUserBind(me.userbindEditDialog, cvar_string(strcat(descr, "_description")), cvar_string(strcat(descr, "_press")), cvar_string(strcat(descr, "_release")));
385
386 DialogOpenButton_Click(btn, me.userbindEditDialog);
387}
#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 412 of file keybinder.qc.

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

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{
199 me.configureXonoticKeyBinder(me);
200 return me;
201}
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().