aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-06-17 23:55:21 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-06-17 23:55:21 +0300
commite7580d2804d29afb486f4eb2bd4dfb94f7181824 (patch)
treee9e6468c12b9acfb46e424d10ee24fa362bb9338 /src
parent6b1f059ccd91acd87e41a83c811b88acbb4b4bc8 (diff)
downloadminetest-e7580d2804d29afb486f4eb2bd4dfb94f7181824.tar.gz
minetest-e7580d2804d29afb486f4eb2bd4dfb94f7181824.tar.bz2
minetest-e7580d2804d29afb486f4eb2bd4dfb94f7181824.zip
added in-game key shortcuts for toggling free_move and fast_move (default K and J)
Diffstat (limited to 'src')
-rw-r--r--src/defaultsettings.cpp2
-rw-r--r--src/game.cpp26
2 files changed, 28 insertions, 0 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index e57157a82..8ae5694e5 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -40,6 +40,8 @@ void set_default_settings()
g_settings.setDefault("keymap_inventory", "KEY_KEY_I");
g_settings.setDefault("keymap_chat", "KEY_KEY_T");
g_settings.setDefault("keymap_rangeselect", "KEY_KEY_R");
+ g_settings.setDefault("keymap_freemove", "KEY_KEY_K");
+ g_settings.setDefault("keymap_fastmove", "KEY_KEY_J");
// Some (temporary) keys for debugging
g_settings.setDefault("keymap_special1", "KEY_KEY_E");
g_settings.setDefault("keymap_print_debug_stacks", "KEY_KEY_P");
diff --git a/src/game.cpp b/src/game.cpp
index eef27c805..09f06f4f6 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1190,6 +1190,32 @@ void the_game(
&g_menumgr, dest,
L""))->drop();
}
+ else if(input->wasKeyDown(getKeySetting("keymap_freemove")))
+ {
+ if(g_settings.getBool("free_move"))
+ {
+ g_settings.set("free_move","false");
+ chat_lines.push_back(ChatLine(L"free_move disabled"));
+ }
+ else
+ {
+ g_settings.set("free_move","true");
+ chat_lines.push_back(ChatLine(L"free_move enabled"));
+ }
+ }
+ else if(input->wasKeyDown(getKeySetting("keymap_fastmove")))
+ {
+ if(g_settings.getBool("fast_move"))
+ {
+ g_settings.set("fast_move","false");
+ chat_lines.push_back(ChatLine(L"fast_move disabled"));
+ }
+ else
+ {
+ g_settings.set("fast_move","true");
+ chat_lines.push_back(ChatLine(L"fast_move enabled"));
+ }
+ }
// Item selection with mouse wheel
{