diff --git a/engines/kyra/engine/kyra_rpg.cpp b/engines/kyra/engine/kyra_rpg.cpp index a2f0460a45e..35cdfa27a3e 100644 --- a/engines/kyra/engine/kyra_rpg.cpp +++ b/engines/kyra/engine/kyra_rpg.cpp @@ -124,6 +124,12 @@ KyraRpgEngine::KyraRpgEngine(OSystem *system, const GameFlags &flags) : KyraEngi _environmentSfx = _environmentSfxVol = _envSfxDistThreshold = 0; _monsterStepCounter = _monsterStepMode = 0; + + _buttonFont = Screen::FID_6_FNT; + if (_flags.use16ColorMode) + _buttonFont = _flags.gameID == GI_LOL ? Screen::FID_SJIS_TEXTMODE_FNT : Screen::FID_SJIS_FNT; + else if (_flags.gameID == GI_EOB2 && _flags.platform == Common::kPlatformFMTowns) + _buttonFont = Screen::FID_8_FNT; } KyraRpgEngine::~KyraRpgEngine() { @@ -222,7 +228,7 @@ bool KyraRpgEngine::posWithinRect(int posX, int posY, int x1, int y1, int x2, in void KyraRpgEngine::drawDialogueButtons() { int cp = screen()->setCurPage(0); - Screen::FontId of = screen()->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : ((_flags.gameID == GI_EOB2 && _flags.platform == Common::kPlatformFMTowns) ? Screen::FID_8_FNT : Screen::FID_6_FNT)); + Screen::FontId of = screen()->setFont(_buttonFont); for (int i = 0; i < _dialogueNumButtons; i++) { int x = _dialogueButtonPosX[i]; diff --git a/engines/kyra/engine/kyra_rpg.h b/engines/kyra/engine/kyra_rpg.h index af1d27f9938..81b5645461d 100644 --- a/engines/kyra/engine/kyra_rpg.h +++ b/engines/kyra/engine/kyra_rpg.h @@ -368,6 +368,7 @@ protected: bool _dialogueField; bool _dialogueFieldAmiga; + Screen::FontId _buttonFont; const char *_dialogueButtonString[9]; const uint16 *_dialogueButtonPosX; diff --git a/engines/kyra/engine/lol.cpp b/engines/kyra/engine/lol.cpp index c80d7fe6f4c..bd79941299b 100644 --- a/engines/kyra/engine/lol.cpp +++ b/engines/kyra/engine/lol.cpp @@ -524,7 +524,7 @@ Common::Error LoLEngine::go() { // the prologue code we need to setup them manually here. if (_gameToLoad != -1 && action != 3) { preInit(); - _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); + _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_TEXTMODE_FNT : Screen::FID_9_FNT); } // We have three sound.dat files, one for the intro, one for the @@ -695,7 +695,7 @@ int LoLEngine::mainMenu() { { 0, 0, 0, 0, 0 }, { 0x01, 0x04, 0x0C, 0x04, 0x00, 0xC1, 0xE1 }, { 0xCC, 0xDD, 0xDD, 0xDD }, - Screen::FID_SJIS_FNT, 1 + Screen::FID_SJIS_TEXTMODE_FNT, 1 } }; @@ -4191,7 +4191,7 @@ void LoLEngine::drawMapPage(int pageNum) { _screen->copyRegion(236, 16, 236 + xOffset, 16, -xOffset, 1, pageNum, pageNum, Screen::CR_NO_P_CHECK); int cp = _screen->setCurPage(pageNum); - Screen::FontId of = _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); + Screen::FontId of = _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_TEXTMODE_FNT : Screen::FID_9_FNT); _screen->printText(getLangString(_autoMapStrings[_currentMapLevel]), 236 + xOffset, 8, 1, 0); uint16 blX = mapGetStartPosX(); uint16 bl = (mapGetStartPosY() << 5) + blX; @@ -4251,7 +4251,7 @@ void LoLEngine::drawMapPage(int pageNum) { _screen->setFont(of); _screen->setCurPage(cp); - of = _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT); + of = _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_TEXTMODE_FNT : Screen::FID_6_FNT); int tY = 0; sx = mapGetStartPosX(); diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp index 3bcbf3967eb..e21344948f8 100644 --- a/engines/kyra/graphics/screen.cpp +++ b/engines/kyra/graphics/screen.cpp @@ -65,6 +65,7 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, co _4bitPixelPacking = false; _currentFont = FID_8_FNT; + _currentFontType = FTYPE_ASCII; _paletteChanged = true; _curDim = 0; } @@ -160,12 +161,21 @@ bool Screen::init() { } if (_useSJIS) { - Graphics::FontSJIS *font = Graphics::FontSJIS::createFont(_vm->gameFlags().platform); + Common::SharedPtr font(Graphics::FontSJIS::createFont(_vm->gameFlags().platform)); - if (!font) + if (!font.get()) error("Could not load any SJIS font, neither the original nor ScummVM's 'SJIS.FNT'"); - _fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, _use16ColorMode, !_use16ColorMode && _vm->game() != GI_LOL && _vm->game() != GI_EOB2, _vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns, !_use16ColorMode && _vm->game() == GI_LOL ? 1 : 0); + if (_use16ColorMode) { + _fonts[FID_SJIS_TEXTMODE_FNT] = new SJISFont(font, _sjisInvisibleColor, true, false, _vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns, 0); + if (_vm->game() == GI_EOB1) + _fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, false, false, _vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns, 0); + } else { + _fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, false, _vm->game() != GI_LOL && _vm->game() != GI_EOB2, _vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns, _vm->game() == GI_LOL ? 1 : 0); + } + + if (_vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns) + _fonts[FID_SJIS_LARGE_FNT] = new SJISFontLarge(font); } } @@ -1397,6 +1407,7 @@ bool Screen::loadFont(FontId fontId, const char *filename) { Screen::FontId Screen::setFont(FontId fontId) { FontId prev = _currentFont; _currentFont = fontId; + _currentFontType = _currentFont >= FID_SJIS_FNT ? FTYPE_SJIS : FTYPE_ASCII; assert(_fonts[_currentFont]); return prev; @@ -1420,9 +1431,10 @@ int Screen::getTextWidth(const char *str) { int maxLineLen = 0; FontId curFont = _currentFont; + FontType curType = _currentFontType; while (1) { - if (_sjisMixedFontMode && curFont != FID_SJIS_FNT && curFont != FID_SJIS_LARGE_FNT && curFont != FID_SJIS_SMALL_FNT) + if (_sjisMixedFontMode && curType == FTYPE_ASCII) setFont((*str & 0x80) ? ((_vm->game() == GI_EOB2 && curFont == FID_6_FNT) ? FID_SJIS_SMALL_FNT : FID_SJIS_FNT) : curFont); uint c = fetchChar(str); @@ -1456,6 +1468,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2 setTextColor(cmap8, 0, 1); FontId curFont = _currentFont; + FontType curType = _currentFontType; if (x < 0) x = 0; @@ -1469,7 +1482,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2 return; while (1) { - if (_sjisMixedFontMode && curFont != FID_SJIS_FNT && curFont != FID_SJIS_LARGE_FNT && curFont != FID_SJIS_SMALL_FNT) + if (_sjisMixedFontMode && curType == FTYPE_ASCII) setFont((*str & 0x80) ? ((_vm->game() == GI_EOB2 && curFont == FID_6_FNT) ? FID_SJIS_SMALL_FNT : FID_SJIS_FNT) : curFont); uint8 charHeightFnt = getFontHeight(); @@ -1497,7 +1510,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2 } uint16 Screen::fetchChar(const char *&s) const { - if (_currentFont != FID_SJIS_FNT && _currentFont != FID_SJIS_LARGE_FNT && _currentFont != FID_SJIS_SMALL_FNT) + if (_currentFontType == FTYPE_ASCII) return (uint8)*s++; uint16 ch = (uint8)*s++; @@ -1529,7 +1542,7 @@ void Screen::drawChar(uint16 c, int x, int y) { return; } - int bpp = (_currentFont == Screen::FID_SJIS_FNT || _currentFont == Screen::FID_SJIS_SMALL_FNT) ? 1 : 2; + int bpp = (_currentFont == Screen::FID_SJIS_LARGE_FNT) ? 2 : 1; destPage += (y * 2) * 640 * bpp + (x * 2 * bpp); fnt->drawChar(c, destPage, 640, bpp); @@ -3770,21 +3783,14 @@ void AMIGAFont::unload() { memset(_chars, 0, sizeof(_chars)); } -SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool drawOutline, bool fatPrint, int extraSpacing) - : _colorMap(0), _font(font), _invisColor(invisColor), _isTextMode(is16Color), _drawOutline(drawOutline), _sjisWidthOffset(extraSpacing) { +SJISFont::SJISFont(Common::SharedPtr &font, const uint8 invisColor, bool is16Color, bool drawOutline, bool fatPrint, int extraSpacing) + : _colorMap(0), _font(font), _invisColor(invisColor), _isTextMode(is16Color), _drawOutline(drawOutline), _fatPrint(fatPrint), _sjisWidthOffset(extraSpacing) { assert(_font); - _font->setDrawingMode(_drawOutline ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode); - _font->toggleFatPrint(fatPrint); _sjisWidth = _font->getMaxFontWidth() >> 1; _fontHeight = _font->getFontHeight() >> 1; _asciiWidth = _font->getCharWidth('a') >> 1; } -void SJISFont::unload() { - delete _font; - _font = 0; -} - int SJISFont::getHeight() const { return _fontHeight; } @@ -3802,13 +3808,6 @@ int SJISFont::getCharWidth(uint16 c) const { void SJISFont::setColorMap(const uint8 *src) { _colorMap = src; - - if (!_isTextMode) { - if (_colorMap[0] == _invisColor) - _font->setDrawingMode(Graphics::FontSJIS::kDefaultMode); - else - _font->setDrawingMode(_drawOutline ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode); - } } void SJISFont::drawChar(uint16 c, byte *dst, int pitch, int) const { @@ -3824,6 +3823,12 @@ void SJISFont::drawChar(uint16 c, byte *dst, int pitch, int) const { color2 = _colorMap[0]; } + if (!_isTextMode && _colorMap[0] == _invisColor) + _font->setDrawingMode(Graphics::FontSJIS::kDefaultMode); + else + _font->setDrawingMode(_drawOutline ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode); + + _font->toggleFatPrint(_fatPrint); _font->drawChar(dst, c, 640, 1, color1, color2, 640, 400); } diff --git a/engines/kyra/graphics/screen.h b/engines/kyra/graphics/screen.h index c1a1cfefa52..d9d28317264 100644 --- a/engines/kyra/graphics/screen.h +++ b/engines/kyra/graphics/screen.h @@ -290,8 +290,8 @@ private: */ class SJISFont : public Font { public: - SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool drawOutline, bool fatPrint, int extraSpacing); - virtual ~SJISFont() { unload(); } + SJISFont(Common::SharedPtr &font, const uint8 invisColor, bool is16Color, bool drawOutline, bool fatPrint, int extraSpacing); + virtual ~SJISFont() {} virtual bool usesOverlay() const { return true; } @@ -303,13 +303,12 @@ public: virtual void drawChar(uint16 c, byte *dst, int pitch, int) const; protected: - void unload(); - const uint8 *_colorMap; - Graphics::FontSJIS *_font; + Common::SharedPtr _font; int _sjisWidth, _asciiWidth; int _fontHeight; const bool _drawOutline; + const bool _fatPrint; private: const uint8 _invisColor; @@ -485,11 +484,17 @@ public: FID_GOLDFONT_FNT, FID_INTRO_FNT, FID_SJIS_FNT, + FID_SJIS_TEXTMODE_FNT, FID_SJIS_LARGE_FNT, FID_SJIS_SMALL_FNT, FID_NUM }; + enum FontType { + FTYPE_ASCII = 0, + FTYPE_SJIS + }; + Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, const int dimTableSize); virtual ~Screen(); @@ -629,6 +634,7 @@ public: uint8 *_shapePages[2]; int _maskMinY, _maskMaxY; FontId _currentFont; + FontType _currentFontType; // decoding functions static void decodeFrame1(const uint8 *src, uint8 *dst, uint32 size); diff --git a/engines/kyra/graphics/screen_eob.cpp b/engines/kyra/graphics/screen_eob.cpp index ad967fe5ed5..e25ad3860c6 100644 --- a/engines/kyra/graphics/screen_eob.cpp +++ b/engines/kyra/graphics/screen_eob.cpp @@ -92,13 +92,7 @@ bool Screen_EoB::init() { if (_vm->gameFlags().platform == Common::kPlatformFMTowns) { _shpBuffer = new uint8[SCREEN_H * SCREEN_W]; _convertHiColorBuffer = new uint8[SCREEN_H * SCREEN_W]; - enableHiColorMode(true); - - Graphics::FontSJIS *font = Graphics::FontSJIS::createFont(Common::kPlatformFMTowns); - if (!font) - error("Could not load any SJIS font, neither the original nor ScummVM's 'SJIS.FNT'"); - _fonts[FID_SJIS_LARGE_FNT] = new SJISFontLarge(font); - + enableHiColorMode(true); loadFont(FID_SJIS_SMALL_FNT, "FONT.DMP"); } @@ -2519,13 +2513,15 @@ void AmigaDOSFont::selectMode(int mode) { _last = _content[mode].data->lastChar; } -SJISFontLarge::SJISFontLarge(Graphics::FontSJIS *font) : SJISFont(font, 0, false, false, false, 0) { +SJISFontLarge::SJISFontLarge(Common::SharedPtr &font) : SJISFont(font, 0, false, false, false, 0) { _sjisWidth = _font->getMaxFontWidth(); _fontHeight = _font->getFontHeight(); _asciiWidth = _font->getCharWidth('a'); } void SJISFontLarge::drawChar(uint16 c, byte *dst, int pitch, int) const { + _font->setDrawingMode(Graphics::FontSJIS::kDefaultMode); + _font->toggleFatPrint(false); _font->drawChar(dst, c, 320, 1, _colorMap[1], _colorMap[0], 320, 200); } diff --git a/engines/kyra/graphics/screen_eob.h b/engines/kyra/graphics/screen_eob.h index b457ba2c834..4f9161af92b 100644 --- a/engines/kyra/graphics/screen_eob.h +++ b/engines/kyra/graphics/screen_eob.h @@ -162,8 +162,8 @@ private: */ class SJISFontLarge : public SJISFont { public: - SJISFontLarge(Graphics::FontSJIS *font); - virtual ~SJISFontLarge() { unload(); } + SJISFontLarge(Common::SharedPtr &font); + virtual ~SJISFontLarge() {} virtual bool usesOverlay() const { return false; } virtual void drawChar(uint16 c, byte *dst, int pitch, int) const; diff --git a/engines/kyra/gui/gui_lol.cpp b/engines/kyra/gui/gui_lol.cpp index dd3f8a32d6a..3776c8382ee 100644 --- a/engines/kyra/gui/gui_lol.cpp +++ b/engines/kyra/gui/gui_lol.cpp @@ -274,7 +274,7 @@ void LoLEngine::gui_printCharacterStats(int index, int redraw, int value) { if (offs) _screen->copyRegion(294, y, 182 + offs, y, 18, 8, 6, _screen->_curPage, Screen::CR_NO_P_CHECK); - Screen::FontId of = (_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? _screen->setFont(Screen::FID_SJIS_FNT) : _screen->_currentFont; + Screen::FontId of = (_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? _screen->setFont(Screen::FID_SJIS_TEXTMODE_FNT) : _screen->_currentFont; _screen->fprintString("%d", 200 + offs, y, col, 0, _flags.use16ColorMode ? 2 : 6, value); _screen->setFont(of); } diff --git a/engines/kyra/script/script_tim.cpp b/engines/kyra/script/script_tim.cpp index 7afa35c3393..11fe9666fa7 100644 --- a/engines/kyra/script/script_tim.cpp +++ b/engines/kyra/script/script_tim.cpp @@ -310,7 +310,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(sjisMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT); + _screen->setFont(sjisMode ? Screen::FID_SJIS_TEXTMODE_FNT : Screen::FID_8_FNT); _screen->setTextColorMap(colorMap); _screen->_charWidth = -2; } @@ -359,7 +359,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(sjisMode ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT); + _screen->setFont(sjisMode ? Screen::FID_SJIS_TEXTMODE_FNT : Screen::FID_INTRO_FNT); _screen->setTextColorMap(colorMap); _screen->_charWidth = 0; } @@ -377,7 +377,7 @@ void TIMInterpreter::displayText(uint16 textId, int16 flags, uint8 color) { if (flags == 255) return; - _screen->setFont((_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT); + _screen->setFont((_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode) ? Screen::FID_SJIS_TEXTMODE_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/sequence/sequences_eob.cpp b/engines/kyra/sequence/sequences_eob.cpp index d8d4ecb1778..cf9671e6e80 100644 --- a/engines/kyra/sequence/sequences_eob.cpp +++ b/engines/kyra/sequence/sequences_eob.cpp @@ -1092,6 +1092,7 @@ void EoBIntroPlayer::printSubtitle(const char *str, int textmodeX, int textmodeY if (!str) return; + Screen::FontId of = _screen->setFont(Screen::FID_SJIS_TEXTMODE_FNT); int cp = _screen->setCurPage(0); for (int i = 0; str[i]; ) { @@ -1129,6 +1130,7 @@ void EoBIntroPlayer::printSubtitle(const char *str, int textmodeX, int textmodeY if (mode == 2) _screen->updateScreen(); + _screen->setFont(of); _screen->setCurPage(cp); } @@ -1591,7 +1593,7 @@ int EoBEngine::mainMenu() { _sound->selectAudioResourceSet(kMusicIntro); _sound->loadSoundFile(0); _screen->hideMouse(); - + seq_playIntro(kOnlyIntro); _screen->showMouse(); diff --git a/engines/kyra/sequence/sequences_lol.cpp b/engines/kyra/sequence/sequences_lol.cpp index 55c0eb14932..40c16c400d3 100644 --- a/engines/kyra/sequence/sequences_lol.cpp +++ b/engines/kyra/sequence/sequences_lol.cpp @@ -72,7 +72,7 @@ int LoLEngine::processPrologue() { // Original version: (260|193) "V CD1.02 D" const int width = _screen->getTextWidth(versionString.c_str()); _screen->fprintString("%s", 320 - width, 193, 0x67, 0x00, 0x04, versionString.c_str()); - _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); + _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_TEXTMODE_FNT : Screen::FID_9_FNT); _screen->fadePalette(_screen->getPalette(0), 0x1E); _screen->updateScreen(); @@ -300,7 +300,7 @@ int LoLEngine::chooseCharacter() { _chargenWSA->displayFrame(0, 2, 113, 0, 0, 0, 0); - _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); + _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_TEXTMODE_FNT : Screen::FID_9_FNT); _screen->_curPage = 2; if (_flags.platform == Common::kPlatformPC98 && _flags.use16ColorMode) { @@ -317,7 +317,7 @@ int LoLEngine::chooseCharacter() { for (int i = 0; i < 4; ++i) { _screen->printText(_charNamesJapanese[i], _charPosXPC98[i], 168, 0xC1, 0x00); - Screen::FontId old = _screen->setFont(Screen::FID_SJIS_FNT); + Screen::FontId old = _screen->setFont(Screen::FID_SJIS_TEXTMODE_FNT); for (int j = 0; j < 3; ++j) { Common::String attribString = Common::String::format("%2d", _charPreviews[i].attrib[j]); _screen->printText(attribString.c_str(), _charPosXPC98[i] + 16, 176 + j * 8, 0x81, 0x00); diff --git a/engines/kyra/text/text_lol.cpp b/engines/kyra/text/text_lol.cpp index 7c724e3b8e1..67d59e788f6 100644 --- a/engines/kyra/text/text_lol.cpp +++ b/engines/kyra/text/text_lol.cpp @@ -160,7 +160,7 @@ void TextDisplayer_LoL::printDialogueText(int dim, char *str, EMCState *script, } int cp = _screen->setCurPage(0); - Screen::FontId of = _screen->setFont((_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); + Screen::FontId of = _screen->setFont(_pc98TextMode ? Screen::FID_SJIS_TEXTMODE_FNT : Screen::FID_9_FNT); preprocessString(str, script, paramList, paramIndex); _numCharsTotal = strlen(_dialogueBuffer); diff --git a/engines/kyra/text/text_rpg.cpp b/engines/kyra/text/text_rpg.cpp index 7b891eea5eb..a1baa976a4e 100644 --- a/engines/kyra/text/text_rpg.cpp +++ b/engines/kyra/text/text_rpg.cpp @@ -35,7 +35,8 @@ enum { TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen *scr) : _vm(engine), _screen(scr), _lineCount(0), _printFlag(false), _lineWidth(0), _numCharsTotal(0), _allowPageBreak(true), - _numCharsLeft(0), _numCharsPrinted(0), _sjisTextModeLineBreak(false), _waitButtonMode(1) { + _numCharsLeft(0), _numCharsPrinted(0), _sjisTextModeLineBreak(false), _waitButtonMode(1), + _pc98TextMode(engine->gameFlags().use16ColorMode && engine->game() == GI_LOL) { static const uint8 amigaColorMap[16] = { 0x00, 0x06, 0x1d, 0x1b, 0x1a, 0x17, 0x18, 0x0e, 0x19, 0x1c, 0x1c, 0x1e, 0x13, 0x0a, 0x11, 0x1f @@ -138,7 +139,7 @@ void TextDisplayer_rpg::displayText(char *str, ...) { const ScreenDim *sd = _screen->_curDim; int sdx = _screen->curDimIndex(); - bool sjisTextMode = (_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false; + bool sjisTextMode = (_pc98TextMode && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false; int sjisOffs = (sjisTextMode || _vm->game() == GI_EOB2) ? 8 : 9; Screen::FontId of = (_vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns) ? _screen->setFont(Screen::FID_8_FNT) : _screen->_currentFont; @@ -232,7 +233,7 @@ void TextDisplayer_rpg::displayText(char *str, ...) { default: if (_vm->game() == GI_EOB1 || _vm->game() == GI_LOL || (unsigned char)c > 30) { - _lineWidth += (sjisTextMode ? 4 : (_screen->_currentFont == Screen::FID_SJIS_FNT ? 9 : _screen->getCharWidth((uint8)c))); + _lineWidth += (sjisTextMode ? 4 : (_screen->_currentFont == Screen::FID_SJIS_TEXTMODE_FNT ? 9 : _screen->getCharWidth((uint8)c))); _currentLine[_numCharsLeft++] = c; _currentLine[_numCharsLeft] = 0; @@ -310,7 +311,7 @@ void TextDisplayer_rpg::printLine(char *str) { int sdx = _screen->curDimIndex(); bool sjisTextMode = _vm->gameFlags().lang == Common::JA_JPN && (_vm->gameFlags().use16ColorMode && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false; - int fh = (_screen->_currentFont == Screen::FID_SJIS_FNT) ? 9 : (_screen->getFontHeight() + _screen->_charOffset); + int fh = (_screen->_currentFont == Screen::FID_SJIS_TEXTMODE_FNT) ? 9 : (_screen->getFontHeight() + _screen->_charOffset); int lines = (sd->h - _screen->_charOffset) / fh; while (_textDimData[sdx].line >= lines) { @@ -510,7 +511,7 @@ void TextDisplayer_rpg::printLine(char *str) { str[len] = 0; _numCharsLeft = strlen(str); - _lineWidth = sjisTextMode ? (_numCharsLeft << 2) : (_screen->_currentFont == Screen::FID_SJIS_FNT ? _numCharsLeft * 9 : _screen->getTextWidth(str)); + _lineWidth = sjisTextMode ? (_numCharsLeft << 2) : (_screen->_currentFont == Screen::FID_SJIS_TEXTMODE_FNT ? _numCharsLeft * 9 : _screen->getTextWidth(str)); if (!_numCharsLeft && (_textDimData[sdx].column + twoByteCharOffs) <= (sd->w << 3)) return; @@ -598,7 +599,7 @@ void TextDisplayer_rpg::textPageBreak() { SWAP(_vm->_dialogueButtonLabelColor1, _vm->_dialogueButtonLabelColor2); int cp = _screen->setCurPage(0); - Screen::FontId cf = _screen->setFont((_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode) ? Screen::FID_SJIS_FNT : ((_vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns) ? Screen::FID_8_FNT : Screen::FID_6_FNT)); + Screen::FontId cf = _screen->setFont(_pc98TextMode ? Screen::FID_SJIS_TEXTMODE_FNT : ((_vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns) ? Screen::FID_8_FNT : Screen::FID_6_FNT)); if (_vm->game() == GI_LOL) _vm->_timer->pauseSingleTimer(11, true); diff --git a/engines/kyra/text/text_rpg.h b/engines/kyra/text/text_rpg.h index 36d5d1f24c7..68a5b51dd08 100644 --- a/engines/kyra/text/text_rpg.h +++ b/engines/kyra/text/text_rpg.h @@ -83,6 +83,7 @@ protected: bool _printFlag; bool _sjisTextModeLineBreak; + const bool _pc98TextMode; char _pageBreakString[20]; char _scriptParaString[11];