From 7b2e0f949188e76634a9a80ee2f196c000f0d5f0 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 1 Apr 2024 18:14:48 +0100 Subject: [PATCH 1/3] Oversight for debugchallenges: use the correct numeric value for debugchallenges highlight Avoids dereferencing ref->conditionset, given ref can be NULL for blank squares --- src/k_menudraw.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 39fd26d57..4dc76f701 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -6801,12 +6801,17 @@ drawborder: } #ifdef DEVELOP - if (cv_debugchallenges.value == -2 || - cv_debugchallenges.value > 0) + if ( + ( + cv_debugchallenges.value == -2 + || cv_debugchallenges.value > 0 + ) + && num < MAXUNLOCKABLES + ) { // Display the conditionset for this tile. V_DrawThinString(x, y, - ref->conditionset == cv_debugchallenges.value ? V_AQUAMAP : V_GRAYMAP, + num+1 == cv_debugchallenges.value ? V_AQUAMAP : V_GRAYMAP, va("%u", num+1)); } #endif From 30bf2e4cc4d2dc1a630e5da0f4089c3c1222b88f Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 1 Apr 2024 18:43:05 +0100 Subject: [PATCH 2/3] M_DrawChallengeScrollbar: Fade to white based on the % of challenges unlocked in the column, not the raw count Means blank squares won't cause this to be permanently incomplete --- src/k_menudraw.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 4dc76f701..79291790e 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -7598,7 +7598,7 @@ static void M_DrawChallengeScrollBar(UINT8 *flashmap) #define COLTOPIX(col) (col*hiliw) //((col * barlen)/gamedata->challengegridwidth) - INT32 hilix, nextstep, i, completionamount, skiplevel; + INT32 hilix, nextstep, i, numincolumn, completionamount, skiplevel; // selection hilix = COLTOPIX(challengesmenu.col); @@ -7611,25 +7611,30 @@ static void M_DrawChallengeScrollBar(UINT8 *flashmap) mindiscouragement = 1; // so someone looking for 101% isn't hunting forever // unbounded so that we can do the last remaining completionamount draw - nextstep = completionamount = skiplevel = 0; + nextstep = numincolumn = completionamount = skiplevel = 0; for (i = 0; ; i++) { INT32 prevstep = nextstep; nextstep = (i % CHALLENGEGRIDHEIGHT); if (prevstep >= nextstep) { - if (completionamount > 0) + if (completionamount > 0 && numincolumn > 0) { - if (skiplevel >= mindiscouragement && completionamount == 10) + if (completionamount >= numincolumn) { - // awareness - completionamount--; + // If any have been skipped, we subtract a little for awareness... + completionamount = (skiplevel >= mindiscouragement) ? 9 : 10; + } + else + { + // Ordinary 0-10 calculation. + completionamount = (completionamount*10)/numincolumn; } V_DrawFadeFill(barx + hilix, bary, hiliw, barh, 0, 1, completionamount); } - completionamount = skiplevel = 0; + numincolumn = completionamount = skiplevel = 0; hilix = i/CHALLENGEGRIDHEIGHT; hilix = COLTOPIX(hilix); } @@ -7641,6 +7646,9 @@ static void M_DrawChallengeScrollBar(UINT8 *flashmap) if (gamedata->challengegrid[i] >= MAXUNLOCKABLES) continue; + // Okay, confirmed not a gap. + numincolumn++; + #ifdef DEVELOP if (cv_debugchallenges.value > 0 && cv_debugchallenges.value == gamedata->challengegrid[i]+1) @@ -7657,7 +7665,7 @@ static void M_DrawChallengeScrollBar(UINT8 *flashmap) if (gamedata->unlocked[gamedata->challengegrid[i]]) { - completionamount += (10/CHALLENGEGRIDHEIGHT); + completionamount++; unlockable_t *ref = &unlockables[gamedata->challengegrid[i]]; From 3d5c0182fe3ebd6a7a49ddeff990349b3db7581b Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 1 Apr 2024 18:44:15 +0100 Subject: [PATCH 3/3] M_BuildConditionSetString: Show a more tantalising message for Challenges with forbidden descriptions "(Find other secrets to learn about this...)" - this replaces "???" --- src/m_cond.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_cond.c b/src/m_cond.c index 436db7dcf..1777af617 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -2899,7 +2899,7 @@ char *M_BuildConditionSetString(UINT16 unlockid) if (work == NULL) { stopasap = true; - work = "???"; + work = "(Find other secrets to learn about this...)"; } else if (cn->type == UC_DESCRIPTIONOVERRIDE) {