From: Holger Schemel Date: Sat, 25 May 2024 10:26:59 +0000 (+0200) Subject: added precedence of game keys over speed/debug keys when playing X-Git-Tag: 4.4.0.0-test-2~16 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=403562c21286288c3f0798e55f075430254399f1;p=rocksndiamonds.git added precedence of game keys over speed/debug keys when playing --- diff --git a/src/events.c b/src/events.c index 3406adc5..99b55fc8 100644 --- a/src/events.c +++ b/src/events.c @@ -2102,14 +2102,40 @@ void HandleKey(Key key, int key_status) { &ski.snap, NULL, DEFAULT_KEY_SNAP, JOY_BUTTON_SNAP }, { &ski.drop, NULL, DEFAULT_KEY_DROP, JOY_BUTTON_DROP } }; + boolean game_key_pressed = FALSE; int joy = 0; int i; - if (HandleKeysSpeed(key, key_status)) - return; // do not handle already processed keys again + // check if any game key is pressed (direction/snap/drop keys) + if (game_status == GAME_MODE_PLAYING) + { + int pnr; - if (HandleKeysDebug(key, key_status)) - return; // do not handle already processed keys again + for (pnr = 0; pnr < MAX_PLAYERS; pnr++) + { + ski = setup.input[pnr].key; + + for (i = 0; i < NUM_PLAYER_ACTIONS; i++) + if (key == *key_info[i].key_custom) + game_key_pressed = TRUE; + } + + ssi = setup.shortcut; + + for (i = 0; i < NUM_DIRECTIONS; i++) + if (key == *key_info[i].key_snap) + game_key_pressed = TRUE; + } + + // only handle speed or debug keys if no game key is pressed + if (!game_key_pressed) + { + if (HandleKeysSpeed(key, key_status)) + return; // do not handle already processed keys again + + if (HandleKeysDebug(key, key_status)) + return; // do not handle already processed keys again + } // map special keys (media keys / remote control buttons) to default keys if (key == KSYM_PlayPause)