forked from rosebudai/OpenRCT2-Web
Magnify picked-up peeps when viewport is in double or quadruple zoom (#26839)
This commit is contained in:
1 parent
727d107be7
commit
ac6030f011
5 files changed
+54
-17
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user