diff options
author | Florian Kagerer | 2009-10-06 17:22:40 +0000 |
---|---|---|
committer | Florian Kagerer | 2009-10-06 17:22:40 +0000 |
commit | 45fda46cf31884ca446c23e6c6df50794145cf9e (patch) | |
tree | 328bf37e8211368e96d7d45c1351d440544e5006 | |
parent | 1481c78d1a61937d9339563a521b3b87c14520e9 (diff) | |
download | scummvm-rg350-45fda46cf31884ca446c23e6c6df50794145cf9e.tar.gz scummvm-rg350-45fda46cf31884ca446c23e6c6df50794145cf9e.tar.bz2 scummvm-rg350-45fda46cf31884ca446c23e6c6df50794145cf9e.zip |
KYRA/LOL: - get rid of ascii/sjis detection which could cause problems when typing savegame names
- fixed some minor bugs
svn-id: r44709
-rw-r--r-- | engines/kyra/gui.cpp | 33 | ||||
-rw-r--r-- | engines/kyra/gui_hof.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/gui_lok.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/gui_lol.cpp | 15 | ||||
-rw-r--r-- | engines/kyra/gui_v2.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/kyra_hof.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_lok.cpp | 5 | ||||
-rw-r--r-- | engines/kyra/lol.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/screen.cpp | 14 | ||||
-rw-r--r-- | engines/kyra/screen_lol.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/script_hof.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/script_lok.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/script_tim.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/sequences_hof.cpp | 22 | ||||
-rw-r--r-- | engines/kyra/sequences_lok.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/sequences_lol.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/text.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/text.h | 3 | ||||
-rw-r--r-- | engines/kyra/text_mr.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/text_mr.h | 2 | ||||
-rw-r--r-- | graphics/sjis.h | 21 |
22 files changed, 122 insertions, 61 deletions
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index ddb9d51fac..a38c6e40ee 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -143,13 +143,19 @@ 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); + printMenuText(getMenuItemTitle(menu.item[i]), textX - 1, textY + 1, defaultColor1(), 0, 0, Screen::FID_8_FNT); if (i == menu.highlightedItem) - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0); + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].highlightColor, 0, 0, Screen::FID_8_FNT); else - printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0); + printMenuText(getMenuItemTitle(menu.item[i]), textX, textY, menu.item[i].textColor, 0, 0, Screen::FID_8_FNT); + + _screen->setFont(of); } } } @@ -258,9 +264,13 @@ 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); } } @@ -284,9 +294,13 @@ 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); } } @@ -447,7 +461,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/*, font*/); } int GUI::getMenuCenterStringX(const char *str, int x1, int x2) { @@ -551,6 +565,9 @@ int MainMenu::handle(int dim) { _screen->showMouse(); int fh = _screen->getFontHeight(); + if (_vm->gameFlags().lang == Common::JA_JPN) + fh++; + int textPos = ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3; Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * _static.menuTable[3]); @@ -599,9 +616,12 @@ int MainMenu::handle(int dim) { void MainMenu::draw(int select) { int top = _screen->_curDim->sy; top += _static.menuTable[1]; + int fh = _screen->getFontHeight(); + if (_vm->gameFlags().lang == Common::JA_JPN) + fh++; for (int i = 0; i < _static.menuTable[3]; ++i) { - int curY = top + i * _screen->getFontHeight(); + int curY = top + i * fh; int color = (i == select) ? _static.menuTable[6] : _static.menuTable[5]; printString("%s", ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3, curY, color, 0, 5, _static.strings[i]); } @@ -638,6 +658,9 @@ void MainMenu::printString(const char *format, int x, int y, int col1, int col2, if (flags & 2) x -= _screen->getTextWidth(string); + if (_vm->gameFlags().use16ColorMode) + flags &= 3; + if (flags & 4) { _screen->printText(string, x - 1, y, _static.altColor, col2); _screen->printText(string, x, y + 1, _static.altColor, col2); diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp index 7fc23ddafa..621b3199c5 100644 --- a/engines/kyra/gui_hof.cpp +++ b/engines/kyra/gui_hof.cpp @@ -552,7 +552,7 @@ void KyraEngine_HoF::bookPrintText(int dstPage, const uint8 *str, int x, int y, _screen->_curPage = dstPage; _screen->setTextColor(_bookTextColorMap, 0, 3); - Screen::FontId oldFont = _screen->setFont(Screen::FID_BOOKFONT_FNT); + Screen::FontId oldFont = _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_BOOKFONT_FNT); _screen->_charWidth = -2; _screen->hideMouse(); diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index 87cd088071..c835d5a02a 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -682,15 +682,17 @@ 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() { @@ -702,7 +704,7 @@ void GUI_LoK::updateSavegameString() { char inputKey = _keyPressed.ascii; Util::convertISOToDOS(inputKey); - if ((uint8)inputKey > 31 && (uint8)inputKey < 226) { + if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 176 : 226)) { if (length < ARRAYSIZE(_savegameName)-1) { _savegameName[length] = inputKey; _savegameName[length+1] = 0; @@ -749,7 +751,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_lol.cpp b/engines/kyra/gui_lol.cpp index 7eaff77432..587e710fc5 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -104,6 +104,7 @@ void LoLEngine::gui_drawInventoryItem(int index) { void LoLEngine::gui_drawScroll() { _screen->copyRegion(112, 0, 12, 0, 87, 15, 2, 2, Screen::CR_NO_P_CHECK); + Screen::FontId of = _screen->setFont(Screen::FID_9_FNT); int h = 0; for (int i = 0; i < 7; i++) { @@ -130,10 +131,12 @@ void LoLEngine::gui_drawScroll() { _screen->fprintString("%s", 24, y, col, 0, 0, getLangString(_spellProperties[_availableSpells[i]].spellNameCode)); y += 9; } + _screen->setFont(of); } void LoLEngine::gui_highlightSelectedSpell(bool mode) { int y = 15; + Screen::FontId of = _screen->setFont(Screen::FID_9_FNT); for (int i = 0; i < 7; i++) { if (_availableSpells[i] == -1) continue; @@ -141,6 +144,7 @@ void LoLEngine::gui_highlightSelectedSpell(bool mode) { _screen->fprintString("%s", 24, y, col, 0, 0, getLangString(_spellProperties[_availableSpells[i]].spellNameCode)); y += 9; } + _screen->setFont(of); } void LoLEngine::gui_displayCharInventory(int charNum) { @@ -175,7 +179,9 @@ void LoLEngine::gui_displayCharInventory(int charNum) { for (int i = 0; i < 11; i++) gui_drawCharInventoryItem(i); + Screen::FontId of = _screen->setFont(Screen::FID_9_FNT); _screen->fprintString("%s", 182, 103, _flags.use16ColorMode ? 0xbb : 172, 0, 5, getLangString(0x4033)); + _screen->setFont(of); static const uint16 statusFlags[] = { 0x0080, 0x0000, 0x1000, 0x0002, 0x100, 0x0001, 0x0000, 0x0000 }; @@ -2277,7 +2283,10 @@ int GUI_LoL::runMenu(Menu &menu) { const ScreenDim *d = _screen->getScreenDim(8); uint32 textCursorTimer = 0; uint8 textCursorStatus = 1; + Screen::FontId of = _screen->setFont(Screen::FID_9_FNT); int wW = _screen->getCharWidth('W'); + _screen->setFont(of); + int fW = (d->w << 3) - wW; int fC = 0; @@ -2287,8 +2296,6 @@ int GUI_LoL::runMenu(Menu &menu) { // a menu has scroll buttons or slider bars. uint8 hasSpecialButtons = 0; - Screen::FontId of = _vm->gameFlags().use16ColorMode ? _screen->setFont(Screen::FID_SJIS_FNT) : _screen->_currentFont; - while (_displayMenu) { _vm->_mouseX = _vm->_mouseY = 0; @@ -2516,8 +2523,6 @@ int GUI_LoL::runMenu(Menu &menu) { _newMenu = 0; } - _screen->setFont(of); - return _menuResult; } @@ -2629,7 +2634,7 @@ int GUI_LoL::getInput() { char inputKey = _keyPressed.ascii; Util::convertISOToDOS(inputKey); - if ((uint8)inputKey > 31 && (uint8)inputKey < 226) { + if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 128 : 226)) { _saveDescription[strlen(_saveDescription) + 1] = 0; _saveDescription[strlen(_saveDescription)] = inputKey; inputFlag |= 0x8000; diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index 69e409c201..5b5a24b24e 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -746,17 +746,21 @@ 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; @@ -779,7 +783,8 @@ 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 < 226 && curPos < bufferSize) { + } else if ((uint8)inputKey > 31 && (uint8)inputKey < (_vm->gameFlags().lang == Common::JA_JPN ? 176 : 226) && curPos < bufferSize) { + of = _screen->setFont(Screen::FID_8_FNT); if (x2 + getCharWidth(inputKey) + 7 < 0x11F) { buffer[curPos] = inputKey; const char text[2] = { buffer[curPos], 0 }; @@ -790,6 +795,7 @@ 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(); diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp index 31deaab450..9bc71a9dea 100644 --- a/engines/kyra/kyra_hof.cpp +++ b/engines/kyra/kyra_hof.cpp @@ -246,7 +246,7 @@ Common::Error KyraEngine_HoF::init() { } _screen->loadFont(_screen->FID_GOLDFONT_FNT, "GOLDFONT.FNT"); - _screen->setFont(_screen->FID_8_FNT); + _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : _screen->FID_8_FNT); _screen->setAnimBlockPtr(3504); _screen->setScreenDim(0); diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index ebeb6f3b67..26c5876844 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -297,6 +297,9 @@ Common::Error KyraEngine_LoK::go() { if (_res->getFileSize("6.FNT")) _screen->loadFont(Screen::FID_6_FNT, "6.FNT"); _screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT"); + + _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT); + _screen->setScreenDim(0); _abortIntroFlag = false; @@ -419,7 +422,7 @@ void KyraEngine_LoK::startup() { saveGameState(0, "New game", 0); } } else { - _screen->setFont(Screen::FID_8_FNT); + _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT); loadGameStateCheck(_gameToLoad); _gameToLoad = -1; } diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 904984cb31..a33a04b3c2 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/lol.cpp @@ -563,7 +563,7 @@ Common::Error LoLEngine::go() { // the prologue code we need to setup them manually here. if (_gameToLoad != -1 && action != 3) { preInit(); - _screen->setFont(Screen::FID_9_FNT); + _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); } // We have three sound.dat files, one for the intro, one for the @@ -738,7 +738,7 @@ int LoLEngine::mainMenu() { { 0, 0, 0, 0, 0 }, { 0x01, 0x04, 0x0C, 0x04, 0x00, 0xC1, 0xE1 }, { 0xCC, 0xDD, 0xDD, 0xDD }, - Screen::FID_9_FNT, 1 + Screen::FID_SJIS_FNT, 1 } }; @@ -4434,7 +4434,9 @@ void LoLEngine::printMapText(uint16 stringId, int x, int y) { void LoLEngine::printMapExitButtonText() { int cp = _screen->setCurPage(2); + Screen::FontId of = _screen->setFont(Screen::FID_9_FNT); _screen->fprintString("%s", 295, 182, _flags.use16ColorMode ? 0xbb : 172, 0, 5, getLangString(0x4033)); + _screen->setFont(of); _screen->setCurPage(cp); } diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 1b9e105d17..43299b47b9 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -1134,7 +1134,8 @@ int Screen::getFontWidth() const { int Screen::getCharWidth(uint16 c) const { if (isSJISChar(c)) - return _fonts[FID_SJIS_FNT]->getCharWidth(c) + _charWidth; + // _charWidth does not apply to sjis (rom) fonts + return _fonts[FID_SJIS_FNT]->getCharWidth(c); else return _fonts[_currentFont]->getCharWidth(c) + _charWidth; } @@ -1167,9 +1168,9 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2 cmap[1] = color1; setTextColor(cmap, 0, 1); - FontId oldFont = FID_NUM; + /*FontId oldFont = FID_NUM; if (requiresSJISFont(str)) - oldFont = setFont(FID_SJIS_FNT); + oldFont = setFont(FID_SJIS_FNT);*/ const uint8 charHeightFnt = getFontHeight(); @@ -1206,8 +1207,8 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2 } } - if (oldFont != FID_NUM) - setFont(oldFont); + /*if (oldFont != FID_NUM) + setFont(oldFont);*/ } bool Screen::isSJISChar(uint16 c) const { @@ -1235,7 +1236,7 @@ bool Screen::requiresSJISFont(const char *s) const { } uint16 Screen::fetchChar(const char *&s) const { - if (!_useSJIS) + if (_currentFont != FID_SJIS_FNT) return (uint8)*s++; uint16 ch = (uint8)*s++; @@ -3333,6 +3334,7 @@ SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Co : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color) { assert(_font); _font->enableOutline(!is16Color); + _font->toggleCharSize(is16Color); } void SJISFont::unload() { diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index d988ae857a..ca26695c47 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -162,7 +162,7 @@ void Screen_LoL::drawShadedBox(int x1, int y1, int x2, int y2, int color1, int c drawClippedLine(x1, y2, x2, y2, color2); if (_use16ColorMode && color1 > color2) - drawBox(x1, y1, x2, y2, 0); + drawBox(x1, y1, x2, y2, 0x44); showMouse(); } diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp index 8121335879..9b3e5afcf1 100644 --- a/engines/kyra/script_hof.cpp +++ b/engines/kyra/script_hof.cpp @@ -152,7 +152,7 @@ int KyraEngine_HoF::o2_meanWhileScene(EMCState *script) { _screen->setScreenPalette(_screen->getPalette(2)); _screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0); if (!scumm_stricmp(cpsfile, "_MEANWIL.CPS") && _flags.lang == Common::JA_JPN) { - Screen::FontId o = _screen->setFont(Screen::FID_6_FNT); + Screen::FontId o = _screen->setFont(Screen::FID_SJIS_FNT); _screen->printText((const char *)jpSubtitle, 140, 176, 255, 132); _screen->setFont(o); } diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp index 848eb238e8..6c26e02d53 100644 --- a/engines/kyra/script_lok.cpp +++ b/engines/kyra/script_lok.cpp @@ -1029,7 +1029,7 @@ int KyraEngine_LoK::o1_specialEventDisplayBrynnsNote(EMCState *script) { _screen->updateScreen(); _screen->showMouse(); - if (_flags.platform != Common::kPlatformAmiga && !_flags.isTalkie) + if (_flags.platform != Common::kPlatformAmiga && !_flags.isTalkie && _flags.lang != Common::JA_JPN) _screen->setFont(Screen::FID_6_FNT); return 0; } @@ -1042,7 +1042,7 @@ int KyraEngine_LoK::o1_specialEventRemoveBrynnsNote(EMCState *script) { _screen->updateScreen(); _screen->showMouse(); - if (_flags.platform != Common::kPlatformAmiga && !_flags.isTalkie) + if (_flags.platform != Common::kPlatformAmiga && !_flags.isTalkie && _flags.lang != Common::JA_JPN) _screen->setFont(Screen::FID_8_FNT); return 0; } diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index cbca497c70..175cada45d 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -320,7 +320,7 @@ void TIMInterpreter::displayText(uint16 textId, int16 flags) { if (flags < 0) { static const uint8 colorMap[] = { 0x00, 0xF0, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - _screen->setFont(Screen::FID_8_FNT); + _screen->setFont(isPC98 ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT); _screen->setTextColorMap(colorMap); _screen->_charWidth = -2; } @@ -369,7 +369,7 @@ void TIMInterpreter::displayText(uint16 textId, int16 flags) { if (flags < 0) { static const uint8 colorMap[] = { 0x00, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0x00, 0x00, 0x00, 0x00 }; - _screen->setFont(Screen::FID_INTRO_FNT); + _screen->setFont(isPC98 ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT); _screen->setTextColorMap(colorMap); _screen->_charWidth = 0; } @@ -387,7 +387,7 @@ void TIMInterpreter::displayText(uint16 textId, int16 flags, uint8 color) { if (flags == 255) return; - _screen->setFont(Screen::FID_INTRO_FNT); + _screen->setFont(_vm->gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT); static const uint8 colorMap[] = { 0x00, 0xA0, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; _screen->setTextColorMap(colorMap); diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp index d045af13f9..8bf2c1d7f5 100644 --- a/engines/kyra/sequences_hof.cpp +++ b/engines/kyra/sequences_hof.cpp @@ -107,7 +107,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) { if (cseq.flags & 4) { int cp = _screen->setCurPage(2); - Screen::FontId cf = _screen->setFont(Screen::FID_GOLDFONT_FNT); + Screen::FontId cf = _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_GOLDFONT_FNT); if (cseq.stringIndex1 != -1) { int sX = (320 - _screen->getTextWidth(_sequenceStrings[cseq.stringIndex1])) / 2; _screen->printText(_sequenceStrings[cseq.stringIndex1], sX, 100 - _screen->getFontHeight(), 1, 0); @@ -1987,7 +1987,6 @@ void KyraEngine_HoF::seq_processWSAs() { } void KyraEngine_HoF::seq_processText() { - Screen::FontId curFont = _screen->setFont(Screen::FID_GOLDFONT_FNT); int curPage = _screen->setCurPage(2); char outputStr[70]; @@ -2019,7 +2018,6 @@ void KyraEngine_HoF::seq_processText() { } _screen->setCurPage(curPage); - _screen->setFont(curFont); } char *KyraEngine_HoF::seq_preprocessString(const char *srcStr, int width) { @@ -2417,6 +2415,8 @@ void KyraEngine_HoF::seq_printCreditsString(uint16 strIndex, int x, int y, const if (skipFlag() || shouldQuit() || _abortIntroFlag || _menuChoice) return; + Screen::FontId of = _screen->setFont(Screen::FID_8_FNT); + memset(&_screen->getPalette(0)[0x2fa], 0x3f, 6); _screen->getPalette(0)[0x2f6] = 0x3f; _screen->getPalette(0)[0x2f5] = 0x20; @@ -2451,6 +2451,8 @@ void KyraEngine_HoF::seq_printCreditsString(uint16 strIndex, int x, int y, const seq_resetAllTextEntries(); _seqTextColor[0] = seqTextColor0; + + _screen->setFont(of); } void KyraEngine_HoF::seq_playWsaSyncDialogue(uint16 strIndex, uint16 vocIndex, int textColor, int x, int y, int width, WSAMovie_v2 *wsa, int firstframe, int lastframe, int wsaXpos, int wsaYpos) { @@ -2774,6 +2776,8 @@ void KyraEngine_HoF::seq_init() { int numShp = -1; + _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_GOLDFONT_FNT); + if (_flags.gameID == GI_LOL) return; @@ -2790,14 +2794,21 @@ void KyraEngine_HoF::seq_init() { addShapeToPool(_screen->getPtrToShape(_animShapeFiledata, numShp), numShp); } while (getShapePtr(numShp)); } else { - MainMenu::StaticData data = { + MainMenu::StaticData dataEN = { { _sequenceStrings[97], _sequenceStrings[96], _sequenceStrings[95], _sequenceStrings[98], 0 }, { 0x01, 0x04, 0x0C, 0x04, 0x00, 0xd7, 0xd6 }, { 0xd8, 0xda, 0xd9, 0xd8 }, Screen::FID_8_FNT, 240 }; + + MainMenu::StaticData dataJPN = { + { _sequenceStrings[97], _sequenceStrings[96], _sequenceStrings[95], _sequenceStrings[98], 0 }, + { 0x01, 0x04, 0x0C, 0x04, 0x00, 0xd7, 0xd6 }, + { 0xd8, 0xda, 0xd9, 0xd8 }, + Screen::FID_SJIS_FNT, 240 + }; _menu = new MainMenu(this); - _menu->init(data, MainMenu::Animation()); + _menu->init(_flags.lang == Common::JA_JPN ? dataJPN : dataEN, MainMenu::Animation()); } } @@ -2822,6 +2833,7 @@ void KyraEngine_HoF::seq_uninit() { delete _menu; _menu = 0; + _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT); } #pragma mark - diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp index 66e32006b5..3c60bea684 100644 --- a/engines/kyra/sequences_lok.cpp +++ b/engines/kyra/sequences_lok.cpp @@ -109,7 +109,7 @@ void KyraEngine_LoK::seq_intro() { } _seq->setCopyViewOffs(true); - _screen->setFont(Screen::FID_8_FNT); + _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT); if (_flags.platform != Common::kPlatformFMTowns && _flags.platform != Common::kPlatformPC98 && _flags.platform != Common::kPlatformAmiga) snd_playTheme(0, 2); _text->setTalkCoords(144); @@ -164,6 +164,7 @@ void KyraEngine_LoK::seq_introLogos() { _screen->clearPage(0); return; } + delay(60 * _tickLength); if (_flags.platform == Common::kPlatformAmiga) { @@ -171,11 +172,14 @@ void KyraEngine_LoK::seq_introLogos() { _screen->setScreenPalette(_screen->getPalette(0)); } + Screen::FontId of = _screen->setFont(Screen::FID_8_FNT); + if ((_seq->playSequence(_seq_KyrandiaLogo, skipFlag()) && !seq_skipSequence()) || shouldQuit()) { _screen->fadeToBlack(); _screen->clearPage(0); return; } + _screen->setFont(of); _screen->fillRect(0, 179, 319, 199, 0); if (shouldQuit()) diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp index 2edfb5dcda..c2cc27dbd4 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/sequences_lol.cpp @@ -64,7 +64,7 @@ int LoLEngine::processPrologue() { // Original version: (260|193) "V CD1.02 D" const int width = _screen->getTextWidth(gScummVMVersion); _screen->fprintString("SVM %s", 300 - width, 193, 0x67, 0x00, 0x04, gScummVMVersion); - _screen->setFont(Screen::FID_9_FNT); + _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); _screen->fadePalette(_screen->getPalette(0), 0x1E); _screen->updateScreen(); @@ -216,7 +216,7 @@ void LoLEngine::showIntro() { _screen->loadFont(Screen::FID_8_FNT, "NEW8P.FNT"); _screen->loadFont(Screen::FID_INTRO_FNT, "INTRO.FNT"); - _screen->setFont(Screen::FID_8_FNT); + _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT); _tim->resetFinishedFlag(); _tim->setLangData("LOLINTRO.DIP"); @@ -286,7 +286,7 @@ int LoLEngine::chooseCharacter() { _chargenWSA->displayFrame(0, 2, 113, 0, 0, 0, 0); - _screen->setFont(Screen::FID_9_FNT); + _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); _screen->_curPage = 2; if (_flags.platform == Common::kPlatformPC98) { diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 99728129ed..45d3d2e143 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -2794,7 +2794,7 @@ void GUI_HoF::initStaticData() { GUI_V2_MENU_ITEM(_gameOptions.item[1], 0, 0x2C, 0xA0, 0x2F, 0x74, 0x0F, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0x20, 0x10, 0x31, 0); GUI_V2_MENU_ITEM(_gameOptions.item[2], 0, 0x2D, 0xA0, 0x40, 0x74, 0x0F, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0x1D, 0x10, 0x42, 0); GUI_V2_MENU_ITEM(_gameOptions.item[3], 0, 0x2E, 0xA0, 0x51, 0x74, 0x0F, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0x1E, 0x10, 0x53, 0); - GUI_V2_MENU_ITEM(_gameOptions.item[4], 1, 0x18, 0xA0, 0x6E, 0x6C, 0x0F, 0xFC, 0xFD, 5, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); + GUI_V2_MENU_ITEM(_gameOptions.item[4], 1, 0x18, -1, 0x6E, 0x6C, 0x0F, 0xFC, 0xFD, -1, 0xF8, 0xF9, 0xFA, -1, 0, 0, 0, 0); _gameOptions.item[4].callback = clickQuitOptionsFunctor; } diff --git a/engines/kyra/text.cpp b/engines/kyra/text.cpp index 0ac75ddf0a..1290d7f66d 100644 --- a/engines/kyra/text.cpp +++ b/engines/kyra/text.cpp @@ -50,9 +50,7 @@ void TextDisplayer::setTalkCoords(uint16 y) { int TextDisplayer::getCenterStringX(const char *str, int x1, int x2) { _screen->_charWidth = -2; - Screen::FontId curFont = _screen->setFont(Screen::FID_8_FNT); int strWidth = _screen->getTextWidth(str); - _screen->setFont(curFont); _screen->_charWidth = 0; int w = x2 - x1 + 1; return x1 + (w - strWidth) / 2; @@ -62,7 +60,6 @@ int TextDisplayer::getCharLength(const char *str, int len) { int charsCount = 0; if (*str) { _screen->_charWidth = -2; - Screen::FontId curFont = _screen->setFont(Screen::FID_8_FNT); int i = 0; while (i <= len && *str) { uint c = *str++; @@ -74,7 +71,6 @@ int TextDisplayer::getCharLength(const char *str, int len) { i += _screen->getCharWidth(c); ++charsCount; } - _screen->setFont(curFont); _screen->_charWidth = 0; } return charsCount; @@ -214,15 +210,13 @@ void TextDisplayer::printTalkTextMessage(const char *text, int x, int y, uint8 c _talkMessagePrinted = true; } -void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font) { +void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) { uint8 colorMap[] = { 0, 15, 12, 12 }; colorMap[3] = c1; _screen->setTextColor(colorMap, 0, 3); - Screen::FontId curFont = _screen->setFont(font); _screen->_charWidth = -2; _screen->printText(str, x, y, c0, c2); _screen->_charWidth = 0; - _screen->setFont(curFont); } void TextDisplayer::printCharacterText(const char *text, int8 charNum, int charX) { diff --git a/engines/kyra/text.h b/engines/kyra/text.h index bf346f8e3e..c53f2d1d2f 100644 --- a/engines/kyra/text.h +++ b/engines/kyra/text.h @@ -50,12 +50,13 @@ public: virtual void calcWidestLineBounds(int &x1, int &x2, int w, int cx); virtual void restoreTalkTextMessageBkgd(int srcPage, int dstPage); void printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage); - virtual void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font=Screen::FID_8_FNT); + virtual void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2); void printCharacterText(const char *text, int8 charNum, int charX); uint16 _talkMessageY; uint16 _talkMessageH; bool printed() const { return _talkMessagePrinted; } + protected: Screen *_screen; KyraEngine_v1 *_vm; diff --git a/engines/kyra/text_mr.cpp b/engines/kyra/text_mr.cpp index b2c4517c73..57b1d83137 100644 --- a/engines/kyra/text_mr.cpp +++ b/engines/kyra/text_mr.cpp @@ -127,7 +127,7 @@ int TextDisplayer_MR::dropCRIntoString(char *str, int minOffs, int maxOffs) { return 0; } -void TextDisplayer_MR::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font) { +void TextDisplayer_MR::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) { if (_vm->_albumChatActive) { c0 = 0xEE; c1 = 0xE3; @@ -137,11 +137,9 @@ void TextDisplayer_MR::printText(const char *str, int x, int y, uint8 c0, uint8 uint8 colorMap[] = { 0, 255, 240, 240 }; colorMap[3] = c1; _screen->setTextColor(colorMap, 0, 3); - Screen::FontId curFont = _screen->setFont(font); _screen->_charWidth = -2; _screen->printText(str, x, y, c0, c2); _screen->_charWidth = 0; - _screen->setFont(curFont); } void TextDisplayer_MR::restoreScreen() { diff --git a/engines/kyra/text_mr.h b/engines/kyra/text_mr.h index 8c559e067a..5803bd0c31 100644 --- a/engines/kyra/text_mr.h +++ b/engines/kyra/text_mr.h @@ -40,7 +40,7 @@ public: char *preprocessString(const char *str); int dropCRIntoString(char *str, int minOffs, int maxOffs); - void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2, Screen::FontId font=Screen::FID_8_FNT); + void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2); void restoreScreen(); diff --git a/graphics/sjis.h b/graphics/sjis.h index 14a5187914..87882e2fae 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -72,13 +72,20 @@ public: /** * Enable outline drawing. - * - * After changing outline state, getFontHeight and getMaxFontWidth / getCharWidth might return - * different values! */ virtual void enableOutline(bool enable) {} /** + * Toggle values returned by getFontHeight and getMaxFontWidth / getCharWidth. + * These methods have to return different values when emulating PC-98 text mode. + * We cannot simply match this with enableOutline(), since there are situations + * where outlines get disabled in graphic mode, too. In these admittedly rare + * cases (Kyra 1: Brynn's note, Kyra 2: spell book) the values returned by + * getFontHeight and getMaxFontWidth / getCharWidth have to remain the same. + */ + virtual void toggleCharSize(bool textMode) {} + + /** * Returns the height of the font. */ virtual uint getFontHeight() const = 0; @@ -122,12 +129,13 @@ public: */ class FontSJIS16x16 : public FontSJIS { public: - FontSJIS16x16() : _outlineEnabled(false) {} + FontSJIS16x16() : _outlineEnabled(false), _pc98TextModeCharSize(false) {} void enableOutline(bool enable) { _outlineEnabled = enable; } + void toggleCharSize(bool textMode) { _pc98TextModeCharSize = textMode; } - uint getFontHeight() const { return _outlineEnabled ? 18 : 16; } - uint getMaxFontWidth() const { return _outlineEnabled ? 18 : 16; } + uint getFontHeight() const { return _pc98TextModeCharSize ? 16 : 18; } + uint getMaxFontWidth() const { return _pc98TextModeCharSize ? 16 : 18; } virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const; @@ -140,6 +148,7 @@ private: protected: bool _outlineEnabled; + bool _pc98TextModeCharSize; virtual const uint16 *getCharData(uint16 c) const = 0; }; |