Merge branch 'challenges-ui-fixes' into 'master'

Challenges UI fixes

Closes #1235

See merge request KartKrew/Kart!2207
This commit is contained in:
James R. 2024-04-02 00:36:45 +00:00
commit f488265d33
2 changed files with 25 additions and 12 deletions

View file

@ -6801,12 +6801,17 @@ drawborder:
} }
#ifdef DEVELOP #ifdef DEVELOP
if (cv_debugchallenges.value == -2 || if (
cv_debugchallenges.value > 0) (
cv_debugchallenges.value == -2
|| cv_debugchallenges.value > 0
)
&& num < MAXUNLOCKABLES
)
{ {
// Display the conditionset for this tile. // Display the conditionset for this tile.
V_DrawThinString(x, y, 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)); va("%u", num+1));
} }
#endif #endif
@ -7593,7 +7598,7 @@ static void M_DrawChallengeScrollBar(UINT8 *flashmap)
#define COLTOPIX(col) (col*hiliw) #define COLTOPIX(col) (col*hiliw)
//((col * barlen)/gamedata->challengegridwidth) //((col * barlen)/gamedata->challengegridwidth)
INT32 hilix, nextstep, i, completionamount, skiplevel; INT32 hilix, nextstep, i, numincolumn, completionamount, skiplevel;
// selection // selection
hilix = COLTOPIX(challengesmenu.col); hilix = COLTOPIX(challengesmenu.col);
@ -7606,25 +7611,30 @@ static void M_DrawChallengeScrollBar(UINT8 *flashmap)
mindiscouragement = 1; // so someone looking for 101% isn't hunting forever mindiscouragement = 1; // so someone looking for 101% isn't hunting forever
// unbounded so that we can do the last remaining completionamount draw // unbounded so that we can do the last remaining completionamount draw
nextstep = completionamount = skiplevel = 0; nextstep = numincolumn = completionamount = skiplevel = 0;
for (i = 0; ; i++) for (i = 0; ; i++)
{ {
INT32 prevstep = nextstep; INT32 prevstep = nextstep;
nextstep = (i % CHALLENGEGRIDHEIGHT); nextstep = (i % CHALLENGEGRIDHEIGHT);
if (prevstep >= nextstep) if (prevstep >= nextstep)
{ {
if (completionamount > 0) if (completionamount > 0 && numincolumn > 0)
{ {
if (skiplevel >= mindiscouragement && completionamount == 10) if (completionamount >= numincolumn)
{ {
// awareness // If any have been skipped, we subtract a little for awareness...
completionamount--; completionamount = (skiplevel >= mindiscouragement) ? 9 : 10;
}
else
{
// Ordinary 0-10 calculation.
completionamount = (completionamount*10)/numincolumn;
} }
V_DrawFadeFill(barx + hilix, bary, hiliw, barh, 0, 1, completionamount); V_DrawFadeFill(barx + hilix, bary, hiliw, barh, 0, 1, completionamount);
} }
completionamount = skiplevel = 0; numincolumn = completionamount = skiplevel = 0;
hilix = i/CHALLENGEGRIDHEIGHT; hilix = i/CHALLENGEGRIDHEIGHT;
hilix = COLTOPIX(hilix); hilix = COLTOPIX(hilix);
} }
@ -7636,6 +7646,9 @@ static void M_DrawChallengeScrollBar(UINT8 *flashmap)
if (gamedata->challengegrid[i] >= MAXUNLOCKABLES) if (gamedata->challengegrid[i] >= MAXUNLOCKABLES)
continue; continue;
// Okay, confirmed not a gap.
numincolumn++;
#ifdef DEVELOP #ifdef DEVELOP
if (cv_debugchallenges.value > 0 if (cv_debugchallenges.value > 0
&& cv_debugchallenges.value == gamedata->challengegrid[i]+1) && cv_debugchallenges.value == gamedata->challengegrid[i]+1)
@ -7652,7 +7665,7 @@ static void M_DrawChallengeScrollBar(UINT8 *flashmap)
if (gamedata->unlocked[gamedata->challengegrid[i]]) if (gamedata->unlocked[gamedata->challengegrid[i]])
{ {
completionamount += (10/CHALLENGEGRIDHEIGHT); completionamount++;
unlockable_t *ref = &unlockables[gamedata->challengegrid[i]]; unlockable_t *ref = &unlockables[gamedata->challengegrid[i]];

View file

@ -2899,7 +2899,7 @@ char *M_BuildConditionSetString(UINT16 unlockid)
if (work == NULL) if (work == NULL)
{ {
stopasap = true; stopasap = true;
work = "???"; work = "(Find other secrets to learn about this...)";
} }
else if (cn->type == UC_DESCRIPTIONOVERRIDE) else if (cn->type == UC_DESCRIPTIONOVERRIDE)
{ {