From d98b88a61fa58e46e194d763f127f98e81ef325d Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 14 Aug 2025 21:52:27 +0100 Subject: [PATCH] M_DrawChallengeTile: The non-category size of SECRET_MAP will now show a "map face", ala Map Anger/menu Round Queue --- src/k_hud.cpp | 48 ++++++++++++++++++---------- src/k_hud.h | 7 ++-- src/k_menudraw.c | 83 ++++++++++++++++++++++++++++++++++-------------- src/k_vote.c | 2 +- src/y_inter.cpp | 2 +- 5 files changed, 97 insertions(+), 45 deletions(-) diff --git a/src/k_hud.cpp b/src/k_hud.cpp index 183afba6d..512b6db40 100644 --- a/src/k_hud.cpp +++ b/src/k_hud.cpp @@ -1526,7 +1526,7 @@ static void K_initKartHUD(void) } } -void K_DrawMapThumbnail(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, UINT16 map, const UINT8 *colormap) +void K_DrawMapThumbnail2(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, UINT16 map, const UINT8 *colormap, fixed_t accordion) { patch_t *PictureOfLevel = NULL; @@ -1543,58 +1543,72 @@ void K_DrawMapThumbnail(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, UINT1 PictureOfLevel = static_cast(mapheaderinfo[map]->thumbnailPic); } - K_DrawLikeMapThumbnail(x, y, width, flags, PictureOfLevel, colormap); + K_DrawLikeMapThumbnail(x, y, width, flags, PictureOfLevel, colormap, accordion); } -void K_DrawLikeMapThumbnail(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, patch_t *patch, const UINT8 *colormap) +void K_DrawLikeMapThumbnail(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, patch_t *patch, const UINT8 *colormap, fixed_t accordion) { - if (flags & V_FLIP) - x += width; + fixed_t scale = FixedDiv(width, (320 << FRACBITS)); - V_DrawFixedPatch( + if (flags & V_FLIP) + x += FixedMul(width, accordion); + + V_DrawStretchyFixedPatch( x, y, - FixedDiv(width, (320 << FRACBITS)), + FixedMul(scale, accordion), + scale, flags, patch, colormap ); } -void K_DrawMapAsFace(INT32 x, INT32 y, UINT32 flags, UINT16 map, const UINT8 *colormap) +void K_DrawMapAsFace(INT32 x, INT32 y, UINT32 flags, UINT16 map, const UINT8 *colormap, fixed_t accordion, INT32 unit) { - const fixed_t iconHeight = (14 << FRACBITS); + const fixed_t iconHeight = (14 * unit) << FRACBITS; const fixed_t iconWidth = (iconHeight * 320) / 200; - INT32 unit = 1; fixed_t mul = FRACUNIT; if (flags & V_NOSCALESTART) { - unit = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); + unit *= (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); mul = 1; } + INT32 hunit = (unit * accordion); + V_DrawFill( x, y, - 16 * unit, + (16 * hunit)/FRACUNIT, 16 * unit, (flags & ~V_FLIP) ); + if (flags & V_NOSCALESTART) + { + hunit /= FRACUNIT; + } + else + { + hunit = FixedMul(hunit, mul); + } + V_SetClipRect( - (x + unit) * mul, + (x * mul) + hunit, (y + unit) * mul, - (14 * unit) * mul, + (14 * hunit), (14 * unit) * mul, (flags & ~V_FLIP) ); - K_DrawMapThumbnail( - ((x + unit) * FRACUNIT) - (iconWidth - iconHeight)/2, + K_DrawMapThumbnail2( + (x * FRACUNIT) + hunit - FixedMul(iconWidth - iconHeight, accordion)/2, ((y + unit) * FRACUNIT), iconWidth, flags, map, - colormap + colormap, + accordion ); V_ClearClipRect(); diff --git a/src/k_hud.h b/src/k_hud.h index af5a30b68..c251fc137 100644 --- a/src/k_hud.h +++ b/src/k_hud.h @@ -58,9 +58,10 @@ INT32 K_drawKartMicroTime(const char *todrawtext, INT32 workx, INT32 worky, INT3 void K_drawKart2PTimestamp(void); void K_drawKart4PTimestamp(void); void K_drawEmeraldWin(boolean overlay); -void K_DrawMapThumbnail(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, UINT16 map, const UINT8 *colormap); -void K_DrawLikeMapThumbnail(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, patch_t *patch, const UINT8 *colormap); -void K_DrawMapAsFace(INT32 x, INT32 y, UINT32 flags, UINT16 map, const UINT8 *colormap); +void K_DrawMapThumbnail2(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, UINT16 map, const UINT8 *colormap, fixed_t accordion); +#define K_DrawMapThumbnail(x, y, w, f, m, c) K_DrawMapThumbnail2(x, y, w, f, m, c, FRACUNIT) +void K_DrawLikeMapThumbnail(fixed_t x, fixed_t y, fixed_t width, UINT32 flags, patch_t *patch, const UINT8 *colormap, fixed_t accordion); +void K_DrawMapAsFace(INT32 x, INT32 y, UINT32 flags, UINT16 map, const UINT8 *colormap, fixed_t accordion, INT32 unit); void K_drawTargetHUD(const vector3_t *origin, player_t *player); void K_drawButton(fixed_t x, fixed_t y, INT32 flags, patch_t *button[2], boolean pressed); void K_drawButtonAnim(INT32 x, INT32 y, INT32 flags, patch_t *button[2], tic_t animtic); diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 2a28d54c6..358c26210 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -6933,8 +6933,42 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, UINT8 *flash } case SECRET_MAP: - iconid = 14; + { + UINT16 mapnum = M_UnlockableMapNum(ref); + if (mapnum < nummapheaders && mapheaderinfo[mapnum] + && ( + ( // Check for visitation + (mapheaderinfo[mapnum]->menuflags & LF2_NOVISITNEEDED) + || (mapheaderinfo[mapnum]->records.mapvisited & MV_VISITED) + ) && ( // Check for completion + !(mapheaderinfo[mapnum]->menuflags & LF2_FINISHNEEDED) + || (mapheaderinfo[mapnum]->records.mapvisited & MV_BEATEN) + ) + )) + { + if (ref->majorunlock) + { + K_DrawMapAsFace( + (x + 5) + (32*(FRACUNIT-accordion))/(2*FRACUNIT), (y + 5), + tileflags, + mapnum, + NULL, accordion, 2 + ); + } + else + { + K_DrawMapAsFace( + (x + 2) + (16*(FRACUNIT-accordion))/(2*FRACUNIT), (y + 2), + tileflags, + mapnum, + NULL, accordion, 1 + ); + } + pat = NULL; + } + iconid = 0; //14; -- This one suits a little better for "go complete this level normally" break; + } case SECRET_ALTMUSIC: iconid = 16; break; @@ -7004,29 +7038,32 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, UINT8 *flash } } - siz = (SHORT(pat->width) << FRACBITS); + if (pat) + { + siz = (SHORT(pat->width) << FRACBITS); - if (!siz) - ; // prevent div/0 - else if (ref->majorunlock) - { - V_DrawStretchyFixedPatch( - ((x + 5)*FRACUNIT) + (32*(FRACUNIT-accordion)/2), (y + 5)*FRACUNIT, - FixedDiv(32*accordion, siz), - FixedDiv(32 << FRACBITS, siz), - tileflags, pat, - colormap - ); - } - else - { - V_DrawStretchyFixedPatch( - ((x + 2)*FRACUNIT) + (16*(FRACUNIT-accordion)/2), (y + 2)*FRACUNIT, - FixedDiv(16*accordion, siz), - FixedDiv(16 << FRACBITS, siz), - tileflags, pat, - colormap - ); + if (!siz) + ; // prevent div/0 + else if (ref->majorunlock) + { + V_DrawStretchyFixedPatch( + ((x + 5)*FRACUNIT) + (32*(FRACUNIT-accordion))/2, (y + 5)*FRACUNIT, + FixedDiv(32*accordion, siz), + FixedDiv(32 << FRACBITS, siz), + tileflags, pat, + colormap + ); + } + else + { + V_DrawStretchyFixedPatch( + ((x + 2)*FRACUNIT) + (16*(FRACUNIT-accordion))/2, (y + 2)*FRACUNIT, + FixedDiv(16*accordion, siz), + FixedDiv(16 << FRACBITS, siz), + tileflags, pat, + colormap + ); + } } drawborder: diff --git a/src/k_vote.c b/src/k_vote.c index 21b1494f5..13ce0b22e 100644 --- a/src/k_vote.c +++ b/src/k_vote.c @@ -705,7 +705,7 @@ static void Y_DrawVoteThumbnail(fixed_t center_x, fixed_t center_y, fixed_t widt fy + fh - whiteSq + dupy, flags | V_NOSCALESTART | ((encore == true) ? V_FLIP : 0), g_voteLevels[v][0], - NULL + NULL, FRACUNIT, 1 ); } } diff --git a/src/y_inter.cpp b/src/y_inter.cpp index a7668b1b2..a096b71f9 100644 --- a/src/y_inter.cpp +++ b/src/y_inter.cpp @@ -1615,7 +1615,7 @@ void Y_RoundQueueDrawer(y_data_t *standings, INT32 offset, boolean doanimations, x - 9, y - 13, (baseflags|((menuqueue.entries[i].encore) ? V_FLIP : 0)), menuqueue.entries[i].mapnum, - NULL + NULL, FRACUNIT, 1 ); x += 24;