Revert "Fix close inputs being throttled, and speed up scrolling when a key is held (#3515)"

This reverts commit 614d4ac2f7.
This commit is contained in:
Deve 2018-10-24 21:16:18 +02:00
parent 5918a6025e
commit a05fa23bf3
2 changed files with 13 additions and 21 deletions

View File

@ -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;

View File

@ -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);