From 9d1492eb661efdda633f73e64ba50e9e666f786f Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 11 Jan 2024 17:36:13 -0800 Subject: [PATCH] DEVELOP: add debugchallenges cheat - Chao Keys cost nothing - Chao Keys unlock any tile, no matter if it has a hint or is a major unlock - Chao Keys can relock any tile (un-unlock) - Unlock animations play at the fastest speed - Affects Chao Keys as well as organic unlocks - Tiles are automatically flipped so you can see the content of every unlock all at once --- src/cvars.cpp | 4 ++++ src/k_menudraw.c | 6 +++++ src/menus/extras-challenges.c | 42 ++++++++++++++++++++++++++--------- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/cvars.cpp b/src/cvars.cpp index 1f6ae9915..aacd4e00f 100644 --- a/src/cvars.cpp +++ b/src/cvars.cpp @@ -859,6 +859,10 @@ consvar_t cv_kartdebugnodes = ServerCheat("debugnodes", "Off").on_off().descript consvar_t cv_1pswap = PlayerCheat("1pswap", "1").min_max(1, MAXSPLITSCREENPLAYERS).description("Let P1's Profile control a different splitscreen player"); +#ifdef DEVELOP + consvar_t cv_debugchallenges = PlayerCheat("debugchallenges", "Off").on_off().description("Chao keys are infinite, unlock any tile, relock tiles, animations play quickly"); +#endif + consvar_t cv_debugfinishline = PlayerCheat("debugfinishline", "Off").on_off().description("Highlight finish lines, respawn lines, death pits and instakill planes with high contrast colors"); consvar_t cv_debughudtracker = PlayerCheat("debughudtracker", "Off").on_off().description("Highlight overlapping HUD tracker blocks"); diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 0c8e9ed42..83e6867d1 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -6022,6 +6022,12 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili categoryside = (challengesmenu.extradata[id].flip <= TILEFLIP_MAX/4 || challengesmenu.extradata[id].flip > (3*TILEFLIP_MAX)/4); +#ifdef DEVELOP + extern consvar_t cv_debugchallenges; + if (cv_debugchallenges.value) + categoryside = false; +#endif + if (categoryside) { char categoryid = '0'; diff --git a/src/menus/extras-challenges.c b/src/menus/extras-challenges.c index 53b72c2ce..8e6395437 100644 --- a/src/menus/extras-challenges.c +++ b/src/menus/extras-challenges.c @@ -10,7 +10,9 @@ #include "../r_skins.h" #include "../s_sound.h" -//#define CHAOKEYDEBUG +#ifdef DEVELOP +extern consvar_t cv_debugchallenges; +#endif menuitem_t MISC_ChallengesStatsDummyMenu[] = { @@ -382,10 +384,6 @@ void M_Challenges(INT32 choice) boolean M_CanKeyHiliTile(void) { - // No keys to do it with? - if (gamedata->chaokeys == 0) - return false; - // No tile data? if (challengesmenu.extradata == NULL) return false; @@ -398,6 +396,16 @@ boolean M_CanKeyHiliTile(void) if (gamedata->unlocked[challengesmenu.currentunlock] == true) return false; +#ifdef DEVELOP + // Ignore game design? + if (cv_debugchallenges.value) + return true; +#endif + + // No keys to do it with? + if (gamedata->chaokeys == 0) + return false; + UINT16 i = (challengesmenu.hilix * CHALLENGEGRIDHEIGHT) + challengesmenu.hiliy; // Not a hinted tile. @@ -517,19 +525,26 @@ void M_ChallengesTick(void) { challengesmenu.chaokeyhold++; - const UINT32 chaohold_duration = + UINT32 chaohold_duration = CHAOHOLD_PADDING + ((unlockables[challengesmenu.currentunlock].majorunlock == true) ? CHAOHOLD_MAJOR : CHAOHOLD_STANDARD ); +#ifdef DEVELOP + if (cv_debugchallenges.value) + chaohold_duration = 0; +#endif + if (challengesmenu.chaokeyhold > chaohold_duration) { -#ifndef CHAOKEYDEBUG - gamedata->chaokeys -= (unlockables[challengesmenu.currentunlock].majorunlock == true) - ? 10 : 1; +#ifdef DEVELOP + if (!cv_debugchallenges.value) #endif + gamedata->chaokeys -= (unlockables[challengesmenu.currentunlock].majorunlock == true) + ? 10 : 1; + challengesmenu.chaokeyhold = 0; challengesmenu.unlockcount[CMC_CHAOANIM]++; @@ -640,6 +655,11 @@ void M_ChallengesTick(void) { tic_t nexttime = M_MenuExtraHeld(pid) ? (UNLOCKTIME*2) : MAXUNLOCKTIME; +#ifdef DEVELOP + if (cv_debugchallenges.value) + nexttime = UNLOCKTIME; +#endif + if (++challengesmenu.unlockanim >= nexttime) { challengesmenu.requestnew = true; @@ -768,8 +788,8 @@ boolean M_ChallengesInputs(INT32 ch) challengesmenu.unlockcount[CMC_CHAONOPE] = 6; S_StartSound(NULL, sfx_s3k7b); //sfx_s3kb2 -#ifdef CHAOKEYDEBUG - if (challengesmenu.currentunlock < MAXUNLOCKABLES && challengesmenu.unlockanim >= UNLOCKTIME && gamedata->unlocked[challengesmenu.currentunlock] == true) +#ifdef DEVELOP + if (cv_debugchallenges.value && challengesmenu.currentunlock < MAXUNLOCKABLES && challengesmenu.unlockanim >= UNLOCKTIME && gamedata->unlocked[challengesmenu.currentunlock] == true) { gamedata->unlocked[challengesmenu.currentunlock] = gamedata->unlockpending[challengesmenu.currentunlock] = false;