mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use ScreenCoordsXY in AttachedPaintStruct
This commit is contained in:
parent
fc75f8b0e9
commit
d35933dc9f
|
@ -1858,9 +1858,7 @@ InteractionInfo SetInteractionInfoFromPaintSession(PaintSession* session, uint32
|
|||
#pragma GCC diagnostic ignored "-Wnull-dereference"
|
||||
for (AttachedPaintStruct* attached_ps = ps->Attached; attached_ps != nullptr; attached_ps = attached_ps->next)
|
||||
{
|
||||
if (IsSpriteInteractedWith(
|
||||
session->DPI, attached_ps->image_id,
|
||||
{ (attached_ps->x + ps->ScreenPos.x), (attached_ps->y + ps->ScreenPos.y) }))
|
||||
if (IsSpriteInteractedWith(session->DPI, attached_ps->image_id, ps->ScreenPos + attached_ps->RelativePos))
|
||||
{
|
||||
if (PSSpriteTypeIsInFilter(ps, filter) && GetPaintStructVisibility(ps, viewFlags) != VisibilityKind::Hidden)
|
||||
{
|
||||
|
|
|
@ -564,7 +564,7 @@ static void PaintAttachedPS(DrawPixelInfo& dpi, PaintStruct* ps, uint32_t viewFl
|
|||
AttachedPaintStruct* attached_ps = ps->Attached;
|
||||
for (; attached_ps != nullptr; attached_ps = attached_ps->next)
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ attached_ps->x + ps->ScreenPos.x, attached_ps->y + ps->ScreenPos.y };
|
||||
const auto screenCoords = ps->ScreenPos + attached_ps->RelativePos;
|
||||
|
||||
auto imageId = PaintPSColourifyImage(ps, attached_ps->image_id, viewFlags);
|
||||
if (attached_ps->IsMasked)
|
||||
|
@ -806,8 +806,7 @@ bool PaintAttachToPreviousAttach(PaintSession& session, const ImageId imageId, i
|
|||
}
|
||||
|
||||
ps->image_id = imageId;
|
||||
ps->x = x;
|
||||
ps->y = y;
|
||||
ps->RelativePos = { x, y };
|
||||
ps->IsMasked = false;
|
||||
ps->next = nullptr;
|
||||
|
||||
|
@ -839,8 +838,7 @@ bool PaintAttachToPreviousPS(PaintSession& session, const ImageId image_id, int3
|
|||
}
|
||||
|
||||
ps->image_id = image_id;
|
||||
ps->x = x;
|
||||
ps->y = y;
|
||||
ps->RelativePos = { x, y };
|
||||
ps->IsMasked = false;
|
||||
|
||||
AttachedPaintStruct* oldFirstAttached = masterPs->Attached;
|
||||
|
|
|
@ -31,8 +31,8 @@ struct AttachedPaintStruct
|
|||
AttachedPaintStruct* next;
|
||||
ImageId image_id;
|
||||
ImageId ColourImageId;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
// This is relative to the parent where we are attached to.
|
||||
ScreenCoordsXY RelativePos;
|
||||
bool IsMasked;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue