Merge branch 'challenges-cleanup' into 'master'

Minor touchups to challenges menu drawer

See merge request KartKrew/Kart!973
This commit is contained in:
Oni 2023-02-25 23:36:15 +00:00
commit 81e7e3a1c8
2 changed files with 36 additions and 21 deletions

View file

@ -4542,8 +4542,23 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
if (!unlockedyet)
{
UINT32 flags = 0;
boolean hint = !!(challengesmenu.extradata[id].flags & CHE_HINT);
if (challengesmenu.extradata[id].flags != CHE_HINT)
pat = W_CachePatchName(
va("UN_OUTL%c",
ref->majorunlock ? 'B' : 'A'
),
PU_CACHE);
V_DrawFixedPatch(
x*FRACUNIT, y*FRACUNIT,
FRACUNIT,
(hint ? V_ADD : V_SUBTRACT)|V_90TRANS,
pat,
colormap
);
if (!hint)
{
colormap = R_GetTranslationColormap(TC_BLINK, SKINCOLOR_BLACK, GTC_CACHE);
flags = V_SUBTRACT|V_90TRANS;
@ -4988,7 +5003,7 @@ static void M_DrawChallengePreview(INT32 x, INT32 y)
void M_DrawChallenges(void)
{
INT32 x = currentMenu->x, explodex, selectx;
INT32 y = currentMenu->y;
INT32 y;
INT16 i, j;
const char *str;
INT16 offset;
@ -5015,12 +5030,25 @@ void M_DrawChallenges(void)
#undef questionloop
}
// Do underlay for everything else early so the bottom of the reticule doesn't get shaded over.
{
y = 120;
V_DrawScaledPatch(0, y,
(10-challengetransparentstrength)<<V_ALPHASHIFT,
W_CachePatchName("MENUHINT", PU_CACHE));
V_DrawFadeFill(0, y+27, BASEVIDWIDTH, BASEVIDHEIGHT - (y+27), 0, 31, challengetransparentstrength);
}
if (gamedata->challengegrid == NULL || challengesmenu.extradata == NULL)
{
V_DrawCenteredString(x, y, V_REDMAP, "No challenges available!?");
goto challengedesc;
}
y = currentMenu->y;
V_DrawFadeFill(0, y-2, BASEVIDWIDTH, 90, 0, 31, challengetransparentstrength);
x -= (challengesgridstep-1);
@ -5107,12 +5135,6 @@ challengedesc:
{
y = 120;
V_DrawScaledPatch(0, y,
(10-challengetransparentstrength)<<V_ALPHASHIFT,
W_CachePatchName("MENUHINT", PU_CACHE));
V_DrawFadeFill(0, y+27, BASEVIDWIDTH, BASEVIDHEIGHT - (y+27), 0, 31, challengetransparentstrength);
if (challengesmenu.currentunlock < MAXUNLOCKABLES)
{
str = unlockables[challengesmenu.currentunlock].name;

View file

@ -18,7 +18,7 @@ menu_t MISC_ChallengesDef = {
&MainDef,
0,
MISC_ChallengesStatsDummyMenu,
BASEVIDWIDTH/2, 32,
BASEVIDWIDTH/2, 30,
0, 0,
"EXTRAS",
98, 0,
@ -85,13 +85,9 @@ static void M_ChallengesAutoFocus(UINT8 unlockid, boolean fresh)
challengesmenu.row = challengesmenu.hiliy = i%CHALLENGEGRIDHEIGHT;
// Begin animation
if (challengesmenu.extradata[i].flip == 0)
if (challengesmenu.pending)
{
challengesmenu.extradata[i].flip =
(challengesmenu.pending
? (TILEFLIP_MAX/2)
: 1
);
challengesmenu.extradata[i].flip = (TILEFLIP_MAX/2);
}
if (fresh)
@ -178,6 +174,7 @@ menu_t *M_InterruptMenuWithChallenges(menu_t *desiredmenu)
if (challengesmenu.pending || desiredmenu == NULL)
{
challengesmenu.ticker = 0;
challengesmenu.requestnew = false;
challengesmenu.currentunlock = MAXUNLOCKABLES;
challengesmenu.unlockcondition = NULL;
@ -297,7 +294,7 @@ void M_ChallengesTick(void)
{
allthewaythrough = (!seeeveryone && !challengesmenu.pending && i != id);
maxflip = ((seeeveryone || !allthewaythrough) ? (TILEFLIP_MAX/2) : TILEFLIP_MAX);
if ((seeeveryone || (challengesmenu.extradata[i].flip > 0))
if ((seeeveryone || (i == id) || (challengesmenu.extradata[i].flip > 0))
&& (challengesmenu.extradata[i].flip != maxflip))
{
challengesmenu.extradata[i].flip++;
@ -629,13 +626,9 @@ boolean M_ChallengesInputs(INT32 ch)
}
}
i = (challengesmenu.hilix * CHALLENGEGRIDHEIGHT) + challengesmenu.hiliy;
//i = (challengesmenu.hilix * CHALLENGEGRIDHEIGHT) + challengesmenu.hiliy;
}
// Begin animation
if (challengesmenu.extradata[i].flip == 0)
challengesmenu.extradata[i].flip++;
return true;
}