From 8f6e9f0bf2cbd3c6cc59488aa7f8a4b5c92ffc15 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 11 Oct 2009 11:29:34 +0000 Subject: Fix FM-Towns/PC98 menu code. svn-id: r44905 --- engines/kyra/gui.cpp | 22 ++++------------------ engines/kyra/gui.h | 2 +- engines/kyra/gui_lok.cpp | 8 +++----- engines/kyra/gui_v2.cpp | 10 ++-------- 4 files changed, 10 insertions(+), 32 deletions(-) diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index a38c6e40ee..0b84b82c72 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -143,19 +143,13 @@ void GUI::initMenu(Menu &menu) { else printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8); } else { - Screen::FontId of = _screen->_currentFont; - if (_vm->_flags.gameID != GI_LOL && menu.item[i].saveSlot > 0) - _screen->setFont(Screen::FID_8_FNT); - if (_vm->gameFlags().platform != Common::kPlatformAmiga) - printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0, Screen::FID_8_FNT); + printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0); if (i == menu.highlightedItem) - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0, Screen::FID_8_FNT); + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0); else - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0, Screen::FID_8_FNT); - - _screen->setFont(of); + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0); } } } @@ -264,13 +258,9 @@ void GUI::redrawText(const Menu &menu) { textY++; printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 8); } else { - Screen::FontId of = _screen->_currentFont; - if (menu.item[i].saveSlot > 0) - _screen->setFont(Screen::FID_8_FNT); if (_vm->gameFlags().platform != Common::kPlatformAmiga) printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0); printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0); - _screen->setFont(of); } } @@ -294,13 +284,9 @@ void GUI::redrawHighlight(const Menu &menu) { textY++; printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 8); } else { - Screen::FontId of = _screen->_currentFont; - if (menu.item[i].saveSlot > 0) - _screen->setFont(Screen::FID_8_FNT); if (_vm->gameFlags().platform != Common::kPlatformAmiga) printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0); printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0); - _screen->setFont(of); } } @@ -461,7 +447,7 @@ void GUI::checkTextfieldInput() { } void GUI::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font) { - _text->printText(str, x, y, c0, c1, c2/*, font*/); + _text->printText(str, x, y, c0, c1, c2); } int GUI::getMenuCenterStringX(const char *str, int x1, int x2) { diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h index 9867daa4ec..6ddc1337d5 100644 --- a/engines/kyra/gui.h +++ b/engines/kyra/gui.h @@ -176,7 +176,7 @@ protected: bool _displaySubMenu; bool _cancelSubMenu; - virtual void printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font=Screen::FID_8_FNT); + virtual void printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font = Screen::FID_8_FNT); virtual int getMenuCenterStringX(const char *str, int x1, int x2); Button::Callback _redrawShadedButtonFunctor; diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index c835d5a02a..8e47a47d92 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -682,17 +682,15 @@ int GUI_LoK::loadGameMenu(Button *button) { } void GUI_LoK::redrawTextfield() { - Screen::FontId of = _screen->setFont(Screen::FID_8_FNT); _screen->fillRect(38, 91, 287, 102, _vm->gameFlags().platform == Common::kPlatformAmiga ? 18 : 250); _text->printText(_savegameName, 38, 92, 253, 0, 0); - + _screen->_charWidth = -2; int width = _screen->getTextWidth(_savegameName); _screen->fillRect(39 + width, 93, 45 + width, 100, _vm->gameFlags().platform == Common::kPlatformAmiga ? 31 : 254); _screen->_charWidth = 0; _screen->updateScreen(); - _screen->setFont(of); } void GUI_LoK::updateSavegameString() { @@ -704,7 +702,7 @@ void GUI_LoK::updateSavegameString() { char inputKey = _keyPressed.ascii; Util::convertISOToDOS(inputKey); - if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 176 : 226)) { + if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 128 : 226)) { if (length < ARRAYSIZE(_savegameName)-1) { _savegameName[length] = inputKey; _savegameName[length+1] = 0; @@ -751,7 +749,7 @@ int GUI_LoK::saveGame(Button *button) { } redrawTextfield(); - while (_displaySubMenu && !_vm->shouldQuit()) { + while (_displaySubMenu && !_vm->shouldQuit()) { checkTextfieldInput(); updateSavegameString(); processHighlights(_menu[3]); diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index 5b5a24b24e..c5e5bab2d3 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -746,21 +746,17 @@ const char *GUI_v2::nameInputProcess(char *buffer, int x, int y, uint8 c1, uint8 int curPos = strlen(buffer); int x2 = x, y2 = y; - Screen::FontId of = _screen->setFont(Screen::FID_8_FNT); _text->printText(buffer, x, y, c1, c2, c2); - + for (int i = 0; i < curPos; ++i) x2 += getCharWidth(buffer[i]); drawTextfieldBlock(x2, y2, c3); - _screen->setFont(of); _keyPressed.reset(); _cancelNameInput = _finishNameInput = false; while (running && !_vm->shouldQuit()) { - of = _screen->setFont(Screen::FID_8_FNT); checkTextfieldInput(); - _screen->setFont(of); processHighlights(_savenameMenu); char inputKey = _keyPressed.ascii; @@ -783,8 +779,7 @@ const char *GUI_v2::nameInputProcess(char *buffer, int x, int y, uint8 c1, uint8 drawTextfieldBlock(x2, y2, c3); _screen->updateScreen(); _lastScreenUpdate = _vm->_system->getMillis(); - } else if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 176 : 226) && curPos < bufferSize) { - of = _screen->setFont(Screen::FID_8_FNT); + } else if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 128 : 226) && curPos < bufferSize) { if (x2 + getCharWidth(inputKey) + 7 < 0x11F) { buffer[curPos] = inputKey; const char text[2] = { buffer[curPos], 0 }; @@ -795,7 +790,6 @@ const char *GUI_v2::nameInputProcess(char *buffer, int x, int y, uint8 c1, uint8 _screen->updateScreen(); _lastScreenUpdate = _vm->_system->getMillis(); } - _screen->setFont(of); } _keyPressed.reset(); -- cgit v1.2.3