summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/macro.h
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-17 17:12:41 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-17 17:12:41 +0000
commit3e5fbd50de561ffc9e84fba6c4b2d0a2e13b118a (patch)
tree8e08d60e131656353d4210e0b01f8235506374aa /crawl-ref/source/macro.h
parent1210d4439b7da2cea42e15892f7a09a03c6f0814 (diff)
downloadcrawl-ref-3e5fbd50de561ffc9e84fba6c4b2d0a2e13b118a.tar.gz
crawl-ref-3e5fbd50de561ffc9e84fba6c4b2d0a2e13b118a.zip
Do "keypress -> command_type" via keybindings. Solves bug 2018200,
where you couldn't do macros with the old 3.4 keymap since the 3.4 keys were done via macros and macros can't recursively invoke macros. Has the little snag that it doesn't exactly reproduce the 3.4 "fire ammo" command since 3.4 automatically goes to the inventory list but 4.0 doesn't. TODO: * Get levelmap commands to use keybindings instead of hardcoded mappings. * Let function keys and alt keys be bound to commands. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6587 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/macro.h')
-rw-r--r--crawl-ref/source/macro.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/crawl-ref/source/macro.h b/crawl-ref/source/macro.h
index 35b2514a51..16c13f358c 100644
--- a/crawl-ref/source/macro.h
+++ b/crawl-ref/source/macro.h
@@ -29,6 +29,10 @@ enum KeymapContext {
KC_TARGETING, // Only during 'x' and other targeting modes
KC_CONFIRM, // When being asked y/n/q questions
+#ifdef USE_TILE
+ KC_TILE, // For context_for_command()
+#endif
+
KC_CONTEXT_COUNT, // Must always be the last real context
KC_NONE // Don't apply any keymaps (for menus)
};
@@ -85,4 +89,17 @@ void insert_macro_into_buff(const keyseq& keys);
int get_macro_buf_size();
+///////////////////////////////////////////////////////////////
+// Keybinding stuff
+
+void init_keybindings();
+
+command_type name_to_command(std::string name);
+std::string command_to_name(command_type cmd);
+
+command_type key_to_command(int key, KeymapContext context);
+int command_to_key(command_type cmd);
+KeymapContext context_for_command(command_type cmd);
+
+void bind_command_to_key(command_type cmd, int key);
#endif