From e7f79a762e6ebdee37bbed3dd6ab9674321dad82 Mon Sep 17 00:00:00 2001 From: Trevor Finney <8711258+finneyt@users.noreply.github.com> Date: Sun, 19 Feb 2023 20:00:21 -0500 Subject: [PATCH] Define order for color picker cells --- src/openrct2-ui/input/MouseInput.cpp | 7 +++++-- src/openrct2-ui/windows/Dropdown.cpp | 18 +++++++++++++++--- src/openrct2/drawing/Drawing.cpp | 2 ++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index af71e09002..ff25caae34 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -32,6 +32,7 @@ #include #include #include +#include struct RCTMouseData { @@ -1341,7 +1342,9 @@ void InputStateWidgetPressed( dropdown_index = gDropdownDefaultIndex; } } - WindowEventDropdownCall(cursor_w, cursor_widgetIndex, dropdown_index); + WindowEventDropdownCall( + cursor_w, cursor_widgetIndex, + (gDropdownIsColour) ? COLOUR_UI_ORDER[dropdown_index] : dropdown_index); } } } @@ -1470,7 +1473,7 @@ void InputStateWidgetPressed( STR_COLOUR_INVISIBLE_TIP, STR_COLOUR_VOID_TIP, }; - WindowTooltipShow(OpenRCT2String{ _colourTooltips[dropdown_index], {} }, screenCoords); + WindowTooltipShow(OpenRCT2String{ _colourTooltips[COLOUR_UI_ORDER[dropdown_index]], {} }, screenCoords); } if (dropdown_index < Dropdown::ItemsMaxSize && Dropdown::IsDisabled(dropdown_index)) diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 25fb68f299..4d8ea3bad9 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -35,6 +35,18 @@ static constexpr const uint8_t _appropriateImageDropdownItemsPerRow[34] = { 6, 8, 9, 8, // 34 }; +// Map of color picker index to true color index +static constexpr uint8_t COLOUR_UI_ORDER[] = { + 0, 3, 47, 6, 50, 45, 11, 37, 39, + 1, 4, 5, 7, 9, 12, 14, 13, 15, + 2, 44, 48, 8, 10, 46, 41, 38, 40, + 29, 27, 35, 42, 23, 52, 21, 19, 32, + 30, 28, 26, 25, 22, 24, 20, 18, 16, + 51, 31, 36, 43, 34, 53, 49, 17, 33, + 54, 55 +}; + + enum { WIDX_BACKGROUND, @@ -452,11 +464,11 @@ void WindowDropdownShowColour(WindowBase* w, Widget* widget, uint8_t dropdownCol // Set items for (uint64_t i = 0; i < COLOUR_COUNT; i++) { - if (selectedColour == i) - defaultIndex = i; + if (selectedColour == COLOUR_UI_ORDER[i]) + defaultIndex = selectedColour; gDropdownItems[i].Format = Dropdown::FormatColourPicker; - gDropdownItems[i].Args = (i << 32) | ImageId(SPR_PALETTE_BTN, i).ToUInt32(); + gDropdownItems[i].Args = (i << 32) | ImageId(SPR_PALETTE_BTN, COLOUR_UI_ORDER[i]).ToUInt32(); } // Show dropdown diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 73addab87a..821b205244 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -557,6 +557,8 @@ static const uint16_t palette_to_g1_offset[PALETTE_TOTAL_OFFSETS] = { SPR_PALETTE_GLASS_BRIGHT_PINK, SPR_PALETTE_GLASS_LIGHT_PINK, + // Start of G2 Palettes + SPR_PALETTE_DARK_OLIVE_DARK, SPR_PALETTE_DARK_OLIVE_LIGHT, SPR_PALETTE_SATURATED_BROWN_LIGHT,