diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index fd24a6623..e08ba00a8 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -120,9 +120,14 @@ void CInput::ClearKeyStates() mem_zero(m_aInputCount, sizeof(m_aInputCount)); } -int CInput::KeyState(int Key) +int CInput::KeyState(int Key) const { - return m_aInputState[m_InputCurrent][Key]; + return m_aInputState[m_InputCurrent][Key>=KEY_MOUSE_1 ? Key : SDL_GetScancodeFromKey(KeyToKeycode(Key))]; +} + +int CInput::KeyStateOld(int Key) const +{ + return m_aInputState[m_InputCurrent^1][Key>=KEY_MOUSE_1 ? Key : SDL_GetScancodeFromKey(KeyToKeycode(Key))]; } int CInput::Update() @@ -162,6 +167,7 @@ int CInput::Update() while(SDL_PollEvent(&Event)) { int Key = -1; + int Scancode = 0; int Action = IInput::FLAG_PRESS; switch (Event.type) { @@ -181,15 +187,13 @@ int CInput::Update() } // handle keys case SDL_KEYDOWN: - if(Event.key.keysym.sym == KEY_UNKNOWN) - continue; - Key = Event.key.keysym.scancode; + Key = KeycodeToKey(Event.key.keysym.sym); + Scancode = Event.key.keysym.scancode; break; case SDL_KEYUP: - if(Event.key.keysym.sym == KEY_UNKNOWN) - continue; Action = IInput::FLAG_RELEASE; - Key = Event.key.keysym.scancode; + Key = KeycodeToKey(Event.key.keysym.sym); + Scancode = Event.key.keysym.scancode; break; // handle mouse buttons @@ -213,6 +217,7 @@ int CInput::Update() if(Event.button.button == 7) Key = KEY_MOUSE_7; // ignore_convention if(Event.button.button == 8) Key = KEY_MOUSE_8; // ignore_convention if(Event.button.button == 9) Key = KEY_MOUSE_9; // ignore_convention + Scancode = Key; break; case SDL_MOUSEWHEEL: @@ -233,12 +238,11 @@ int CInput::Update() #endif } - // if(Key >= 0 && Key < 1024) { m_aInputCount[m_InputCurrent][Key].m_Presses++; if(Action == IInput::FLAG_PRESS) - m_aInputState[m_InputCurrent][Key] = 1; + m_aInputState[m_InputCurrent][Scancode] = 1; AddEvent(0, Key, Action); } diff --git a/src/engine/client/input.h b/src/engine/client/input.h index 7df5575c4..d3f16bbe5 100644 --- a/src/engine/client/input.h +++ b/src/engine/client/input.h @@ -24,6 +24,15 @@ public: virtual void Init(); + int KeyState(int Key) const; + int KeyStateOld(int Key) const; + int KeyWasPressed(int Key) const { return KeyStateOld(Key); } + + int KeyPressed(int Key) const { return KeyState(Key); } + int KeyReleases(int Key) const { return m_aInputCount[m_InputCurrent][Key].m_Releases; } + int KeyPresses(int Key) const { return m_aInputCount[m_InputCurrent][Key].m_Presses; } + int KeyDown(int Key) const { return KeyPressed(Key)&&!KeyWasPressed(Key); } + virtual void MouseRelative(float *x, float *y); virtual void MouseModeAbsolute(); virtual void MouseModeRelative(); @@ -32,7 +41,6 @@ public: virtual void SetClipboardText(const char *Text); void ClearKeyStates(); - int KeyState(int Key); int ButtonPressed(int Button) { return m_aInputState[m_InputCurrent][Button]; } diff --git a/src/engine/client/keynames.h b/src/engine/client/keynames.h index 0968398f7..de98b03ad 100644 --- a/src/engine/client/keynames.h +++ b/src/engine/client/keynames.h @@ -4,14 +4,105 @@ #error do not include this header! #endif -#include - const char g_aaKeyStrings[512][20] = { "unknown", "&1", "&2", "&3", + "&4", + "&5", + "&6", + "&7", + "backspace", + "tab", + "&10", + "&11", + "&12", + "return", + "&14", + "&15", + "&16", + "&17", + "&18", + "&19", + "&20", + "&21", + "&22", + "&23", + "&24", + "&25", + "&26", + "escape", + "&28", + "&29", + "&30", + "&31", + "space", + "exclaim", + "quotedbl", + "hash", + "dollar", + "percent", + "ampersand", + "quote", + "leftparen", + "rightparen", + "asterix", + "plus", + "comma", + "minus", + "period", + "slash", + "0", + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "colon", + "semicolon", + "less", + "equals", + "greater", + "question", + "at", + "&65", + "&66", + "&67", + "&68", + "&69", + "&70", + "&71", + "&72", + "&73", + "&74", + "&75", + "&76", + "&77", + "&78", + "&79", + "&80", + "&81", + "&82", + "&83", + "&84", + "&85", + "&86", + "&87", + "&88", + "&89", + "&90", + "leftbracket", + "backslash", + "rightbracket", + "caret", + "underscore", + "backquote", "a", "b", "c", @@ -38,33 +129,68 @@ const char g_aaKeyStrings[512][20] = "x", "y", "z", - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "0", - "return", - "escape", - "backspace", - "tab", - "space", - "minus", - "equals", - "leftbracket", - "rightbracket", - "backslash", - "nonushash", - "semicolon", - "apostrophe", - "grave", - "comma", - "period", - "slash", + "&123", + "&124", + "&125", + "&126", + "delete", + "&128", + "&129", + "&130", + "&131", + "&132", + "&133", + "&134", + "&135", + "&136", + "&137", + "&138", + "&139", + "&140", + "&141", + "&142", + "&143", + "&144", + "&145", + "&146", + "&147", + "&148", + "&149", + "&150", + "&151", + "&152", + "&153", + "&154", + "&155", + "&156", + "&157", + "&158", + "&159", + "&160", + "&161", + "&162", + "&163", + "&164", + "&165", + "&166", + "&167", + "&168", + "&169", + "&170", + "&171", + "&172", + "&173", + "&174", + "&175", + "&176", + "&177", + "&178", + "&179", + "&180", + "&181", + "&182", + "&183", + "&184", "capslock", "f1", "f2", @@ -84,7 +210,7 @@ const char g_aaKeyStrings[512][20] = "insert", "home", "pageup", - "delete", + "&204", "end", "pagedown", "right", @@ -108,7 +234,7 @@ const char g_aaKeyStrings[512][20] = "kp_9", "kp_0", "kp_period", - "nonusbackslash", + "&228", "application", "power", "kp_equals", @@ -138,29 +264,29 @@ const char g_aaKeyStrings[512][20] = "mute", "volumeup", "volumedown", - "&130", - "&131", - "&132", + "&258", + "&259", + "&260", "kp_comma", "kp_equalsas400", - "international1", - "international2", - "international3", - "international4", - "international5", - "international6", - "international7", - "international8", - "international9", - "lang1", - "lang2", - "lang3", - "lang4", - "lang5", - "lang6", - "lang7", - "lang8", - "lang9", + "&263", + "&264", + "&265", + "&266", + "&267", + "&268", + "&269", + "&270", + "&271", + "&272", + "&273", + "&274", + "&275", + "&276", + "&277", + "&278", + "&279", + "&280", "alterase", "sysreq", "cancel", @@ -173,17 +299,17 @@ const char g_aaKeyStrings[512][20] = "clearagain", "crsel", "exsel", - "&165", - "&166", - "&167", - "&168", - "&169", - "&170", - "&171", - "&172", - "&173", - "&174", - "&175", + "&293", + "&294", + "&295", + "&296", + "&297", + "&298", + "&299", + "&300", + "&301", + "&302", + "&303", "kp_00", "kp_000", "thousandsseparator", @@ -230,8 +356,8 @@ const char g_aaKeyStrings[512][20] = "kp_octal", "kp_decimal", "kp_hexadecimal", - "&222", - "&223", + "&350", + "&351", "lctrl", "lshift", "lalt", @@ -240,134 +366,6 @@ const char g_aaKeyStrings[512][20] = "rshift", "ralt", "rgui", - "&232", - "&233", - "&234", - "&235", - "&236", - "&237", - "&238", - "&239", - "&240", - "&241", - "&242", - "&243", - "&244", - "&245", - "&246", - "&247", - "&248", - "&249", - "&250", - "&251", - "&252", - "&253", - "&254", - "&255", - "&256", - "mode", - "audionext", - "audioprev", - "audiostop", - "audioplay", - "audiomute", - "mediaselect", - "www", - "mail", - "calculator", - "computer", - "ac_search", - "ac_home", - "ac_back", - "ac_forward", - "ac_stop", - "ac_refresh", - "ac_bookmarks", - "brightnessdown", - "brightnessup", - "displayswitch", - "kbdillumtoggle", - "kbdillumdown", - "kbdillumup", - "eject", - "sleep", - "app1", - "app2", - "mouse1", - "mouse2", - "mouse3", - "mouse4", - "mouse5", - "mouse6", - "mouse7", - "mouse8", - "mousewheelup", - "mousewheeldown", - "mouse9", - "&296", - "&297", - "&298", - "&299", - "&300", - "&301", - "&302", - "&303", - "&304", - "&305", - "&306", - "&307", - "&308", - "&309", - "&310", - "&311", - "&312", - "&313", - "&314", - "&315", - "&316", - "&317", - "&318", - "&319", - "&320", - "&321", - "&322", - "&323", - "&324", - "&325", - "&326", - "&327", - "&328", - "&329", - "&330", - "&331", - "&332", - "&333", - "&334", - "&335", - "&336", - "&337", - "&338", - "&339", - "&340", - "&341", - "&342", - "&343", - "&344", - "&345", - "&346", - "&347", - "&348", - "&349", - "&350", - "&351", - "&352", - "&353", - "&354", - "&355", - "&356", - "&357", - "&358", - "&359", "&360", "&361", "&362", @@ -393,43 +391,43 @@ const char g_aaKeyStrings[512][20] = "&382", "&383", "&384", - "&385", - "&386", - "&387", - "&388", - "&389", - "&390", - "&391", - "&392", - "&393", - "&394", - "&395", - "&396", - "&397", - "&398", - "&399", - "&400", - "&401", - "&402", - "&403", - "&404", - "&405", - "&406", - "&407", - "&408", - "&409", - "&410", - "&411", - "&412", - "&413", - "&414", - "&415", - "&416", - "&417", - "&418", - "&419", - "&420", - "&421", + "mode", + "audionext", + "audioprev", + "audiostop", + "audioplay", + "audiomute", + "mediaselect", + "www", + "mail", + "calculator", + "computer", + "ac_search", + "ac_home", + "ac_back", + "ac_forward", + "ac_stop", + "ac_refresh", + "ac_bookmarks", + "brightnessdown", + "brightnessup", + "displayswitch", + "kbdillumtoggle", + "kbdillumdown", + "kpdillumup", + "eject", + "sleep", + "mouse1", + "mouse2", + "mouse3", + "mouse4", + "mouse5", + "mouse6", + "mouse7", + "mouse8", + "mouse9", + "mousewheelup", + "mousewheeldown", "&422", "&423", "&424", diff --git a/src/engine/input.h b/src/engine/input.h index f3bf54a67..f712434f0 100644 --- a/src/engine/input.h +++ b/src/engine/input.h @@ -40,8 +40,6 @@ protected: int m_InputCurrent; bool m_InputDispatched; - int KeyWasPressed(int Key) { return m_aInputState[m_InputCurrent^1][Key]; } - public: enum { @@ -68,10 +66,10 @@ public: } // keys - int KeyPressed(int Key) { return m_aInputState[m_InputCurrent][Key]; } - int KeyReleases(int Key) { return m_aInputCount[m_InputCurrent][Key].m_Releases; } - int KeyPresses(int Key) { return m_aInputCount[m_InputCurrent][Key].m_Presses; } - int KeyDown(int Key) { return KeyPressed(Key)&&!KeyWasPressed(Key); } + virtual int KeyPressed(int Key) const = 0; + virtual int KeyReleases(int Key) const = 0; + virtual int KeyPresses(int Key) const = 0; + virtual int KeyDown(int Key) const = 0; const char *KeyName(int Key) { return (Key >= 0 && Key < 512) ? g_aaKeyStrings[Key] : g_aaKeyStrings[0]; } // diff --git a/src/engine/keys.h b/src/engine/keys.h index cd60bc4e7..9f3770945 100644 --- a/src/engine/keys.h +++ b/src/engine/keys.h @@ -8,258 +8,256 @@ enum { KEY_FIRST = 0, KEY_UNKNOWN = 0, - KEY_A = 4, - KEY_B = 5, - KEY_C = 6, - KEY_D = 7, - KEY_E = 8, - KEY_F = 9, - KEY_G = 10, - KEY_H = 11, - KEY_I = 12, - KEY_J = 13, - KEY_K = 14, - KEY_L = 15, - KEY_M = 16, - KEY_N = 17, - KEY_O = 18, - KEY_P = 19, - KEY_Q = 20, - KEY_R = 21, - KEY_S = 22, - KEY_T = 23, - KEY_U = 24, - KEY_V = 25, - KEY_W = 26, - KEY_X = 27, - KEY_Y = 28, - KEY_Z = 29, - KEY_1 = 30, - KEY_2 = 31, - KEY_3 = 32, - KEY_4 = 33, - KEY_5 = 34, - KEY_6 = 35, - KEY_7 = 36, - KEY_8 = 37, - KEY_9 = 38, - KEY_0 = 39, - KEY_RETURN = 40, - KEY_ESCAPE = 41, - KEY_BACKSPACE = 42, - KEY_TAB = 43, - KEY_SPACE = 44, + KEY_BACKSPACE = 8, + KEY_TAB = 9, + KEY_RETURN = 13, + KEY_ESCAPE = 27, + KEY_SPACE = 32, + KEY_EXCLAIM = 33, + KEY_QUOTEDBL = 34, + KEY_HASH = 35, + KEY_DOLLAR = 36, + KEY_PERCENT = 37, + KEY_AMPERSAND = 38, + KEY_QUOTE = 39, + KEY_LEFTPAREN = 40, + KEY_RIGHTPAREN = 41, + KEY_ASTERISK = 42, + KEY_PLUS = 43, + KEY_COMMA = 44, KEY_MINUS = 45, - KEY_EQUALS = 46, - KEY_LEFTBRACKET = 47, - KEY_RIGHTBRACKET = 48, - KEY_BACKSLASH = 49, - KEY_NONUSHASH = 50, - KEY_SEMICOLON = 51, - KEY_APOSTROPHE = 52, - KEY_GRAVE = 53, - KEY_COMMA = 54, - KEY_PERIOD = 55, - KEY_SLASH = 56, - KEY_CAPSLOCK = 57, - KEY_F1 = 58, - KEY_F2 = 59, - KEY_F3 = 60, - KEY_F4 = 61, - KEY_F5 = 62, - KEY_F6 = 63, - KEY_F7 = 64, - KEY_F8 = 65, - KEY_F9 = 66, - KEY_F10 = 67, - KEY_F11 = 68, - KEY_F12 = 69, - KEY_PRINTSCREEN = 70, - KEY_SCROLLLOCK = 71, - KEY_PAUSE = 72, - KEY_INSERT = 73, - KEY_HOME = 74, - KEY_PAGEUP = 75, - KEY_DELETE = 76, - KEY_END = 77, - KEY_PAGEDOWN = 78, - KEY_RIGHT = 79, - KEY_LEFT = 80, - KEY_DOWN = 81, - KEY_UP = 82, - KEY_NUMLOCKCLEAR = 83, - KEY_KP_DIVIDE = 84, - KEY_KP_MULTIPLY = 85, - KEY_KP_MINUS = 86, - KEY_KP_PLUS = 87, - KEY_KP_ENTER = 88, - KEY_KP_1 = 89, - KEY_KP_2 = 90, - KEY_KP_3 = 91, - KEY_KP_4 = 92, - KEY_KP_5 = 93, - KEY_KP_6 = 94, - KEY_KP_7 = 95, - KEY_KP_8 = 96, - KEY_KP_9 = 97, - KEY_KP_0 = 98, - KEY_KP_PERIOD = 99, - KEY_NONUSBACKSLASH = 100, - KEY_APPLICATION = 101, - KEY_POWER = 102, - KEY_KP_EQUALS = 103, - KEY_F13 = 104, - KEY_F14 = 105, - KEY_F15 = 106, - KEY_F16 = 107, - KEY_F17 = 108, - KEY_F18 = 109, - KEY_F19 = 110, - KEY_F20 = 111, - KEY_F21 = 112, - KEY_F22 = 113, - KEY_F23 = 114, - KEY_F24 = 115, - KEY_EXECUTE = 116, - KEY_HELP = 117, - KEY_MENU = 118, - KEY_SELECT = 119, - KEY_STOP = 120, - KEY_AGAIN = 121, - KEY_UNDO = 122, - KEY_CUT = 123, - KEY_COPY = 124, - KEY_PASTE = 125, - KEY_FIND = 126, - KEY_MUTE = 127, - KEY_VOLUMEUP = 128, - KEY_VOLUMEDOWN = 129, - KEY_KP_COMMA = 133, - KEY_KP_EQUALSAS400 = 134, - KEY_INTERNATIONAL1 = 135, - KEY_INTERNATIONAL2 = 136, - KEY_INTERNATIONAL3 = 137, - KEY_INTERNATIONAL4 = 138, - KEY_INTERNATIONAL5 = 139, - KEY_INTERNATIONAL6 = 140, - KEY_INTERNATIONAL7 = 141, - KEY_INTERNATIONAL8 = 142, - KEY_INTERNATIONAL9 = 143, - KEY_LANG1 = 144, - KEY_LANG2 = 145, - KEY_LANG3 = 146, - KEY_LANG4 = 147, - KEY_LANG5 = 148, - KEY_LANG6 = 149, - KEY_LANG7 = 150, - KEY_LANG8 = 151, - KEY_LANG9 = 152, - KEY_ALTERASE = 153, - KEY_SYSREQ = 154, - KEY_CANCEL = 155, - KEY_CLEAR = 156, - KEY_PRIOR = 157, - KEY_RETURN2 = 158, - KEY_SEPARATOR = 159, - KEY_OUT = 160, - KEY_OPER = 161, - KEY_CLEARAGAIN = 162, - KEY_CRSEL = 163, - KEY_EXSEL = 164, - KEY_KP_00 = 176, - KEY_KP_000 = 177, - KEY_THOUSANDSSEPARATOR = 178, - KEY_DECIMALSEPARATOR = 179, - KEY_CURRENCYUNIT = 180, - KEY_CURRENCYSUBUNIT = 181, - KEY_KP_LEFTPAREN = 182, - KEY_KP_RIGHTPAREN = 183, - KEY_KP_LEFTBRACE = 184, - KEY_KP_RIGHTBRACE = 185, - KEY_KP_TAB = 186, - KEY_KP_BACKSPACE = 187, - KEY_KP_A = 188, - KEY_KP_B = 189, - KEY_KP_C = 190, - KEY_KP_D = 191, - KEY_KP_E = 192, - KEY_KP_F = 193, - KEY_KP_XOR = 194, - KEY_KP_POWER = 195, - KEY_KP_PERCENT = 196, - KEY_KP_LESS = 197, - KEY_KP_GREATER = 198, - KEY_KP_AMPERSAND = 199, - KEY_KP_DBLAMPERSAND = 200, - KEY_KP_VERTICALBAR = 201, - KEY_KP_DBLVERTICALBAR = 202, - KEY_KP_COLON = 203, - KEY_KP_HASH = 204, - KEY_KP_SPACE = 205, - KEY_KP_AT = 206, - KEY_KP_EXCLAM = 207, - KEY_KP_MEMSTORE = 208, - KEY_KP_MEMRECALL = 209, - KEY_KP_MEMCLEAR = 210, - KEY_KP_MEMADD = 211, - KEY_KP_MEMSUBTRACT = 212, - KEY_KP_MEMMULTIPLY = 213, - KEY_KP_MEMDIVIDE = 214, - KEY_KP_PLUSMINUS = 215, - KEY_KP_CLEAR = 216, - KEY_KP_CLEARENTRY = 217, - KEY_KP_BINARY = 218, - KEY_KP_OCTAL = 219, - KEY_KP_DECIMAL = 220, - KEY_KP_HEXADECIMAL = 221, - KEY_LCTRL = 224, - KEY_LSHIFT = 225, - KEY_LALT = 226, - KEY_LGUI = 227, - KEY_RCTRL = 228, - KEY_RSHIFT = 229, - KEY_RALT = 230, - KEY_RGUI = 231, - KEY_MODE = 257, - KEY_AUDIONEXT = 258, - KEY_AUDIOPREV = 259, - KEY_AUDIOSTOP = 260, - KEY_AUDIOPLAY = 261, - KEY_AUDIOMUTE = 262, - KEY_MEDIASELECT = 263, - KEY_WWW = 264, - KEY_MAIL = 265, - KEY_CALCULATOR = 266, - KEY_COMPUTER = 267, - KEY_AC_SEARCH = 268, - KEY_AC_HOME = 269, - KEY_AC_BACK = 270, - KEY_AC_FORWARD = 271, - KEY_AC_STOP = 272, - KEY_AC_REFRESH = 273, - KEY_AC_BOOKMARKS = 274, - KEY_BRIGHTNESSDOWN = 275, - KEY_BRIGHTNESSUP = 276, - KEY_DISPLAYSWITCH = 277, - KEY_KBDILLUMTOGGLE = 278, - KEY_KBDILLUMDOWN = 279, - KEY_KBDILLUMUP = 280, - KEY_EJECT = 281, - KEY_SLEEP = 282, - KEY_APP1 = 283, - KEY_APP2 = 284, - KEY_MOUSE_1 = 285, - KEY_MOUSE_2 = 286, - KEY_MOUSE_3 = 287, - KEY_MOUSE_4 = 288, - KEY_MOUSE_5 = 289, - KEY_MOUSE_6 = 290, - KEY_MOUSE_7 = 291, - KEY_MOUSE_8 = 292, - KEY_MOUSE_WHEEL_UP = 293, - KEY_MOUSE_WHEEL_DOWN = 294, - KEY_MOUSE_9 = 295, - KEY_LAST = 512, + KEY_PERIOD = 46, + KEY_SLASH = 47, + KEY_0 = 48, + KEY_1 = 49, + KEY_2 = 50, + KEY_3 = 51, + KEY_4 = 52, + KEY_5 = 53, + KEY_6 = 54, + KEY_7 = 55, + KEY_8 = 56, + KEY_9 = 57, + KEY_COLON = 58, + KEY_SEMICOLON = 59, + KEY_LESS = 60, + KEY_EQUALS = 61, + KEY_GREATER = 62, + KEY_QUESTION = 63, + KEY_AT = 64, + KEY_LEFTBRACKET = 91, + KEY_BACKSLASH = 92, + KEY_RIGHTBRACKET = 93, + KEY_CARET = 94, + KEY_UNDERSCORE = 95, + KEY_BACKQUOTE = 96, + KEY_A = 97, + KEY_B = 98, + KEY_C = 99, + KEY_D = 100, + KEY_E = 101, + KEY_F = 102, + KEY_G = 103, + KEY_H = 104, + KEY_I = 105, + KEY_J = 106, + KEY_K = 107, + KEY_L = 108, + KEY_M = 109, + KEY_N = 110, + KEY_O = 111, + KEY_P = 112, + KEY_Q = 113, + KEY_R = 114, + KEY_S = 115, + KEY_T = 116, + KEY_U = 117, + KEY_V = 118, + KEY_W = 119, + KEY_X = 120, + KEY_Y = 121, + KEY_Z = 122, + KEY_DELETE = 127, + KEY_CAPSLOCK = 185, + KEY_F1 = 186, + KEY_F2 = 187, + KEY_F3 = 188, + KEY_F4 = 189, + KEY_F5 = 190, + KEY_F6 = 191, + KEY_F7 = 192, + KEY_F8 = 193, + KEY_F9 = 194, + KEY_F10 = 195, + KEY_F11 = 196, + KEY_F12 = 197, + KEY_PRINTSCREEN = 198, + KEY_SCROLLLOCK = 199, + KEY_PAUSE = 200, + KEY_INSERT = 201, + KEY_HOME = 202, + KEY_PAGEUP = 203, + KEY_END = 205, + KEY_PAGEDOWN = 206, + KEY_RIGHT = 207, + KEY_LEFT = 208, + KEY_DOWN = 209, + KEY_UP = 210, + KEY_NUMLOCKCLEAR = 211, + KEY_KP_DIVIDE = 212, + KEY_KP_MULTIPLY = 213, + KEY_KP_MINUS = 214, + KEY_KP_PLUS = 215, + KEY_KP_ENTER = 216, + KEY_KP_1 = 217, + KEY_KP_2 = 218, + KEY_KP_3 = 219, + KEY_KP_4 = 220, + KEY_KP_5 = 221, + KEY_KP_6 = 222, + KEY_KP_7 = 223, + KEY_KP_8 = 224, + KEY_KP_9 = 225, + KEY_KP_0 = 226, + KEY_KP_PERIOD = 227, + KEY_APPLICATION = 229, + KEY_POWER = 230, + KEY_KP_EQUALS = 231, + KEY_F13 = 232, + KEY_F14 = 233, + KEY_F15 = 234, + KEY_F16 = 235, + KEY_F17 = 236, + KEY_F18 = 237, + KEY_F19 = 238, + KEY_F20 = 239, + KEY_F21 = 240, + KEY_F22 = 241, + KEY_F23 = 242, + KEY_F24 = 243, + KEY_EXECUTE = 244, + KEY_HELP = 245, + KEY_MENU = 246, + KEY_SELECT = 247, + KEY_STOP = 248, + KEY_AGAIN = 249, + KEY_UNDO = 250, + KEY_CUT = 251, + KEY_COPY = 252, + KEY_PASTE = 253, + KEY_FIND = 254, + KEY_MUTE = 255, + KEY_VOLUMEUP = 256, + KEY_VOLUMEDOWN = 257, + KEY_KP_COMMA = 261, + KEY_KP_EQUALSAS400 = 262, + KEY_ALTERASE = 281, + KEY_SYSREQ = 282, + KEY_CANCEL = 283, + KEY_CLEAR = 284, + KEY_PRIOR = 285, + KEY_RETURN2 = 286, + KEY_SEPARATOR = 287, + KEY_OUT = 288, + KEY_OPER = 289, + KEY_CLEARAGAIN = 290, + KEY_CRSEL = 291, + KEY_EXSEL = 292, + KEY_KP_00 = 304, + KEY_KP_000 = 305, + KEY_THOUSANDSSEPARATOR = 306, + KEY_DECIMALSEPARATOR = 307, + KEY_CURRENCYUNIT = 308, + KEY_CURRENCYSUBUNIT = 309, + KEY_KP_LEFTPAREN = 310, + KEY_KP_RIGHTPAREN = 311, + KEY_KP_LEFTBRACE = 312, + KEY_KP_RIGHTBRACE = 313, + KEY_KP_TAB = 314, + KEY_KP_BACKSPACE = 315, + KEY_KP_A = 316, + KEY_KP_B = 317, + KEY_KP_C = 318, + KEY_KP_D = 319, + KEY_KP_E = 320, + KEY_KP_F = 321, + KEY_KP_XOR = 322, + KEY_KP_POWER = 323, + KEY_KP_PERCENT = 324, + KEY_KP_LESS = 325, + KEY_KP_GREATER = 326, + KEY_KP_AMPERSAND = 327, + KEY_KP_DBLAMPERSAND = 328, + KEY_KP_VERTICALBAR = 329, + KEY_KP_DBLVERTICALBAR = 330, + KEY_KP_COLON = 331, + KEY_KP_HASH = 332, + KEY_KP_SPACE = 333, + KEY_KP_AT = 334, + KEY_KP_EXCLAM = 335, + KEY_KP_MEMSTORE = 336, + KEY_KP_MEMRECALL = 337, + KEY_KP_MEMCLEAR = 338, + KEY_KP_MEMADD = 339, + KEY_KP_MEMSUBTRACT = 340, + KEY_KP_MEMMULTIPLY = 341, + KEY_KP_MEMDIVIDE = 342, + KEY_KP_PLUSMINUS = 343, + KEY_KP_CLEAR = 344, + KEY_KP_CLEARENTRY = 345, + KEY_KP_BINARY = 346, + KEY_KP_OCTAL = 347, + KEY_KP_DECIMAL = 348, + KEY_KP_HEXADECIMAL = 349, + KEY_LCTRL = 352, + KEY_LSHIFT = 353, + KEY_LALT = 354, + KEY_LGUI = 355, + KEY_RCTRL = 356, + KEY_RSHIFT = 357, + KEY_RALT = 358, + KEY_RGUI = 359, + KEY_MODE = 385, + KEY_AUDIONEXT = 386, + KEY_AUDIOPREV = 387, + KEY_AUDIOSTOP = 388, + KEY_AUDIOPLAY = 389, + KEY_AUDIOMUTE = 390, + KEY_MEDIASELECT = 391, + KEY_WWW = 392, + KEY_MAIL = 393, + KEY_CALCULATOR = 394, + KEY_COMPUTER = 395, + KEY_AC_SEARCH = 396, + KEY_AC_HOME = 397, + KEY_AC_BACK = 398, + KEY_AC_FORWARD = 399, + KEY_AC_STOP = 400, + KEY_AC_REFRESH = 401, + KEY_AC_BOOKMARKS = 402, + KEY_BRIGHTNESSDOWN = 403, + KEY_BRIGHTNESSUP = 404, + KEY_DISPLAYSWITCH = 405, + KEY_KBDILLUMTOGGLE = 406, + KEY_KBDILLUMDOWN = 407, + KEY_KBDILLUMUP = 408, + KEY_EJECT = 409, + KEY_SLEEP = 410, + KEY_MOUSE_1 = 411, + KEY_MOUSE_2 = 412, + KEY_MOUSE_3 = 413, + KEY_MOUSE_4 = 414, + KEY_MOUSE_5 = 415, + KEY_MOUSE_6 = 416, + KEY_MOUSE_7 = 417, + KEY_MOUSE_8 = 418, + KEY_MOUSE_9 = 419, + KEY_MOUSE_WHEEL_UP = 420, + KEY_MOUSE_WHEEL_DOWN = 421, + KEY_LAST, }; +inline int KeyToKeycode(int Key) { return (Key>=0x80) ? (Key-0x80)|(1<<30) : Key; }; +inline int KeycodeToKey(int Keycode) { return (Keycode&(1<<30)) ? Keycode-(1<<30)+0x80 : Keycode; }; + #endif diff --git a/src/game/client/components/binds.cpp b/src/game/client/components/binds.cpp index b912aeaad..a4e0ffba5 100644 --- a/src/game/client/components/binds.cpp +++ b/src/game/client/components/binds.cpp @@ -89,7 +89,7 @@ void CBinds::SetDefaults() Bind(KEY_F1, "toggle_local_console"); Bind(KEY_F2, "toggle_remote_console"); Bind(KEY_TAB, "+scoreboard"); - Bind(KEY_GRAVE, "+statboard"); + Bind(KEY_CARET, "+statboard"); Bind(KEY_F10, "screenshot"); Bind('a', "+left");