summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorDuane Robertson <duane@duanerobertson.com>2015-09-28 13:59:03 -0500
committersfan5 <sfan5@live.de>2015-10-29 21:48:57 +0100
commitb6dfae02215d7bd61e06ff1999ee3ecb0ec80b9e (patch)
tree800511483f8b27cb35141dece5a937dd6dfa4a78 /src/game.cpp
parentc0a7c670a465b4c05d90a8a4e8001797ec4e628a (diff)
downloadminetest-b6dfae02215d7bd61e06ff1999ee3ecb0ec80b9e.tar.gz
minetest-b6dfae02215d7bd61e06ff1999ee3ecb0ec80b9e.tar.bz2
minetest-b6dfae02215d7bd61e06ff1999ee3ecb0ec80b9e.zip
WoW-style Autorun
This allows the player to toggle continuous forward with a key (F by default), so we don't have to hold down the forward key endlessly.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 36945f343..df5ab701a 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1234,6 +1234,7 @@ struct KeyCache {
KEYMAP_ID_JUMP,
KEYMAP_ID_SPECIAL1,
KEYMAP_ID_SNEAK,
+ KEYMAP_ID_AUTORUN,
// Other
KEYMAP_ID_DROP,
@@ -1286,6 +1287,8 @@ void KeyCache::populate()
key[KEYMAP_ID_SPECIAL1] = getKeySetting("keymap_special1");
key[KEYMAP_ID_SNEAK] = getKeySetting("keymap_sneak");
+ key[KEYMAP_ID_AUTORUN] = getKeySetting("keymap_autorun");
+
key[KEYMAP_ID_DROP] = getKeySetting("keymap_drop");
key[KEYMAP_ID_INVENTORY] = getKeySetting("keymap_inventory");
key[KEYMAP_ID_CHAT] = getKeySetting("keymap_chat");
@@ -2615,6 +2618,10 @@ void Game::processKeyboardInput(VolatileRunFlags *flags,
if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_DROP])) {
dropSelectedItem();
+ // Add WoW-style autorun by toggling continuous forward.
+ } else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_AUTORUN])) {
+ bool autorun_setting = g_settings->getBool("continuous_forward");
+ g_settings->setBool("continuous_forward", !autorun_setting);
} else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_INVENTORY])) {
openInventory();
} else if (input->wasKeyDown(EscapeKey) || input->wasKeyDown(CancelKey)) {