mirror of
https://github.com/minetest/minetest.git
synced 2025-07-05 01:10:22 +02:00
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.
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user