From: Holger Schemel Date: Wed, 22 Jun 2022 21:29:05 +0000 (+0200) Subject: fixed synchronization problem when configuring keyboard X-Git-Tag: 4.3.3.0~88 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=e7c8e578d45fe076e6bf40042202971d83e73104;p=rocksndiamonds.git fixed synchronization problem when configuring keyboard This is a somewhat similar bug like that in the previous commit, but in this case only one event was processed for each screen update, causing many events (like those produced from analog sticks that are moved while the keyboard is about to be configured) to be processed one after the other, each with a full video frame delay in between. The fix works just like that used when configuring game controllers. --- diff --git a/src/screens.c b/src/screens.c index 533cf4c4..576f1ff0 100644 --- a/src/screens.c +++ b/src/screens.c @@ -8456,8 +8456,13 @@ static boolean CustomizeKeyboardMain(int player_nr) while (!finished) { Event event; + unsigned int event_frame_delay = 0; + unsigned int event_frame_delay_value = GAME_FRAME_DELAY; - if (NextValidEvent(&event)) + // reset frame delay counter directly after updating screen + ResetDelayCounter(&event_frame_delay); + + while (NextValidEvent(&event)) { switch (event.type) { @@ -8528,6 +8533,10 @@ static boolean CustomizeKeyboardMain(int player_nr) HandleOtherEvents(&event); break; } + + // do not handle events for longer than standard frame delay period + if (DelayReached(&event_frame_delay, event_frame_delay_value)) + break; } BackToFront();