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

Method invalidatePressedImageButtons

src/OpenLoco/src/Ui/Window.cpp:393–426  ·  view source on GitHub ↗

0x004C99B9

Source from the content-addressed store, hash-verified

391
392 // 0x004C99B9
393 void Window::invalidatePressedImageButtons()
394 {
395 WidgetIndex_t pressedWidgetIndex = kWidgetIndexNull;
396 if (Input::isPressed(type, number) || Input::isDropdownActive(type, number))
397 {
398 pressedWidgetIndex = Input::getPressedWidgetIndex();
399 }
400
401 int16_t toolWidgetIndex = -1;
402 if (ToolManager::isToolActive(type, number))
403 {
404 toolWidgetIndex = ToolManager::getToolWidgetIndex();
405 }
406
407 WidgetIndex_t widx{};
408 for (auto& widget : widgets)
409 {
410 const bool activated = isActivated(widx);
411 // This might be the remap flag, not entirely sure.
412 const bool hasBit31 = (widget.content & (1U << 31)) != 0;
413 if ((widget.type == WidgetType::slider || widget.type == WidgetType::wt_3) && hasBit31)
414 {
415 if (activated || pressedWidgetIndex == widx || toolWidgetIndex == widx)
416 {
417 Gfx::invalidateRegion(
418 x + widget.left,
419 y + widget.top,
420 x + widget.right + 1,
421 y + widget.bottom + 1);
422 }
423 }
424 widx++;
425 }
426 }
427
428 // 0x004CA4BD
429 // input: regs.esi - window (this)

Callers 1

Calls 6

isPressedFunction · 0.85
isDropdownActiveFunction · 0.85
getPressedWidgetIndexFunction · 0.85
isToolActiveFunction · 0.85
getToolWidgetIndexFunction · 0.85
invalidateRegionFunction · 0.85

Tested by

no test coverage detected