From 6409fac876661c57e4561774d910f752fe57ba02 Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Tue, 20 Jun 2023 08:51:10 +0200 Subject: [PATCH] Make arrow keys not scroll so slow you want to self-harm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All keyboard and mouse button work via standard text editor semantics: keeping a button pressed will wait for a while, after which it will repeat at fixed rate. That's fine for a text editor or whatnot, but it's painful when you want to scroll with the arrow keys. I hated this back when I first played the game, and I'm hating it now. I don't think anyone will miss the old "functionality". We can't outright remove the delay for all keys, as e.g. pressing "i" will repeat so fast that you can never open the inventory. Come to think of it, I think we can remove all of this functionality, at least for the keyboard as I don't *think* it's ever used (it is used for mouse buttons, although that too can be simplified greatly) – but all of that is a much larger refactor. --- src/plib/gnw/input.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plib/gnw/input.cc b/src/plib/gnw/input.cc index e4c243d..26d9be7 100644 --- a/src/plib/gnw/input.cc +++ b/src/plib/gnw/input.cc @@ -1148,6 +1148,13 @@ void GNW95_process_message() if (ptr->time != -1) { unsigned int elapsedTime = ptr->time > tick ? INT_MAX : tick - ptr->time; unsigned int delay = ptr->count == 0 ? GNW95_repeat_delay : GNW95_repeat_rate; + switch (key) { + case SDL_SCANCODE_LEFT: + case SDL_SCANCODE_RIGHT: + case SDL_SCANCODE_UP: + case SDL_SCANCODE_DOWN: + delay = 0; + } if (elapsedTime > delay) { keyboardData.key = key; keyboardData.down = 1;