From 524eff9fde114c988960a453099068d8fece4b7b Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 10 Sep 2022 16:01:47 -0400 Subject: [PATCH] Update new menus to use long names --- src/doomstat.h | 6 +++--- src/k_menudraw.c | 34 ++++++++++++++++++++++++++-------- src/k_menufunc.c | 10 +++++++--- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/doomstat.h b/src/doomstat.h index 09922d2e8..32b48eb27 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -460,10 +460,10 @@ typedef struct cupheader_s UINT16 id; ///< Cup ID char name[15]; ///< Cup title (14 chars) char icon[9]; ///< Name of the icon patch - char * levellist[MAXLEVELLIST]; ///< List of levels that belong to this cup + char *levellist[MAXLEVELLIST]; ///< List of levels that belong to this cup UINT8 numlevels; ///< Number of levels defined in levellist - char * bonusgame; ///< Map number to use for bonus game - char * specialstage; ///< Map number to use for special stage + char *bonusgame; ///< Map name to use for bonus game + char *specialstage; ///< Map name to use for special stage UINT8 emeraldnum; ///< ID of Emerald to use for special stage (1-7 for Chaos Emeralds, 8-14 for Super Emeralds, 0 for no emerald) SINT8 unlockrequired; ///< An unlockable is required to select this cup. -1 for no unlocking required. struct cupheader_s *next; ///< Next cup in linked list diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 76a001544..657b6a379 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -1846,10 +1846,15 @@ static void M_DrawCupPreview(INT16 y, cupheader_t *cup) i = (cupgrid.previewanim / 82) % cup->numlevels; while (x < BASEVIDWIDTH + pad) { - lumpnum_t lumpnum; + INT32 cupLevelNum = G_MapNumber(cup->levellist[i]); + lumpnum_t lumpnum = LUMPERROR; patch_t *PictureOfLevel; - lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(cup->levellist[i]+1))); + if (mapheaderinfo[cupLevelNum]) + { + lumpnum = W_CheckNumForLongName(mapheaderinfo[cupLevelNum]->thumbnailLump); + } + if (lumpnum != LUMPERROR) PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE); else @@ -2073,14 +2078,18 @@ static void M_DrawHighLowLevelTitle(INT16 x, INT16 y, INT16 map) static void M_DrawLevelSelectBlock(INT16 x, INT16 y, INT16 map, boolean redblink, boolean greyscale) { - lumpnum_t lumpnum; + lumpnum_t lumpnum = LUMPERROR; patch_t *PictureOfLevel; UINT8 *colormap = NULL; if (greyscale) colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_GREY, GTC_MENUCACHE); - lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(map+1))); + if (mapheaderinfo[map]) + { + lumpnum = W_CheckNumForLongName(mapheaderinfo[map]->thumbnailLump); + } + if (lumpnum != LUMPERROR) PictureOfLevel = W_CachePatchNum(lumpnum, PU_CACHE); else @@ -2146,7 +2155,7 @@ void M_DrawTimeAttack(void) INT16 rightedge = 149+t+155; INT16 opty = 140; INT32 w; - lumpnum_t lumpnum; + lumpnum_t lumpnum = LUMPERROR; UINT8 i; consvar_t *cv; @@ -2158,7 +2167,11 @@ void M_DrawTimeAttack(void) if (currentMenu == &PLAY_TimeAttackDef) { - lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(map+1))); + if (mapheaderinfo[map]) + { + lumpnum = W_CheckNumForName(mapheaderinfo[map]->minimapLump); + } + if (lumpnum != LUMPERROR) V_DrawScaledPatch(24-t, 82, 0, W_CachePatchNum(lumpnum, PU_CACHE)); @@ -3825,7 +3838,7 @@ void M_DrawPlaybackMenu(void) #define SCALEDVIEWHEIGHT (vid.height/vid.dupy) void M_DrawReplayHutReplayInfo(void) { - lumpnum_t lumpnum; + lumpnum_t lumpnum = LUMPERROR; patch_t *patch; UINT8 *colormap; INT32 x, y, w, h; @@ -3852,7 +3865,12 @@ void M_DrawReplayHutReplayInfo(void) // A 160x100 image of the level as entry MAPxxP //CONS_Printf("%d %s\n", extrasmenu.demolist[dir_on[menudepthleft]].map, G_BuildMapName(extrasmenu.demolist[dir_on[menudepthleft]].map)); - lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(extrasmenu.demolist[dir_on[menudepthleft]].map))); + + if (mapheaderinfo[extrasmenu.demolist[dir_on[menudepthleft]].map]) + { + lumpnum = W_CheckNumForName(mapheaderinfo[extrasmenu.demolist[dir_on[menudepthleft]].map]->thumbnailLump); + } + if (lumpnum != LUMPERROR) patch = W_CachePatchNum(lumpnum, PU_CACHE); else diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 753a9b767..0df40ab4c 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -3208,7 +3208,9 @@ boolean M_CanShowLevelInList(INT16 mapnum, UINT8 gt) for (i = 0; i < levellist.selectedcup->numlevels; i++) { - if (mapnum == levellist.selectedcup->levellist[i]) + const INT32 cupLevelNum = G_MapNumber(levellist.selectedcup->levellist[i]); + + if (mapnum == cupLevelNum) break; } @@ -3414,7 +3416,7 @@ void M_CupSelectHandler(INT32 choice) if (cupgrid.grandprix == true) { - + INT32 levelNum; UINT8 ssplayers = cv_splitplayers.value-1; S_StartSound(NULL, sfx_s3k63); @@ -3458,8 +3460,10 @@ void M_CupSelectHandler(INT32 choice) netgame = levellist.netgame; // ^ ditto. } + levelNum = G_MapNumber(grandprixinfo.cup->levellist[0]); + D_MapChange( - grandprixinfo.cup->levellist[0] + 1, + levelNum + 1, GT_RACE, grandprixinfo.encore, true,