diff options
author | Paul Gilbert | 2017-11-24 19:20:25 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-11-24 19:20:25 -0500 |
commit | e7c98ffda0107af56435f8048d000c1cdc139bf6 (patch) | |
tree | 0d7ace73ac2584e626fe2d4c8fb0fb665293ad85 /engines/xeen/dialogs.cpp | |
parent | 6af295b96c0bd1447d77b5325708994c5291dd88 (diff) | |
download | scummvm-rg350-e7c98ffda0107af56435f8048d000c1cdc139bf6.tar.gz scummvm-rg350-e7c98ffda0107af56435f8048d000c1cdc139bf6.tar.bz2 scummvm-rg350-e7c98ffda0107af56435f8048d000c1cdc139bf6.zip |
XEEN: Toggle UI buttons when hotkey is pressed
Diffstat (limited to 'engines/xeen/dialogs.cpp')
-rw-r--r-- | engines/xeen/dialogs.cpp | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/engines/xeen/dialogs.cpp b/engines/xeen/dialogs.cpp index b890aa73b3..f1c1032d23 100644 --- a/engines/xeen/dialogs.cpp +++ b/engines/xeen/dialogs.cpp @@ -63,6 +63,7 @@ void ButtonContainer::addPartyButtons(XeenEngine *vm) { bool ButtonContainer::checkEvents(XeenEngine *vm) { EventsManager &events = *vm->_events; + Screen &screen = *vm->_screen; _buttonValue = 0; if (events._leftButton) { @@ -74,11 +75,11 @@ bool ButtonContainer::checkEvents(XeenEngine *vm) { events.debounceMouse(); _buttonValue = _buttons[i]._value; - return true; + break; } } - if (Common::Rect(8, 8, 224, 135).contains(pt)) { + if (!_buttonValue && Common::Rect(8, 8, 224, 135).contains(pt)) { _buttonValue = 1; return true; } @@ -95,8 +96,35 @@ bool ButtonContainer::checkEvents(XeenEngine *vm) { _buttonValue = Common::KEYCODE_RETURN; _buttonValue |= (keyState.flags & ~Common::KBD_CAPS) << 16; - if (_buttonValue) - return true; + } + + if (_buttonValue) { + // Check for a button matching the selected _buttonValue + Window &win = screen._windows[39]; + for (uint btnIndex = 0; btnIndex < _buttons.size(); ++btnIndex) { + UIButton &btn = _buttons[btnIndex]; + if (btn._draw && btn._value == _buttonValue) { + // Found the correct button + // Draw button depressed + btn._sprites->draw(screen, btnIndex * 2 + 1, + Common::Point(btn._bounds.left, btn._bounds.top)); + win.setBounds(btn._bounds); + win.update(); + + // Slight delay + screen.update(); + events.wait(4); + + // Redraw button in it's original non-depressed form + btn._sprites->draw(screen, btnIndex * 2, + Common::Point(btn._bounds.left, btn._bounds.top)); + win.setBounds(btn._bounds); + win.update(); + break; + } + } + + return true; } return false; |