|
|
@@ -14,11 +14,11 @@
|
|
|
#include "Shortcut.h"
|
|
|
#include <SDL_keycode.h>
|
|
|
|
|
|
-std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
|
|
|
+std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key) const
|
|
|
{
|
|
|
static const std::multimap<SDL_Keycode, EShortcut> keyToShortcut = {
|
|
|
- {SDLK_RETURN, EShortcut::GLOBAL_CONFIRM },
|
|
|
- {SDLK_KP_ENTER, EShortcut::GLOBAL_CONFIRM },
|
|
|
+ {SDLK_RETURN, EShortcut::GLOBAL_ACCEPT },
|
|
|
+ {SDLK_KP_ENTER, EShortcut::GLOBAL_ACCEPT },
|
|
|
{SDLK_ESCAPE, EShortcut::GLOBAL_CANCEL },
|
|
|
{SDLK_RETURN, EShortcut::GLOBAL_RETURN },
|
|
|
{SDLK_KP_ENTER, EShortcut::GLOBAL_RETURN },
|
|
|
@@ -27,14 +27,14 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
|
|
|
{SDLK_BACKSPACE, EShortcut::GLOBAL_BACKSPACE },
|
|
|
{SDLK_TAB, EShortcut::GLOBAL_MOVE_FOCUS },
|
|
|
{SDLK_o, EShortcut::GLOBAL_OPTIONS },
|
|
|
- {SDLK_LEFT, EShortcut::SELECT_LEFT },
|
|
|
- {SDLK_RIGHT, EShortcut::SELECT_RIGHT },
|
|
|
- {SDLK_UP, EShortcut::SELECT_UP },
|
|
|
- {SDLK_DOWN, EShortcut::SELECT_DOWN },
|
|
|
- {SDLK_HOME, EShortcut::SELECT_FIRST },
|
|
|
- {SDLK_END, EShortcut::SELECT_LAST },
|
|
|
- {SDLK_PAGEUP, EShortcut::SELECT_PAGE_UP },
|
|
|
- {SDLK_PAGEDOWN, EShortcut::SELECT_PAGE_DOWN },
|
|
|
+ {SDLK_LEFT, EShortcut::MOVE_LEFT },
|
|
|
+ {SDLK_RIGHT, EShortcut::MOVE_RIGHT },
|
|
|
+ {SDLK_UP, EShortcut::MOVE_UP },
|
|
|
+ {SDLK_DOWN, EShortcut::MOVE_DOWN },
|
|
|
+ {SDLK_HOME, EShortcut::MOVE_FIRST },
|
|
|
+ {SDLK_END, EShortcut::MOVE_LAST },
|
|
|
+ {SDLK_PAGEUP, EShortcut::MOVE_PAGE_UP },
|
|
|
+ {SDLK_PAGEDOWN, EShortcut::MOVE_PAGE_DOWN },
|
|
|
{SDLK_1, EShortcut::SELECT_INDEX_1 },
|
|
|
{SDLK_2, EShortcut::SELECT_INDEX_2 },
|
|
|
{SDLK_3, EShortcut::SELECT_INDEX_3 },
|
|
|
@@ -43,9 +43,9 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
|
|
|
{SDLK_6, EShortcut::SELECT_INDEX_6 },
|
|
|
{SDLK_7, EShortcut::SELECT_INDEX_7 },
|
|
|
{SDLK_8, EShortcut::SELECT_INDEX_8 },
|
|
|
- {SDLK_n, EShortcut::MAIN_MENU_NEW },
|
|
|
- {SDLK_l, EShortcut::MAIN_MENU_LOAD },
|
|
|
- {SDLK_h, EShortcut::MAIN_MENU_SCORES },
|
|
|
+ {SDLK_n, EShortcut::MAIN_MENU_NEW_GAME },
|
|
|
+ {SDLK_l, EShortcut::MAIN_MENU_LOAD_GAME },
|
|
|
+ {SDLK_h, EShortcut::MAIN_MENU_HIGH_SCORES },
|
|
|
{SDLK_c, EShortcut::MAIN_MENU_CREDITS },
|
|
|
{SDLK_q, EShortcut::MAIN_MENU_QUIT },
|
|
|
{SDLK_b, EShortcut::MAIN_MENU_BACK },
|
|
|
@@ -67,17 +67,17 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
|
|
|
{SDLK_r, EShortcut::LOBBY_RANDOM_MAP },
|
|
|
{SDLK_h, EShortcut::LOBBY_HIDE_CHAT },
|
|
|
{SDLK_a, EShortcut::LOBBY_ADDITIONAL_OPTIONS },
|
|
|
- {SDLK_s, EShortcut::LOBBY_SELECT },
|
|
|
+ {SDLK_s, EShortcut::LOBBY_SELECT_SCENARIO },
|
|
|
{SDLK_e, EShortcut::GAME_END_TURN },
|
|
|
{SDLK_l, EShortcut::GAME_LOAD_GAME },
|
|
|
{SDLK_s, EShortcut::GAME_SAVE_GAME },
|
|
|
{SDLK_r, EShortcut::GAME_RESTART_GAME },
|
|
|
{SDLK_m, EShortcut::GAME_TO_MAIN_MENU },
|
|
|
{SDLK_q, EShortcut::GAME_QUIT_GAME },
|
|
|
- {SDLK_t, EShortcut::GAME_MARKETPLACE },
|
|
|
- {SDLK_g, EShortcut::GAME_THIEVES_GUILD },
|
|
|
+ {SDLK_t, EShortcut::GAME_OPEN_MARKETPLACE },
|
|
|
+ {SDLK_g, EShortcut::GAME_OPEN_THIEVES_GUILD },
|
|
|
{SDLK_TAB, EShortcut::GAME_ACTIVATE_CONSOLE },
|
|
|
- {SDLK_o, EShortcut::ADVENTURE_OPTIONS },
|
|
|
+ {SDLK_o, EShortcut::ADVENTURE_GAME_OPTIONS },
|
|
|
{SDLK_F6, EShortcut::ADVENTURE_TOGGLE_GRID },
|
|
|
{SDLK_z, EShortcut::ADVENTURE_TOGGLE_SLEEP },
|
|
|
{SDLK_w, EShortcut::ADVENTURE_TOGGLE_SLEEP },
|
|
|
@@ -91,6 +91,10 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
|
|
|
{SDLK_KP_7, EShortcut::ADVENTURE_MOVE_HERO_NW },
|
|
|
{SDLK_KP_8, EShortcut::ADVENTURE_MOVE_HERO_NN },
|
|
|
{SDLK_KP_9, EShortcut::ADVENTURE_MOVE_HERO_NE },
|
|
|
+ {SDLK_DOWN, EShortcut::ADVENTURE_MOVE_HERO_SS },
|
|
|
+ {SDLK_LEFT, EShortcut::ADVENTURE_MOVE_HERO_WW },
|
|
|
+ {SDLK_RIGHT, EShortcut::ADVENTURE_MOVE_HERO_EE },
|
|
|
+ {SDLK_UP, EShortcut::ADVENTURE_MOVE_HERO_NN },
|
|
|
{SDLK_RETURN, EShortcut::ADVENTURE_VIEW_SELECTED },
|
|
|
{SDLK_KP_ENTER, EShortcut::ADVENTURE_VIEW_SELECTED },
|
|
|
// {SDLK_, EShortcut::ADVENTURE_NEXT_OBJECT },
|
|
|
@@ -129,8 +133,8 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
|
|
|
{SDLK_u, EShortcut::RECRUITMENT_UPGRADE },
|
|
|
{SDLK_a, EShortcut::RECRUITMENT_UPGRADE_ALL },
|
|
|
{SDLK_u, EShortcut::RECRUITMENT_UPGRADE_ALL },
|
|
|
- {SDLK_h, EShortcut::KINGDOM_HEROES },
|
|
|
- {SDLK_t, EShortcut::KINGDOM_TOWNS },
|
|
|
+ {SDLK_h, EShortcut::KINGDOM_HEROES_TAB },
|
|
|
+ {SDLK_t, EShortcut::KINGDOM_TOWNS_TAB },
|
|
|
{SDLK_d, EShortcut::HERO_DISMISS },
|
|
|
{SDLK_c, EShortcut::HERO_COMMANDER },
|
|
|
{SDLK_l, EShortcut::HERO_LOOSE_FORMATION },
|
|
|
@@ -154,24 +158,24 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-EShortcut ShortcutHandler::findShortcut(const std::string & identifier )
|
|
|
+EShortcut ShortcutHandler::findShortcut(const std::string & identifier ) const
|
|
|
{
|
|
|
static const std::map<std::string, EShortcut> shortcutNames = {
|
|
|
- {"globalConfirm", EShortcut::GLOBAL_CONFIRM },
|
|
|
+ {"globalAccept", EShortcut::GLOBAL_ACCEPT },
|
|
|
{"globalCancel", EShortcut::GLOBAL_CANCEL },
|
|
|
{"globalReturn", EShortcut::GLOBAL_RETURN },
|
|
|
{"globalFullscreen", EShortcut::GLOBAL_FULLSCREEN },
|
|
|
{"globalOptions", EShortcut::GLOBAL_OPTIONS },
|
|
|
{"globalBackspace", EShortcut::GLOBAL_BACKSPACE },
|
|
|
{"globalMoveFocus", EShortcut::GLOBAL_MOVE_FOCUS },
|
|
|
- {"selectLeft", EShortcut::SELECT_LEFT },
|
|
|
- {"selectRight", EShortcut::SELECT_RIGHT },
|
|
|
- {"selectUp", EShortcut::SELECT_UP },
|
|
|
- {"selectDown", EShortcut::SELECT_DOWN },
|
|
|
- {"selectFirst", EShortcut::SELECT_FIRST },
|
|
|
- {"selectLast", EShortcut::SELECT_LAST },
|
|
|
- {"selectPageUp", EShortcut::SELECT_PAGE_UP },
|
|
|
- {"selectPageDown", EShortcut::SELECT_PAGE_DOWN },
|
|
|
+ {"moveLeft", EShortcut::MOVE_LEFT },
|
|
|
+ {"moveRight", EShortcut::MOVE_RIGHT },
|
|
|
+ {"moveUp", EShortcut::MOVE_UP },
|
|
|
+ {"moveDown", EShortcut::MOVE_DOWN },
|
|
|
+ {"moveFirst", EShortcut::MOVE_FIRST },
|
|
|
+ {"moveLast", EShortcut::MOVE_LAST },
|
|
|
+ {"movePageUp", EShortcut::MOVE_PAGE_UP },
|
|
|
+ {"movePageDown", EShortcut::MOVE_PAGE_DOWN },
|
|
|
{"selectIndex1", EShortcut::SELECT_INDEX_1 },
|
|
|
{"selectIndex2", EShortcut::SELECT_INDEX_2 },
|
|
|
{"selectIndex3", EShortcut::SELECT_INDEX_3 },
|
|
|
@@ -180,9 +184,9 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier )
|
|
|
{"selectIndex6", EShortcut::SELECT_INDEX_6 },
|
|
|
{"selectIndex7", EShortcut::SELECT_INDEX_7 },
|
|
|
{"selectIndex8", EShortcut::SELECT_INDEX_8 },
|
|
|
- {"mainMenuNew", EShortcut::MAIN_MENU_NEW },
|
|
|
- {"mainMenuLoad", EShortcut::MAIN_MENU_LOAD },
|
|
|
- {"mainMenuScores", EShortcut::MAIN_MENU_SCORES },
|
|
|
+ {"mainMenuNewGame", EShortcut::MAIN_MENU_NEW_GAME },
|
|
|
+ {"mainMenuLoadGame", EShortcut::MAIN_MENU_LOAD_GAME },
|
|
|
+ {"mainMenuHighScores", EShortcut::MAIN_MENU_HIGH_SCORES },
|
|
|
{"mainMenuCredits", EShortcut::MAIN_MENU_CREDITS },
|
|
|
{"mainMenuQuit", EShortcut::MAIN_MENU_QUIT },
|
|
|
{"mainMenuBack", EShortcut::MAIN_MENU_BACK },
|
|
|
@@ -200,17 +204,17 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier )
|
|
|
{"lobbyRandomMap", EShortcut::LOBBY_RANDOM_MAP },
|
|
|
{"lobbyHideChat", EShortcut::LOBBY_HIDE_CHAT },
|
|
|
{"lobbyAdditionalOptions", EShortcut::LOBBY_ADDITIONAL_OPTIONS },
|
|
|
- {"lobbySelect", EShortcut::LOBBY_SELECT },
|
|
|
+ {"lobbySelectScenario", EShortcut::LOBBY_SELECT_SCENARIO },
|
|
|
{"gameEndTurn", EShortcut::GAME_END_TURN },
|
|
|
{"gameLoadGame", EShortcut::GAME_LOAD_GAME },
|
|
|
{"gameSaveGame", EShortcut::GAME_SAVE_GAME },
|
|
|
{"gameRestartGame", EShortcut::GAME_RESTART_GAME },
|
|
|
{"gameMainMenu", EShortcut::GAME_TO_MAIN_MENU },
|
|
|
{"gameQuitGame", EShortcut::GAME_QUIT_GAME },
|
|
|
- {"gameMarketplace", EShortcut::GAME_MARKETPLACE },
|
|
|
- {"gameThievesGuild", EShortcut::GAME_THIEVES_GUILD },
|
|
|
+ {"gameOpenMarketplace", EShortcut::GAME_OPEN_MARKETPLACE },
|
|
|
+ {"gameOpenThievesGuild", EShortcut::GAME_OPEN_THIEVES_GUILD },
|
|
|
{"gameActivateConsole", EShortcut::GAME_ACTIVATE_CONSOLE },
|
|
|
- {"adventureOptions", EShortcut::ADVENTURE_OPTIONS },
|
|
|
+ {"adventureGameOptions", EShortcut::ADVENTURE_GAME_OPTIONS },
|
|
|
{"adventureToggleGrid", EShortcut::ADVENTURE_TOGGLE_GRID },
|
|
|
{"adventureToggleSleep", EShortcut::ADVENTURE_TOGGLE_SLEEP },
|
|
|
{"adventureMoveHero", EShortcut::ADVENTURE_MOVE_HERO },
|
|
|
@@ -257,8 +261,8 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier )
|
|
|
{"recruitmentMin", EShortcut::RECRUITMENT_MIN },
|
|
|
{"recruitmentUpgrade", EShortcut::RECRUITMENT_UPGRADE },
|
|
|
{"recruitmentUpgradeAll", EShortcut::RECRUITMENT_UPGRADE_ALL },
|
|
|
- {"kingdomHeroes", EShortcut::KINGDOM_HEROES },
|
|
|
- {"kingdomTowns", EShortcut::KINGDOM_TOWNS },
|
|
|
+ {"kingdomHeroesTab", EShortcut::KINGDOM_HEROES_TAB },
|
|
|
+ {"kingdomTownsTab", EShortcut::KINGDOM_TOWNS_TAB },
|
|
|
{"heroDismiss", EShortcut::HERO_DISMISS },
|
|
|
{"heroCommander", EShortcut::HERO_COMMANDER },
|
|
|
{"heroLooseFormation", EShortcut::HERO_LOOSE_FORMATION },
|