[input] Ensure button id is never 0

IN_ButtonAction treats id 0 as not pressed in its internal processing,
and the previous input implementation treated 0 as "no key", so this is
both the simplest and most correct fix.

Fixes mouse left button not working every second time the game is run
(due to keyboard and mouse bindings swapping places in the config file
(separate issue, if it really is one)).
This commit is contained in:
Bill Currie 2021-12-18 14:14:12 +09:00
parent 68de8615d6
commit 8d58dee4b1

View file

@ -649,6 +649,8 @@ IMT_ProcessButton (int button, int state)
while (imt) {
in_buttonbinding_t *b = imt->button_bindings.a[button];
if (b) {
// ensure IN_ButtonAction never sees button id 0
button += 1;
switch (b->type) {
case inb_button:
IN_ButtonAction (b->button, button, state);