From 312a1590ab50d8f9ddbd95adf712346f5d596e66 Mon Sep 17 00:00:00 2001 From: Trevor Finney <8711258+finneyt@users.noreply.github.com> Date: Mon, 20 Feb 2023 19:27:47 -0500 Subject: [PATCH] Invisible color sprite displays properly --- resources/g2/icons/colour_invisible.png | Bin 153 -> 153 bytes resources/g2/icons/colour_invisible_pressed.png | Bin 0 -> 153 bytes resources/g2/sprites.json | 3 +++ src/openrct2-ui/interface/Widget.cpp | 9 ++++++++- src/openrct2-ui/windows/Dropdown.cpp | 3 +-- src/openrct2/drawing/Drawing.cpp | 3 +-- src/openrct2/interface/Colour.cpp | 1 + src/openrct2/interface/Colour.h | 1 + src/openrct2/sprites.h | 1 + 9 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 resources/g2/icons/colour_invisible_pressed.png diff --git a/resources/g2/icons/colour_invisible.png b/resources/g2/icons/colour_invisible.png index af1c4fd57a07971cb7f32726ec7d82c1c8c9db9f..e93619f0c6d5222a5fe7064ce63406270e5ca959 100644 GIT binary patch delta 57 zcmbQqIFoULr_><^2EId#q8eTe3=9lWw7JW!6o M)78&qol`;+0M{uIbN~PV delta 57 zcmbQqIFoULr_^Bv2EN0L$MaXDFfcIadAc};XapxSG+zJwd}6Ya$UPpTc5{)^V4xg> Mr>mdKI;Vst024eCF#rGn diff --git a/resources/g2/icons/colour_invisible_pressed.png b/resources/g2/icons/colour_invisible_pressed.png new file mode 100644 index 0000000000000000000000000000000000000000..b9b5fa9fb5c55fb122335d516d022724220f3544 GIT binary patch literal 153 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&k#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSK$uZf!>a)(sORb87@`rJ%+Ppxd;Wj+L<4pXj*p(qOJ1<7 sOl{i4E-dk}j)7A_y5U@ULP7!qL$HfQyZV$hT|k`-p00i_>zopr054)EP5=M^ literal 0 HcmV?d00001 diff --git a/resources/g2/sprites.json b/resources/g2/sprites.json index 82c4e825c2..4beaf254dd 100644 --- a/resources/g2/sprites.json +++ b/resources/g2/sprites.json @@ -20591,6 +20591,9 @@ }, { "path": "icons/colour_invisible.png" + }, + { + "path": "icons/colour_invisible_pressed.png" }, { "path": "palette_map/palette_map_dark_olive_dark.png" diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 328c0343b9..d5e1349183 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -1186,5 +1186,12 @@ static void WidgetTextBoxDraw(DrawPixelInfo* dpi, WindowBase& w, WidgetIndex wid ImageId GetColourButtonImage(colour_t colour) { - return ImageId(SPR_PALETTE_BTN, colour).WithBlended(true); + if (colour == COLOUR_OFFSET_INVISIBLE) + { + return ImageId(SPR_G2_ICON_PALETTE_INVISIBLE - 1, colour).WithBlended(false); + } + else + { + return ImageId(SPR_PALETTE_BTN, colour).WithBlended(true); + } } diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 716b162051..80b726fe87 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -473,8 +473,7 @@ void WindowDropdownShowColour(WindowBase* w, Widget* widget, uint8_t dropdownCol // Get palette offset for G2 colours // Use special graphic for Invisible colour - //auto imageId = (orderedColour == FilterPaletteID::PaletteG2Invisible) ? ImageId(SPR_G2_ICON_PALETTE_INVISIBLE, COLOUR_BORDEAUX_RED) - auto imageId = ImageId(SPR_PALETTE_BTN, orderedColour); + auto imageId = (orderedColour == COLOUR_OFFSET_INVISIBLE) ? ImageId(SPR_G2_ICON_PALETTE_INVISIBLE - 1, COLOUR_WHITE) : ImageId(SPR_PALETTE_BTN, orderedColour); gDropdownItems[i].Format = Dropdown::FormatColourPicker; gDropdownItems[i].Args = (i << 32) | imageId.ToUInt32(); diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 977f6cd3f9..0c48f88cc4 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -295,8 +295,7 @@ enum SPR_PALETTE_GLASS_LIGHT_PINK = 5047, // Start of G2 Palettes - // For some reason these only load correctly if this is set to the G2 index ONE PRIOR to actual index - SPR_PALETTE_DARK_OLIVE_DARK = SPR_G2_ICON_PALETTE_INVISIBLE, + SPR_PALETTE_DARK_OLIVE_DARK = SPR_G2_PALETTE_BEGIN - 1, SPR_PALETTE_DARK_OLIVE_LIGHT, SPR_PALETTE_SATURATED_BROWN_LIGHT, SPR_PALETTE_BORDEAUX_RED_DARK, diff --git a/src/openrct2/interface/Colour.cpp b/src/openrct2/interface/Colour.cpp index fa0e723b24..4a044ff2ca 100644 --- a/src/openrct2/interface/Colour.cpp +++ b/src/openrct2/interface/Colour.cpp @@ -42,6 +42,7 @@ void ColoursInitMaps() // Get palette index in g1 / g2 auto paletteIndex = (i < COLOUR_NUM_ORIGINAL) ? SPR_PALETTE_2_START : SPR_G2_PALETTE_BEGIN - COLOUR_NUM_ORIGINAL; const G1Element* g1 = GfxGetG1Element(paletteIndex + i); + //TODO: Integrate themes with G2 palettes if (g1 != nullptr) { ColourMapA[i].colour_0 = g1->offset[INDEX_COLOUR_0]; diff --git a/src/openrct2/interface/Colour.h b/src/openrct2/interface/Colour.h index 52d1b3b3c8..934cdc8d3a 100644 --- a/src/openrct2/interface/Colour.h +++ b/src/openrct2/interface/Colour.h @@ -206,6 +206,7 @@ constexpr uint8_t PALETTE_LENGTH_ANIMATED = 16; constexpr uint8_t COLOUR_NUM_ORIGINAL = 32; constexpr uint8_t COLOUR_NUM_NORMAL = 54; constexpr uint8_t COLOUR_ID_G2_OFFSET = 112; +constexpr uint8_t COLOUR_OFFSET_INVISIBLE = 166; #define TEXT_COLOUR_254 (254) #define TEXT_COLOUR_255 (255) diff --git a/src/openrct2/sprites.h b/src/openrct2/sprites.h index 7e38d5b1c0..083129b374 100644 --- a/src/openrct2/sprites.h +++ b/src/openrct2/sprites.h @@ -1365,6 +1365,7 @@ enum SPR_G2_ALPINE_END = SPR_G2_ALPINE_LIFT_TRACK_GENTLE_DIAGONAL + 12, SPR_G2_ICON_PALETTE_INVISIBLE, + SPR_G2_ICON_PALETTE_INVISIBLE_PRESSED, SPR_G2_PALETTE_BEGIN, SPR_G2_PAL_REMAP_DARK_OLIVE_DARK = SPR_G2_PALETTE_BEGIN, SPR_G2_PAL_REMAP_DARK_OLIVE_LIGHT,