From a05fa23bf378f5c146e59ff608b7ecf51311b714 Mon Sep 17 00:00:00 2001 From: Deve Date: Wed, 24 Oct 2018 21:16:18 +0200 Subject: [PATCH] Revert "Fix close inputs being throttled, and speed up scrolling when a key is held (#3515)" This reverts commit 614d4ac2f79195544c7f01ce3bb21bb1b64e6f6e. --- src/input/input_manager.cpp | 26 ++++++++++---------------- src/input/input_manager.hpp | 8 +++----- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/input/input_manager.cpp b/src/input/input_manager.cpp index 1b1eb5ae9..4ff2e0533 100644 --- a/src/input/input_manager.cpp +++ b/src/input/input_manager.cpp @@ -82,7 +82,6 @@ InputManager::InputManager() : m_mode(BOOTSTRAP), m_timer_in_use = false; m_master_player_only = false; m_timer = 0; - m_timer_use_count = 0; } // ----------------------------------------------------------------------------- @@ -117,7 +116,7 @@ void InputManager::handleStaticAction(int key, int value) // When no players... a cutscene if (race_manager->getNumPlayers() == 0 && world != NULL && value > 0 && - (key == IRR_KEY_SPACE || key == IRR_KEY_RETURN || + (key == IRR_KEY_SPACE || key == IRR_KEY_RETURN || key == IRR_KEY_BUTTON_A)) { world->onFirePressed(NULL); @@ -824,6 +823,12 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, // ... when in menus else { + // reset timer when released + if (abs(value) == 0 && type == Input::IT_STICKBUTTON) + { + m_timer_in_use = false; + m_timer = 0; + } // When in master-only mode, we can safely assume that players // are set up, contrarly to early menus where we accept every @@ -855,10 +860,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, if (abs(value) > Input::MAX_VALUE*2/3) { m_timer_in_use = true; - - // After three iterations of the timer, pick up the scrolling pace - m_timer_use_count++; - m_timer = m_timer_use_count > 3 ? 0.05 : 0.25; + m_timer = 0.25; } // player may be NULL in early menus, before player setup has @@ -885,14 +887,6 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, ->processGUIAction(action, deviceID, abs(value), type, playerID); } - - // reset timer when released - if (abs(value) == 0) - { - m_timer_in_use = false; - m_timer = 0; - m_timer_use_count = 0; - } } } else if (type == Input::IT_KEYBOARD) @@ -1036,7 +1030,7 @@ EventPropagation InputManager::input(const SEvent& event) // single letter). Same for spacebar. Same for letters. if (GUIEngine::isWithinATextBox()) { - if (key == IRR_KEY_BACK || key == IRR_KEY_SPACE || + if (key == IRR_KEY_BACK || key == IRR_KEY_SPACE || key == IRR_KEY_SHIFT) { return EVENT_LET; @@ -1069,7 +1063,7 @@ EventPropagation InputManager::input(const SEvent& event) // single letter). Same for spacebar. Same for letters. if (GUIEngine::isWithinATextBox()) { - if (key == IRR_KEY_BACK || key == IRR_KEY_SPACE || + if (key == IRR_KEY_BACK || key == IRR_KEY_SPACE || key == IRR_KEY_SHIFT) { return EVENT_LET; diff --git a/src/input/input_manager.hpp b/src/input/input_manager.hpp index e6806d829..8c2ed7ff0 100644 --- a/src/input/input_manager.hpp +++ b/src/input/input_manager.hpp @@ -46,6 +46,9 @@ public: BOOTSTRAP }; + // to put a delay before a new gamepad axis move is considered in menu + bool m_timer_in_use; + float m_timer; private: @@ -65,11 +68,6 @@ private: */ int m_mouse_val_x, m_mouse_val_y; - // to put a delay before a new gamepad axis move is considered in menu - bool m_timer_in_use; - int m_timer_use_count; - float m_timer; - void dispatchInput(Input::InputType, int deviceID, int btnID, Input::AxisDirection direction, int value, bool shift_mask = false);