From eaf10c331bca02cc1f9561abbd491d3a45292fc7 Mon Sep 17 00:00:00 2001 From: FreakyMutantMan <freakymutantman@gmail.com> Date: Sun, 3 Nov 2024 19:58:47 -0800 Subject: [PATCH] Replaced background graphics with separated graphic lumps; added a button on the menu to automatically revert to the default color profile. --- src/k_menu.h | 1 + src/k_menudraw.c | 12 ++++++---- src/menus/options-video-colorprofile.c | 32 ++++++++++++++++++++++++-- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/k_menu.h b/src/k_menu.h index fbb34dcc8..8b70d09c5 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -1148,6 +1148,7 @@ void M_RefreshAdvancedVideoOptions(void); void M_HandleItemToggles(INT32 choice); // For item toggling void M_EraseData(INT32 choice); // For data erasing void M_CheckProfileData(INT32 choice); // check if we have profiles. +void M_ColorProfileDefault(INT32 choice); // For the reset button in the color profile menu. // profile selection menu void M_ProfileSelectInit(INT32 choice); diff --git a/src/k_menudraw.c b/src/k_menudraw.c index c8538d328..ae95c8798 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -4393,7 +4393,9 @@ void M_DrawOptionsColorProfile(void) // the background isn't drawn outside of being in the main menu state. if (gamestate == GS_MENU && solidbg) { - patch_t *back = W_CachePatchName(va("OPT_BC%u", tick), PU_CACHE); + patch_t *back = W_CachePatchName(va("OPT_BG%u", tick), PU_CACHE); + patch_t *colorp_photo = W_CachePatchName("COL_PHO", PU_CACHE); + patch_t *colorp_bar = W_CachePatchName("COL_BAR", PU_CACHE); INT32 tflag = 0; UINT8 *c; UINT8 *c2; // colormap for the one we're changing @@ -4409,6 +4411,8 @@ void M_DrawOptionsColorProfile(void) } c = R_GetTranslationColormap(TC_DEFAULT, optionsmenu.currcolour, GTC_CACHE); V_DrawFixedPatch(0, 0, FRACUNIT, tflag, back, c); + V_DrawFixedPatch(243<<FRACBITS, 67<<FRACBITS, FRACUNIT, 0, colorp_bar, NULL); + V_DrawFixedPatch(0, 0, FRACUNIT, 0, colorp_photo, NULL); //M_DrawCharSelectSprite( //figure this out later } // Given the need for accessibility, I don't want the background to be drawn transparent here - a clear color reference is needed for proper utilization. - Freaky Mutant Man @@ -4419,12 +4423,12 @@ void M_DrawOptionsColorProfile(void) M_DrawEggaChannelAlignable(true); } - patch_t *back_pause = W_CachePatchName(va("OPT_BAC%u", tick), PU_CACHE); - V_DrawFixedPatch(0, 0, FRACUNIT, 0, back_pause, NULL); + patch_t *colorp_bar = W_CachePatchName("COL_BAR", PU_CACHE); + V_DrawFixedPatch(243<<FRACBITS, 67<<FRACBITS, FRACUNIT, 0, colorp_bar, NULL); if (!solidbg) { - V_DrawFixedPatch(0, 0, FRACUNIT, 0, back_pause, NULL); + V_DrawFixedPatch(243<<FRACBITS, 67<<FRACBITS, FRACUNIT, 0, colorp_bar, NULL); } } } diff --git a/src/menus/options-video-colorprofile.c b/src/menus/options-video-colorprofile.c index d9a906504..7507cf890 100644 --- a/src/menus/options-video-colorprofile.c +++ b/src/menus/options-video-colorprofile.c @@ -24,8 +24,8 @@ menuitem_t OPTIONS_VideoColorProfile[] = {IT_STRING | IT_CVAR, "Gamma", "Increase or decrease the brightness of the displayed image.", NULL, {.cvar = &cv_globalgamma}, 0, 0}, - {IT_NOTHING|IT_SPACE, NULL, NULL, - NULL, {NULL}, 0, 0}, + {IT_STRING | IT_CALL, "Reset All", "Reset the color profile to default settings.", + NULL, {.routine = M_ColorProfileDefault}, 0, 0}, {IT_HEADER, "Red...", NULL, NULL, {NULL}, 0, 0}, @@ -118,3 +118,31 @@ menu_t OPTIONS_VideoColorProfileDef = { NULL, NULL, }; + +// Set all color profile settings to the default values. +void M_ColorProfileDefault(INT32 choice) +{ + (void)choice; + + // The set value army approaches - gotta be a better way to handle this. + CV_SetValue(&cv_globalsaturation, 10); + CV_SetValue(&cv_rsaturation, 10); + CV_SetValue(&cv_ysaturation, 10); + CV_SetValue(&cv_gsaturation, 10); + CV_SetValue(&cv_csaturation, 10); + CV_SetValue(&cv_bsaturation, 10); + CV_SetValue(&cv_msaturation, 10); + CV_SetValue(&cv_globalgamma, 0); + CV_SetValue(&cv_rgamma, 0); + CV_SetValue(&cv_ygamma, 0); + CV_SetValue(&cv_ggamma, 0); + CV_SetValue(&cv_cgamma, 0); + CV_SetValue(&cv_bgamma, 0); + CV_SetValue(&cv_mgamma, 0); + CV_SetValue(&cv_rhue, 0); + CV_SetValue(&cv_yhue, 4); + CV_SetValue(&cv_ghue, 8); + CV_SetValue(&cv_chue, 12); + CV_SetValue(&cv_bhue, 16); + CV_SetValue(&cv_mhue, 20); +} -- GitLab