MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / nextMouseInput

Function nextMouseInput

src/OpenLoco/src/Input/MouseInput.cpp:1762–1867  ·  view source on GitHub ↗

0x004C6EE6

Source from the content-addressed store, hash-verified

1760
1761 // 0x004C6EE6
1762 MouseButton nextMouseInput(int32_t& x, int32_t& y)
1763 {
1764 if (!hasFlag(Flags::rightMousePressed))
1765 {
1766 // Interrupt tutorial on mouse button input.
1767 auto input = dequeueMouseInput();
1768 if (Tutorial::state() == Tutorial::State::playing && input.has_value())
1769 {
1770 Tutorial::stop();
1771 }
1772
1773 // If tutorial is playing, follow the recorded mouse coordinates.
1774 MouseButton button{};
1775 if (Tutorial::state() == Tutorial::State::playing)
1776 {
1777 button = MouseButton(Tutorial::nextInput());
1778
1779 // 0x004C6F6C
1780 if (button != MouseButton::released)
1781 {
1782 button = MouseButton(Tutorial::nextInput());
1783 x = Tutorial::nextInput();
1784 y = Tutorial::nextInput();
1785 }
1786 else
1787 {
1788 button = loc_4C6FCE(x, y);
1789 if (x < 0)
1790 {
1791 return button;
1792 }
1793 }
1794 }
1795 // 0x004C6F5F
1796 else if (!input)
1797 {
1798 button = loc_4C6FCE(x, y);
1799 if (x < 0)
1800 {
1801 return button;
1802 }
1803 }
1804 else if (input)
1805 {
1806 // 0x004C6F87
1807 switch (input->button)
1808 {
1809 case 1:
1810 button = MouseButton::leftPressed;
1811 break;
1812 case 2:
1813 button = MouseButton::rightPressed;
1814 break;
1815 case 3:
1816 button = MouseButton::leftReleased;
1817 break;
1818 default:
1819 button = MouseButton::rightReleased;

Callers 2

handleInputFunction · 0.85
minimalHandleInputFunction · 0.85

Calls 11

dequeueMouseInputFunction · 0.85
MouseButtonEnum · 0.85
nextInputFunction · 0.85
loc_4C6FCEFunction · 0.85
widthFunction · 0.85
heightFunction · 0.85
isRightMouseButtonDownFunction · 0.85
rightMouseButtonReleasedFunction · 0.85
hasFlagFunction · 0.50
stateFunction · 0.50
stopFunction · 0.50

Tested by

no test coverage detected