Close #25526: When a shop item cannot be recoloured, show a preview of the building (#25528)

This commit is contained in:
Michael Steenbeek authored and GitHub committed 2026-02-14 23:49:40 +01:00
1 parent cd8aa64140
commit 92d5574ffb
2 files changed
+31 -9

No files matched your search

+1
View File
@@ -2,6 +2,7 @@
------------------------------------------------------------------------
- Feature: [#22704] Rides can be made invisible more easily.
- Improved: [#21753] Tracked rides with cheated powered launch mode can change powered launch speed without extra cheats.
- Improved: [#25526] When a shop item cannot be recoloured, show a preview of the building instead.
- Improved: [#25941] The command line sprite build command is now faster.
- Fix: [#14686, #23996, #25981] Preview images from different windows overwrite each other when using OpenGL.
- Fix: [#15128, #15626, #16331, #17443, #18626, #21597, #24175, #24971, #25963] Crash when loading corrupted RCT2/RCT1 save files with duplicate entity indices.
+30 -9
View File
@@ -4879,21 +4879,42 @@ namespace OpenRCT2::Ui::Windows
}
else
{
auto screenCoords = windowPos
+ ScreenCoordsXY{ (trackPreviewWidget.left + trackPreviewWidget.right) / 2 - 8,
(trackPreviewWidget.bottom + trackPreviewWidget.top) / 2 - 6 };
ShopItem shopItemIndex = rideEntry->shop_item[1] == ShopItem::none ? rideEntry->shop_item[0]
: rideEntry->shop_item[1];
auto shopItem = GetShopItemDescriptor(shopItemIndex);
ShopItem shopItem = rideEntry->shop_item[1] == ShopItem::none ? rideEntry->shop_item[0]
: rideEntry->shop_item[1];
if (ride->hasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS))
if (shopItem.IsRecolourable())
{
auto spriteColour = static_cast<Colour>((getGameState().currentTicks / 32) % kColourNumTotal);
auto screenCoords = windowPos
+ ScreenCoordsXY{ (trackPreviewWidget.left + trackPreviewWidget.right) / 2 - 8,
(trackPreviewWidget.bottom + trackPreviewWidget.top) / 2 - 6 };
GfxDrawSprite(rt, ImageId(GetShopItemDescriptor(shopItem).Image, spriteColour), screenCoords);
Colour spriteColour = ride->trackColours[0].main;
if (ride->hasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS))
spriteColour = Colour((getGameState().currentTicks / 32) % kColourNumNormal);
GfxDrawSprite(rt, ImageId(shopItem.Image, spriteColour), screenCoords);
}
else
{
GfxDrawSprite(rt, ImageId(GetShopItemDescriptor(shopItem).Image, ride->trackColours[0].main), screenCoords);
const ImageIndex previewImage = rideEntry->images_offset + 3 + 1;
auto image = GfxGetG1Element(previewImage);
if (image == nullptr)
return;
const auto& previewWidget = widgets[WIDX_TRACK_PREVIEW];
RenderTarget clipRT;
auto clipScreenPos = windowPos + ScreenCoordsXY{ previewWidget.left + 1, previewWidget.top + 1 };
const auto clipWidth = previewWidget.width() - 2;
const auto clipHeight = previewWidget.height() - 1;
ClipRenderTarget(clipRT, rt, clipScreenPos, clipWidth, clipHeight);
auto imageLocationX = (clipWidth / 2) - (image->width / 2) - image->xOffset;
auto imageLocationY = (clipHeight / 2) - (image->height / 2) - image->yOffset;
GfxDrawSprite(
clipRT, ImageId(previewImage, ride->trackColours[0].main), { imageLocationX, imageLocationY });
}
}