Fix setinfo.
[xonotic/darkplaces.git] / keys.h
diff --git a/keys.h b/keys.h
index 343b311..7841e9d 100644 (file)
--- a/keys.h
+++ b/keys.h
@@ -32,8 +32,9 @@
 //
 // these are the key numbers that should be passed to Key_Event
 //
-extern enum keynum_e
+typedef enum keynum_e
 {
+       K_TEXT                  = 1, // used only for unicode character input
        K_TAB                   = 9,
        K_ENTER                 = 13,
        K_ESCAPE                = 27,
@@ -50,6 +51,7 @@ extern enum keynum_e
        K_ALT,
        K_CTRL,
        K_SHIFT,
+
        K_F1,
        K_F2,
        K_F3,
@@ -62,6 +64,7 @@ extern enum keynum_e
        K_F10,
        K_F11,
        K_F12,
+
        K_INS,
        K_DEL,
        K_PGDN,
@@ -104,15 +107,18 @@ extern enum keynum_e
        K_KP_ENTER,
        K_KP_EQUALS,
 
+       K_PRINTSCREEN,
+
        // mouse buttons generate virtual keys
 
        K_MOUSE1 = 512,
+       K_OTHERDEVICESBEGIN = K_MOUSE1,
        K_MOUSE2,
        K_MOUSE3,
+       K_MWHEELUP,
+       K_MWHEELDOWN,
        K_MOUSE4,
-       K_MWHEELUP              = K_MOUSE4,
        K_MOUSE5,
-       K_MWHEELDOWN    = K_MOUSE5,
        K_MOUSE6,
        K_MOUSE7,
        K_MOUSE8,
@@ -182,17 +188,174 @@ extern enum keynum_e
        K_AUX31,
        K_AUX32,
 
+       // Microsoft Xbox 360 Controller For Windows
+       K_X360_DPAD_UP,
+       K_X360_DPAD_DOWN,
+       K_X360_DPAD_LEFT,
+       K_X360_DPAD_RIGHT,
+       K_X360_START,
+       K_X360_BACK,
+       K_X360_LEFT_THUMB,
+       K_X360_RIGHT_THUMB,
+       K_X360_LEFT_SHOULDER,
+       K_X360_RIGHT_SHOULDER,
+       K_X360_A,
+       K_X360_B,
+       K_X360_X,
+       K_X360_Y,
+       K_X360_LEFT_TRIGGER,
+       K_X360_RIGHT_TRIGGER,
+       K_X360_LEFT_THUMB_UP,
+       K_X360_LEFT_THUMB_DOWN,
+       K_X360_LEFT_THUMB_LEFT,
+       K_X360_LEFT_THUMB_RIGHT,
+       K_X360_RIGHT_THUMB_UP,
+       K_X360_RIGHT_THUMB_DOWN,
+       K_X360_RIGHT_THUMB_LEFT,
+       K_X360_RIGHT_THUMB_RIGHT,
+
+       // generic joystick emulation for menu
+       K_JOY_UP,
+       K_JOY_DOWN,
+       K_JOY_LEFT,
+       K_JOY_RIGHT,
+
+       K_MIDINOTE0 = 896, // to this, the note number is added
+       K_MIDINOTE1,
+       K_MIDINOTE2,
+       K_MIDINOTE3,
+       K_MIDINOTE4,
+       K_MIDINOTE5,
+       K_MIDINOTE6,
+       K_MIDINOTE7,
+       K_MIDINOTE8,
+       K_MIDINOTE9,
+       K_MIDINOTE10,
+       K_MIDINOTE11,
+       K_MIDINOTE12,
+       K_MIDINOTE13,
+       K_MIDINOTE14,
+       K_MIDINOTE15,
+       K_MIDINOTE16,
+       K_MIDINOTE17,
+       K_MIDINOTE18,
+       K_MIDINOTE19,
+       K_MIDINOTE20,
+       K_MIDINOTE21,
+       K_MIDINOTE22,
+       K_MIDINOTE23,
+       K_MIDINOTE24,
+       K_MIDINOTE25,
+       K_MIDINOTE26,
+       K_MIDINOTE27,
+       K_MIDINOTE28,
+       K_MIDINOTE29,
+       K_MIDINOTE30,
+       K_MIDINOTE31,
+       K_MIDINOTE32,
+       K_MIDINOTE33,
+       K_MIDINOTE34,
+       K_MIDINOTE35,
+       K_MIDINOTE36,
+       K_MIDINOTE37,
+       K_MIDINOTE38,
+       K_MIDINOTE39,
+       K_MIDINOTE40,
+       K_MIDINOTE41,
+       K_MIDINOTE42,
+       K_MIDINOTE43,
+       K_MIDINOTE44,
+       K_MIDINOTE45,
+       K_MIDINOTE46,
+       K_MIDINOTE47,
+       K_MIDINOTE48,
+       K_MIDINOTE49,
+       K_MIDINOTE50,
+       K_MIDINOTE51,
+       K_MIDINOTE52,
+       K_MIDINOTE53,
+       K_MIDINOTE54,
+       K_MIDINOTE55,
+       K_MIDINOTE56,
+       K_MIDINOTE57,
+       K_MIDINOTE58,
+       K_MIDINOTE59,
+       K_MIDINOTE60,
+       K_MIDINOTE61,
+       K_MIDINOTE62,
+       K_MIDINOTE63,
+       K_MIDINOTE64,
+       K_MIDINOTE65,
+       K_MIDINOTE66,
+       K_MIDINOTE67,
+       K_MIDINOTE68,
+       K_MIDINOTE69,
+       K_MIDINOTE70,
+       K_MIDINOTE71,
+       K_MIDINOTE72,
+       K_MIDINOTE73,
+       K_MIDINOTE74,
+       K_MIDINOTE75,
+       K_MIDINOTE76,
+       K_MIDINOTE77,
+       K_MIDINOTE78,
+       K_MIDINOTE79,
+       K_MIDINOTE80,
+       K_MIDINOTE81,
+       K_MIDINOTE82,
+       K_MIDINOTE83,
+       K_MIDINOTE84,
+       K_MIDINOTE85,
+       K_MIDINOTE86,
+       K_MIDINOTE87,
+       K_MIDINOTE88,
+       K_MIDINOTE89,
+       K_MIDINOTE90,
+       K_MIDINOTE91,
+       K_MIDINOTE92,
+       K_MIDINOTE93,
+       K_MIDINOTE94,
+       K_MIDINOTE95,
+       K_MIDINOTE96,
+       K_MIDINOTE97,
+       K_MIDINOTE98,
+       K_MIDINOTE99,
+       K_MIDINOTE100,
+       K_MIDINOTE101,
+       K_MIDINOTE102,
+       K_MIDINOTE103,
+       K_MIDINOTE104,
+       K_MIDINOTE105,
+       K_MIDINOTE106,
+       K_MIDINOTE107,
+       K_MIDINOTE108,
+       K_MIDINOTE109,
+       K_MIDINOTE110,
+       K_MIDINOTE111,
+       K_MIDINOTE112,
+       K_MIDINOTE113,
+       K_MIDINOTE114,
+       K_MIDINOTE115,
+       K_MIDINOTE116,
+       K_MIDINOTE117,
+       K_MIDINOTE118,
+       K_MIDINOTE119,
+       K_MIDINOTE120,
+       K_MIDINOTE121,
+       K_MIDINOTE122,
+       K_MIDINOTE123,
+       K_MIDINOTE124,
+       K_MIDINOTE125,
+       K_MIDINOTE126,
+       K_MIDINOTE127,
+
+       MAX_KEYS
 }
 keynum_t;
 
