From: Holger Schemel Date: Tue, 13 Jun 2023 21:22:10 +0000 (+0200) Subject: fixed sending button press/release events to animation event handling X-Git-Tag: 4.3.7.0~44 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=41b98d9099512bb9515d97eee340172e9567ee34;p=rocksndiamonds.git fixed sending button press/release events to animation event handling --- diff --git a/src/events.c b/src/events.c index e03f58f9..648b035f 100644 --- a/src/events.c +++ b/src/events.c @@ -2614,12 +2614,15 @@ void HandleJoystick(void) int up = joy & JOY_UP; int down = joy & JOY_DOWN; int button = joy & JOY_BUTTON; - int newbutton = (AnyJoystickButton() == JOY_BUTTON_NEW_PRESSED); + int anybutton = AnyJoystickButton(); + int newbutton = (anybutton == JOY_BUTTON_NEW_PRESSED); int dx = (left ? -1 : right ? 1 : 0); int dy = (up ? -1 : down ? 1 : 0); boolean use_delay_value_first = (joytest != joytest_last); + boolean new_button_event = (anybutton == JOY_BUTTON_NEW_PRESSED || + anybutton == JOY_BUTTON_NEW_RELEASED); - if (HandleGlobalAnimClicks(-1, -1, newbutton, FALSE)) + if (new_button_event && HandleGlobalAnimClicks(-1, -1, newbutton, FALSE)) { // do not handle this button event anymore return;