diff options
Diffstat (limited to 'engines/wage')
-rw-r--r-- | engines/wage/gui.cpp | 2 | ||||
-rw-r--r-- | engines/wage/menu.cpp | 39 | ||||
-rw-r--r-- | engines/wage/menu.h | 2 |
3 files changed, 27 insertions, 16 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 8731b4be6a..21ff005bc8 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -69,7 +69,7 @@ static const byte palette[] = { static byte fillPattern[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; static byte fillPatternStripes[8] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }; -static byte fillPatternCheckers[8] = { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa }; +static byte fillPatternCheckers[8] = { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 }; static const byte macCursorArrow[] = { 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp index b9e59fb51d..094eea1f75 100644 --- a/engines/wage/menu.cpp +++ b/engines/wage/menu.cpp @@ -193,12 +193,12 @@ const Graphics::Font *Menu::getMenuFont() { return _gui->getFont("Chicago-12", Graphics::FontManager::kBigGUIFont); } -const char *Menu::getAcceleratorString(MenuSubItem *item) { +const char *Menu::getAcceleratorString(MenuSubItem *item, const char *prefix) { static char res[20]; *res = 0; if (item->shortcut != 0) - sprintf(res, " %c%c", (_gui->_builtInFonts ? '^' : '\x11'), item->shortcut); + sprintf(res, "%s%c%c", prefix, (_gui->_builtInFonts ? '^' : '\x11'), item->shortcut); return res; } @@ -209,7 +209,7 @@ int Menu::calculateMenuWidth(MenuItem *menu) { MenuSubItem *item = menu->subitems[i]; if (item->text.size()) { Common::String text(item->text); - Common::String acceleratorText(getAcceleratorString(item)); + Common::String acceleratorText(getAcceleratorString(item, " ")); if (acceleratorText.size()) { text += acceleratorText; } @@ -279,10 +279,8 @@ void Menu::renderSubmenu(MenuItem *menu) { int y = r->top + 1; for (int i = 0; i < menu->subitems.size(); i++) { Common::String text(menu->subitems[i]->text); - Common::String acceleratorText(getAcceleratorString(menu->subitems[i])); - if (acceleratorText.size()) { - text += acceleratorText; - } + Common::String acceleratorText(getAcceleratorString(menu->subitems[i], "")); + int accelX = r->right - 25; int color = kColorBlack; if (i == _activeSubItem && text.size() && menu->subitems[i]->enabled) { @@ -291,19 +289,32 @@ void Menu::renderSubmenu(MenuItem *menu) { Design::drawFilledRect(&_gui->_screen, trect, kColorBlack, _gui->_patterns, kPatternSolid); } + if (text.size()) { - if (menu->subitems[i]->enabled) { - _font->drawString(&_gui->_screen, text, x, y, r->width(), color); - } else { - // I am lazy to extend drawString() with plotProc as a parameter, so - // fake it here + Graphics::Surface *s = &_gui->_screen; + int tx = x, ty = y; + + if (!menu->subitems[i]->enabled) { + s = &_tempSurface; + tx = 0; + ty = 0; + accelX -= x; + _tempSurface.fillRect(Common::Rect(0, 0, _tempSurface.w, _tempSurface.h), kColorGreen); - _font->drawString(&_tempSurface, text, 0, 0, r->width(), kColorBlack); + } + + _font->drawString(s, text, tx, ty, r->width(), color); + + if (acceleratorText.size()) + _font->drawString(s, acceleratorText, accelX, ty, r->width(), color); + if (!menu->subitems[i]->enabled) { + // I am lazy to extend drawString() with plotProc as a parameter, so + // fake it here for (int ii = 0; ii < _tempSurface.h; ii++) { const byte *src = (const byte *)_tempSurface.getBasePtr(0, ii); byte *dst = (byte *)_gui->_screen.getBasePtr(x, y+ii); - byte pat = _gui->_patterns[kPatternCheckers - 1][(y + ii) % 8]; + byte pat = _gui->_patterns[kPatternCheckers - 1][ii % 8]; for (int j = 0; j < r->width(); j++) { if (*src != kColorGreen && (pat & (1 << (7 - (x + j) % 8)))) *dst = *src; diff --git a/engines/wage/menu.h b/engines/wage/menu.h index 58195dd5f8..00b7a3f906 100644 --- a/engines/wage/menu.h +++ b/engines/wage/menu.h @@ -73,7 +73,7 @@ private: private: const Graphics::Font *getMenuFont(); - const char *getAcceleratorString(MenuSubItem *item); + const char *getAcceleratorString(MenuSubItem *item, const char *prefix); int calculateMenuWidth(MenuItem *menu); void calcMenuBounds(MenuItem *menu); void renderSubmenu(MenuItem *menu); |