From 0427f7f3ff9d29ff45eabba6bc965834607a8ade Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 5 Apr 2024 00:45:12 +0100 Subject: [PATCH] Don't show uncollected Platinum medals You'll see the Platinum time to reach as a guiding star when Time Attacking the specific course, but with no accompanying empty medal icon. Also - fixes an x coordinate issue for higher medal quantity on the version that draws under the timestamp - cache SECRET_ENCORE and SECRET_SPBATTACK availability in the statistics drawer too --- src/g_game.c | 10 ++++++++-- src/g_game.h | 1 + src/k_hud.cpp | 13 +++++++++---- src/k_menudraw.c | 43 +++++++++++++++++++++++++++---------------- 4 files changed, 45 insertions(+), 22 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index fa2ca0839..f983a070c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -440,8 +440,14 @@ void G_UpdateTimeStickerMedals(UINT16 map, boolean showownrecord) if (cv_dummyspbattack.value && !(emblem->flags & (ME_SPBATTACK|ME_ENCORE))) return; - if (!gamedata->collected[(emblem-emblemlocations)] && gonnadrawtime) - break; + if (!gamedata->collected[(emblem-emblemlocations)]) + { + if (gonnadrawtime) + break; + + if (emblem->type == ET_TIME && emblem->tag == AUTOMEDAL_PLATINUM) + stickermedalinfo.platinumcount++; + } // Simpler than having two checks if (stickermedalinfo.visiblecount == MAXMEDALVISIBLECOUNT) diff --git a/src/g_game.h b/src/g_game.h index 8d3ea37b8..232ba411f 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -213,6 +213,7 @@ void G_EndGame(void); // moved from y_inter.c/h and renamed extern struct stickermedalinfo { UINT8 visiblecount; + UINT8 platinumcount; UINT8 jitter; boolean norecord; tic_t timetoreach; diff --git a/src/k_hud.cpp b/src/k_hud.cpp index 4b3f1f079..d02285c96 100644 --- a/src/k_hud.cpp +++ b/src/k_hud.cpp @@ -2015,7 +2015,7 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT32 splitflags, U Draw(workx, worky).text(text); } - workx -= (6 + (i*5)); + workx -= (((1 + i - stickermedalinfo.platinumcount)*6) - 1); if (!mode) splitflags = (splitflags &~ V_HUDTRANSHALF)|V_HUDTRANS; @@ -2029,16 +2029,21 @@ void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT32 splitflags, U static_cast(W_CachePatchName(M_GetEmblemPatch(stickermedalinfo.emblems[i], false), PU_CACHE)), R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(stickermedalinfo.emblems[i]), GTC_CACHE) ); + + workx += 6; } - else + else if ( + stickermedalinfo.emblems[i]->type != ET_TIME + || stickermedalinfo.emblems[i]->tag != AUTOMEDAL_PLATINUM + ) { V_DrawMappedPatch(workx, worky, splitflags, static_cast(W_CachePatchName("NEEDIT", PU_CACHE)), NULL ); - } - workx += 6; + workx += 6; + } } } diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 5fd50d562..c311e86b6 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -7952,24 +7952,32 @@ challengedesc: #define STATSSTEP 10 -static void M_DrawMapMedals(INT32 mapnum, INT32 x, INT32 y) +static void M_DrawMapMedals(INT32 mapnum, INT32 x, INT32 y, boolean allowtime, boolean allowencore, boolean allowspb) { UINT8 lasttype = UINT8_MAX, curtype; // M_GetLevelEmblems is ONE-indexed, urgh - mapnum++; + emblem_t *emblem = M_GetLevelEmblems(mapnum+1); - emblem_t *emblem = M_GetLevelEmblems(mapnum); - - boolean hasmedals = (emblem != NULL); + const boolean hasmedals = (emblem != NULL); + boolean collected = false; while (emblem) { + collected = gamedata->collected[emblem-emblemlocations]; switch (emblem->type) { case ET_TIME: + { + if (!allowtime + || (!collected && emblem->tag == AUTOMEDAL_PLATINUM)) + { + emblem = M_GetLevelEmblems(-1); + continue; + } curtype = 1; break; + } case ET_GLOBAL: { if (emblem->flags & GE_NOTMEDAL) @@ -7982,8 +7990,8 @@ static void M_DrawMapMedals(INT32 mapnum, INT32 x, INT32 y) } case ET_MAP: { - if (((emblem->flags & ME_ENCORE) && !M_SecretUnlocked(SECRET_ENCORE, true)) - || ((emblem->flags & ME_SPBATTACK) && !M_SecretUnlocked(SECRET_SPBATTACK, true))) + if (((emblem->flags & ME_ENCORE) && !allowencore) + || ((emblem->flags & ME_SPBATTACK) && !allowspb)) { emblem = M_GetLevelEmblems(-1); continue; @@ -7992,8 +8000,10 @@ static void M_DrawMapMedals(INT32 mapnum, INT32 x, INT32 y) break; } default: + { curtype = 0; break; + } } // Shift over if emblem is of a different discipline @@ -8001,7 +8011,7 @@ static void M_DrawMapMedals(INT32 mapnum, INT32 x, INT32 y) x -= 4; lasttype = curtype; - if (gamedata->collected[emblem-emblemlocations]) + if (collected) V_DrawMappedPatch(x, y, 0, W_CachePatchName(M_GetEmblemPatch(emblem, false), PU_CACHE), R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_MENUCACHE)); else @@ -8011,9 +8021,6 @@ static void M_DrawMapMedals(INT32 mapnum, INT32 x, INT32 y) x -= 8; } - // Undo offset - mapnum--; - if (hasmedals) x -= 4; @@ -8107,6 +8114,10 @@ static void M_DrawStatsMaps(void) i = -1; + const boolean allowencore = M_SecretUnlocked(SECRET_ENCORE, true); + const boolean allowspb = M_SecretUnlocked(SECRET_SPBATTACK, true); + boolean allowtime = false; + while ((mnum = statisticsmenu.maplist[++i]) != NEXTMAP_INVALID) { if (location) @@ -8157,13 +8168,13 @@ static void M_DrawStatsMaps(void) V_DrawFadeFill(24, y + 5, (BASEVIDWIDTH - 24) - 24, 3, 0, 31, 8 - (i & 1)*2); - if (!(mapheaderinfo[mnum]->menuflags & LF2_NOTIMEATTACK) - && ( + allowtime = ( (timeattack[0] && (mapheaderinfo[mnum]->typeoflevel & TOL_RACE)) || (timeattack[1] && (mapheaderinfo[mnum]->typeoflevel & TOL_BATTLE)) || (timeattack[2] && (mapheaderinfo[mnum]->typeoflevel & (TOL_SPECIAL|TOL_VERSUS))) - ) - ) + ); + + if (!(mapheaderinfo[mnum]->menuflags & LF2_NOTIMEATTACK) && allowtime) { besttime = mapheaderinfo[mnum]->records.timeattack.time; @@ -8183,7 +8194,7 @@ static void M_DrawStatsMaps(void) } } - M_DrawMapMedals(mnum, medalspos - 8, y); + M_DrawMapMedals(mnum, medalspos - 8, y, allowtime, allowencore, allowspb); if (mapheaderinfo[mnum]->menuttl[0]) {