diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 12784df8a..e1a9d7296 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -484,10 +484,6 @@ void PressKey(SDL_Keycode vkey, uint16_t modState) if (vkey == SDLK_UNKNOWN) return; - if (vkey == SDLK_PAUSE) { - diablo_pause_game(); - return; - } if (gmenu_presskeys(vkey) || control_presskeys(vkey)) { return; } @@ -1821,6 +1817,12 @@ void InitKeymapActions() N_("Pauses the game."), 'P', diablo_pause_game); + sgOptions.Keymapper.AddAction( + "Pause Game (Alternate)", + N_("Pause Game (Alternate)"), + N_("Pauses the game."), + SDLK_PAUSE, + diablo_pause_game); sgOptions.Keymapper.AddAction( "DecreaseGamma", N_("Decrease Gamma"), diff --git a/Source/options.cpp b/Source/options.cpp index 50858d14e..467474366 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -1292,7 +1292,7 @@ std::vector LanguageOptions::GetEntries() KeymapperOptions::KeymapperOptions() : OptionCategoryBase("Keymapping", N_("Keymapping"), N_("Keymapping Settings")) { - // Insert all supported keys: a-z, 0-9 and F1-F12. + // Insert all supported keys: a-z, 0-9 and F1-F24. keyIDToKeyName.reserve(('Z' - 'A' + 1) + ('9' - '0' + 1) + 12); for (char c = 'A'; c <= 'Z'; ++c) { keyIDToKeyName.emplace(c, std::string(1, c)); @@ -1303,6 +1303,9 @@ KeymapperOptions::KeymapperOptions() for (int i = 0; i < 12; ++i) { keyIDToKeyName.emplace(SDLK_F1 + i, StrCat("F", i + 1)); } + for (int i = 0; i < 12; ++i) { + keyIDToKeyName.emplace(SDLK_F13 + i, StrCat("F", i + 13)); + } keyIDToKeyName.emplace(SDLK_KP_0, "KEYPADNUM 0"); for (int i = 0; i < 9; i++) { @@ -1311,9 +1314,12 @@ KeymapperOptions::KeymapperOptions() keyIDToKeyName.emplace(SDLK_LALT, "LALT"); keyIDToKeyName.emplace(SDLK_RALT, "RALT"); + keyIDToKeyName.emplace(SDLK_SPACE, "SPACE"); + keyIDToKeyName.emplace(SDLK_RCTRL, "RCONTROL"); keyIDToKeyName.emplace(SDLK_LCTRL, "LCONTROL"); + keyIDToKeyName.emplace(SDLK_PRINTSCREEN, "PRINT"); keyIDToKeyName.emplace(SDLK_PAUSE, "PAUSE"); keyIDToKeyName.emplace(SDLK_TAB, "TAB"); @@ -1321,6 +1327,29 @@ KeymapperOptions::KeymapperOptions() keyIDToKeyName.emplace(SDL_BUTTON_X1 | KeymapperMouseButtonMask, "X1MOUSE"); keyIDToKeyName.emplace(SDL_BUTTON_X2 | KeymapperMouseButtonMask, "X2MOUSE"); + keyIDToKeyName.emplace(SDLK_BACKQUOTE, "`"); + keyIDToKeyName.emplace(SDLK_LEFTBRACKET, "["); + keyIDToKeyName.emplace(SDLK_RIGHTBRACKET, "]"); + keyIDToKeyName.emplace(SDLK_BACKSLASH, "\\"); + keyIDToKeyName.emplace(SDLK_SEMICOLON, ";"); + keyIDToKeyName.emplace(SDLK_QUOTE, "'"); + keyIDToKeyName.emplace(SDLK_COMMA, ","); + keyIDToKeyName.emplace(SDLK_PERIOD, "."); + keyIDToKeyName.emplace(SDLK_SLASH, "/"); + + keyIDToKeyName.emplace(SDLK_BACKSPACE, "BACKSPACE"); + keyIDToKeyName.emplace(SDLK_CAPSLOCK, "CAPSLOCK"); + keyIDToKeyName.emplace(SDLK_SCROLLLOCK, "SCROLLLOCK"); + keyIDToKeyName.emplace(SDLK_INSERT, "INSERT"); + keyIDToKeyName.emplace(SDLK_DELETE, "DELETE"); + keyIDToKeyName.emplace(SDLK_HOME, "HOME"); + keyIDToKeyName.emplace(SDLK_END, "END"); + + keyIDToKeyName.emplace(SDLK_KP_DIVIDE, "KEYPAD /"); + keyIDToKeyName.emplace(SDLK_KP_MULTIPLY, "KEYPAD *"); + keyIDToKeyName.emplace(SDLK_KP_ENTER, "KEYPAD ENTER"); + keyIDToKeyName.emplace(SDLK_KP_PERIOD, "KEYPAD DECIMAL"); + keyNameToKeyID.reserve(keyIDToKeyName.size()); for (const auto &[key, value] : keyIDToKeyName) { keyNameToKeyID.emplace(value, key);