From 96805601e06e6ed6f7b5aaffc3bbb22dd9e8d58a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 1 Dec 2014 21:06:41 +0300 Subject: Unassign direction change keys. --- src/configmanager.cpp | 22 +++++++++++++++++++++- src/defaults.cpp | 2 +- src/input/inputactionmap.h | 8 ++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/configmanager.cpp b/src/configmanager.cpp index 44bf58a88..b90ac3180 100644 --- a/src/configmanager.cpp +++ b/src/configmanager.cpp @@ -29,6 +29,8 @@ #include "being/beingspeech.h" +#include "input/inputmanager.h" + #include "utils/files.h" #include "utils/gettext.h" #include "utils/mkdir.h" @@ -270,6 +272,10 @@ void ConfigManager::storeSafeParameters() } #endif +#define unassignKey(key, value) \ + if (config.getStringValue(prefix + key) == value) \ + config.setValue(key, "-1"); + void ConfigManager::checkConfigVersion() { const int version = config.getIntValue("cfgver"); @@ -322,5 +328,19 @@ void ConfigManager::checkConfigVersion() if (version < 10) config.setValue("enableLazyScrolling", false); - config.setValue("cfgver", 10); + if (version < 11) + { +#ifdef USE_SDL2 + const std::string prefix = std::string("sdl2"); +#else + const std::string prefix = std::string(); +#endif + unassignKey("keyDirectUp", "k108"); + unassignKey("keyDirectDown", "k59"); + unassignKey("keyDirectLeft", "k107"); + unassignKey("keyDirectRight", "k39"); + } + config.setValue("cfgver", 11); } + +#undef unassignKey diff --git a/src/defaults.cpp b/src/defaults.cpp index 81b1abff1..e11e6b897 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -352,7 +352,7 @@ DefaultsData* getConfigDefaults() AddDEF("uselonglivesprites", false); AddDEF("uselonglivesounds", true); AddDEF("screenDensity", 0); - AddDEF("cfgver", 10); + AddDEF("cfgver", 11); AddDEF("enableDebugLog", false); AddDEF("doubleClick", true); AddDEF("useDiagonalSpeed", true); diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 34171954c..460f11048 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -2122,7 +2122,7 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { "", false}, {"keyDirectUp", - InputType::KEYBOARD, SDLK_l, + InputType::UNKNOWN, InputAction::NO_VALUE, InputType::UNKNOWN, InputAction::NO_VALUE, Input::GRP_DEFAULT, &Actions::directUp, @@ -2131,7 +2131,7 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { "directup|turnup", false}, {"keyDirectDown", - InputType::KEYBOARD, SDLK_SEMICOLON, + InputType::UNKNOWN, InputAction::NO_VALUE, InputType::UNKNOWN, InputAction::NO_VALUE, Input::GRP_DEFAULT, &Actions::directDown, @@ -2140,7 +2140,7 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { "directdown|turndown", false}, {"keyDirectLeft", - InputType::KEYBOARD, SDLK_k, + InputType::UNKNOWN, InputAction::NO_VALUE, InputType::UNKNOWN, InputAction::NO_VALUE, Input::GRP_DEFAULT, &Actions::directLeft, @@ -2149,7 +2149,7 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { "directleft|turnleft", false}, {"keyDirectRight", - InputType::KEYBOARD, SDLK_QUOTE, + InputType::UNKNOWN, InputAction::NO_VALUE, InputType::UNKNOWN, InputAction::NO_VALUE, Input::GRP_DEFAULT, &Actions::directRight, -- cgit v1.2.3-60-g2f50