Add a x/X counter to the unlocks menu, like KAR and Smash

This commit is contained in:
toaster 2022-12-10 21:06:24 +00:00
parent d2c9c7027d
commit 6d4b55a2d5
3 changed files with 73 additions and 16 deletions

View file

@ -1088,6 +1088,12 @@ void M_DrawAddons(void);
#define RIGHTUNLOCKSCROLL 3
#define LEFTUNLOCKSCROLL (RIGHTUNLOCKSCROLL-1)
#define CC_TOTAL 0
#define CC_UNLOCKED 1
#define CC_TALLY 2
#define CC_ANIM 3
#define CC_MAX 4
// Keep track of some pause menu data for visual goodness.
extern struct challengesmenu_s {
@ -1105,6 +1111,8 @@ extern struct challengesmenu_s {
boolean pending;
boolean requestnew;
UINT8 unlockcount[CC_MAX];
UINT8 fade;
} challengesmenu;

View file

@ -4684,24 +4684,37 @@ void M_DrawChallenges(void)
M_DrawCharSelectExplosions(false, explodex, currentMenu->y);
challengedesc:
y = 120;
V_DrawScaledPatch(0, y, 0, W_CachePatchName("MENUHINT", PU_CACHE));
if (challengesmenu.currentunlock < MAXUNLOCKABLES)
// Tally
{
str = unlockables[challengesmenu.currentunlock].name;
if (!gamedata->unlocked[challengesmenu.currentunlock])
str = va("%d/%d",
challengesmenu.unlockcount[CC_UNLOCKED] + challengesmenu.unlockcount[CC_TALLY],
challengesmenu.unlockcount[CC_TOTAL]
);
V_DrawRightAlignedKartString(BASEVIDWIDTH-7, 9-challengesmenu.unlockcount[CC_ANIM], 0, str);
}
// Name bar
{
y = 120;
V_DrawScaledPatch(0, y, 0, W_CachePatchName("MENUHINT", PU_CACHE));
if (challengesmenu.currentunlock < MAXUNLOCKABLES)
{
str = "???"; //M_CreateSecretMenuOption(str);
str = unlockables[challengesmenu.currentunlock].name;
if (!gamedata->unlocked[challengesmenu.currentunlock])
{
str = "???"; //M_CreateSecretMenuOption(str);
}
}
else
{
str = "---";
}
}
else
{
str = "---";
}
offset = V_LSTitleLowStringWidth(str, 0) / 2;
V_DrawLSTitleLowString(BASEVIDWIDTH/2 - offset, y+6, 0, str);
offset = V_LSTitleLowStringWidth(str, 0) / 2;
V_DrawLSTitleLowString(BASEVIDWIDTH/2 - offset, y+6, 0, str);
}
if (!challengesmenu.fade)
V_DrawThinString(20, 120 + 60, V_ALLOWLOWERCASE, "Press (B)");

View file

@ -6848,6 +6848,8 @@ struct challengesmenu_s challengesmenu;
menu_t *M_InterruptMenuWithChallenges(menu_t *desiredmenu)
{
UINT8 i;
M_UpdateUnlockablesAndExtraEmblems(false);
if ((challengesmenu.pending = challengesmenu.requestnew = (M_GetNextAchievedUnlock() < MAXUNLOCKABLES)))
@ -6864,6 +6866,24 @@ menu_t *M_InterruptMenuWithChallenges(menu_t *desiredmenu)
if (gamedata->challengegrid)
challengesmenu.extradata = M_ChallengeGridExtraData();
memset(&challengesmenu.unlockcount, 0, sizeof(challengesmenu.unlockcount));
for (i = 0; i < MAXUNLOCKABLES; i++)
{
if (!unlockables[i].conditionset)
{
continue;
}
challengesmenu.unlockcount[CC_TOTAL]++;
if (!gamedata->unlocked[i])
{
continue;
}
challengesmenu.unlockcount[CC_UNLOCKED]++;
}
return &MISC_ChallengesDef;
}
@ -7035,6 +7055,8 @@ void M_ChallengesTick(void)
if (setup_explosions[i].tics > 0)
setup_explosions[i].tics--;
}
if (challengesmenu.unlockcount[CC_ANIM] > 0)
challengesmenu.unlockcount[CC_ANIM]--;
if (challengesmenu.pending)
{
@ -7075,6 +7097,8 @@ void M_ChallengesTick(void)
{
// Unlock animation... also tied directly to the actual unlock!
gamedata->unlocked[challengesmenu.currentunlock] = true;
challengesmenu.unlockcount[CC_TALLY]++;
challengesmenu.unlockcount[CC_ANIM]++;
Z_Free(challengesmenu.extradata);
if ((challengesmenu.extradata = M_ChallengeGridExtraData()))
@ -7127,10 +7151,22 @@ void M_ChallengesTick(void)
}
}
}
else if (challengesmenu.fade > 0)
else
{
// Fade decrease.
challengesmenu.fade--;
// Tick down the tally. (currently not visible)
/*if ((challengesmenu.ticker & 1)
&& challengesmenu.unlockcount[CC_TALLY] > 0)
{
challengesmenu.unlockcount[CC_TALLY]--;
challengesmenu.unlockcount[CC_UNLOCKED]++;
}*/
if (challengesmenu.fade > 0)
{
// Fade decrease.
challengesmenu.fade--;
}
}
}