diff options
-rw-r--r-- | engines/avalanche/help.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index b667ad090d..5d3247ba9a 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -180,6 +180,7 @@ bool Help::handleMouse(const Common::Event &event) { } else { // LBUTTONDOWN or MOUSEMOVE int highlightIs = 0; + // Decide which button we are hovering the cursor over: if ((mousePos.x > 470) && (mousePos.x <= 550) && (((mousePos.y - 13) % 27) <= 20)) { // No click, so highlight. highlightIs = (mousePos.y - 13) / 27 - 1; if ((highlightIs < 0) || (5 < highlightIs)) @@ -187,20 +188,21 @@ bool Help::handleMouse(const Common::Event &event) { } else highlightIs = 177; - if (((highlightIs != 177) && (event.type == Common::EVENT_LBUTTONDOWN)) || _holdLeft) { + Color highlightColor = kColorLightblue; + // If we clicked on a button or we are holding down the button, we have to highlight it with cyan: + if (((highlightIs != 177) && ((event.type == Common::EVENT_LBUTTONDOWN)) || _holdLeft)) { _holdLeft = true; - highlightIs += 32; + highlightColor = kColorLightcyan; } - if (_highlightWas != highlightIs) { + // Erase the previous highlight only if it's needed: + if (_highlightWas != highlightIs) _vm->_graphics->helpDrawHighlight(_highlightWas, kColorBlue); + + // Highligt the current one with the proper color: + if (_buttons[highlightIs]._trigger != Common::KEYCODE_INVALID) { _highlightWas = highlightIs; - if (_buttons[highlightIs & 31]._trigger != Common::KEYCODE_INVALID) { - if (highlightIs > 31) - _vm->_graphics->helpDrawHighlight(highlightIs, kColorLightcyan); - else - _vm->_graphics->helpDrawHighlight(highlightIs, kColorLightblue); - } + _vm->_graphics->helpDrawHighlight(highlightIs, highlightColor); } } |