From f87db3cfabd03a2c9c3dcefb13b8c7befa9c9f9a Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 14 Dec 2022 13:08:06 +0000 Subject: [PATCH] Further K_DrawMapThumbnail changes. - Precache M_NOLVL. - Make all width calculations relative to a lump 320 pixels wide, to make outdated map thumbnails much, MUCH more visible. - Add K_DrawLikeMapThumbnail to draw a 320x200 patch like a map thumbnail (currently used only for RANDOMLVL). --- src/hu_stuff.c | 3 ++- src/k_hud.c | 11 ++++++++--- src/k_hud.h | 1 + src/r_defs.h | 2 +- src/y_inter.c | 24 +++++++++++++++++++++--- 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index e30a725e9..40944e8b2 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -98,7 +98,7 @@ static char hu_tick; //------------------------------------------- patch_t *missingpat; -patch_t *blanklvl; +patch_t *blanklvl, *nolvl; // song credits static patch_t *songcreditbg; @@ -186,6 +186,7 @@ void HU_LoadGraphics(void) Font_Load(); HU_UpdatePatch(&blanklvl, "BLANKLVL"); + HU_UpdatePatch(&nolvl, "M_NOLVL"); HU_UpdatePatch(&songcreditbg, "K_SONGCR"); diff --git a/src/k_hud.c b/src/k_hud.c index 3aa2f7a68..486a576d4 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -1130,7 +1130,7 @@ void K_DrawMapThumbnail(INT32 x, INT32 y, INT32 width, UINT32 flags, UINT16 map, if (map >= nummapheaders || !mapheaderinfo[map]) { - PictureOfLevel = W_CachePatchName("M_NOLVL", PU_CACHE); + PictureOfLevel = nolvl; } else if (!mapheaderinfo[map]->thumbnailPic) { @@ -1141,14 +1141,19 @@ void K_DrawMapThumbnail(INT32 x, INT32 y, INT32 width, UINT32 flags, UINT16 map, PictureOfLevel = mapheaderinfo[map]->thumbnailPic; } + K_DrawLikeMapThumbnail(x, y, width, flags, PictureOfLevel, colormap); +} + +void K_DrawLikeMapThumbnail(INT32 x, INT32 y, INT32 width, UINT32 flags, patch_t *patch, UINT8 *colormap) +{ if (flags & V_FLIP) x += width; V_DrawFixedPatch( x, y, - FixedDiv(width, (SHORT(PictureOfLevel->width) << FRACBITS)), + FixedDiv(width, (320 << FRACBITS)), flags, - PictureOfLevel, + patch, colormap ); } diff --git a/src/k_hud.h b/src/k_hud.h index be3e6b5b9..ba4f8f5cf 100644 --- a/src/k_hud.h +++ b/src/k_hud.h @@ -39,6 +39,7 @@ void K_drawKartFreePlay(void); void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, UINT8 mode); void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol); void K_DrawMapThumbnail(INT32 x, INT32 y, INT32 width, UINT32 flags, UINT16 map, UINT8 *colormap); +void K_DrawLikeMapThumbnail(INT32 x, INT32 y, INT32 width, UINT32 flags, patch_t *patch, UINT8 *colormap); extern patch_t *kp_facehighlight[8]; diff --git a/src/r_defs.h b/src/r_defs.h index 59faac3c0..9216603ed 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -821,7 +821,7 @@ struct patch_t }; extern patch_t *missingpat; -extern patch_t *blanklvl; +extern patch_t *blanklvl, *nolvl; #if defined(_MSC_VER) #pragma pack(1) diff --git a/src/y_inter.c b/src/y_inter.c index 63cd54fe7..8cb21fe04 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1074,7 +1074,13 @@ void Y_VoteDrawer(void) if (i == 3) { str = "RANDOM"; - V_DrawSmallScaledPatch(BASEVIDWIDTH-100, y, V_SNAPTORIGHT, randomlvl); + K_DrawLikeMapThumbnail( + (BASEVIDWIDTH-100)<= 3 && (i != pickedvote || voteendtic == -1)) { - V_DrawTinyScaledPatch(x, y, V_SNAPTOLEFT, randomlvl); + K_DrawLikeMapThumbnail( + (x)<