Use ScreenCoordsXY in AttachedPaintStruct

This commit is contained in:
ζeh Matt 2023-04-14 03:22:32 +03:00
parent fc75f8b0e9
commit d35933dc9f
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
3 changed files with 6 additions and 10 deletions

View File

@ -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)
{

View File

@ -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;

View File

@ -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;
};