summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcpasjuste <cpasjuste@gmail.com>2020-04-29 11:17:12 +0200
committercpasjuste <cpasjuste@gmail.com>2020-04-29 11:17:12 +0200
commit63fd641252dd035e51730fa2172f6faea0d5f756 (patch)
tree1cfcfd1b607b2e3c070162cb222ab0bed16d56f0
parent767d987fb02051621ae087534b42ab956abdfc32 (diff)
downloadmv-63fd641252dd035e51730fa2172f6faea0d5f756.tar.gz
mv-63fd641252dd035e51730fa2172f6faea0d5f756.tar.bz2
mv-63fd641252dd035e51730fa2172f6faea0d5f756.tar.xz
mv-63fd641252dd035e51730fa2172f6faea0d5f756.zip
switch: change default input mapping in inputactionmap.h
-rw-r--r--README-SWITCH.md22
-rw-r--r--src/gui/windows/logindialog.cpp7
-rw-r--r--src/input/inputactionmap.h48
3 files changed, 61 insertions, 16 deletions
diff --git a/README-SWITCH.md b/README-SWITCH.md
index 35d732bf8..ccd863ba9 100644
--- a/README-SWITCH.md
+++ b/README-SWITCH.md
@@ -1,18 +1,18 @@
-Switch button mapping:
+Nintendo Switch button mapping (https://manaplus.germantmw.de/?site=2):
```
-KEY_A JButton1
-KEY_B JButton2
-KEY_X JButton3
-KEY_Y JButton4
+KEY_A JButton1 "target + move + attack"
+KEY_B JButton2 "stop attack / sit"
+KEY_X JButton3 "pickup"
+KEY_Y JButton4 "move to target"
KEY_LSTICK JButton5
KEY_RSTICK JButton6
-KEY_L JButton7
-KEY_R JButton8
-KEY_ZL JButton9
-KEY_ZR JButton10
-KEY_PLUS JButton11
-KEY_MINUS JButton12
+KEY_L JButton7 "target NPC"
+KEY_R JButton8 "target monster"
+KEY_ZL JButton9 "talk (NPCS)"
+KEY_ZR JButton10 "attack (without move)"
+KEY_PLUS JButton11 "toggle Chat"
+KEY_MINUS JButton12 "toggle Quit (window)"
KEY_DLEFT JButton13
KEY_DUP JButton14
KEY_DRIGHT JButton15
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index f169635dc..7f36704cb 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -204,14 +204,15 @@ void LoginDialog::postInit()
loadWindowState();
reflowLayout(0, 0);
+#ifdef SAVE_PASSWORD
+ mPassField->setText(LoginDialog::savedPassword);
+#else
if (mUserField->getText().empty())
mUserField->requestFocus();
else {
-#ifdef SAVE_PASSWORD
- mPassField->setText(LoginDialog::savedPassword);
-#endif
mPassField->requestFocus();
}
+#endif
mLoginButton->setEnabled(canSubmit());
if (loginHandler != nullptr)
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 9a7983312..926a98e6b 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -100,7 +100,11 @@ static const InputActionData inputActionData
Protected_false},
{"keyAttack",
addKey(SDLK_x),
+#ifdef __SWITCH__
+ joystickButton(9),
+#else
emptyKey,
+#endif
Input::GRP_DEFAULT | Input::GRP_REPEAT,
&Actions::attack,
InputAction::NO_VALUE, 50,
@@ -127,7 +131,11 @@ static const InputActionData inputActionData
Protected_false},
{"keyMoveToTarget",
addKey(SDLK_v),
+#ifdef __SWITCH__
+ joystickButton(3),
+#else
emptyKey,
+#endif
Input::GRP_DEFAULT,
&Actions::moveToTarget,
InputAction::NO_VALUE, 50,
@@ -188,7 +196,11 @@ static const InputActionData inputActionData
Protected_false},
{"keyTalk",
addKey(SDLK_t),
+#ifdef __SWITCH__
+ joystickButton(8),
+#else
emptyKey,
+#endif
Input::GRP_DEFAULT,
&Actions::talk,
InputAction::NO_VALUE, 50,
@@ -198,7 +210,11 @@ static const InputActionData inputActionData
Protected_false},
{"keyTarget",
addKey(SDLK_LSHIFT),
+#ifdef __SWITCH__
+ emptyKey,
+#else
joystickButton(4),
+#endif
Input::GRP_DEFAULT,
&Actions::stopAttack,
InputAction::NO_VALUE, 50,
@@ -214,7 +230,11 @@ static const InputActionData inputActionData
Protected_false},
{"keyTargetMonster",
addKey(SDLK_a),
+#ifdef __SWITCH__
+ joystickButton(7),
+#else
joystickButton(3),
+#endif
Input::GRP_DEFAULT | Input::GRP_REPEAT,
&Actions::targetMonster,
InputAction::NO_VALUE, 50,
@@ -227,7 +247,11 @@ static const InputActionData inputActionData
Protected_false},
{"keyTargetNPC",
addKey(SDLK_n),
+#ifdef __SWITCH__
+ joystickButton(6),
+#else
emptyKey,
+#endif
Input::GRP_DEFAULT,
&Actions::targetNPC,
InputAction::NO_VALUE, 50,
@@ -251,7 +275,11 @@ static const InputActionData inputActionData
Protected_false},
{"keyPickup",
addKey(SDLK_z),
+#ifdef __SWITCH__
+ joystickButton(2),
+#else
joystickButton(1),
+#endif
Input::GRP_DEFAULT,
&Actions::pickup,
InputAction::NO_VALUE, 50,
@@ -288,7 +316,11 @@ static const InputActionData inputActionData
Protected_true},
{"keyBeingSit",
addKey(SDLK_s),
+#ifdef __SWITCH__
+ emptyKey,
+#else
joystickButton(2),
+#endif
Input::GRP_DEFAULT,
&Actions::sit,
InputAction::NO_VALUE, 50,
@@ -355,7 +387,7 @@ static const InputActionData inputActionData
#if defined(ANDROID)
addKey(SDLK_AC_BACK),
#elif defined(__SWITCH__)
- joystickButton(10),
+ joystickButton(11),
#else
emptyKey,
#endif
@@ -2320,7 +2352,11 @@ static const InputActionData inputActionData
Protected_true},
{"keyChat",
addKey(SDLK_RETURN),
+#ifdef __SWITCH__
+ joystickButton(10),
+#else
emptyKey,
+#endif
Input::GRP_DEFAULT | Input::GRP_CHAT,
&Actions::toggleChat,
InputAction::NO_VALUE, 50,
@@ -2787,7 +2823,7 @@ static const InputActionData inputActionData
#if defined(ANDROID)
addKey(SDLK_AC_BACK),
#elif defined(__SWITCH__)
- joystickButton(10),
+ joystickButton(11),
#else
emptyKey,
#endif
@@ -2900,7 +2936,15 @@ static const InputActionData inputActionData
UseArgs_false,
Protected_true},
{"keyStopSit",
+#ifdef __SWITCH__
+ emptyKey,
+ joystickButton(1),
+ Input::GRP_DEFAULT,
+ &Actions::stopSit,
+ InputAction::NO_VALUE, 50,
+#else
defaultAction(&Actions::stopSit),
+#endif
InputCondition::KEY_DOWN |
InputCondition::DEFAULT |
InputCondition::INGAME,