1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 04:23:20 +01:00

Define order for color picker cells

This commit is contained in:
Trevor Finney
2023-02-19 20:00:21 -05:00
parent 827b1ced12
commit e7f79a762e
3 changed files with 22 additions and 5 deletions

View File

@@ -32,6 +32,7 @@
#include <openrct2/world/Banner.h>
#include <openrct2/world/Map.h>
#include <openrct2/world/Scenery.h>
#include <openrct2-ui/windows/Dropdown.cpp>
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))

View File

@@ -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

View File

@@ -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,