Merge branch 'photosensitivity' into 'master'

Color profile sub-menu in Video Options

See merge request KartKrew/RingRacers!61
This commit is contained in:
Oni 2025-08-27 23:03:09 +00:00
commit 82e63d36c3
5 changed files with 214 additions and 1 deletions

View file

@ -462,6 +462,9 @@ extern menu_t OPTIONS_VideoDef;
extern menuitem_t OPTIONS_VideoModes[];
extern menu_t OPTIONS_VideoModesDef;
extern menuitem_t OPTIONS_VideoColorProfile[];
extern menu_t OPTIONS_VideoColorProfileDef;
extern menuitem_t OPTIONS_VideoAdvanced[];
extern menu_t OPTIONS_VideoAdvancedDef;
@ -1145,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);
@ -1356,6 +1360,7 @@ void M_DrawPlaybackMenu(void);
// Options menus:
void M_DrawOptionsCogs(void);
void M_DrawOptionsColorProfile(void);
void M_DrawOptionsMovingButton(void); // for sick transitions...
void M_DrawOptions(void);
void M_DrawGenericOptions(void);

View file

@ -978,7 +978,7 @@ void M_Drawer(void)
{
M_DrawGonerBack();
}
else if (!WipeInAction && currentMenu != &PAUSE_PlaybackMenuDef)
else if (!WipeInAction && currentMenu != &PAUSE_PlaybackMenuDef && currentMenu != &OPTIONS_VideoColorProfileDef)
{
V_DrawFadeScreen(122, 3);
}
@ -4408,6 +4408,62 @@ void M_DrawOptionsCogs(void)
}
}
// Hacking up M_DrawOptionsCogs to try and make something better suited for changing the color profile. - Freaky Mutant Man
void M_DrawOptionsColorProfile(void)
{
boolean eggahack = (
currentMenu->prevMenu == &PLAY_MP_HostDef
|| (
currentMenu->prevMenu
&& currentMenu->prevMenu->prevMenu == &PLAY_MP_HostDef
)
);
boolean solidbg = M_GameTrulyStarted() && !eggahack;
UINT32 tick = ((optionsmenu.ticker/10) % 3) + 1;
// 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_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
if (optionsmenu.fade)
{
c2 = R_GetTranslationColormap(TC_DEFAULT, optionsmenu.lastcolour, GTC_CACHE);
V_DrawFixedPatch(0, 0, FRACUNIT, 0, back, c2);
// prepare fade flag:
tflag = min(V_90TRANS, (optionsmenu.fade)<<V_ALPHASHIFT);
}
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
else
{
if (eggahack)
{
M_DrawEggaChannelAlignable(true);
}
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(243<<FRACBITS, 67<<FRACBITS, FRACUNIT, 0, colorp_bar, NULL);
}
}
}
void M_DrawOptionsMovingButton(void)
{
patch_t *butt = W_CachePatchName("OPT_BUTT", PU_CACHE);

View file

@ -28,6 +28,7 @@ target_sources(SRB2SDL2 PRIVATE
options-sound.cpp
options-video-1.c
options-video-advanced.c
options-video-colorprofile.c
options-video-modes.c
play-1.c
play-char-select.c

View file

@ -36,6 +36,9 @@ menuitem_t OPTIONS_Video[] =
{IT_STRING | IT_CVAR, "Screen Effect", "Uses a special effect when displaying the game.",
NULL, {.cvar = &cv_scr_effect}, 0, 0},
{IT_STRING | IT_SUBMENU, "Color Profile...", "Adjust the color profile of the game's display.",
NULL, {.submenu = &OPTIONS_VideoColorProfileDef}, 0, 0},
{IT_NOTHING|IT_SPACE, NULL, NULL,
NULL, {NULL}, 0, 0},

View file

@ -0,0 +1,148 @@
// DR. ROBOTNIK'S RING RACERS
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Kart Krew.
// This file created by Freaky Mutant Man.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file menus/options-video-colorprofile.c
/// \brief Color Profile Options
#include "../k_menu.h"
#include "../v_video.h" // cv_globalgamma
#include "../r_fps.h" // fps cvars
// color profile menu
menuitem_t OPTIONS_VideoColorProfile[] =
{
{IT_STRING | IT_CVAR, "Saturation", "Reduce the saturation of the displayed image.",
NULL, {.cvar = &cv_globalsaturation}, 0, 0},
{IT_STRING | IT_CVAR, "Gamma", "Increase or decrease the brightness of the displayed image.",
NULL, {.cvar = &cv_globalgamma}, 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},
{IT_STRING | IT_CVAR, "Saturation", "Reduce the saturation of red in the displayed image.",
NULL, {.cvar = &cv_rsaturation}, 0, 0},
{IT_STRING | IT_CVAR, "Gamma", "Increase or decrease the brightness of red in the displayed image.",
NULL, {.cvar = &cv_rgamma}, 0, 0},
{IT_STRING | IT_CVAR, "Hue", "Adjust the hue of red in the displayed image.",
NULL, {.cvar = &cv_rhue}, 0, 0},
{IT_HEADER, "Yellow...", NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Saturation", "Reduce the saturation of yellow in the displayed image.",
NULL, {.cvar = &cv_ysaturation}, 0, 0},
{IT_STRING | IT_CVAR, "Gamma", "Increase or decrease the brightness of yellow in the displayed image.",
NULL, {.cvar = &cv_ygamma}, 0, 0},
{IT_STRING | IT_CVAR, "Hue", "Adjust the hue of yellow in the displayed image.",
NULL, {.cvar = &cv_yhue}, 0, 0},
{IT_HEADER, "Green...", NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Saturation", "Reduce the saturation of green in the displayed image.",
NULL, {.cvar = &cv_gsaturation}, 0, 0},
{IT_STRING | IT_CVAR, "Gamma", "Increase or decrease the brightness of green in the displayed image.",
NULL, {.cvar = &cv_ggamma}, 0, 0},
{IT_STRING | IT_CVAR, "Hue", "Adjust the hue of green in the displayed image.",
NULL, {.cvar = &cv_ghue}, 0, 0},
{IT_HEADER, "Cyan...", NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Saturation", "Reduce the saturation of cyan in the displayed image.",
NULL, {.cvar = &cv_csaturation}, 0, 0},
{IT_STRING | IT_CVAR, "Gamma", "Increase or decrease the brightness of cyan in the displayed image.",
NULL, {.cvar = &cv_cgamma}, 0, 0},
{IT_STRING | IT_CVAR, "Hue", "Adjust the hue of cyan in the displayed image.",
NULL, {.cvar = &cv_chue}, 0, 0},
{IT_HEADER, "Blue...", NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Saturation", "Reduce the saturation of blue in the displayed image.",
NULL, {.cvar = &cv_bsaturation}, 0, 0},
{IT_STRING | IT_CVAR, "Gamma", "Increase or decrease the brightness of blue in the displayed image.",
NULL, {.cvar = &cv_bgamma}, 0, 0},
{IT_STRING | IT_CVAR, "Hue", "Adjust the hue of blue in the displayed image.",
NULL, {.cvar = &cv_bhue}, 0, 0},
{IT_HEADER, "Magenta...", NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Saturation", "Reduce the saturation of magenta in the displayed image.",
NULL, {.cvar = &cv_msaturation}, 0, 0},
{IT_STRING | IT_CVAR, "Gamma", "Increase or decrease the brightness of magenta in the displayed image.",
NULL, {.cvar = &cv_mgamma}, 0, 0},
{IT_STRING | IT_CVAR, "Hue", "Adjust the hue of magenta in the displayed image.",
NULL, {.cvar = &cv_mhue}, 0, 0},
};
menu_t OPTIONS_VideoColorProfileDef = {
sizeof (OPTIONS_VideoColorProfile) / sizeof (menuitem_t),
&OPTIONS_VideoDef,
0,
OPTIONS_VideoColorProfile,
96, 80-8,
SKINCOLOR_WHITE, 0,
MBF_DRAWBGWHILEPLAYING,
NULL,
2, 5,
M_DrawGenericOptions,
M_DrawOptionsColorProfile,
M_OptionsTick,
NULL,
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);
}