diff --git a/src/k_hud.c b/src/k_hud.c index 5037132d8..3aa2f7a68 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -1124,6 +1124,35 @@ static void K_initKartHUD(void) } } +void K_DrawMapThumbnail(INT32 x, INT32 y, INT32 width, UINT32 flags, UINT16 map, UINT8 *colormap) +{ + patch_t *PictureOfLevel = NULL; + + if (map >= nummapheaders || !mapheaderinfo[map]) + { + PictureOfLevel = W_CachePatchName("M_NOLVL", PU_CACHE); + } + else if (!mapheaderinfo[map]->thumbnailPic) + { + PictureOfLevel = blanklvl; + } + else + { + PictureOfLevel = mapheaderinfo[map]->thumbnailPic; + } + + if (flags & V_FLIP) + x += width; + + V_DrawFixedPatch( + x, y, + FixedDiv(width, (SHORT(PictureOfLevel->width) << FRACBITS)), + flags, + PictureOfLevel, + colormap + ); +} + // see also MT_PLAYERARROW mobjthinker in p_mobj.c static void K_drawKartItem(void) { diff --git a/src/k_hud.h b/src/k_hud.h index dd27654fd..be3e6b5b9 100644 --- a/src/k_hud.h +++ b/src/k_hud.h @@ -38,6 +38,7 @@ void K_drawKartHUD(void); 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); extern patch_t *kp_facehighlight[8]; diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 38e55886e..e31d5df28 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -1925,28 +1925,24 @@ void M_DrawRaceDifficulty(void) static void M_DrawCupPreview(INT16 y, cupheader_t *cup) { UINT8 i; - const INT16 pad = ((vid.width/vid.dupx) - BASEVIDWIDTH)/2; - INT16 x = -(cupgrid.previewanim % 82) - pad; + INT16 x = -(cupgrid.previewanim % 82); V_DrawFill(0, y, BASEVIDWIDTH, 54, 31); if (cup && (cup->unlockrequired >= MAXUNLOCKABLES || M_CheckNetUnlockByID(cup->unlockrequired))) { i = (cupgrid.previewanim / 82) % cup->numlevels; - while (x < BASEVIDWIDTH + pad) + while (x < BASEVIDWIDTH) { INT32 cupLevelNum = cup->cachedlevels[i]; - patch_t *PictureOfLevel = NULL; - if (cupLevelNum < nummapheaders && mapheaderinfo[cupLevelNum]) - { - PictureOfLevel = mapheaderinfo[cupLevelNum]->thumbnailPic; - } + K_DrawMapThumbnail( + (x+1)<numlevels; x += 82; } @@ -2164,26 +2160,22 @@ static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map) static void M_DrawLevelSelectBlock(INT16 x, INT16 y, INT16 map, boolean redblink, boolean greyscale) { - patch_t *PictureOfLevel = NULL; UINT8 *colormap = NULL; if (greyscale) colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_GREY, GTC_MENUCACHE); - if (mapheaderinfo[map]) - { - PictureOfLevel = mapheaderinfo[map]->thumbnailPic; - } - - if (!PictureOfLevel) - PictureOfLevel = blanklvl; - if (redblink) V_DrawScaledPatch(3+x, y, 0, W_CachePatchName("LVLSEL2", PU_CACHE)); else V_DrawScaledPatch(3+x, y, 0, W_CachePatchName("LVLSEL", PU_CACHE)); - V_DrawSmallMappedPatch(9+x, y+6, 0, PictureOfLevel, colormap); + K_DrawMapThumbnail( + (9+x)<type) { @@ -3937,34 +3929,19 @@ static void M_DrawReplayHutReplayInfo(menudemo_t *demoref) // Draw level stuff x = 15; y = 15; - // A 160x100 image of the level as entry MAPxxP - if (demoref->map < nummapheaders && mapheaderinfo[demoref->map]) - { - patch = mapheaderinfo[demoref->map]->thumbnailPic; - if (!patch) - { - patch = blanklvl; - } - } - else - { - patch = W_CachePatchName("M_NOLVL", PU_CACHE); - } + K_DrawMapThumbnail( + x<kartspeed & DF_ENCORE) ? V_FLIP : 0), + demoref->map, + NULL); - if (!(demoref->kartspeed & DF_ENCORE)) - V_DrawSmallScaledPatch(x, y, V_SNAPTOTOP, patch); - else + if (demoref->kartspeed & DF_ENCORE) { - w = SHORT(patch->width); - h = SHORT(patch->height); - V_DrawSmallScaledPatch(x+(w>>1), y, V_SNAPTOTOP|V_FLIP, patch); - - { - static angle_t rubyfloattime = 0; - const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT); - V_DrawFixedPatch((x+(w>>2))<>2))<>ANGLETOFINESHIFT); + V_DrawFixedPatch((x+40)<thumbnailPic; - } - - if (!pic) - { - pic = blanklvl; - } - } - if (selected[i]) { + const char *str; UINT8 sizeadd = selected[i]; for (j = 0; j <= splitscreen; j++) // another loop for drawing the selection backgrounds in the right order, grumble grumble.. @@ -1093,11 +1071,24 @@ void Y_VoteDrawer(void) sizeadd--; } - if (!levelinfo[i].encore) - V_DrawSmallScaledPatch(BASEVIDWIDTH-100, y, V_SNAPTORIGHT, pic); + if (i == 3) + { + str = "RANDOM"; + V_DrawSmallScaledPatch(BASEVIDWIDTH-100, y, V_SNAPTORIGHT, randomlvl); + } else { - V_DrawFixedPatch((BASEVIDWIDTH-20)<= 3 && (i != pickedvote || voteendtic == -1)) - { - pic = randomlvl; - } - else - { - pic = NULL; - - if (mapheaderinfo[votelevels[votes[i]][0]]) - { - pic = mapheaderinfo[votelevels[votes[i]][0]]->thumbnailPic; - } - - if (!pic) - { - pic = blanklvl; - } - } - if (!timer && i == voteclient.ranim) { V_DrawScaledPatch(x-18, y+9, V_SNAPTOLEFT, cursor); @@ -1176,11 +1157,22 @@ void Y_VoteDrawer(void) V_DrawFill(x-1, y-1, 42, 27, levelinfo[votes[i]].gtc|V_SNAPTOLEFT); } - if (!levelinfo[votes[i]].encore) - V_DrawTinyScaledPatch(x, y, V_SNAPTOLEFT, pic); + if (votes[i] >= 3 && (i != pickedvote || voteendtic == -1)) + { + V_DrawTinyScaledPatch(x, y, V_SNAPTOLEFT, randomlvl); + } else { - V_DrawFixedPatch((x+40)<