Quake II RTX doxygen  1.0 dev
keys.c
Go to the documentation of this file.
1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18 
19 #include "client.h"
20 
21 static keywaitcb_t key_wait_cb;
22 static void *key_wait_arg;
23 
24 static char *keybindings[256];
25 
26 // bitmap of keys not passed to interpreter while in console
27 static byte consolekeys[256 / 8];
28 
29 // key to map to if shift held down in console
30 static byte keyshift[256];
31 
32 // key down status: if > 1, it is auto-repeating
33 static byte keydown[256];
34 
35 // number of keys down for BUTTON_ANY
36 static int anykeydown;
37 
38 // bitmap for generating button up commands
39 static byte buttondown[256 / 8];
40 
41 static qboolean key_overstrike;
42 
43 typedef struct keyname_s {
44  char *name;
45  int keynum;
46 } keyname_t;
47 
48 #define K(x) { #x, K_##x }
49 
50 static const keyname_t keynames[] = {
51  K(BACKSPACE),
52  K(TAB),
53  K(ENTER),
54  K(PAUSE),
55  K(ESCAPE),
56  K(SPACE),
57 
58  K(UPARROW),
59  K(DOWNARROW),
60  K(LEFTARROW),
61  K(RIGHTARROW),
62 
63  K(ALT),
64  K(LALT),
65  K(RALT),
66  K(CTRL),
67  K(LCTRL),
68  K(RCTRL),
69  K(SHIFT),
70  K(LSHIFT),
71  K(RSHIFT),
72 
73  K(F1),
74  K(F2),
75  K(F3),
76  K(F4),
77  K(F5),
78  K(F6),
79  K(F7),
80  K(F8),
81  K(F9),
82  K(F10),
83  K(F11),
84  K(F12),
85 
86  K(INS),
87  K(DEL),
88  K(PGDN),
89  K(PGUP),
90  K(HOME),
91  K(END),
92 
93  K(102ND),
94 
95  K(NUMLOCK),
96  K(CAPSLOCK),
97  K(SCROLLOCK),
98  K(LWINKEY),
99  K(RWINKEY),
100  K(MENU),
101  K(PRINTSCREEN),
102 
103  K(KP_HOME),
104  K(KP_UPARROW),
105  K(KP_PGUP),
106  K(KP_LEFTARROW),
107  K(KP_5),
108  K(KP_RIGHTARROW),
109  K(KP_END),
110  K(KP_DOWNARROW),
111  K(KP_PGDN),
112  K(KP_ENTER),
113  K(KP_INS),
114  K(KP_DEL),
115  K(KP_SLASH),
116  K(KP_MINUS),
117  K(KP_PLUS),
118  K(KP_MULTIPLY),
119 
120  K(MOUSE1),
121  K(MOUSE2),
122  K(MOUSE3),
123  K(MOUSE4),
124  K(MOUSE5),
125  K(MOUSE6),
126  K(MOUSE7),
127  K(MOUSE8),
128 
129  K(MWHEELUP),
130  K(MWHEELDOWN),
131  K(MWHEELRIGHT),
132  K(MWHEELLEFT),
133 
134  {"SEMICOLON", ';'}, // because a raw semicolon seperates commands
135 
136  {NULL, 0}
137 };
138 
139 #undef K
140 
141 //============================================================================
142 
143 /*
144 ===================
145 Key_GetOverstrikeMode
146 ===================
147 */
148 qboolean Key_GetOverstrikeMode(void)
149 {
150  return key_overstrike;
151 }
152 
153 /*
154 ===================
155 Key_SetOverstrikeMode
156 ===================
157 */
158 void Key_SetOverstrikeMode(qboolean overstrike)
159 {
160  key_overstrike = overstrike;
161 }
162 
163 /*
164 ===================
165 Key_GetDest
166 ===================
167 */
168 keydest_t Key_GetDest(void)
169 {
170  return cls.key_dest;
171 }
172 
173 /*
174 ===================
175 Key_SetDest
176 ===================
177 */
178 void Key_SetDest(keydest_t dest)
179 {
180  int diff;
181 
182 // if not connected, console or menu should be up
183  if (cls.state < ca_active && !(dest & (KEY_MENU | KEY_CONSOLE))) {
184  dest |= KEY_CONSOLE;
185  }
186 
187  diff = cls.key_dest ^ dest;
188  cls.key_dest = dest;
189 
190 // activate or deactivate mouse
191  if (diff & (KEY_CONSOLE | KEY_MENU)) {
192  IN_Activate();
194  }
195 }
196 
197 /*
198 ===================
199 Key_IsDown
200 
201 Returns key down status: if > 1, it is auto-repeating
202 ===================
203 */
204 int Key_IsDown(int key)
205 {
206  if (key < 0 || key > 255) {
207  return 0;
208  }
209 
210  return keydown[key];
211 }
212 
213 /*
214 ===================
215 Key_AnyKeyDown
216 
217 Returns total number of keys down.
218 ===================
219 */
220 int Key_AnyKeyDown(void)
221 {
222  return anykeydown;
223 }
224 
225 /*
226 ===================
227 Key_StringToKeynum
228 
229 Returns a key number to be used to index keybindings[] by looking at
230 the given string. Single ascii characters return themselves, while
231 the K_* names are matched up.
232 ===================
233 */
234 int Key_StringToKeynum(const char *str)
235 {
236  const keyname_t *kn;
237 
238  if (!str || !str[0])
239  return -1;
240  if (!str[1])
241  return Q_tolower(str[0]);
242 
243  for (kn = keynames; kn->name; kn++) {
244  if (!Q_stricmp(str, kn->name))
245  return kn->keynum;
246  }
247  return -1;
248 }
249 
250 /*
251 ===================
252 Key_KeynumToString
253 
254 Returns a string (either a single ascii char, or a K_* name) for the
255 given keynum.
256 FIXME: handle quote special (general escape sequence?)
257 ===================
258 */
259 char *Key_KeynumToString(int keynum)
260 {
261  const keyname_t *kn;
262  static char tinystr[2];
263 
264  if (keynum == -1)
265  return "<KEY NOT FOUND>";
266 
267  if (keynum > 32 && keynum < 127 && keynum != ';' && keynum != '"') {
268  // printable ascii
269  tinystr[0] = keynum;
270  tinystr[1] = 0;
271  return tinystr;
272  }
273 
274  for (kn = keynames; kn->name; kn++)
275  if (keynum == kn->keynum)
276  return kn->name;
277 
278  return "<UNKNOWN KEYNUM>";
279 }
280 
281 /*
282 ===================
283 Key_GetBinding
284 
285 Returns the name of the first key found.
286 ===================
287 */
288 char *Key_GetBinding(const char *binding)
289 {
290  int key;
291 
292  for (key = 0; key < 256; key++) {
293  if (keybindings[key]) {
294  if (!Q_stricmp(keybindings[key], binding)) {
295  return Key_KeynumToString(key);
296  }
297  }
298  }
299 
300  return "";
301 }
302 
303 /*
304 ===================
305 Key_GetBindingForKey
306 
307 Returns the command bound to a given key.
308 ===================
309 */
310 char *Key_GetBindingForKey(int keynum)
311 {
312  return keybindings[keynum];
313 }
314 
315 /*
316 ===================
317 Key_EnumBindings
318 ===================
319 */
320 int Key_EnumBindings(int key, const char *binding)
321 {
322  if (key < 0) {
323  key = 0;
324  }
325  for (; key < 256; key++) {
326  if (keybindings[key]) {
327  if (!Q_stricmp(keybindings[key], binding)) {
328  return key;
329  }
330  }
331  }
332 
333  return -1;
334 }
335 
336 /*
337 ===================
338 Key_SetBinding
339 ===================
340 */
341 void Key_SetBinding(int keynum, const char *binding)
342 {
343  if (keynum < 0 || keynum > 255)
344  return;
345 
346 // free old binding
347  if (keybindings[keynum]) {
348  Z_Free(keybindings[keynum]);
349  }
350 
351 // allocate memory for new binding
352  keybindings[keynum] = Z_CopyString(binding);
353 }
354 
355 static void Key_Name_g(genctx_t *ctx)
356 {
357  const keyname_t *k;
358 
359  ctx->ignorecase = qtrue;
360  for (k = keynames; k->name; k++) {
361  if (!Prompt_AddMatch(ctx, k->name)) {
362  break;
363  }
364  }
365 }
366 
367 static void Key_Bound_g(genctx_t *ctx)
368 {
369  int i;
370 
371  ctx->ignorecase = qtrue;
372  for (i = 0; i < 256; i++) {
373  if (keybindings[i]) {
374  if (!Prompt_AddMatch(ctx, Key_KeynumToString(i))) {
375  break;
376  }
377  }
378  }
379 }
380 
381 static void Key_Bind_c(genctx_t *ctx, int argnum)
382 {
383  if (argnum == 1) {
384  Key_Name_g(ctx);
385  } else {
386  Com_Generic_c(ctx, argnum - 2);
387  }
388 }
389 
390 static void Key_Unbind_c(genctx_t *ctx, int argnum)
391 {
392  if (argnum == 1) {
393  Key_Bound_g(ctx);
394  }
395 }
396 
397 /*
398 ===================
399 Key_Unbind_f
400 ===================
401 */
402 static void Key_Unbind_f(void)
403 {
404  int b;
405 
406  if (Cmd_Argc() != 2) {
407  Com_Printf("unbind <key> : remove commands from a key\n");
408  return;
409  }
410 
412  if (b == -1) {
413  Com_Printf("\"%s\" isn't a valid key\n", Cmd_Argv(1));
414  return;
415  }
416 
417  Key_SetBinding(b, NULL);
418 }
419 
420 /*
421 ===================
422 Key_Unbindall_f
423 ===================
424 */
425 static void Key_Unbindall_f(void)
426 {
427  int i;
428 
429  for (i = 0; i < 256; i++)
430  if (keybindings[i])
431  Key_SetBinding(i, NULL);
432 }
433 
434 
435 /*
436 ===================
437 Key_Bind_f
438 ===================
439 */
440 static void Key_Bind_f(void)
441 {
442  int c, b;
443 
444  c = Cmd_Argc();
445 
446  if (c < 2) {
447  Com_Printf("bind <key> [command] : attach a command to a key\n");
448  return;
449  }
451  if (b == -1) {
452  Com_Printf("\"%s\" isn't a valid key\n", Cmd_Argv(1));
453  return;
454  }
455 
456  if (c == 2) {
457  if (keybindings[b])
458  Com_Printf("\"%s\" = \"%s\"\n", Cmd_Argv(1), keybindings[b]);
459  else
460  Com_Printf("\"%s\" is not bound\n", Cmd_Argv(1));
461  return;
462  }
463 
464 // copy the rest of the command line
466 }
467 
468 /*
469 ============
470 Key_WriteBindings
471 
472 Writes lines containing "bind key value"
473 ============
474 */
475 void Key_WriteBindings(qhandle_t f)
476 {
477  int i;
478 
479  for (i = 0; i < 256; i++) {
480  if (keybindings[i] && keybindings[i][0]) {
481  FS_FPrintf(f, "bind %s \"%s\"\n", Key_KeynumToString(i),
482  keybindings[i]);
483  }
484  }
485 }
486 
487 
488 /*
489 ============
490 Key_Bindlist_f
491 
492 ============
493 */
494 static void Key_Bindlist_f(void)
495 {
496  int i;
497 
498  for (i = 0; i < 256; i++) {
499  if (keybindings[i] && keybindings[i][0]) {
500  Com_Printf("%s \"%s\"\n", Key_KeynumToString(i),
501  keybindings[i]);
502  }
503  }
504 }
505 
506 static cmdreg_t c_keys[] = {
507  { "bind", Key_Bind_f, Key_Bind_c },
508  { "unbind", Key_Unbind_f, Key_Unbind_c },
509  { "unbindall", Key_Unbindall_f },
510  { "bindlist", Key_Bindlist_f },
511 
512  { NULL }
513 };
514 
515 /*
516 ===================
517 Key_Init
518 ===================
519 */
520 void Key_Init(void)
521 {
522  int i;
523 
524 //
525 // init ascii characters in console mode
526 //
527  for (i = K_ASCIIFIRST; i <= K_ASCIILAST; i++)
528  Q_SetBit(consolekeys, i);
529 
530 #define K(x) \
531  Q_SetBit(consolekeys, K_##x)
532 
533  K(BACKSPACE);
534  K(TAB);
535  K(ENTER);
536 
537  K(UPARROW);
538  K(DOWNARROW);
539  K(LEFTARROW);
540  K(RIGHTARROW);
541 
542  K(ALT);
543  K(LALT);
544  K(RALT);
545  K(CTRL);
546  K(LCTRL);
547  K(RCTRL);
548  K(SHIFT);
549  K(LSHIFT);
550  K(RSHIFT);
551 
552  K(INS);
553  K(DEL);
554  K(PGDN);
555  K(PGUP);
556  K(HOME);
557  K(END);
558 
559  K(KP_HOME);
560  K(KP_UPARROW);
561  K(KP_PGUP);
562  K(KP_LEFTARROW);
563  K(KP_5);
564  K(KP_RIGHTARROW);
565  K(KP_END);
566  K(KP_DOWNARROW);
567  K(KP_PGDN);
568  K(KP_ENTER);
569  K(KP_INS);
570  K(KP_DEL);
571  K(KP_SLASH);
572  K(KP_MINUS);
573  K(KP_PLUS);
574  K(KP_MULTIPLY);
575 
576  K(MOUSE3);
577 
578  K(MWHEELUP);
579  K(MWHEELDOWN);
580 
581 #undef K
582 
583 //
584 // init ascii keyshift characters
585 //
586  for (i = 0; i < 256; i++)
587  keyshift[i] = i;
588  for (i = 'a'; i <= 'z'; i++)
589  keyshift[i] = i - 'a' + 'A';
590 
591  keyshift['1'] = '!';
592  keyshift['2'] = '@';
593  keyshift['3'] = '#';
594  keyshift['4'] = '$';
595  keyshift['5'] = '%';
596  keyshift['6'] = '^';
597  keyshift['7'] = '&';
598  keyshift['8'] = '*';
599  keyshift['9'] = '(';
600  keyshift['0'] = ')';
601  keyshift['-'] = '_';
602  keyshift['='] = '+';
603  keyshift[','] = '<';
604  keyshift['.'] = '>';
605  keyshift['/'] = '?';
606  keyshift[';'] = ':';
607  keyshift['\''] = '"';
608  keyshift['['] = '{';
609  keyshift[']'] = '}';
610  keyshift['`'] = '~';
611  keyshift['\\'] = '|';
612 
613 //
614 // register our functions
615 //
617 }
618 
619 /*
620 ===================
621 Key_Event
622 
623 Called by the system between frames for both key up and key down events
624 Should NOT be called during an interrupt!
625 ===================
626 */
627 void Key_Event(unsigned key, qboolean down, unsigned time)
628 {
629  char *kb;
630  char cmd[MAX_STRING_CHARS];
631 
632  if (key >= 256) {
633  Com_Error(ERR_FATAL, "%s: bad key", __func__);
634  }
635 
636  Com_DDDPrintf("%u: %c%s\n", time,
637  down ? '+' : '-', Key_KeynumToString(key));
638 
639  // hack for menu key binding
640  if (key_wait_cb && down && !key_wait_cb(key_wait_arg, key)) {
641  return;
642  }
643 
644  // update key down and auto-repeat status
645  if (down) {
646  if (keydown[key] < 255)
647  keydown[key]++;
648  } else {
649  keydown[key] = 0;
650  }
651 
652  // console key is hardcoded, so the user can never unbind it
653  if (!Key_IsDown(K_SHIFT) && (key == '`' || key == '~')) {
654  if (keydown[key] == 1) {
656  }
657  return;
658  }
659 
660  // Alt+Enter is hardcoded for all systems
661  if (Key_IsDown(K_ALT) && key == K_ENTER) {
662  if (keydown[key] == 1) {
664  }
665  return;
666  }
667 
668  // menu key is hardcoded, so the user can never unbind it
669  if (key == K_ESCAPE) {
670  if (!down) {
671  return;
672  }
673 
674  if (cls.key_dest == KEY_GAME &&
675  cl.frame.ps.stats[STAT_LAYOUTS] &&
676  cls.demo.playback == qfalse) {
677  if (keydown[key] == 2) {
678  // force main menu if escape is held
679  UI_OpenMenu(UIMENU_GAME);
680  } else if (keydown[key] == 1) {
681  // put away help computer / inventory
682  CL_ClientCommand("putaway");
683  }
684  return;
685  }
686 
687  // ignore autorepeats
688  if (keydown[key] > 1) {
689  return;
690  }
691 
692  if (cls.key_dest & KEY_CONSOLE) {
693  if (cls.state < ca_active && !(cls.key_dest & KEY_MENU)) {
694  UI_OpenMenu(UIMENU_MAIN);
695  } else {
696  Con_Close(qtrue);
697  }
698  } else if (cls.key_dest & KEY_MENU) {
699  UI_KeyEvent(key, down);
700  } else if (cls.key_dest & KEY_MESSAGE) {
701  Key_Message(key);
702  } else if (cls.state >= ca_active) {
703  UI_OpenMenu(UIMENU_GAME);
704  } else {
705  UI_OpenMenu(UIMENU_MAIN);
706  }
707  return;
708  }
709 
710  // track if any key is down for BUTTON_ANY
711  if (down) {
712  if (keydown[key] == 1)
713  anykeydown++;
714  } else {
715  anykeydown--;
716  if (anykeydown < 0)
717  anykeydown = 0;
718  }
719 
720  // hack for demo freelook in windowed mode
721  if (cls.key_dest == KEY_GAME && cls.demo.playback && key == K_SHIFT && keydown[key] <= 1) {
722  IN_Activate();
723  }
724 
725  // skip the rest of the cinematic
726  if (cls.key_dest == KEY_GAME && cls.state == ca_cinematic && down) {
728  }
729 
730  if (cls.key_dest == KEY_GAME)
731  {
732  if(R_InterceptKey(key, down))
733  return;
734  }
735 
736 //
737 // if not a consolekey, send to the interpreter no matter what mode is
738 //
739  if ((cls.key_dest == KEY_GAME) ||
740  ((cls.key_dest & KEY_CONSOLE) && !Q_IsBitSet(consolekeys, key)) ||
741  ((cls.key_dest & KEY_MENU) && (key >= K_F1 && key <= K_F12)) ||
742  (!down && Q_IsBitSet(buttondown, key))) {
743 //
744 // Key up events only generate commands if the game key binding is a button
745 // command (leading + sign). These will occur even in console mode, to keep the
746 // character from continuing an action started before a console switch. Button
747 // commands include the kenum as a parameter, so multiple downs can be matched
748 // with ups.
749 //
750  if (!down) {
751  kb = keybindings[key];
752  if (kb && kb[0] == '+') {
753  Q_snprintf(cmd, sizeof(cmd), "-%s %i %i\n",
754  kb + 1, key, time);
755  Cbuf_AddText(&cmd_buffer, cmd);
756  }
757  Q_ClearBit(buttondown, key);
758  return;
759  }
760 
761  // ignore autorepeats
762  if (keydown[key] > 1) {
763  return;
764  }
765 
766  // generate button up command when released
767  Q_SetBit(buttondown, key);
768 
769  kb = keybindings[key];
770  if (kb) {
771  if (kb[0] == '+') {
772  // button commands add keynum and time as a parm
773  Q_snprintf(cmd, sizeof(cmd), "%s %i %i\n", kb, key, time);
774  Cbuf_AddText(&cmd_buffer, cmd);
775  } else {
776  Cbuf_AddText(&cmd_buffer, kb);
777  Cbuf_AddText(&cmd_buffer, "\n");
778  }
779  }
780  return;
781  }
782 
783  if (cls.key_dest == KEY_GAME)
784  return;
785 
786  if (!down) {
787  if (cls.key_dest & KEY_MENU)
788  UI_KeyEvent(key, down);
789  return; // other subsystems only care about key down events
790  }
791 
792  if (cls.key_dest & KEY_CONSOLE) {
793  Key_Console(key);
794  } else if (cls.key_dest & KEY_MENU) {
795  UI_KeyEvent(key, down);
796  } else if (cls.key_dest & KEY_MESSAGE) {
797  Key_Message(key);
798  }
799 
800  if (Key_IsDown(K_CTRL) || Key_IsDown(K_ALT)) {
801  return;
802  }
803 
804  switch (key) {
805  case K_KP_SLASH:
806  key = '/';
807  break;
808  case K_KP_MULTIPLY:
809  key = '*';
810  break;
811  case K_KP_MINUS:
812  key = '-';
813  break;
814  case K_KP_PLUS:
815  key = '+';
816  break;
817  case K_KP_HOME:
818  key = '7';
819  break;
820  case K_KP_UPARROW:
821  key = '8';
822  break;
823  case K_KP_PGUP:
824  key = '9';
825  break;
826  case K_KP_LEFTARROW:
827  key = '4';
828  break;
829  case K_KP_5:
830  key = '5';
831  break;
832  case K_KP_RIGHTARROW:
833  key = '6';
834  break;
835  case K_KP_END:
836  key = '1';
837  break;
838  case K_KP_DOWNARROW:
839  key = '2';
840  break;
841  case K_KP_PGDN:
842  key = '3';
843  break;
844  case K_KP_INS:
845  key = '0';
846  break;
847  case K_KP_DEL:
848  key = '.';
849  break;
850  }
851 
852  // if key is printable, generate char events
853  if (key < 32 || key >= 127) {
854  return;
855  }
856 
857  if (Key_IsDown(K_SHIFT)) {
858  key = keyshift[key];
859  }
860 
861  if (cls.key_dest & KEY_CONSOLE) {
862  Char_Console(key);
863  } else if (cls.key_dest & KEY_MENU) {
864  UI_CharEvent(key);
865  } else if (cls.key_dest & KEY_MESSAGE) {
866  Char_Message(key);
867  }
868 }
869 
870 /*
871 ===================
872 Key_ClearStates
873 ===================
874 */
875 void Key_ClearStates(void)
876 {
877  int i;
878 
879  // hack for menu key binding
880  if (key_wait_cb) {
881  key_wait_cb(key_wait_arg, K_ESCAPE);
882  key_wait_cb = NULL;
883  }
884 
885  for (i = 0; i < 256; i++) {
886  if (keydown[i])
887  Key_Event(i, qfalse, com_eventTime);
888  }
889 
890  memset(buttondown, 0, sizeof(buttondown));
891  anykeydown = 0;
892 }
893 
894 /*
895 ===================
896 Key_WaitKey
897 ===================
898 */
899 void Key_WaitKey(keywaitcb_t wait, void *arg)
900 {
901  key_wait_cb = wait;
902  key_wait_arg = arg;
903 }
904 
client_state_s::frame
server_frame_t frame
Definition: client.h:212
keydown
static byte keydown[256]
Definition: keys.c:33
Key_GetBindingForKey
char * Key_GetBindingForKey(int keynum)
Definition: keys.c:310
R_InterceptKey
qboolean(* R_InterceptKey)(unsigned key, qboolean down)
Definition: refresh.c:428
Key_Bind_f
static void Key_Bind_f(void)
Definition: keys.c:440
client_static_s::playback
qhandle_t playback
Definition: client.h:453
Q_snprintf
size_t Q_snprintf(char *dest, size_t size, const char *fmt,...)
Definition: shared.c:846
c_keys
static cmdreg_t c_keys[]
Definition: keys.c:506
client_static_s::demo
struct client_static_s::@3 demo
key_wait_cb
static keywaitcb_t key_wait_cb
Definition: keys.c:21
Key_SetOverstrikeMode
void Key_SetOverstrikeMode(qboolean overstrike)
Definition: keys.c:158
Key_Console
void Key_Console(int key)
Definition: console.c:1137
keyname_s::keynum
int keynum
Definition: keys.c:45
keyname_s
Definition: keys.c:43
Key_SetDest
void Key_SetDest(keydest_t dest)
Definition: keys.c:178
client_static_s::key_dest
keydest_t key_dest
Definition: client.h:376
IN_Activate
void IN_Activate(void)
Definition: input.c:117
Key_Bindlist_f
static void Key_Bindlist_f(void)
Definition: keys.c:494
keyname_s::name
char * name
Definition: keys.c:44
anykeydown
static int anykeydown
Definition: keys.c:36
ca_active
@ ca_active
Definition: client.h:340
FS_FPrintf
ssize_t FS_FPrintf(qhandle_t f, const char *format,...)
Definition: files.c:2039
keyshift
static byte keyshift[256]
Definition: keys.c:30
client_static_s::state
connstate_t state
Definition: client.h:375
Key_GetOverstrikeMode
qboolean Key_GetOverstrikeMode(void)
Definition: keys.c:148
Key_Bind_c
static void Key_Bind_c(genctx_t *ctx, int argnum)
Definition: keys.c:381
Key_EnumBindings
int Key_EnumBindings(int key, const char *binding)
Definition: keys.c:320
Key_Init
void Key_Init(void)
Definition: keys.c:520
Key_Name_g
static void Key_Name_g(genctx_t *ctx)
Definition: keys.c:355
Cmd_Argv
char * Cmd_Argv(int arg)
Definition: cmd.c:899
Con_ToggleConsole_f
void Con_ToggleConsole_f(void)
Definition: console.c:194
Cmd_Argc
int Cmd_Argc(void)
Definition: cmd.c:889
Prompt_AddMatch
qboolean Prompt_AddMatch(genctx_t *ctx, const char *s)
Definition: prompt.c:149
cmd_buffer
cmdbuf_t cmd_buffer
Definition: cmd.c:49
Com_Generic_c
void Com_Generic_c(genctx_t *ctx, int argnum)
Definition: common.c:748
Cmd_ArgsFrom
char * Cmd_ArgsFrom(int from)
Definition: cmd.c:981
Com_Error
void Com_Error(error_type_t type, const char *fmt,...)
Definition: g_main.c:258
Key_Unbind_c
static void Key_Unbind_c(genctx_t *ctx, int argnum)
Definition: keys.c:390
buttondown
static byte buttondown[256/8]
Definition: keys.c:39
SCR_FinishCinematic
void SCR_FinishCinematic(void)
Definition: cin.c:105
Cbuf_AddText
void Cbuf_AddText(cmdbuf_t *buf, const char *text)
Definition: cmd.c:95
Z_Free
void Z_Free(void *ptr)
Definition: zone.c:147
Cmd_Register
void Cmd_Register(const cmdreg_t *reg)
Definition: cmd.c:1572
Key_IsDown
int Key_IsDown(int key)
Definition: keys.c:204
Key_SetBinding
void Key_SetBinding(int keynum, const char *binding)
Definition: keys.c:341
consolekeys
static byte consolekeys[256/8]
Definition: keys.c:27
Key_GetBinding
char * Key_GetBinding(const char *binding)
Definition: keys.c:288
CL_CheckForPause
void CL_CheckForPause(void)
Definition: main.c:3056
Con_Close
void Con_Close(qboolean force)
Definition: console.c:124
Key_KeynumToString
char * Key_KeynumToString(int keynum)
Definition: keys.c:259
UI_CharEvent
void UI_CharEvent(int key)
Definition: ui.c:528
Key_Message
void Key_Message(int key)
Definition: console.c:1241
UI_OpenMenu
void UI_OpenMenu(uiMenu_t type)
Definition: ui.c:208
Char_Console
void Char_Console(int key)
Definition: console.c:1229
Key_Unbindall_f
static void Key_Unbindall_f(void)
Definition: keys.c:425
cl
client_state_t cl
Definition: main.c:99
key_overstrike
static qboolean key_overstrike
Definition: keys.c:41
K
#define K(x)
Definition: keys.c:48
cls
client_static_t cls
Definition: main.c:98
ca_cinematic
@ ca_cinematic
Definition: client.h:341
VID_ToggleFullscreen
void VID_ToggleFullscreen(void)
Definition: refresh.c:204
c
statCounters_t c
Definition: main.c:30
Key_StringToKeynum
int Key_StringToKeynum(const char *str)
Definition: keys.c:234
Key_Event
void Key_Event(unsigned key, qboolean down, unsigned time)
Definition: keys.c:627
Key_GetDest
keydest_t Key_GetDest(void)
Definition: keys.c:168
server_frame_t::ps
player_state_t ps
Definition: client.h:137
Key_WriteBindings
void Key_WriteBindings(qhandle_t f)
Definition: keys.c:475
diff
static q_noinline int diff(uint32_t A_u32, uint32_t B_u32)
Definition: hq2x.c:55
client.h
Key_Bound_g
static void Key_Bound_g(genctx_t *ctx)
Definition: keys.c:367
CL_ClientCommand
void CL_ClientCommand(const char *string)
Definition: main.c:299
key_wait_arg
static void * key_wait_arg
Definition: keys.c:22
UI_KeyEvent
void UI_KeyEvent(int key, qboolean down)
Definition: ui.c:503
Key_ClearStates
void Key_ClearStates(void)
Definition: keys.c:875
Key_AnyKeyDown
int Key_AnyKeyDown(void)
Definition: keys.c:220
keynames
static const keyname_t keynames[]
Definition: keys.c:50
Char_Message
void Char_Message(int key)
Definition: console.c:1289
keybindings
static char * keybindings[256]
Definition: keys.c:24
Key_WaitKey
void Key_WaitKey(keywaitcb_t wait, void *arg)
Definition: keys.c:899
Key_Unbind_f
static void Key_Unbind_f(void)
Definition: keys.c:402
keyname_t
struct keyname_s keyname_t
com_eventTime
unsigned com_eventTime
Definition: common.c:122