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

Function stateScrollRight

src/OpenLoco/src/Input/MouseInput.cpp:665–705  ·  view source on GitHub ↗

0x004C76A7 regs.cx = (uint16_t)button; regs.ax = x; regs.bx = y; Right mouse dragging in scrollview widgets.

Source from the content-addressed store, hash-verified

663 // regs.bx = y;
664 // Right mouse dragging in scrollview widgets.
665 static void stateScrollRight(const MouseButton button)
666 {
667 auto window = WindowManager::find(_dragWindowType, _dragWindowNumber);
668 if (window == nullptr)
669 {
670 Input::state(State::reset);
671 return;
672 }
673
674 switch (button)
675 {
676 case MouseButton::released:
677 {
678 _ticksSinceDragStart += getTimeSinceLastTick();
679
680 const Ui::Point dragOffset = getNextDragOffset();
681 if (dragOffset.x != 0 || dragOffset.y != 0)
682 {
683 _ticksSinceDragStart = 1000;
684
685 Ui::Widget& widget = window->widgets[_dragWidgetIndex];
686 const auto invert = Config::get().invertRightMouseViewPan ? -1 : 1;
687 Ui::ScrollView::horizontalDragFollow(*window, &widget, _dragWidgetIndex, _dragScrollIndex, dragOffset.x * invert);
688 Ui::ScrollView::verticalDragFollow(*window, &widget, _dragWidgetIndex, _dragScrollIndex, dragOffset.y * invert);
689 }
690
691 break;
692 }
693
694 case MouseButton::rightReleased:
695 {
696 Input::state(State::reset);
697 // in the original assembly code we load into registers values from _dragLast.x, _dragLast.y
698 // if _ticksSinceDragStart <= 500, however the result was unused
699 break;
700 }
701
702 default:
703 break;
704 }
705 }
706
707 MouseButton getLastKnownButtonState()
708 {

Callers 1

handleMouseFunction · 0.85

Calls 7

findFunction · 0.85
getTimeSinceLastTickFunction · 0.85
getNextDragOffsetFunction · 0.85
horizontalDragFollowFunction · 0.85
verticalDragFollowFunction · 0.85
stateFunction · 0.50
getFunction · 0.50

Tested by

no test coverage detected