diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index e3497b3b148..e511bd83719 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -118,15 +118,15 @@ void Font::setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4) { _fontColors[2] = v3; } -void Font::setColorMode(int mode) { +void Font::setColorMode(SelectionMode mode) { switch (mode) { - case 0: + case SELMODE_UNSELECTED: setColors(0xFF, 4, 4, 0); break; - case 1: + case SELMODE_HIGHLIGHTED: setColors(0xFF, 5, 5, 0); break; - case 2: + case SELMODE_SELECTED: setColors(0xFF, 6, 6, 0); break; default: diff --git a/engines/mads/font.h b/engines/mads/font.h index 5079f1261fb..1511b60a825 100644 --- a/engines/mads/font.h +++ b/engines/mads/font.h @@ -39,6 +39,10 @@ namespace MADS { #define FONT_TELE "*FONTTELE.FF" // Not in Phantom #define FONT_PHAN "*FONTPHAN.FF" // Phantom only +enum SelectionMode { + SELMODE_UNSELECTED = 0, SELMODE_HIGHLIGHTED = 1, SELMODE_SELECTED = 2 +}; + class MADSEngine; class Font { @@ -77,7 +81,7 @@ public: virtual ~Font(); void setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4); - void setColorMode(int mode); + void setColorMode(SelectionMode mode); int maxWidth() const { return _maxWidth; } int getWidth(const Common::String &msg, int spaceWidth = -1); diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index ba6875205f2..a2cc75f381f 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -575,7 +575,7 @@ void ScreenObjects::elementHighlighted() { if (currentPos.x > bounds.left) newIndex = idx; } else { - if (currentPos.x > bounds.right) + if (currentPos.x < bounds.right) newIndex = idx; } } diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 67fb50e4acb..b45ff146335 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -331,10 +331,10 @@ void UserInterface::writeVocab(ScrCategory category, int id) { case CAT_ACTION: font = _vm->_font->getFont(FONT_INTERFACE); vocabId = scene._verbList[id]._id; - if (_highlightedActionIndex) { - _vm->_font->setColorMode(1); + if (id == _highlightedActionIndex) { + _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { - _vm->_font->setColorMode(id == _selectedActionIndex ? 2 : 0); + _vm->_font->setColorMode(id == _selectedActionIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); } vocabStr = scene.getVocab(vocabId); vocabStr.setChar(toupper(vocabStr[0]), 0); @@ -344,10 +344,10 @@ void UserInterface::writeVocab(ScrCategory category, int id) { case CAT_INV_LIST: font = _vm->_font->getFont(FONT_INTERFACE); vocabId = _vm->_game->_objects.getItem(id)._descId; - if (_v1C == id) { - _vm->_font->setColorMode(1); + if (id == _v1C) { + _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { - _vm->_font->setColorMode(id == _selectedInvIndex ? 2 : 0); + _vm->_font->setColorMode(id == _selectedInvIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); vocabStr = scene.getVocab(vocabId); vocabStr.setChar(toupper(vocabStr[0]), 0); font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); @@ -378,16 +378,17 @@ void UserInterface::writeVocab(ScrCategory category, int id) { break; } - font->setColorMode((id == 4) || (_scrollerY == 3) ? 1 : 0); + font->setColorMode((id == 4) || (_scrollerY == 3) ? SELMODE_HIGHLIGHTED : SELMODE_UNSELECTED); font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); break; default: + // Item specific verbs font = _vm->_font->getFont(FONT_INTERFACE); vocabId = _vm->_game->_objects.getItem(_selectedInvIndex)._vocabList[id]._vocabId; - if (_v1E == id) { - _vm->_font->setColorMode(1); + if (id == _v1E) { + _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { - _vm->_font->setColorMode(id == _selectedInvIndex ? 2 : 0); + _vm->_font->setColorMode(id == _selectedInvIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); vocabStr = scene.getVocab(vocabId); vocabStr.setChar(toupper(vocabStr[0]), 0); font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top));