diff options
author | Markus Koch <markus@notsyncing.net> | 2020-11-07 17:45:32 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2020-11-09 11:58:50 +0100 |
commit | e1142ee57f2d7b59a86f6d0d72ae043844bc3121 (patch) | |
tree | 9b63cede37948a78d05e7595ee5976aab0c63a41 /src/client/game.cpp | |
parent | 7589cbe086a5558eea018e1e3d25e388b26d51e8 (diff) | |
download | minetest-e1142ee57f2d7b59a86f6d0d72ae043844bc3121.tar.gz minetest-e1142ee57f2d7b59a86f6d0d72ae043844bc3121.tar.bz2 minetest-e1142ee57f2d7b59a86f6d0d72ae043844bc3121.zip |
Joystick: Remap joystick-specific KeyTypes to generic ones
According to the following table:
* MOUSE_L -> DIG
* MOUSE_R -> PLACE
* SCROLL_UP -> HOTBAR_NEXT
* SCROLL_DOWN -> HOTBAR_PREV
This commit entirely removes the special KeyTypes used for joysticks.
Support for the MOUSE KeyTypes had already been removed in the main
game code without adapting the joystick code, breaking joystick
input. This commit restores joystick functionality.
Diffstat (limited to 'src/client/game.cpp')
-rw-r--r-- | src/client/game.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp index 0380c1661..5c38e027d 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -2014,15 +2014,11 @@ void Game::processItemSelection(u16 *new_playeritem) s32 dir = wheel; - if (input->joystick.wasKeyDown(KeyType::SCROLL_DOWN) || - wasKeyDown(KeyType::HOTBAR_NEXT)) { + if (wasKeyDown(KeyType::HOTBAR_NEXT)) dir = -1; - } - if (input->joystick.wasKeyDown(KeyType::SCROLL_UP) || - wasKeyDown(KeyType::HOTBAR_PREV)) { + if (wasKeyDown(KeyType::HOTBAR_PREV)) dir = 1; - } if (dir < 0) *new_playeritem = *new_playeritem < max_item ? *new_playeritem + 1 : 0; @@ -3138,11 +3134,11 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug) input->clearWasKeyPressed(); input->clearWasKeyReleased(); - input->joystick.clearWasKeyDown(KeyType::MOUSE_L); - input->joystick.clearWasKeyDown(KeyType::MOUSE_R); + input->joystick.clearWasKeyDown(KeyType::DIG); + input->joystick.clearWasKeyDown(KeyType::PLACE); - input->joystick.clearWasKeyReleased(KeyType::MOUSE_L); - input->joystick.clearWasKeyReleased(KeyType::MOUSE_R); + input->joystick.clearWasKeyReleased(KeyType::DIG); + input->joystick.clearWasKeyReleased(KeyType::PLACE); } |