-typedef enum keydest_e { key_game, key_message, key_menu } keydest_t;
+typedef enum keydest_e { key_game, key_message, key_menu, key_menu_grabbed, key_console, key_void } keydest_t;
 
-#define MAX_INPUTLINES 32
-#define MAX_BINDMAPS 8
-#define MAX_KEYS 1024
-extern int                     edit_line;
-extern int                     history_line;
-extern char            key_lines[MAX_INPUTLINES][MAX_INPUTLINE];
+extern char            key_line[MAX_INPUTLINE];
 extern int                     key_linepos;
 extern qboolean        key_insert;     // insert key toggle (for editing)
 extern keydest_t       key_dest;
@@ -204,17 +367,25 @@ extern    keydest_t       key_dest;
 extern int                     key_consoleactive;
 extern char            *keybindings[MAX_BINDMAPS][MAX_KEYS];
 
-extern void Key_ClearEditLine(int edit_line);
-extern qboolean chat_team;
+extern int chat_mode; // 0 for say, 1 for say_team, -1 for command
 extern char chat_buffer[MAX_INPUTLINE];
 extern unsigned int chat_bufferlen;
 
+void Key_ClearEditLine(int edit_line);
 void Key_WriteBindings(qfile_t *f);
 void Key_Init(void);
+void Key_Shutdown(void);
 void Key_Init_Cvars(void);
-void Key_Event(int key, char ascii, qboolean down);
-void Key_ClearStates (void);
-void Key_SetBinding (int keynum, int bindmap, const char *binding);
+void Key_Event(int key, int ascii, qboolean down);
+void Key_ReleaseAll (void);
+void Key_EventQueue_Block(void);
+void Key_EventQueue_Unblock(void);
+
+qboolean Key_SetBinding (int keynum, int bindmap, const char *binding);
+const char *Key_GetBind (int key, int bindmap);
+void Key_FindKeysForCommand (const char *command, int *keys, int numkeys, int bindmap);
+qboolean Key_SetBindMap(int fg, int bg);
+void Key_GetBindMap(int *fg, int *bg);
 
 #endif // __KEYS_H