diff --git a/port/src/optionsmenu.c b/port/src/optionsmenu.c index c700b8dcb..b3f80e207 100644 --- a/port/src/optionsmenu.c +++ b/port/src/optionsmenu.c @@ -971,7 +971,6 @@ static MenuItemHandlerResult menuhandlerCrosshairColorPreview(s32 operation, str { if (operation == MENUOP_GETCOLOUR) { data->label.colour1 = g_PlayerExtCfg[g_ExtMenuPlayer].crosshaircolour; - data->label.colour2 = g_PlayerExtCfg[g_ExtMenuPlayer].crosshaircolour; } return 0; @@ -1019,10 +1018,10 @@ struct menuitem g_ExtendedGameCrosshairColourMenuItems[] = { NULL, }, { - MENUITEMTYPE_LABEL, + MENUITEMTYPE_COLORBOX, + 0, + 0, 0, - MENUITEMFLAG_LITERAL_TEXT | MENUITEMFLAG_LABEL_CUSTOMCOLOUR | MENUITEMFLAG_SELECTABLE_CENTRE, - (uintptr_t)"PREVIEW\n", 0, menuhandlerCrosshairColorPreview, }, diff --git a/src/game/menu.c b/src/game/menu.c index b63ad6315..46e743aca 100644 --- a/src/game/menu.c +++ b/src/game/menu.c @@ -1178,6 +1178,9 @@ bool menuIsItemFocusable(struct menuitem *item, struct menudialog *dialog, s32 a case MENUITEMTYPE_METER: case MENUITEMTYPE_MARQUEE: case MENUITEMTYPE_CONTROLLER: +#ifndef PLATFORM_N64 + case MENUITEMTYPE_COLORBOX: +#endif return false; case MENUITEMTYPE_10: case MENUITEMTYPE_14: diff --git a/src/game/menuitem.c b/src/game/menuitem.c index 11e53274d..d780e74ab 100644 --- a/src/game/menuitem.c +++ b/src/game/menuitem.c @@ -2109,6 +2109,36 @@ Gfx *menuitemMeterRender(Gfx *gdl, struct menurendercontext *context) return gdl; } +#ifndef PLATFORM_N64 + +// Draws a colored box which fills the background of the menu item. +Gfx* menuitemColorBoxRender(Gfx *gdl, struct menurendercontext *context) +{ + u32 width = context->width; + u32 height = context->height; + u32 colour1; + s32 x1; + s32 x2; + + x1 = context->x; + x2 = x1 + width; + + union handlerdata data; + if (context->item->handlervoid) { + context->item->handlervoid(MENUOP_GETCOLOUR, context->item, &data); + } + + colour1 = data.label.colour1; + + gdl = textSetPrimColour(gdl, colour1); + gDPFillRectangleScaled(gdl++, x1, context->y, x2, context->y + height); + gdl = text0f153838(gdl); + + return gdl; +} + +#endif + Gfx *menuitemSelectableRender(Gfx *gdl, struct menurendercontext *context) { u32 leftcolour; @@ -4349,6 +4379,7 @@ Gfx *menuitemRender(Gfx *gdl, struct menurendercontext *context) case MENUITEMTYPE_CAROUSEL: return menuitemCarouselRender(gdl, context); case MENUITEMTYPE_MODEL: return menuitemModelRender(gdl, context); case MENUITEMTYPE_CONTROLLER: return menuitemControllerRender(gdl, context); + case MENUITEMTYPE_COLORBOX: return menuitemColorBoxRender(gdl, context); } return gdl; diff --git a/src/include/constants.h b/src/include/constants.h index 943f172d3..8b39686d4 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -1692,6 +1692,10 @@ #define MENUITEMTYPE_CONTROLLER 0x19 #define MENUITEMTYPE_END 0x1a +#ifndef PLATFORM_N64 +#define MENUITEMTYPE_COLORBOX 0x1b +#endif + #define MENUMODELFLAG_HASSCALE 0x01 #define MENUMODELFLAG_HASPOSITION 0x02 #define MENUMODELFLAG_HASROTATION 0x04 diff --git a/src/include/game/menuitem.h b/src/include/game/menuitem.h index 27747bf71..79b868989 100644 --- a/src/include/game/menuitem.h +++ b/src/include/game/menuitem.h @@ -32,6 +32,10 @@ Gfx *menuitemLabelRender(Gfx *gdl, struct menurendercontext *context); Gfx *menuitemMeterRender(Gfx *gdl, struct menurendercontext *context); +#ifndef PLATFORM_N64 +Gfx *menuitemColorBoxRender(Gfx *gdl, struct menurendercontext *context); +#endif + Gfx *menuitemSelectableRender(Gfx *gdl, struct menurendercontext *context); bool menuitemSelectableTick(struct menuitem *item, struct menuinputs *inputs, u32 tickflags);