1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-25 15:54:31 +01:00

Extend color selection dropdown with more colors (#19446)

* Setup for extended palette

* Define order for color picker cells

* Init G2 Palettes in ColoursInitMaps

* Add Glass Palettes

* Use special sprite for Invisible color

* Set up new cheat for special colors

* Add glass palettes to palette_to_g1_offset

* Add entries for new colors in TranslucentWindowPalettes

* Finish implementation of special colors cheat

* Some cleanup

* New colors almost work

* Correct g2 palette loading indices

* Invisible color sprite displays properly

* Repaint works with large scenery and walls

* Prevent random shop items from overflowing to junk palettes

* More cleanup

* Fix glass palettes

* Add mapping of new colors to original colors for UI themes

* Fix junk palettes for random shop items

* Fix missing highlight color in software renderer

* Convert small scenery support flag to allow use of new colors

* Progress on displaying new colors in software renderer

* Fix invisible color scheme sprite

* Formatting cleanup

* Resolve comparison of integer expressions of different signedness

* Index g2 palette maps to fix visible chain lift

* Progress on fixing new colors in software renderer

* Fix station and support colors

* Fix dropdown selected index

* Get invisible color (mostly) working in software renderer

* Use forceBmp for palette resources

* Remove test function definition left in by mistake

* Remove some obsolete range checks for original color values

* Add changelog entry

* Reorder color dropdown based on NE user feedback

* Some cleanup

* Further cleanup

* Formatting

* Add include for GetPaletteMapIndexForColour

* Fix a couple things I broke

* Fix function placement

* Revert "Add include for GetPaletteMapIndexForColour"

This reverts commit 0af9611e6656d792adb7a36efe7dbf3387a4a759.

* Use color constants for color order list

* Make remappable colors contiguous

* turn off clang format for ordered color list

* Appease clang

* Use all colors for random shop item animation

* Improvements to palette map resources

* Fix chain lifts again + adjustments to a few colors

* Update changelog and contributors.md

* Revert changes to S4 and S6 importers which are no longer needed

* Bump network, plugin, and minimum park versions

* Revert "Progress on displaying new colors in software renderer"

This reverts commit 337602e4a7.

* Remove unnecessary comment

---------

Co-authored-by: Trevor Finney <8711258+finneyt@users.noreply.github.com>
This commit is contained in:
kyphii
2023-04-06 03:36:07 -04:00
committed by GitHub
parent b4beb0c69f
commit 39790779bb
79 changed files with 908 additions and 113 deletions

View File

@@ -32,7 +32,7 @@ static constexpr const uint8_t _appropriateImageDropdownItemsPerRow[34] = {
1, 1, 1, 1, 2, 2, 3, 3, 4, 3, // 10
5, 4, 4, 5, 5, 5, 4, 5, 6, 5, // 20
5, 7, 4, 5, 6, 5, 6, 6, 6, 6, // 30
6, 8, 8, 8, // 34
6, 8, 9, 8, // 34
};
enum
@@ -449,20 +449,27 @@ int32_t DropdownIndexFromPoint(const ScreenCoordsXY& loc, WindowBase* w)
void WindowDropdownShowColour(WindowBase* w, Widget* widget, uint8_t dropdownColour, uint8_t selectedColour)
{
int32_t defaultIndex = -1;
auto numColours = (gCheatsAllowSpecialColourSchemes) ? static_cast<uint8_t>(COLOUR_COUNT) : COLOUR_NUM_NORMAL;
// Set items
for (uint64_t i = 0; i < COLOUR_COUNT; i++)
for (uint64_t i = 0; i < numColours; i++)
{
if (selectedColour == i)
auto orderedColour = ColourToPaletteIndex(i);
if (selectedColour == orderedColour)
defaultIndex = i;
// Use special graphic for Invisible colour
auto imageId = (orderedColour == COLOUR_INVISIBLE) ? ImageId(SPR_G2_ICON_PALETTE_INVISIBLE, COLOUR_WHITE)
: ImageId(SPR_PALETTE_BTN, orderedColour);
gDropdownItems[i].Format = Dropdown::FormatColourPicker;
gDropdownItems[i].Args = (i << 32) | ImageId(SPR_PALETTE_BTN, i).ToUInt32();
gDropdownItems[i].Args = (i << 32) | imageId.ToUInt32();
}
// Show dropdown
WindowDropdownShowImage(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() + 1, dropdownColour,
Dropdown::Flag::StayOpen, COLOUR_COUNT, 12, 12, _appropriateImageDropdownItemsPerRow[COLOUR_COUNT]);
Dropdown::Flag::StayOpen, numColours, 12, 12, _appropriateImageDropdownItemsPerRow[COLOUR_NUM_ORIGINAL]);
gDropdownIsColour = true;
gDropdownLastColourHover = -1;