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

Function stateNormalRight

src/OpenLoco/src/Input/MouseInput.cpp:1356–1427  ·  view source on GitHub ↗

0x004C834A

Source from the content-addressed store, hash-verified

1354
1355 // 0x004C834A
1356 static void stateNormalRight(int32_t x, int32_t y, Ui::Window* window, Ui::WidgetIndex_t widgetIndex)
1357 {
1358 Ui::WindowType windowType = Ui::WindowType::undefined;
1359 Ui::WindowNumber_t windowNumber = 0;
1360
1361 if (window != nullptr)
1362 {
1363 windowType = window->type;
1364 windowNumber = window->number;
1365 }
1366
1367 WindowManager::close(Ui::WindowType::tooltip);
1368
1369 // Window might have changed position in the list, therefore find it again
1370 window = WindowManager::find(windowType, windowNumber);
1371 if (window == nullptr)
1372 {
1373 return;
1374 }
1375
1376 window = WindowManager::bringToFront(*window);
1377
1378 if (widgetIndex == -1)
1379 {
1380 return;
1381 }
1382 // Widget may have changed memory position during bringToFront
1383 auto* widget = &window->widgets[widgetIndex];
1384
1385 if (WindowManager::getCurrentModalType() != Ui::WindowType::undefined)
1386 {
1387 if (WindowManager::getCurrentModalType() == window->type)
1388 {
1389 ScrollView::scrollModalRight(x, y, *window, widget, widgetIndex);
1390 }
1391
1392 return;
1393 }
1394
1395 if (SceneManager::isTitleMode())
1396 {
1397 return;
1398 }
1399
1400 switch (widget->type)
1401 {
1402 default:
1403 break;
1404
1405 case Ui::WidgetType::viewport:
1406 viewportDragBegin(window);
1407
1408 _dragLast.x = x;
1409 _dragLast.y = y;
1410
1411 Ui::hideCursor();
1412 startCursorDrag();
1413

Callers 1

stateNormalFunction · 0.85

Calls 11

findFunction · 0.85
bringToFrontFunction · 0.85
getCurrentModalTypeFunction · 0.85
scrollModalRightFunction · 0.85
isTitleModeFunction · 0.85
viewportDragBeginFunction · 0.85
hideCursorFunction · 0.85
startCursorDragFunction · 0.85
scrollDragBeginFunction · 0.85
closeFunction · 0.50
setFlagFunction · 0.50

Tested by

no test coverage detected