Merge branch 'profile-polish' into 'master'

Profile card: add Accessibility menu

See merge request KartKrew/Kart!1729
This commit is contained in:
Oni 2023-12-29 19:06:09 +00:00
commit dbafe3fe91
8 changed files with 151 additions and 31 deletions

View file

@ -347,6 +347,7 @@ typedef enum
{
popt_profilename = 0,
popt_controls,
popt_accessibility,
popt_char,
popt_profilepname,
popt_confirm,
@ -360,6 +361,9 @@ void M_StartEditProfile(INT32 c);
extern menuitem_t OPTIONS_ProfileControls[];
extern menu_t OPTIONS_ProfileControlsDef;
extern menuitem_t OPTIONS_ProfileAccessibility[];
extern menu_t OPTIONS_ProfileAccessibilityDef;
extern menuitem_t OPTIONS_Video[];
extern menu_t OPTIONS_VideoDef;
@ -1228,7 +1232,9 @@ void M_DrawOptionsCogs(void);
void M_DrawOptionsMovingButton(void); // for sick transitions...
void M_DrawOptions(void);
void M_DrawGenericOptions(void);
void M_DrawProfileCard(INT32 x, INT32 y, boolean greyedout, profile_t *p);
void M_DrawProfileSelect(void);
void M_DrawEditProfileTooltips(void);
void M_DrawEditProfile(void);
void M_DrawProfileControls(void);
void M_DrawVideoModes(void);

View file

@ -2251,7 +2251,7 @@ static void M_DrawCharSelectCursor(UINT8 num)
// Draw character profile card.
// Moved here because in the case of profile edition this is drawn in the charsel menu.
static void M_DrawProfileCard(INT32 x, INT32 y, boolean greyedout, profile_t *p)
void M_DrawProfileCard(INT32 x, INT32 y, boolean greyedout, profile_t *p)
{
setup_player_t *sp = &setup_player[0]; // When editing profile character, we'll always be checking for what P1 is doing.
patch_t *card = W_CachePatchName("PR_CARD", PU_CACHE);
@ -4379,6 +4379,17 @@ void M_DrawProfileSelect(void)
}
void M_DrawEditProfileTooltips(void)
{
// Tooltip
// The text is slightly shifted hence why we don't just use M_DrawMenuTooltips()
V_DrawFixedPatch(0, 0, FRACUNIT, 0, W_CachePatchName("MENUHINT", PU_CACHE), NULL);
if (currentMenu->menuitems[itemOn].tooltip != NULL)
{
V_DrawCenteredThinString(224, 12, 0, currentMenu->menuitems[itemOn].tooltip);
}
}
// Profile edition menu
void M_DrawEditProfile(void)
{
@ -4387,13 +4398,7 @@ void M_DrawEditProfile(void)
INT32 x = (145 + (menutransition.tics*32));
INT32 i;
// Tooltip
// The text is slightly shifted hence why we don't just use M_DrawMenuTooltips()
V_DrawFixedPatch(0, 0, FRACUNIT, 0, W_CachePatchName("MENUHINT", PU_CACHE), NULL);
if (currentMenu->menuitems[itemOn].tooltip != NULL)
{
V_DrawCenteredThinString(224, 12, 0, currentMenu->menuitems[itemOn].tooltip);
}
M_DrawEditProfileTooltips();
// Draw the menu options...
for (i = 0; i < currentMenu->numitems; i++)

View file

@ -22,6 +22,7 @@ target_sources(SRB2SDL2 PRIVATE
options-hud-online.c
options-profiles-1.c
options-profiles-edit-1.c
options-profiles-edit-accessibility.cpp
options-profiles-edit-controls.c
options-server-1.c
options-server-advanced.c

View file

@ -33,12 +33,6 @@ menuitem_t OPTIONS_Gameplay[] =
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Minimum Input Delay", "Practice for online play! Higher = more delay, 0 = instant response.",
NULL, {.cvar = &cv_mindelay}, 0, 0},
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_SUBMENU, "Random Item Toggles...", "Change which items to enable for your games.",
NULL, {.submenu = &OPTIONS_GameplayItemsDef}, 0, 0},

View file

@ -12,10 +12,13 @@ menuitem_t OPTIONS_EditProfile[] = {
NULL, {.cvar = &cv_dummyprofilename}, 0, 41},
{IT_STRING | IT_CALL, "Controls", "Select the button mappings for this Profile.",
NULL, {.routine = M_ProfileDeviceSelect}, 0, 81},
NULL, {.routine = M_ProfileDeviceSelect}, 0, 71},
{IT_STRING | IT_SUBMENU, "Accessibility", "Acccessibility and quality of life options.",
NULL, {.submenu = &OPTIONS_ProfileAccessibilityDef}, 0, 91},
{IT_STRING | IT_CALL, "Character", "Default character and color for this Profile.",
NULL, {.routine = M_CharacterSelect}, 0, 101},
NULL, {.routine = M_CharacterSelect}, 0, 111},
{IT_STRING | IT_CVAR | IT_CV_STRING, "Player Tag", "Name displayed online when using this Profile.",
NULL, {.cvar = &cv_dummyprofileplayername}, 0, 141},

View file

