1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef ULTIMA4_META_ENGINE
24 #define ULTIMA4_META_ENGINE
25 
26 #include "backends/keymapper/keymapper.h"
27 
28 namespace Ultima {
29 namespace Ultima4 {
30 
31 enum KeybindingAction {
32 	KEYBIND_UP, KEYBIND_DOWN, KEYBIND_LEFT, KEYBIND_RIGHT,
33 	KEYBIND_ATTACK, KEYBIND_BOARD, KEYBIND_CAST, KEYBIND_CLIMB,
34 	KEYBIND_DESCEND, KEYBIND_ENTER, KEYBIND_EXIT, KEYBIND_FIRE,
35 	KEYBIND_GET, KEYBIND_HOLE_UP, KEYBIND_IGNITE, KEYBIND_JIMMY,
36 	KEYBIND_LOCATE, KEYBIND_MIX, KEYBIND_NEW_ORDER,
37 	KEYBIND_OPEN_DOOR, KEYBIND_PASS, KEYBIND_PEER,
38 	KEYBIND_QUIT_SAVE, KEYBIND_READY_WEAPON, KEYBIND_SEARCH,
39 	KEYBIND_STATS, KEYBIND_TALK, KEYBIND_USE, KEYBIND_WEAR,
40 	KEYBIND_YELL, KEYBIND_INTERACT, KEYBIND_ESCAPE,
41 
42 	KEYBIND_SPEED_UP, KEYBIND_SPEED_DOWN, KEYBIND_SPEED_NORMAL,
43 	KEYBIND_COMBATSPEED_UP, KEYBIND_COMBATSPEED_DOWN,
44 	KEYBIND_COMBATSPEED_NORMAL,
45 
46 	KEYBIND_PARTY0, KEYBIND_PARTY1, KEYBIND_PARTY2, KEYBIND_PARTY3,
47 	KEYBIND_PARTY4, KEYBIND_PARTY5, KEYBIND_PARTY6, KEYBIND_PARTY7,
48 	KEYBIND_PARTY8,
49 
50 	KEYBIND_CHEAT_COLLISIONS, KEYBIND_CHEAT_DESTROY,
51 	KEYBIND_CHEAT_DESTROY_CREATURES, KEYBIND_CHEAT_EQUIPMENT,
52 	KEYBIND_CHEAT_FLEE, KEYBIND_CHEAT_GOTO, KEYBIND_CHEAT_HELP,
53 	KEYBIND_CHEAT_ITEMS, KEYBIND_CHEAT_KARMA, KEYBIND_CHEAT_LEAVE,
54 	KEYBIND_CHEAT_MIXTURES, KEYBIND_CHEAT_NO_COMBAT,
55 	KEYBIND_CHEAT_OVERHEAD, KEYBIND_CHEAT_PARTY, KEYBIND_CHEAT_REAGENTS,
56 	KEYBIND_CHEAT_STATS, KEYBIND_CHEAT_TRANSPORT, KEYBIND_CHEAT_UP,
57 	KEYBIND_CHEAT_DOWN, KEYBIND_CHEAT_VIRTUE, KEYBIND_CHEAT_WIND,
58 
59 	KEYBIND_NONE
60 };
61 
62 enum KeybindingMode {
63 	KBMODE_NORMAL,		///< Keys available when normal in-game
64 	KBMODE_MINIMAL,		///< Minimal list available when reading input
65 	KBMODE_DIRECTION,	///< Mode for selecting direction
66 	KBMODE_MENU,		///< Intro config menus
67 	KBMODE_COMBAT		///< Keys when in combat mode
68 };
69 
70 class MetaEngine {
71 private:
72 	/**
73 	 * Get the method to execute
74 	 */
75 	static Common::String getMethod(KeybindingAction keyAction);
76 
77 	/**
78 	 * Adds the default actions for the mouse buttons
79 	 */
80 	static void addMouseClickActions(Common::Keymap &keyMap);
81 public:
82 	/**
83 	 * Initialize keymaps
84 	 */
85 	static Common::KeymapArray initKeymaps(KeybindingMode mode = KBMODE_NORMAL);
86 
87 	/**
88 	 * Execute an engine keymap action
89 	 */
90 	static void executeAction(KeybindingAction keyAction);
91 
92 	/**
93 	 * Sets the current set of actions which are active
94 	 */
95 	static void setKeybindingMode(KeybindingMode mode);
96 };
97 
98 } // End of namespace Ultima4
99 } // End of namespace Ultima
100 
101 #endif
102