From 0b38615a431582f499f28da3b038f12e0c216c56 Mon Sep 17 00:00:00 2001 From: athrxx Date: Mon, 7 Jan 2013 19:55:14 +0100 Subject: KYRA: (LOL/FM-TOWNS) - adjust sjis font settings, spacing, etc. --- engines/kyra/gui_lol.cpp | 2 +- engines/kyra/kyra_rpg.cpp | 2 +- engines/kyra/lol.cpp | 19 ++++-- engines/kyra/screen.cpp | 30 ++++++--- engines/kyra/screen.h | 11 +++- engines/kyra/script_tim.cpp | 12 ++-- engines/kyra/sequences_lol.cpp | 8 +-- engines/kyra/text_lol.cpp | 2 +- engines/kyra/text_rpg.cpp | 142 ++++++++++++++++++++--------------------- 9 files changed, 127 insertions(+), 101 deletions(-) diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index 38478aa8d2..f7a5386574 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/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.use16ColorMode ? _screen->setFont(Screen::FID_SJIS_FNT) : _screen->_currentFont; + Screen::FontId of = (_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? _screen->setFont(Screen::FID_SJIS_FNT) : _screen->_currentFont; _screen->fprintString("%d", 200 + offs, y, col, 0, _flags.use16ColorMode ? 2 : 6, value); _screen->setFont(of); } diff --git a/engines/kyra/kyra_rpg.cpp b/engines/kyra/kyra_rpg.cpp index 13654111fa..67d27dee86 100644 --- a/engines/kyra/kyra_rpg.cpp +++ b/engines/kyra/kyra_rpg.cpp @@ -204,7 +204,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(gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT); + Screen::FontId of = screen()->setFont(gameFlags().lang == Common::JA_JPN && gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT); for (int i = 0; i < _dialogueNumButtons; i++) { int x = _dialogueButtonPosX[i]; diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp index 1906591d8c..e9faa9df8a 100644 --- a/engines/kyra/lol.cpp +++ b/engines/kyra/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.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); + _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); } // We have three sound.dat files, one for the intro, one for the @@ -683,14 +683,21 @@ int LoLEngine::mainMenu() { bool hasSave = saveFileLoadable(0); MainMenu::StaticData data[] = { - // 256 color mode + // 256 color ASCII mode { { 0, 0, 0, 0, 0 }, { 0x01, 0x04, 0x0C, 0x04, 0x00, 0x3D, 0x9F }, { 0x2C, 0x19, 0x48, 0x2C }, Screen::FID_9_FNT, 1 }, - // 16 color mode + // 256 color SJIS mode + { + { 0, 0, 0, 0, 0 }, + { 0x01, 0x04, 0x0C, 0x04, 0x00, 0x3D, 0x9F }, + { 0x2C, 0x19, 0x48, 0x2C }, + Screen::FID_9_FNT, 1 + }, + // 16 color SJIS mode { { 0, 0, 0, 0, 0 }, { 0x01, 0x04, 0x0C, 0x04, 0x00, 0xC1, 0xE1 }, @@ -699,7 +706,7 @@ int LoLEngine::mainMenu() { } }; - int dataIndex = _flags.use16ColorMode ? 1 : 0; + int dataIndex = (_flags.lang == Common::JA_JPN) ? (_flags.use16ColorMode ? 2 : 1) : 0; if (!_flags.isTalkie) --data[dataIndex].menuTable[3]; @@ -4191,7 +4198,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.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); + Screen::FontId of = _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_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 +4258,7 @@ void LoLEngine::drawMapPage(int pageNum) { _screen->setFont(of); _screen->setCurPage(cp); - of = _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT); + of = _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT); int tY = 0; sx = mapGetStartPosX(); diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 5dd7cfb25b..419b630714 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -56,6 +56,7 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, co _pageMapping[i] = i & ~1; _renderMode = Common::kRenderDefault; + _sjisMixedFontMode = false; _currentFont = FID_8_FNT; _paletteChanged = true; @@ -124,6 +125,7 @@ bool Screen::init() { if (_useOverlays) { _useSJIS = (_vm->gameFlags().lang == Common::JA_JPN); _sjisInvisibleColor = (_vm->game() == GI_KYRA1) ? 0x80 : 0xF6; + _sjisMixedFontMode = !_use16ColorMode; for (int i = 0; i < SCREEN_OVLS_NUM; ++i) { if (!_sjisOverlayPtrs[i]) { @@ -139,7 +141,7 @@ bool Screen::init() { if (!font) 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); + _fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, _use16ColorMode, !_use16ColorMode && _vm->game() != GI_LOL, _vm->game() == GI_LOL ? 1 : 0); } } @@ -1246,11 +1248,16 @@ int Screen::getCharWidth(uint16 c) const { return width + ((_currentFont != FID_SJIS_FNT) ? _charWidth : 0); } -int Screen::getTextWidth(const char *str) const { +int Screen::getTextWidth(const char *str) { int curLineLen = 0; int maxLineLen = 0; + FontId curFont = _currentFont; + while (1) { + if (_sjisMixedFontMode) + setFont(*str < 0 ? FID_SJIS_FNT : curFont); + uint c = fetchChar(str); if (c == 0) { @@ -1274,7 +1281,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2 cmap[1] = color1; setTextColor(cmap, 0, 1); - const uint8 charHeightFnt = getFontHeight(); + FontId curFont = _currentFont; if (x < 0) x = 0; @@ -1288,6 +1295,11 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2 return; while (1) { + if (_sjisMixedFontMode) + setFont(*str < 0 ? FID_SJIS_FNT : curFont); + + uint8 charHeightFnt = getFontHeight(); + uint c = fetchChar(str); if (c == 0) { @@ -3566,11 +3578,11 @@ void AMIGAFont::unload() { memset(_chars, 0, sizeof(_chars)); } -SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize) - : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color) { +SJISFont::SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool drawOutline, int extraSpacing) + : _colorMap(0), _font(font), _invisColor(invisColor), _is16Color(is16Color), _drawOutline(drawOutline), _sjisWidthOffset(extraSpacing) { assert(_font); - _font->setDrawingMode(outlineSize ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode); + _font->setDrawingMode(_drawOutline ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode); _sjisWidth = _font->getMaxFontWidth() >> 1; _fontHeight = _font->getFontHeight() >> 1; @@ -3587,14 +3599,14 @@ int SJISFont::getHeight() const { } int SJISFont::getWidth() const { - return _sjisWidth; + return _sjisWidth + _sjisWidthOffset; } int SJISFont::getCharWidth(uint16 c) const { if (c <= 0x7F || (c >= 0xA1 && c <= 0xDF)) return _asciiWidth; else - return _sjisWidth; + return _sjisWidth + _sjisWidthOffset; } void SJISFont::setColorMap(const uint8 *src) { @@ -3604,7 +3616,7 @@ void SJISFont::setColorMap(const uint8 *src) { if (_colorMap[0] == _invisColor) _font->setDrawingMode(Graphics::FontSJIS::kDefaultMode); else - _font->setDrawingMode(Graphics::FontSJIS::kOutlineMode); + _font->setDrawingMode(_drawOutline ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode); } } diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index 7f3abf8b5f..156b5b9a7c 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -211,7 +211,7 @@ private: */ class SJISFont : public Font { public: - SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool outlineSize); + SJISFont(Graphics::FontSJIS *font, const uint8 invisColor, bool is16Color, bool drawOutline, int extraSpacing); ~SJISFont() { unload(); } bool usesOverlay() const { return true; } @@ -230,6 +230,12 @@ private: Graphics::FontSJIS *_font; const uint8 _invisColor; const bool _is16Color; + const bool _drawOutline; + // We use this for cases where the font width returned by getWidth() or getCharWidth() does not match the original. + // The original Japanese game versions use hard coded sjis font widths of 8 or 9. However, this does not necessarily + // depend on whether an outline is used or not (neither LOL/PC-9801 nor LOL/FM-TOWNS use an outline, but the first + // version uses a font width of 8 where the latter uses a font width of 9). + const int _sjisWidthOffset; int _sjisWidth, _asciiWidth; int _fontHeight; @@ -468,7 +474,7 @@ public: int getFontWidth() const; int getCharWidth(uint16 c) const; - int getTextWidth(const char *str) const; + int getTextWidth(const char *str); void printText(const char *str, int x, int y, uint8 color1, uint8 color2); @@ -581,6 +587,7 @@ protected: Common::RenderMode _renderMode; uint8 _sjisInvisibleColor; + bool _sjisMixedFontMode; Palette *_screenPalette; Common::Array _palettes; diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index 82ec3dc658..ba0f62a2b4 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -297,20 +297,20 @@ void TIMInterpreter::displayText(uint16 textId, int16 flags) { memcpy(filename, text+1, end-1-text); } - const bool isPC98 = (_vm->gameFlags().platform == Common::kPlatformPC98); + const bool sjisMode = (_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode); if (filename[0] && (_vm->speechEnabled() || !_vm->gameFlags().isTalkie)) _vm->sound()->voicePlay(filename, 0, 255, 255, !_vm->gameFlags().isTalkie); if (text[0] == '$') text = strchr(text + 1, '$') + 1; - if (!isPC98) + if (!_vm->gameFlags().use16ColorMode) setupTextPalette((flags < 0) ? 1 : flags, 0); 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(isPC98 ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT); + _screen->setFont(sjisMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT); _screen->setTextColorMap(colorMap); _screen->_charWidth = -2; } @@ -335,7 +335,7 @@ void TIMInterpreter::displayText(uint16 textId, int16 flags) { int width = _screen->getTextWidth(str); if (flags >= 0) { - if (isPC98) { + if (_vm->gameFlags().use16ColorMode) { static const uint8 colorMap[] = { 0xE1, 0xE1, 0xC1, 0xA1, 0x81, 0x61 }; _screen->printText(str, (320 - width) >> 1, 160 + heightAdd, colorMap[flags], 0x00); } else { @@ -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(isPC98 ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT); + _screen->setFont(sjisMode ? Screen::FID_SJIS_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().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_INTRO_FNT); + _screen->setFont((_vm->gameFlags().lang == Common::JA_JPN && _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_lol.cpp b/engines/kyra/sequences_lol.cpp index b319bfa53f..c8f97eb770 100644 --- a/engines/kyra/sequences_lol.cpp +++ b/engines/kyra/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 ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); + _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); _screen->fadePalette(_screen->getPalette(0), 0x1E); _screen->updateScreen(); @@ -230,7 +230,7 @@ void LoLEngine::showIntro() { _screen->loadFont(Screen::FID_8_FNT, "NEW8P.FNT"); _screen->loadFont(Screen::FID_INTRO_FNT, "INTRO.FNT"); - _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT); + _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT); _tim->resetFinishedFlag(); _tim->setLangData("LOLINTRO.DIP"); @@ -300,10 +300,10 @@ int LoLEngine::chooseCharacter() { _chargenWSA->displayFrame(0, 2, 113, 0, 0, 0, 0); - _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); + _screen->setFont((_flags.lang == Common::JA_JPN && _flags.use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); _screen->_curPage = 2; - if (_flags.platform == Common::kPlatformPC98) { + if (_flags.platform == Common::kPlatformPC98 && _flags.use16ColorMode) { _screen->fillRect(17, 29, 94, 97, 17); _screen->fillRect(68, 167, 310, 199, 17); _screen->drawClippedLine(68, 166, 311, 166, 238); diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp index eee3ea92f9..9aad10529d 100644 --- a/engines/kyra/text_lol.cpp +++ b/engines/kyra/text_lol.cpp @@ -162,7 +162,7 @@ void TextDisplayer_LoL::printDialogueText(int dim, char *str, EMCState *script, } int cp = _screen->setCurPage(0); - Screen::FontId of = _screen->setFont(_vm->gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); + Screen::FontId of = _screen->setFont((_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_9_FNT); preprocessString(str, script, paramList, paramIndex); _numCharsTotal = strlen(_dialogueBuffer); diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp index 07f4fe0057..f9861cfb77 100644 --- a/engines/kyra/text_rpg.cpp +++ b/engines/kyra/text_rpg.cpp @@ -88,8 +88,8 @@ void TextDisplayer_rpg::resetDimTextPositions(int dim) { } void TextDisplayer_rpg::resetPageBreakString() { - if (vm()->_moreStrings) - strcpy(_pageBreakString, vm()->_moreStrings[0]); + if (_vm->_moreStrings) + strcpy(_pageBreakString, _vm->_moreStrings[0]); } void TextDisplayer_rpg::setPageBreakFlag() { @@ -319,13 +319,13 @@ void TextDisplayer_rpg::printLine(char *str) { if ((lw + _textDimData[sdx].column) > w) { if ((lines - 1 - (_waitButtonSpace << 1)) <= _lineCount) // cut off line to leave space for "MORE" button - w -= vm()->guiSettings()->buttons.waitReserve; + w -= _vm->guiSettings()->buttons.waitReserve; } else { if (!_sjisLineBreakFlag || (_lineCount + 1 < lines - 1)) ct = false; else // cut off line to leave space for "MORE" button - w -= vm()->guiSettings()->buttons.waitReserve; + w -= _vm->guiSettings()->buttons.waitReserve; } if (ct) { @@ -347,7 +347,7 @@ void TextDisplayer_rpg::printLine(char *str) { if ((lw + _textDimData[sdx].column) > w) { if ((lines - 1) <= _lineCount && _allowPageBreak) // cut off line to leave space for "MORE" button - w -= vm()->guiSettings()->buttons.waitReserve; + w -= _vm->guiSettings()->buttons.waitReserve; w -= _textDimData[sdx].column; @@ -483,7 +483,7 @@ void TextDisplayer_rpg::printMessage(const char *str, int textColor, ...) { displayText(_dialogueBuffer); - if (vm()->game() != GI_EOB1) + if (_vm->game() != GI_EOB1) _textDimData[_screen->curDimIndex()].color1 = tc; if (!_screen->_curPage) @@ -494,7 +494,7 @@ int TextDisplayer_rpg::clearDim(int dim) { int res = _screen->curDimIndex(); _screen->setScreenDim(dim); _textDimData[dim].color1 = _screen->_curDim->unk8; - _textDimData[dim].color2 = vm()->game() == GI_LOL ? _screen->_curDim->unkA : vm()->guiSettings()->colors.fill; + _textDimData[dim].color2 = _vm->game() == GI_LOL ? _screen->_curDim->unkA : _vm->guiSettings()->colors.fill; clearCurDim(); return res; } @@ -502,7 +502,7 @@ int TextDisplayer_rpg::clearDim(int dim) { void TextDisplayer_rpg::clearCurDim() { int d = _screen->curDimIndex(); const ScreenDim *tmp = _screen->getScreenDim(d); - if (vm()->gameFlags().use16ColorMode) { + if (_vm->gameFlags().use16ColorMode) { _screen->fillRect(tmp->sx << 3, tmp->sy, ((tmp->sx + tmp->w) << 3) - 2, (tmp->sy + tmp->h) - 2, _textDimData[d].color2); } else _screen->fillRect(tmp->sx << 3, tmp->sy, ((tmp->sx + tmp->w) << 3) - 1, (tmp->sy + tmp->h) - 1, _textDimData[d].color2); @@ -512,40 +512,40 @@ void TextDisplayer_rpg::clearCurDim() { } void TextDisplayer_rpg::textPageBreak() { - if (vm()->game() != GI_LOL) - SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2); + if (_vm->game() != GI_LOL) + SWAP(_vm->_dialogueButtonLabelColor1, _vm->_dialogueButtonLabelColor2); int cp = _screen->setCurPage(0); - Screen::FontId cf = _screen->setFont(vm()->gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT); + Screen::FontId cf = _screen->setFont((_vm->gameFlags().lang == Common::JA_JPN && _vm->gameFlags().use16ColorMode) ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT); - if (vm()->game() == GI_LOL) - vm()->_timer->pauseSingleTimer(11, true); + if (_vm->game() == GI_LOL) + _vm->_timer->pauseSingleTimer(11, true); - vm()->_fadeText = false; + _vm->_fadeText = false; int resetPortraitAfterSpeechAnim = 0; int updatePortraitSpeechAnimDuration = 0; - if (vm()->_updateCharNum != -1) { - resetPortraitAfterSpeechAnim = vm()->_resetPortraitAfterSpeechAnim; - vm()->_resetPortraitAfterSpeechAnim = 0; - updatePortraitSpeechAnimDuration = vm()->_updatePortraitSpeechAnimDuration; - if (vm()->_updatePortraitSpeechAnimDuration > 36) - vm()->_updatePortraitSpeechAnimDuration = 36; + if (_vm->_updateCharNum != -1) { + resetPortraitAfterSpeechAnim = _vm->_resetPortraitAfterSpeechAnim; + _vm->_resetPortraitAfterSpeechAnim = 0; + updatePortraitSpeechAnimDuration = _vm->_updatePortraitSpeechAnimDuration; + if (_vm->_updatePortraitSpeechAnimDuration > 36) + _vm->_updatePortraitSpeechAnimDuration = 36; } uint32 speechPartTime = 0; - if (vm()->speechEnabled() && vm()->_activeVoiceFileTotalTime && _numCharsTotal) - speechPartTime = vm()->_system->getMillis() + ((_numCharsPrinted * vm()->_activeVoiceFileTotalTime) / _numCharsTotal); + if (_vm->speechEnabled() && _vm->_activeVoiceFileTotalTime && _numCharsTotal) + speechPartTime = _vm->_system->getMillis() + ((_numCharsPrinted * _vm->_activeVoiceFileTotalTime) / _numCharsTotal); const ScreenDim *dim = _screen->getScreenDim(_screen->curDimIndex()); int x = ((dim->sx + dim->w) << 3) - (_vm->_dialogueButtonWidth + 3); int y = 0; - int w = vm()->_dialogueButtonWidth; + int w = _vm->_dialogueButtonWidth; - if (vm()->game() == GI_LOL) { - if (vm()->_needSceneRestore && (vm()->_updateFlags & 2)) { - if (vm()->_currentControlMode || !(vm()->_updateFlags & 2)) { + if (_vm->game() == GI_LOL) { + if (_vm->_needSceneRestore && (_vm->_updateFlags & 2)) { + if (_vm->_currentControlMode || !(_vm->_updateFlags & 2)) { y = dim->sy + dim->h - 5; } else { x += 6; @@ -555,49 +555,49 @@ void TextDisplayer_rpg::textPageBreak() { y = dim->sy + dim->h - 10; } } else { - y = vm()->guiSettings()->buttons.waitY[_waitButtonMode]; - x = vm()->guiSettings()->buttons.waitX[_waitButtonMode]; - w = vm()->guiSettings()->buttons.waitWidth[_waitButtonMode]; + y = _vm->guiSettings()->buttons.waitY[_waitButtonMode]; + x = _vm->guiSettings()->buttons.waitX[_waitButtonMode]; + w = _vm->guiSettings()->buttons.waitWidth[_waitButtonMode]; } - if (vm()->gameFlags().use16ColorMode) { - vm()->gui_drawBox(x + 8, (y & ~7) - 1, 66, 10, 0xEE, 0xCC, -1); + if (_vm->gameFlags().use16ColorMode) { + _vm->gui_drawBox(x + 8, (y & ~7) - 1, 66, 10, 0xEE, 0xCC, -1); _screen->printText(_pageBreakString, (x + 37 - (strlen(_pageBreakString) << 1) + 4) & ~3, (y + 2) & ~7, 0xC1, 0); } else { - vm()->gui_drawBox(x, y, w, vm()->guiSettings()->buttons.height, vm()->guiSettings()->colors.frame1, vm()->guiSettings()->colors.frame2, vm()->guiSettings()->colors.fill); - _screen->printText(_pageBreakString, x + (w >> 1) - (vm()->screen()->getTextWidth(_pageBreakString) >> 1), y + 2, vm()->_dialogueButtonLabelColor1, 0); + _vm->gui_drawBox(x, y, w, _vm->guiSettings()->buttons.height, _vm->guiSettings()->colors.frame1, _vm->guiSettings()->colors.frame2, _vm->guiSettings()->colors.fill); + _screen->printText(_pageBreakString, x + (w >> 1) - (_vm->screen()->getTextWidth(_pageBreakString) >> 1), y + 2, _vm->_dialogueButtonLabelColor1, 0); } - vm()->removeInputTop(); + _vm->removeInputTop(); bool loop = true; bool target = false; do { - int inputFlag = vm()->checkInput(0, false) & 0xFF; - vm()->removeInputTop(); + int inputFlag = _vm->checkInput(0, false) & 0xFF; + _vm->removeInputTop(); while (!inputFlag && !_vm->shouldQuit()) { - vm()->update(); + _vm->update(); - if (vm()->speechEnabled()) { - if (((vm()->_system->getMillis() > speechPartTime) || (vm()->snd_updateCharacterSpeech() != 2)) && speechPartTime) { + if (_vm->speechEnabled()) { + if (((_vm->_system->getMillis() > speechPartTime) || (_vm->snd_updateCharacterSpeech() != 2)) && speechPartTime) { loop = false; - inputFlag = vm()->_keyMap[Common::KEYCODE_RETURN]; + inputFlag = _vm->_keyMap[Common::KEYCODE_RETURN]; break; } } - inputFlag = vm()->checkInput(0, false) & 0xFF; - vm()->removeInputTop(); + inputFlag = _vm->checkInput(0, false) & 0xFF; + _vm->removeInputTop(); } - vm()->gui_notifyButtonListChanged(); + _vm->gui_notifyButtonListChanged(); - if (inputFlag == vm()->_keyMap[Common::KEYCODE_SPACE] || inputFlag == vm()->_keyMap[Common::KEYCODE_RETURN]) { + if (inputFlag == _vm->_keyMap[Common::KEYCODE_SPACE] || inputFlag == _vm->_keyMap[Common::KEYCODE_RETURN]) { loop = false; } else if (inputFlag == 199 || inputFlag == 201) { - if (vm()->posWithinRect(vm()->_mouseX, vm()->_mouseY, x, y, x + w, y + 9)) { + if (_vm->posWithinRect(_vm->_mouseX, _vm->_mouseY, x, y, x + w, y + 9)) { if (_vm->game() == GI_LOL) target = true; else @@ -609,7 +609,7 @@ void TextDisplayer_rpg::textPageBreak() { } } while (loop && !_vm->shouldQuit()); - if (vm()->gameFlags().use16ColorMode) + if (_vm->gameFlags().use16ColorMode) _screen->fillRect(x + 8, y, x + 57, y + 9, _textDimData[_screen->curDimIndex()].color2); else _screen->fillRect(x, y, x + w - 1, y + 8, _textDimData[_screen->curDimIndex()].color2); @@ -617,52 +617,52 @@ void TextDisplayer_rpg::textPageBreak() { clearCurDim(); _screen->updateScreen(); - if (vm()->game() == GI_LOL) - vm()->_timer->pauseSingleTimer(11, false); + if (_vm->game() == GI_LOL) + _vm->_timer->pauseSingleTimer(11, false); - if (vm()->_updateCharNum != -1) { - vm()->_resetPortraitAfterSpeechAnim = resetPortraitAfterSpeechAnim; + if (_vm->_updateCharNum != -1) { + _vm->_resetPortraitAfterSpeechAnim = resetPortraitAfterSpeechAnim; if (updatePortraitSpeechAnimDuration > 36) updatePortraitSpeechAnimDuration -= 36; else updatePortraitSpeechAnimDuration >>= 1; - vm()->_updatePortraitSpeechAnimDuration = updatePortraitSpeechAnimDuration; + _vm->_updatePortraitSpeechAnimDuration = updatePortraitSpeechAnimDuration; } _screen->setFont(cf); _screen->setCurPage(cp); - if (vm()->game() != GI_LOL) - SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2); + if (_vm->game() != GI_LOL) + SWAP(_vm->_dialogueButtonLabelColor1, _vm->_dialogueButtonLabelColor2); - vm()->removeInputTop(); + _vm->removeInputTop(); } void TextDisplayer_rpg::displayWaitButton() { - vm()->_dialogueNumButtons = 1; - vm()->_dialogueButtonString[0] = _pageBreakString; - vm()->_dialogueButtonString[1] = 0; - vm()->_dialogueButtonString[2] = 0; - vm()->_dialogueHighlightedButton = 0; + _vm->_dialogueNumButtons = 1; + _vm->_dialogueButtonString[0] = _pageBreakString; + _vm->_dialogueButtonString[1] = 0; + _vm->_dialogueButtonString[2] = 0; + _vm->_dialogueHighlightedButton = 0; - vm()->_dialogueButtonPosX = &vm()->guiSettings()->buttons.waitX[_waitButtonMode]; - vm()->_dialogueButtonPosY = &vm()->guiSettings()->buttons.waitY[_waitButtonMode]; - vm()->_dialogueButtonWidth = vm()->guiSettings()->buttons.waitWidth[_waitButtonMode]; - vm()->_dialogueButtonYoffs = 0; + _vm->_dialogueButtonPosX = &_vm->guiSettings()->buttons.waitX[_waitButtonMode]; + _vm->_dialogueButtonPosY = &_vm->guiSettings()->buttons.waitY[_waitButtonMode]; + _vm->_dialogueButtonWidth = _vm->guiSettings()->buttons.waitWidth[_waitButtonMode]; + _vm->_dialogueButtonYoffs = 0; - SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2); - vm()->drawDialogueButtons(); + SWAP(_vm->_dialogueButtonLabelColor1, _vm->_dialogueButtonLabelColor2); + _vm->drawDialogueButtons(); - if (!vm()->shouldQuit()) - vm()->removeInputTop(); + if (!_vm->shouldQuit()) + _vm->removeInputTop(); - while (!vm()->processDialogue() && !vm()->shouldQuit()) {} + while (!_vm->processDialogue() && !_vm->shouldQuit()) {} - _screen->fillRect(vm()->_dialogueButtonPosX[0], vm()->_dialogueButtonPosY[0], vm()->_dialogueButtonPosX[0] + vm()->_dialogueButtonWidth - 1, vm()->_dialogueButtonPosY[0] + vm()->guiSettings()->buttons.height - 1, vm()->guiSettings()->colors.fill); + _screen->fillRect(_vm->_dialogueButtonPosX[0], _vm->_dialogueButtonPosY[0], _vm->_dialogueButtonPosX[0] + _vm->_dialogueButtonWidth - 1, _vm->_dialogueButtonPosY[0] + _vm->guiSettings()->buttons.height - 1, _vm->guiSettings()->colors.fill); _screen->updateScreen(); - vm()->_dialogueButtonWidth = 95; - SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2); + _vm->_dialogueButtonWidth = 95; + SWAP(_vm->_dialogueButtonLabelColor1, _vm->_dialogueButtonLabelColor2); clearCurDim(); } -- cgit v1.2.3