From a6efdf7e2ba71ae09ef46972078ad411a6edf90a Mon Sep 17 00:00:00 2001 From: minenice55 Date: Mon, 6 Apr 2026 14:45:18 -0400 Subject: [PATCH] fix the weird perf drop when drawing stat bars this is stupid --- src/m_menu.c | 59 +++++++++++++++++++++++----------------------------- src/m_menu.h | 2 -- 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 73ea88835..d423fbaa4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7588,51 +7588,49 @@ void MD_DrawCssStatBars(void) const INT32 ICNYFIRST = 1; const INT32 ICNYSECOND = 17; + menuitem_t *item = M_GetMenuItem(MN_MP_PLAYERSETUP, "STATBAR"); + patch_t *statbitsub = W_CachePatchName("STATBSPD", PU_CACHE); patch_t *statbitmain = W_CachePatchName("STATBWGT", PU_CACHE); patch_t *speedicn = W_CachePatchName("K_STSPD", PU_CACHE); patch_t *weighticn = W_CachePatchName("K_STWHT", PU_CACHE); - //patch_t *accelicn = W_CachePatchName("K_STACL", PU_CACHE); - //patch_t *handlingicn = W_CachePatchName("K_STHDL", PU_CACHE); - UINT8 *speedcolour = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_SAPPHIRE, 0); - UINT8 *weightcolour = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_KETCHUP, 0); - UINT8 *speednumcolour = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_NIGHTFALL, 0); - UINT8 *weightnumcolour = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_AMBER, 0); - // UINT8 *accelcolour = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GOLD, 0); - // UINT8 *handlingcolour = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_MINT, 0); - UINT8 *subcolour = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_BLACK, 0); + UINT8 *speedcolour = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_SAPPHIRE, GTC_MENUCACHE); + UINT8 *weightcolour = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_KETCHUP, GTC_MENUCACHE); + UINT8 *speednumcolour = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_NIGHTFALL, GTC_MENUCACHE); + UINT8 *weightnumcolour = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_AMBER, GTC_MENUCACHE); + // UINT8 *accelcolour = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_GOLD, GTC_MENUCACHE); + // UINT8 *handlingcolour = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_MINT, GTC_MENUCACHE); + UINT8 *subcolour = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_BLACK, GTC_MENUCACHE); INT32 skintodisplay = cv_chooseskin.value; UINT8 speed = skins[skintodisplay].kartspeed; UINT8 weight = skins[skintodisplay].kartweight; - INT16 i; + mx = item->x; + my = item->y; - mx = M_GetItemX(MN_MP_PLAYERSETUP, "STATBAR"); - my = M_GetItemY(MN_MP_PLAYERSETUP, "STATBAR"); - - // Draw speed - for (i = 0; i < speed; i++) + // // Draw speed + for (INT16 s = 0; s < speed; s++) { - V_DrawFixedPatch((mx + BITSTARTXMAIN + (BITSPACING * i))<width * FRACUNIT/4), (cursory * FRACUNIT) - (face->height * FRACUNIT/4), FRACUNIT, 0, face, colmap); - - cursorframe += renderdeltatics / 4; - for (; cursorframe > 7 * FRACUNIT; cursorframe -= 7 * FRACUNIT) {} + cursorframe = (cursorframe + (renderdeltatics / 4)) % (7*FRACUNIT); cursor = W_CachePatchName(va("K_BHILI%d", (cursorframe >> FRACBITS) + 1), PU_CACHE); // cursor patch offsets are wrong so draw at same coordinate as portrait V_DrawFixedPatch((cursorx * FRACUNIT) - (face->width * FRACUNIT/4), (cursory * FRACUNIT) - (face->height * FRACUNIT/4), FRACUNIT, 0, cursor, colmap); - } else { face = faceprefix[skintodisplay][FACE_RANK]; colmap = R_GetTranslationColormap(skintodisplay, cv_dummycolor.value, GTC_MENUCACHE); V_DrawFixedPatch((cursorx + face->leftoffset) * FRACUNIT, (cursory + face->topoffset) * FRACUNIT, FRACUNIT, 0, face, colmap); - cursor = W_CachePatchName("M_FSEL", PU_CACHE); - + if (skullAnimCounter < 4) { + cursor = W_CachePatchName("M_FSEL", PU_CACHE); colmap = V_GetStringColormap(skincolors[cv_dummycolor.value].chatcolor); V_DrawFixedPatch(cursorx * FRACUNIT, cursory * FRACUNIT, FRACUNIT/2, 0, cursor, colmap); } @@ -8024,14 +8017,14 @@ void MD_DrawGridCssSelector(void) // // Maps a CSS grid selection cursor column (x) and row (y) to a skin selection index // -INT32 MapGridSelectToSkin(INT32 row, INT32 column) +static inline INT32 MapGridSelectToSkin(INT32 row, INT32 column) { - return (row % SKINGRIDWIDTH) + (column * SKINGRIDWIDTH); + return ((row % SKINGRIDWIDTH) + (column * SKINGRIDWIDTH)); } INT32 MR_HandleSetupMultiPlayerMenu(INT32 choice) { - INT32 sortedIndex; + INT32 sortedIndex = 0; // don't consume input if we're not interacting with the grid CSS if (!(M_IsItemOn(MN_MP_PLAYERSETUP, "SKIN") && cv_skinselectstyle.value)) { diff --git a/src/m_menu.h b/src/m_menu.h index 243f8ec08..965c22033 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -374,8 +374,6 @@ void MD_DrawLevelPlatterMenu(void); void MD_DrawDiscordRequests(void); #endif -INT32 MapGridSelectToSkin(INT32 column, INT32 row); - // Maybe this goes here????? Who knows. boolean M_MouseNeeded(void);