Instead of calculating relevant medals for every frame, calculate once and store the result

This commit is contained in:
toaster 2023-08-06 23:23:59 +01:00
parent efe02794d4
commit 49e3e6b500
3 changed files with 4 additions and 2 deletions

View file

@ -1270,6 +1270,8 @@ extern struct statisticsmenu_s {
statisticspage_t page;
INT32 location;
INT32 nummaps;
INT32 gotmedals;
INT32 nummedals;
INT32 numextramedals;
INT32 maxscroll;
UINT16 *maplist;

View file

@ -6038,7 +6038,7 @@ static void M_DrawStatsMaps(void)
else
V_DrawRightAlignedThinString(BASEVIDWIDTH-20, 70, 0, "(complete)");
V_DrawThinString(32, 70, 0, va("x %d/%d", M_CountMedals(false, false), M_CountMedals(true, false)));
V_DrawThinString(30, 70, 0, va("x %d/%d", statisticsmenu.gotmedals, statisticsmenu.nummedals));
V_DrawSmallMappedPatch(20, 70, 0, W_CachePatchName("GOTITA", PU_CACHE),
R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GOLD, GTC_MENUCACHE));

View file

@ -75,7 +75,7 @@ static void M_StatisticsMaps(void)
M_StatisticsAddMap(i, NULL, &headerexists);
}
if ((i = statisticsmenu.numextramedals = M_CountMedals(true, true)) != 0)
if ((i = statisticsmenu.numextramedals) != 0)
i += 2;
statisticsmenu.maplist[statisticsmenu.nummaps] = NEXTMAP_INVALID;