Magnify picked-up peeps when viewport is in double or quadruple zoom (#26839)

This commit is contained in:
Aaron van Geffen authored and GitHub committed 2026-07-29 10:38:53 +00:00
1 parent 727d107be7
commit ac6030f011
5 files changed
+54 -17

No files matched your search

+1
View File
@@ -5,6 +5,7 @@
- Improved: [#26747] Exporting a sprite file now also outputs a JSON file, allowing for round-trip conversions.
- Improved: [#26763] The ride colour/appearance tab now visually separates fields using group boxes.
- Improved: [#26765] The ride operations tab now visually separates fields using group boxes.
- Improved: [#26839] Magnify picked-up peeps when viewport is in double or quadruple zoom.
- Fix: [#26610] Player list is not updated automatically when a player joins or leaves.
- Fix: [#26639] Handymen could begin a task while another handyman was already doing the exact same task.
- Fix: [#26752] The Cut-away View window doesn’t display negative height values correctly on some platforms.
+6
View File
@@ -995,6 +995,12 @@ namespace OpenRCT2::Ui::Windows
gPickupPeepX = screenCoords.x - 1;
gPickupPeepY = screenCoords.y + 16;
auto* mainWindow = WindowGetMain();
if (mainWindow != nullptr)
{
gPickupPeepZoom = std::min(mainWindow->viewport->zoom, ZoomLevel{ 0 });
}
const auto peep = GetGuest();
if (peep == nullptr)
{
+6
View File
@@ -690,6 +690,12 @@ namespace OpenRCT2::Ui::Windows
gPickupPeepX = screenCoords.x - 1;
gPickupPeepY = screenCoords.y + 16;
auto* mainWindow = WindowGetMain();
if (mainWindow != nullptr)
{
gPickupPeepZoom = std::min(mainWindow->viewport->zoom, ZoomLevel{ 0 });
}
auto staff = GetStaff();
if (staff == nullptr)
{
+38 -17
View File
@@ -102,6 +102,7 @@ uint32_t gPaletteEffectFrame;
ImageId gPickupPeepImage;
int32_t gPickupPeepX;
int32_t gPickupPeepY;
ZoomLevel gPickupPeepZoom;
bool gPaintForceRedraw{ false };
@@ -619,29 +620,49 @@ bool ClipRenderTarget(RenderTarget& dst, RenderTarget& src, const ScreenCoordsXY
return false;
}
constexpr std::array<int8_t, 3> kPickedUpPeepYOffsets = { 0, 16, 48 };
void GfxInvalidatePickedUpPeep()
{
auto imageId = gPickupPeepImage;
if (imageId.HasValue())
{
auto* g1 = GfxGetG1Element(imageId);
if (g1 != nullptr)
{
int32_t left = gPickupPeepX + g1->xOffset;
int32_t top = gPickupPeepY + g1->yOffset;
int32_t right = left + g1->width;
int32_t bottom = top + g1->height;
GfxSetDirtyBlocks({ { left, top }, { right, bottom } });
}
}
if (!gPickupPeepImage.HasValue())
return;
auto* g1 = GfxGetG1Element(gPickupPeepImage);
if (g1 == nullptr)
return;
auto zoom = gPickupPeepZoom;
auto xOffset = -int8_t(gPickupPeepZoom);
auto yOffset = kPickedUpPeepYOffsets[xOffset];
int32_t left = gPickupPeepX + zoom.ApplyInversedTo(g1->xOffset) + xOffset;
int32_t top = gPickupPeepY + zoom.ApplyInversedTo(g1->yOffset) + yOffset;
int32_t right = left + zoom.ApplyInversedTo(g1->width);
int32_t bottom = top + zoom.ApplyInversedTo(g1->height);
GfxSetDirtyBlocks({ { left, top }, { right, bottom } });
}
void GfxDrawPickedUpPeep(RenderTarget& rt)
{
if (gPickupPeepImage.HasValue())
{
GfxDrawSprite(rt, gPickupPeepImage, { gPickupPeepX, gPickupPeepY });
}
if (!gPickupPeepImage.HasValue())
return;
assert(rt.zoom_level == ZoomLevel{ 0 });
auto zoom = gPickupPeepZoom;
auto xOffset = -int8_t(gPickupPeepZoom);
auto yOffset = kPickedUpPeepYOffsets[xOffset];
auto pos = ScreenCoordsXY{ zoom.ApplyTo(gPickupPeepX + xOffset), zoom.ApplyTo(gPickupPeepY + yOffset) };
rt.zoom_level = zoom;
rt.pitch = zoom.ApplyTo(rt.pitch);
GfxDrawSprite(rt, gPickupPeepImage, pos);
rt.pitch = zoom.ApplyInversedTo(rt.pitch);
rt.zoom_level = ZoomLevel{ 0 };
}
std::optional<uint32_t> GetPaletteG1Index(FilterPaletteID paletteId)
+3
View File
@@ -21,6 +21,7 @@
struct ScreenCoordsXY;
struct ScreenLine;
struct ScreenRect;
struct ZoomLevel;
namespace OpenRCT2::Drawing
{
@@ -51,6 +52,8 @@ extern const OpenRCT2::Drawing::TranslucentWindowPalette kTranslucentWindowPalet
extern ImageId gPickupPeepImage;
extern int32_t gPickupPeepX;
extern int32_t gPickupPeepY;
extern ZoomLevel gPickupPeepZoom;
extern bool gPaintForceRedraw;
bool ClipRenderTarget(