From ca3ecce7ca33862970bc35f5738c216e9615cb21 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sat, 1 Jul 2023 16:02:31 -0700 Subject: [PATCH 1/4] DEVELOP: Hold Z to unlock anything, anytime --- src/menus/extras-challenges.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/menus/extras-challenges.c b/src/menus/extras-challenges.c index ff35d2ed6..564c16f84 100644 --- a/src/menus/extras-challenges.c +++ b/src/menus/extras-challenges.c @@ -366,7 +366,11 @@ void M_ChallengesTick(void) if (challengesmenu.chaokeyhold) { - if (M_MenuExtraHeld(pid) && M_CanKeyHiliTile()) + boolean devskip = false; +#ifdef DEVELOP + devskip = M_MenuButtonHeld(pid, MBT_Z); +#endif + if (devskip || (M_MenuExtraHeld(pid) && M_CanKeyHiliTile())) { // Not pressed just this frame? if (!M_MenuExtraPressed(pid)) @@ -628,6 +632,13 @@ boolean M_ChallengesInputs(INT32 ch) } return true; } +#ifdef DEVELOP + else if (M_MenuButtonPressed(pid, MBT_Z)) + { + challengesmenu.chaokeyhold = 1; + return true; + } +#endif else { if (M_MenuBackPressed(pid) || start) From 24d3524509c9faa08625c47f62ab4e25af9b43c6 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sat, 1 Jul 2023 16:10:17 -0700 Subject: [PATCH 2/4] DEVELOP Z-unlock should still try not to crash --- src/menus/extras-challenges.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/menus/extras-challenges.c b/src/menus/extras-challenges.c index 564c16f84..94ca9aa2a 100644 --- a/src/menus/extras-challenges.c +++ b/src/menus/extras-challenges.c @@ -287,10 +287,10 @@ void M_Challenges(INT32 choice) M_SetupNextMenu(&MISC_ChallengesDef, false); } -static boolean M_CanKeyHiliTile(void) +static boolean M_CanKeyHiliTile(boolean devskip) { // No keys to do it with? - if (gamedata->chaokeys == 0) + if (gamedata->chaokeys == 0 && !devskip) return false; // No tile data? @@ -306,14 +306,15 @@ static boolean M_CanKeyHiliTile(void) return false; // Marked as unskippable? - if (unlockables[challengesmenu.currentunlock].majorunlock == true) + if (unlockables[challengesmenu.currentunlock].majorunlock == true && !devskip) return false; UINT16 i = (challengesmenu.hilix * CHALLENGEGRIDHEIGHT) + challengesmenu.hiliy; // Not a hinted tile OR a fresh board. if (!(challengesmenu.extradata[i].flags & CHE_HINT) - && (challengesmenu.unlockcount[CC_UNLOCKED] + challengesmenu.unlockcount[CC_TALLY] > 0)) + && (challengesmenu.unlockcount[CC_UNLOCKED] + challengesmenu.unlockcount[CC_TALLY] > 0) + && !devskip) return false; // All good! @@ -370,7 +371,8 @@ void M_ChallengesTick(void) #ifdef DEVELOP devskip = M_MenuButtonHeld(pid, MBT_Z); #endif - if (devskip || (M_MenuExtraHeld(pid) && M_CanKeyHiliTile())) + // A little messy, but don't freak out, this is just so devs don't crash the game on non-tiles + if ((devskip || M_MenuExtraHeld(pid)) && M_CanKeyHiliTile(devskip)) { // Not pressed just this frame? if (!M_MenuExtraPressed(pid)) @@ -609,7 +611,7 @@ boolean M_ChallengesInputs(INT32 ch) } else if (M_MenuExtraPressed(pid)) { - if (M_CanKeyHiliTile()) + if (M_CanKeyHiliTile(false)) { challengesmenu.chaokeyhold = 1; } From 304ed85941d53bc61d18124155754ddd6f164b70 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sat, 1 Jul 2023 16:14:42 -0700 Subject: [PATCH 3/4] DEVELOP devmode cheat: allow saving --- src/m_cheat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 0db6a5b9b..824719172 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -146,7 +146,8 @@ static UINT8 cheatf_devmode(void) gamedata->unlocked[i] = true; } - G_SetUsedCheats(); + // This is a developer feature, you know how to delete ringdata + // G_SetUsedCheats(); S_StartSound(0, sfx_kc42); devparm = true; From d1c954fd86d1859148c9be6d45c36e118d369f1e Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sat, 1 Jul 2023 16:17:37 -0700 Subject: [PATCH 4/4] DEVELOP devmode cheat: save gamedata instantly --- src/m_cheat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/m_cheat.c b/src/m_cheat.c index 824719172..cb424c6b7 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -153,6 +153,8 @@ static UINT8 cheatf_devmode(void) devparm = true; cht_debug |= 0x8000; + G_SaveGameData(); + return 1; } #endif