From 1ccde62f8a53b4299d348956a14b168b4c42687e Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 26 Feb 2023 21:19:22 +0000 Subject: [PATCH] Challenges menu: Sidestep the problem with holding down the "flip to see the other side" button by making it instead a toggle This toggle gets switched off when pressing any movement input to make it not possible to just leave on all the time and make the menu messy --- src/k_menu.h | 2 ++ src/menus/extras-challenges.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/k_menu.h b/src/k_menu.h index fb08ff4ab..063bb5a5b 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -1158,6 +1158,8 @@ extern struct challengesmenu_s { boolean pending; boolean requestnew; + boolean requestflip; + UINT8 unlockcount[CC_MAX]; UINT8 fade; diff --git a/src/menus/extras-challenges.c b/src/menus/extras-challenges.c index 790a03376..17ced0502 100644 --- a/src/menus/extras-challenges.c +++ b/src/menus/extras-challenges.c @@ -175,6 +175,7 @@ menu_t *M_InterruptMenuWithChallenges(menu_t *desiredmenu) if (challengesmenu.pending || desiredmenu == NULL) { challengesmenu.ticker = 0; + challengesmenu.requestflip = false; challengesmenu.requestnew = false; challengesmenu.currentunlock = MAXUNLOCKABLES; challengesmenu.unlockcondition = NULL; @@ -287,7 +288,7 @@ void M_ChallengesTick(void) if (challengesmenu.extradata != NULL) { UINT16 id = (challengesmenu.hilix * CHALLENGEGRIDHEIGHT) + challengesmenu.hiliy; - boolean seeeveryone = M_MenuButtonHeld(pid, MBT_R); + boolean seeeveryone = challengesmenu.requestflip; boolean allthewaythrough; UINT8 maxflip; for (i = 0; i < (CHALLENGEGRIDHEIGHT * gamedata->challengegridwidth); i++) @@ -479,8 +480,17 @@ boolean M_ChallengesInputs(INT32 ch) return true; } + if (M_MenuButtonPressed(pid, MBT_R)) + { + challengesmenu.requestflip ^= true; + + return true; + } + if (challengesmenu.extradata != NULL && move) { + challengesmenu.requestflip = false; + // Determine movement around the grid // For right/down movement, we can pre-determine the number of steps based on extradata. // For left/up movement, we can't - we have to be ready to iterate twice, and break early if we don't run into a large tile.