The rest of toaster's changes

This commit is contained in:
GenericHeroGuy 2025-02-07 03:02:34 +01:00
parent 14e5796cf2
commit a97dcae2c2
5 changed files with 49 additions and 46 deletions

View file

@ -98,6 +98,7 @@ static char hu_tick;
//-------------------------------------------
patch_t *missingpat;
patch_t *blanklvl;
// song credits
static patch_t *songcreditbg;
@ -186,6 +187,8 @@ void HU_LoadGraphics(void)
Font_Load();
HU_UpdatePatch(&blanklvl, "BLANKLVL");
HU_UpdatePatch(&songcreditbg, "K_SONGCR");
// cache ping gfx:

View file

@ -8952,7 +8952,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
{
PictureOfLevel = mapheaderinfo[cv_nextmap.value+1]->thumbnailPic;
if (!PictureOfLevel)
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
PictureOfLevel = blanklvl;
}
else
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_CACHE);
@ -9016,7 +9016,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
{
PictureOfLevel = mapheaderinfo[i+1]->thumbnailPic;
if (!PictureOfLevel)
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
PictureOfLevel = blanklvl;
}
else
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_CACHE);
@ -9052,7 +9052,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
{
PictureOfLevel = mapheaderinfo[i+1]->thumbnailPic;
if (!PictureOfLevel)
PictureOfLevel = W_CachePatchName("BLANKLVL", PU_CACHE);
PictureOfLevel = blanklvl;
}
else
PictureOfLevel = W_CachePatchName("RANDOMLV", PU_CACHE);

View file

@ -400,13 +400,13 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
if (mapheaderinfo[num]->thumbnailPic)
{
Z_Free(mapheaderinfo[num]->thumbnailPic);
Patch_Free(mapheaderinfo[num]->thumbnailPic);
mapheaderinfo[num]->thumbnailPic = NULL;
}
if (mapheaderinfo[num]->minimapPic)
{
Z_Free(mapheaderinfo[num]->minimapPic);
Patch_Free(mapheaderinfo[num]->minimapPic);
mapheaderinfo[num]->minimapPic = NULL;
}
@ -8809,14 +8809,26 @@ UINT8 P_InitMapData(void)
thumbnailPic = vres_Find(virtmap, "PICTURE");
minimap = vres_Find(virtmap, "MINIMAP");
// Clear out existing graphics...
if (mapheaderinfo[i]->thumbnailPic)
{
Patch_Free(mapheaderinfo[i]->thumbnailPic);
}
if (mapheaderinfo[i]->minimapPic)
{
Patch_Free(mapheaderinfo[i]->minimapPic);
}
// Now apply the new ones!
if (thumbnailPic)
{
mapheaderinfo[i]->thumbnailPic = vres_GetPatch(thumbnailPic, PU_CACHE);
mapheaderinfo[i]->thumbnailPic = vres_GetPatch(thumbnailPic, PU_STATIC);
}
if (minimap)
{
mapheaderinfo[i]->minimapPic = vres_GetPatch(minimap, PU_HUDGFX);
mapheaderinfo[i]->minimapPic = vres_GetPatch(minimap, PU_STATIC);
}
vres_Free(virtmap);

View file

@ -892,6 +892,7 @@ struct patch_t
};
extern patch_t *missingpat;
extern patch_t *blanklvl;
#if defined(_MSC_VER)
#pragma pack(1)

View file

@ -128,7 +128,6 @@ typedef struct
char str[62];
UINT8 gtc;
const char *gts;
patch_t *pic;
boolean encore;
} y_votelvlinfo;
@ -1158,7 +1157,17 @@ void Y_VoteDrawer(void)
else
{
str = levelinfo[i].str;
pic = levelinfo[i].pic;
pic = NULL;
if (mapheaderinfo[votelevels[i][0]])
{
pic = mapheaderinfo[votelevels[i][0]]->thumbnailPic;
}
if (!pic)
{
pic = blanklvl;
}
}
if (selected[i])
@ -1278,9 +1287,23 @@ void Y_VoteDrawer(void)
patch_t *pic;
if (votes[i] >= 3 && (i != pickedvote || voteendtic == -1))
{
pic = randomlvl;
}
else
pic = levelinfo[votes[i]].pic;
{
pic = NULL;
if (mapheaderinfo[votelevels[votes[i]][0]])
{
pic = mapheaderinfo[votelevels[votes[i]][0]]->thumbnailPic;
}
if (!pic)
{
pic = blanklvl;
}
}
if (!timer && i == voteclient.ranim)
{
@ -1680,18 +1703,6 @@ void Y_StartVote(void)
levelinfo[i].gts = gametype_cons_t[votelevels[i][1]].strvalue;
else
levelinfo[i].gts = NULL;
// set up the pic
patch_t *thumbnailPic = NULL;
if (mapheaderinfo[votelevels[i][0]+1])
{
thumbnailPic = mapheaderinfo[votelevels[i][0]]->thumbnailPic;
}
if (thumbnailPic)
levelinfo[i].pic = thumbnailPic;
else
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_STATIC);
}
voteclient.loaded = true;
@ -1712,8 +1723,6 @@ void Y_EndVote(void)
//
static void Y_UnloadVoteData(void)
{
UINT8 i;
voteclient.loaded = false;
if (rendermode != render_soft)
@ -1728,28 +1737,6 @@ static void Y_UnloadVoteData(void)
UNLOAD(cursor4);
UNLOAD(randomlvl);
UNLOAD(rubyicon);
// to prevent double frees...
for (i = 0; i < 4; i++)
{
// I went to all the trouble of doing this,
// but literally nowhere else frees level pics.
#if 0
UINT8 j;
if (!levelinfo[i].pic)
continue;
for (j = i+1; j < 4; j++)
{
if (levelinfo[j].pic == levelinfo[i].pic)
levelinfo[j].pic = NULL;
}
UNLOAD(levelinfo[i].pic);
#else
CLEANUP(levelinfo[i].pic);
#endif
}
}
//