@ -0,0 +1,124 @@
/// \file menus/options-profiles-edit-accessibility.c
/// \brief Profile Accessibibility Options
#include "../v_draw.hpp"
#include "../command.h"
#include "../k_menu.h"
#include "../p_local.h" // cv_tilting
extern "C" consvar_t cv_mindelay;
using srb2::Draw;
namespace
{
void draw_routine()
{
Draw row = Draw(0, currentMenu->y).font(Draw::Font::kConsole);
M_DrawEditProfileTooltips();
for (int i = 0; i < currentMenu->numitems; ++i)
{
const menuitem_t& it = currentMenu->menuitems[i];
if (it.status & IT_DISPLAY)
{
bool selected = i == itemOn;
Draw h = row.x(currentMenu->x);
if ((it.status & IT_HEADERTEXT) == IT_HEADERTEXT)
{
h
.x(-4)
.flags(V_GRAYMAP)
.text(it.text);
}
else
{
h
.flags(selected ? highlightflags : 0)
.text(it.text);
}
if ((it.status & IT_TYPE) == IT_CVAR)
{
auto val = Draw::TextElement(it.itemaction.cvar->string).font(Draw::Font::kConsole);
h = row.x(BASEVIDWIDTH - 16).flags(highlightflags);
h.align(Draw::Align::kRight).text(val);
if (selected)
{
int ofs = skullAnimCounter / 5;
h.x(-val.width() - 10 - ofs).text("\x1C");
h.x(2 + ofs).text("\x1D");
}
}
}
row = row.y(11);
}
// Finally, draw the card ontop
if (optionsmenu.profile != NULL)
{
M_DrawProfileCard(optionsmenu.optx, optionsmenu.opty, false, optionsmenu.profile);
}
}
}; // namespace
menuitem_t OPTIONS_ProfileAccessibility[] = {
{IT_HEADER, "This Profile only:", NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Rumble", "For gamepad users - should your device rumble?",
NULL, {.cvar = &cv_dummyprofilerumble}, 0, 0},
{IT_STRING | IT_CVAR, "Auto Roulette", "Item roulette auto-stops on a random result.",
NULL, {.cvar = &cv_dummyprofileautoroulette}, 0, 0},
{IT_STRING | IT_CVAR, "Kickstart Accel", "Hold A to auto-accel. Tap it to cancel.",
NULL, {.cvar = &cv_dummyprofilekickstart}, 0, 0},
{IT_STRING | IT_CVAR, "Lite Steer", "Hold DOWN on d-pad/keyboard for shallow turns.",
NULL, {.cvar = &cv_dummyprofilelitesteer}, 0, 0},
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, {NULL}, 0, 0},
{IT_HEADER, "For all Profiles:", NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Minimum Input Delay", "Practice for online play! 0 = instant response.",
NULL, {.cvar = &cv_mindelay}, 0, 0},
{IT_STRING | IT_CVAR, "Screen Tilting", "View rotation on inclines.",
NULL, {.cvar = &cv_tilting}, 0, 0},
{IT_STRING | IT_CVAR, "Reduce Effects", "If overwhelmed, hide less-important particle cues.",
NULL, {.cvar = &cv_reducevfx}, 0, 0},
};
menu_t OPTIONS_ProfileAccessibilityDef = {
sizeof (OPTIONS_ProfileAccessibility) / sizeof (menuitem_t),
&OPTIONS_EditProfileDef,
0,
OPTIONS_ProfileAccessibility,
145, 52,
SKINCOLOR_ULTRAMARINE, 0,
MBF_DRAWBGWHILEPLAYING,
"FILE",
2, 5,
draw_routine,
M_DrawOptionsCogs,
M_OptionsTick, // animate cogs
NULL,
NULL,
NULL,
};

View file

@ -82,21 +82,6 @@ menuitem_t OPTIONS_ProfileControls[] = {
{IT_CONTROL, "LUA/C", "May be used by add-ons.",
NULL, {.routine = M_ProfileSetControl}, gc_luac, 0},
{IT_HEADER, "TOGGLES", "For per-player commands",
NULL, {NULL}, 0, 0},
{IT_CONTROL | IT_CVAR, "RUMBLE", "For gamepad users - should your device rumble?",
NULL, {.cvar = &cv_dummyprofilerumble}, 0, 0},
{IT_CONTROL | IT_CVAR, "KICKSTART ACCEL", "Hold A to auto-accel. Tap it to cancel.",
NULL, {.cvar = &cv_dummyprofilekickstart}, 0, 0},
{IT_CONTROL | IT_CVAR, "AUTO ROULETTE", "Item roulette auto-stops on a random result.",
NULL, {.cvar = &cv_dummyprofileautoroulette}, 0, 0},
{IT_CONTROL | IT_CVAR, "LITE STEER", "Hold DOWN on d-pad/keyboard for shallow turns.",
NULL, {.cvar = &cv_dummyprofilelitesteer}, 0, 0},
{IT_HEADER, "EXTRA", "",
NULL, {NULL}, 0, 0},

View file

@ -27,11 +27,13 @@ menuitem_t OPTIONS_Video[] =
{IT_NOTHING|IT_SPACE, NULL, NULL,
NULL, {NULL}, 0, 0},
#if 0 // See Profiles/Accessibility
{IT_STRING | IT_CVAR, "Screen Tilting", "The view rotatation on inclines can be disabled to reduce motion sickness.",
NULL, {.cvar = &cv_tilting}, 0, 0},
{IT_STRING | IT_CVAR, "Reduce Visual Effects", "If on, some less-important particle cues will be hidden.",
NULL, {.cvar = &cv_reducevfx}, 0, 0},
#endif
{IT_STRING | IT_CVAR | IT_CV_SLIDER, "Gamma", "Adjusts the overall brightness of the game.",
NULL, {.cvar = &cv_globalgamma}, 0, 0},