MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / SetInteractionInfoFromPaintSession

Function SetInteractionInfoFromPaintSession

src/openrct2/interface/Viewport.cpp:1650–1693  ·  view source on GitHub ↗

* * rct2: 0x0068862C */

Source from the content-addressed store, hash-verified

1648 * rct2: 0x0068862C
1649 */
1650 InteractionInfo SetInteractionInfoFromPaintSession(PaintSession* session, uint32_t viewFlags, uint16_t filter)
1651 {
1652 PROFILED_FUNCTION();
1653
1654 InteractionInfo info{};
1655
1656 PaintStruct* ps = session->PaintHead;
1657 while (ps != nullptr)
1658 {
1659 PaintStruct* old_ps = ps;
1660 PaintStruct* next_ps = ps;
1661 while (next_ps != nullptr)
1662 {
1663 ps = next_ps;
1664 if (IsSpriteInteractedWith(session->rt, ps->image_id, ps->ScreenPos))
1665 {
1666 if (PSInteractionTypeIsInFilter(ps, filter)
1667 && GetPaintStructVisibility(ps, viewFlags) == VisibilityKind::visible)
1668 {
1669 info = { ps };
1670 }
1671 }
1672 next_ps = ps->Children;
1673 }
1674
1675#pragma GCC diagnostic push
1676#pragma GCC diagnostic ignored "-Wnull-dereference"
1677 for (AttachedPaintStruct* attached_ps = ps->Attached; attached_ps != nullptr; attached_ps = attached_ps->NextEntry)
1678 {
1679 if (IsSpriteInteractedWith(session->rt, attached_ps->image_id, ps->ScreenPos + attached_ps->RelativePos))
1680 {
1681 if (PSInteractionTypeIsInFilter(ps, filter)
1682 && GetPaintStructVisibility(ps, viewFlags) == VisibilityKind::visible)
1683 {
1684 info = { ps };
1685 }
1686 }
1687 }
1688#pragma GCC diagnostic pop
1689
1690 ps = old_ps->NextQuadrantEntry;
1691 }
1692 return info;
1693 }
1694
1695 /**
1696 *

Callers 2

PrepareLightListFunction · 0.85

Calls 3

IsSpriteInteractedWithFunction · 0.85
GetPaintStructVisibilityFunction · 0.85

Tested by

no test coverage detected