From 974c5cc08cc4d9e77de44b3667d5945a5cb3c496 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 14 May 2011 15:43:26 +0300 Subject: Added key configuration in the configuration file. --- src/game.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index f32a2f0c9..43d6bd362 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "materials.h" #include "config.h" #include "clouds.h" +#include "keycode.h" /* Setting this to 1 enables a special camera mode that forces @@ -1079,7 +1080,7 @@ void the_game( /* Launch menus according to keys */ - if(input->wasKeyDown(irr::KEY_KEY_I)) + if(input->wasKeyDown(getKeySetting("keymap_inventory"))) { dstream<drop(); } - else if(input->wasKeyDown(irr::KEY_ESCAPE)) + else if(input->wasKeyDown(KEY_ESCAPE)) { dstream<drop(); } - else if(input->wasKeyDown(irr::KEY_KEY_T)) + else if(input->wasKeyDown(getKeySetting("keymap_chat"))) { TextDest *dest = new TextDestChat(&client); @@ -1163,7 +1164,7 @@ void the_game( } // Viewing range selection - if(input->wasKeyDown(irr::KEY_KEY_R)) + if(input->wasKeyDown(getKeySetting("keymap_rangeselect"))) { if(draw_control.range_all) { @@ -1178,7 +1179,7 @@ void the_game( } // Print debug stacks - if(input->wasKeyDown(irr::KEY_KEY_P)) + if(input->wasKeyDown(getKeySetting("keymap_print_debug_stacks"))) { dstream<<"-----------------------------------------" <isKeyDown(irr::KEY_KEY_W), - input->isKeyDown(irr::KEY_KEY_S), - input->isKeyDown(irr::KEY_KEY_A), - input->isKeyDown(irr::KEY_KEY_D), - input->isKeyDown(irr::KEY_SPACE), - input->isKeyDown(irr::KEY_KEY_E), - input->isKeyDown(irr::KEY_LSHIFT) - || input->isKeyDown(irr::KEY_RSHIFT), + input->isKeyDown(getKeySetting("keymap_forward")), + input->isKeyDown(getKeySetting("keymap_backward")), + input->isKeyDown(getKeySetting("keymap_left")), + input->isKeyDown(getKeySetting("keymap_right")), + input->isKeyDown(getKeySetting("keymap_jump")), + input->isKeyDown(getKeySetting("keymap_special1")), + input->isKeyDown(getKeySetting("keymap_sneak")), camera_pitch, camera_yaw ); @@ -1281,7 +1282,7 @@ void the_game( s32 dy = input->getMousePos().Y - displaycenter.Y; //std::cout<<"window active, pos difference "<isKeyDown(irr::KEY_UP)) dy -= dtime * keyspeed; if(input->isKeyDown(irr::KEY_DOWN)) @@ -1289,7 +1290,7 @@ void the_game( if(input->isKeyDown(irr::KEY_LEFT)) dx -= dtime * keyspeed; if(input->isKeyDown(irr::KEY_RIGHT)) - dx += dtime * keyspeed; + dx += dtime * keyspeed;*/ camera_yaw -= dx*0.2; camera_pitch += dy*0.2; -- cgit v1.2.3