From 8b618e46df21d90a1a5ad62633a2b9d3c1da0317 Mon Sep 17 00:00:00 2001 From: athrxx Date: Sun, 11 Dec 2011 12:29:09 +0100 Subject: KYRA: (EOB/LOL) - cleanup common code (rename some stuff and move EOB/LOL common code to separate files) --- engines/kyra/text_rpg.cpp | 688 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 688 insertions(+) create mode 100644 engines/kyra/text_rpg.cpp (limited to 'engines/kyra/text_rpg.cpp') diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp new file mode 100644 index 0000000000..bbc3cdbd98 --- /dev/null +++ b/engines/kyra/text_rpg.cpp @@ -0,0 +1,688 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * + */ + +#if defined(ENABLE_EOB) || defined(ENABLE_LOL) + +#include "kyra/kyra_rpg.h" +#include "kyra/screen.h" +#include "kyra/timer.h" + +#include "common/system.h" + +namespace Kyra { + +enum { + kEobTextBufferSize = 2048 +}; + +TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen *sScreen) : _vm(engine), _screen(sScreen), + _lineCount(0), _printFlag(false), _lineWidth(0), _numCharsTotal(0), _allowPageBreak(true), + _numCharsLeft(0), _numCharsPrinted(0), _sjisLineBreakFlag(false), _waitButtonMode(1) { + + _dialogueBuffer = new char[kEobTextBufferSize]; + memset(_dialogueBuffer, 0, kEobTextBufferSize); + + _currentLine = new char[85]; + memset(_currentLine, 0, 85); + + _textDimData = new TextDimData[_screen->screenDimTableCount()]; + + for (int i = 0; i < _screen->screenDimTableCount(); i++){ + const ScreenDim *d = _screen->getScreenDim(i); + _textDimData[i].color1 = d->unk8; + _textDimData[i].color2 = d->unkA; + _textDimData[i].line = d->unkC; + _textDimData[i].column = d->unkE; + } + + _table1 = new char[128]; + memset(_table1, 0, 128); + _table2 = new char[16]; + memset(_table2, 0, 16); + + _waitButtonSpace = 0; +} + +TextDisplayer_rpg::~TextDisplayer_rpg() { + delete[] _dialogueBuffer; + delete[] _currentLine; + delete[] _textDimData; + delete[] _table1; + delete[] _table2; +} + +void TextDisplayer_rpg::setupField(int dim, bool mode) { + setPageBreakFlag(); + + _textDimData[dim].color2 = _vm->_bkgColor_1; + _screen->setScreenDim(dim); + + if (mode) + clearCurDim(); + else + resetDimTextPositions(dim); +} + +void TextDisplayer_rpg::resetDimTextPositions(int dim) { + _textDimData[dim].column = 0; + _textDimData[dim].line = 0; +} + +void TextDisplayer_rpg::resetPageBreakString() { + if (vm()->_moreStrings) + strcpy(_pageBreakString, vm()->_moreStrings[0]); +} + +void TextDisplayer_rpg::setPageBreakFlag() { + _allowPageBreak = true; + _lineCount = 0; +} + +void TextDisplayer_rpg::removePageBreakFlag() { + _allowPageBreak = false; +} + +void TextDisplayer_rpg::displayText(char *str, ...) { + const bool isPc98 = (_vm->gameFlags().platform == Common::kPlatformPC98); + + _printFlag = false; + + _lineWidth = 0; + _numCharsLeft = 0; + _numCharsPrinted = 0; + + _tempString1 = str; + _tempString2 = 0; + + _currentLine[0] = 0; + + memset(_ctrl, 0, 3); + + char c = parseCommand(); + + va_list args; + va_start(args, str); + + const ScreenDim *sd = _screen->_curDim; + int sdx = _screen->curDimIndex(); + + bool pc98PrintFlag = (isPc98 && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false; + uint16 charsPerLine = (sd->w << 3) / (_screen->getFontWidth() + _screen->_charWidth); + + while (c) { + char a = tolower(_ctrl[1]); + + if (!_tempString2 && c == '%') { + if (a == 'd') { + strcpy(_scriptParaString, Common::String::format("%d", va_arg(args, int)).c_str()); + _tempString2 = _scriptParaString; + } else if (a == 's') { + _tempString2 = va_arg(args, char *); + } else { + break; + } + + _ctrl[0] = _ctrl[2]; + _ctrl[2] = _ctrl[1] = 0; + c = parseCommand(); + } + + if (isPc98) { + uint8 cu = (uint8) c; + if (cu >= 0xE0 || (cu > 0x80 && cu < 0xA0)) { + _currentLine[_numCharsLeft++] = c; + _currentLine[_numCharsLeft++] = parseCommand(); + _currentLine[_numCharsLeft] = '\0'; + _lineWidth += 8; + if ((_textDimData[sdx].column + _lineWidth) > (sd->w << 3)) + printLine(_currentLine); + c = parseCommand(); + continue; + } + } + + uint16 dv = _textDimData[sdx].column / (_screen->getFontWidth() + _screen->_charWidth); + + switch (c - 1) { + case 0: + printLine(_currentLine); + textPageBreak(); + _numCharsPrinted = 0; + break; + + case 1: + printLine(_currentLine); + _textDimData[sdx].color2 = parseCommand(); + break; + + case 5: + printLine(_currentLine); + _textDimData[sdx].color1 = parseCommand(); + break; + + case 8: + printLine(_currentLine); + dv = _textDimData[sdx].column / (_screen->getFontWidth() + _screen->_charWidth); + dv = ((dv + 8) & 0xfff8) - 1; + if (dv >= charsPerLine) + dv = 0; + _textDimData[sdx].column = (_screen->getFontWidth() + _screen->_charWidth) * dv; + break; + + case 11: + _sjisLineBreakFlag=_sjisLineBreakFlag; + // TODO (UNUSED) + break; + + case 12: + if (isPc98) + _sjisLineBreakFlag = true; + printLine(_currentLine); + _sjisLineBreakFlag = false; + _lineCount++; + _textDimData[sdx].column = 0; + _textDimData[sdx].line++; + break; + + case 18: + _sjisLineBreakFlag=_sjisLineBreakFlag; + // TODO (UNUSED) + break; + + case 23: + _sjisLineBreakFlag=_sjisLineBreakFlag; + // TODO (UNUSED) + break; + + case 24: + _sjisLineBreakFlag=_sjisLineBreakFlag; + // TODO (UNUSED) + break; + + case 26: + _sjisLineBreakFlag=_sjisLineBreakFlag; + // TODO (UNUSED) + break; + + case 28: + _sjisLineBreakFlag=_sjisLineBreakFlag; + // TODO (UNUSED) + break; + + default: + if (_vm->game() == GI_LOL || c > 30) { + _lineWidth += (pc98PrintFlag ? 4 : _screen->getCharWidth((uint8)c)); + _currentLine[_numCharsLeft++] = c; + _currentLine[_numCharsLeft] = 0; + + if ((_textDimData[sdx].column + _lineWidth) > (sd->w << 3)) + printLine(_currentLine); + } + } + + c = parseCommand(); + } + + va_end(args); + + if (_numCharsLeft) + printLine(_currentLine); +} + +char TextDisplayer_rpg::parseCommand() { + if (!_ctrl[1]) + readNextPara(); + + char res = _ctrl[1]; + _ctrl[1] = _ctrl[2]; + _ctrl[2] = 0; + + if (!_ctrl[1]) + readNextPara(); + + return res; +} + +void TextDisplayer_rpg::readNextPara() { + char c = 0; + char d = 0; + + if (_tempString2) { + if (*_tempString2) { + d = *_tempString2++; + } else { + _tempString2 = 0; + d = _ctrl[0]; + } + } + + if (!d && _tempString1) { + if (*_tempString1) + d = *_tempString1++; + else + _tempString1 = 0; + } + + if ((_vm->game() != GI_LOL) && (d & 0x80)) { + d &= 0x7f; + c = d & 7; + d = (d & 0x78) >> 3; + uint8 l = d; + c = _table1[(l << 3) + c]; + d = _table2[l]; + } + + _ctrl[1] = d; + _ctrl[2] = c; +} + +void TextDisplayer_rpg::printLine(char *str) { + const bool isPc98 = (_vm->gameFlags().platform == Common::kPlatformPC98); + const ScreenDim *sd = _screen->_curDim; + int sdx = _screen->curDimIndex(); + bool pc98PrintFlag = (isPc98 && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false; + + int fh = (_screen->_currentFont == Screen::FID_SJIS_FNT) ? 9 : (_screen->getFontHeight() + _screen->_charOffset); + int lines = (sd->h - _screen->_charOffset) / fh; + + while (_textDimData[sdx].line >= lines) { + if ((lines - _waitButtonSpace) <= _lineCount && _allowPageBreak) { + _lineCount = 0; + textPageBreak(); + _numCharsPrinted = 0; + } + + int h1 = ((sd->h / fh) - 1) * fh; + int h2 = sd->h - fh; + + if (h2) + _screen->copyRegion(sd->sx << 3, sd->sy + fh, sd->sx << 3, sd->sy, sd->w << 3, h2, _screen->_curPage, _screen->_curPage, Screen::CR_NO_P_CHECK); + + _screen->fillRect(sd->sx << 3, sd->sy + h1, ((sd->sx + sd->w) << 3) - 1, sd->sy + sd->h - 1, _textDimData[sdx].color2); + if (_textDimData[sdx].line) + _textDimData[sdx].line--; + } + + int x1 = (sd->sx << 3) + _textDimData[sdx].column; + int y = sd->sy + (pc98PrintFlag ? (_textDimData[sdx].line << 3) : (fh * _textDimData[sdx].line)); + int w = sd->w << 3; + int lw = _lineWidth; + int s = _numCharsLeft; + char c = 0; + + if (pc98PrintFlag) { + bool ct = true; + + if ((lw + _textDimData[sdx].column) > w) { + if ((lines - 1 - (_waitButtonSpace << 1)) <= _lineCount) + // cut off line to leave space for "MORE" button + w -= vm()->_waitButtonReverveW; + } else { + if (!_sjisLineBreakFlag || (_lineCount + 1 < lines - 1)) + ct = false; + else + // cut off line to leave space for "MORE" button + w -= vm()->_waitButtonReverveW; + } + + if (ct) { + w -= _textDimData[sdx].column; + + int n2 = 0; + int n1 = (w / 4) - 1; + + while (n2 < n1 && n2 < s) { + c = str[n2]; + uint8 cu = (uint8) c; + if (cu >= 0xE0 || (cu > 0x80 && cu < 0xA0)) + n2++; + n2++; + } + s = n2; + } + } else { + if ((lw + _textDimData[sdx].column) > w) { + if ((lines - 1) <= _lineCount && _allowPageBreak) + // cut off line to leave space for "MORE" button + w -= vm()->_waitButtonReverveW; + + w -= _textDimData[sdx].column; + + int n2 = 0; + int n1 = s - 1; + + while (n1 > 0) { + //cut off line after last space + c = str[n1]; + + lw -= _screen->getCharWidth((uint8)c); + + if (!n2 && lw <= w) + n2 = n1; + + if (n2 && c == ' ') { + s = n1; + _printFlag = false; + break; + } + n1--; + } + + if (!n1) { + if (_textDimData[sdx].column && !_printFlag) { + s = lw = 0; + _printFlag = true; + } else { + s = n2; + } + } + } + } + + c = str[s]; + str[s] = 0; + + uint8 col = _textDimData[sdx].color1; + if (isPc98 && (sdx == 2 || sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) { + switch (_textDimData[sdx].color1) { + case 0x88: + col = 0x41; + break; + case 0x55: + col = 0x81; + break; + case 0xaa: + col = 0x21; + break; + case 0x99: + col = 0xa1; + break; + case 0x33: + col = 0xe1; + break; + case 0x18: + col = 0x61; + break; + default: + col = 1; + break; + } + _screen->printText(str, x1 & ~3, (y + 8) & ~7, col, 0); + } else { + _screen->printText(str, x1, y, col, _textDimData[sdx].color2); + } + + _textDimData[sdx].column += lw; + _numCharsPrinted += strlen(str); + + str[s] = c; + + if (c == ' ') + s++; + + if (str[s] == ' ') + s++; + + uint32 len = strlen(&str[s]); + for (uint32 i = 0; i < len; i++) + str[i] = str[s + i]; + str[len] = 0; + + _numCharsLeft = strlen(str); + _lineWidth = pc98PrintFlag ? (_numCharsLeft << 2) : _screen->getTextWidth(str); + + if (!_numCharsLeft && _textDimData[sdx].column < (sd->w << 3)) + return; + + _textDimData[sdx].column = 0; + _textDimData[sdx].line++; + _lineCount++; + + printLine(str); +} + +void TextDisplayer_rpg::printDialogueText(int stringId, const char *pageBreakString) { + const char * str = (const char *)(screen()->getCPagePtr(5) + READ_LE_UINT16(&screen()->getCPagePtr(5)[(stringId - 1) << 1])); + assert (strlen(str) < kEobTextBufferSize); + Common::strlcpy(_dialogueBuffer, str, kEobTextBufferSize); + + displayText(_dialogueBuffer); + + if (pageBreakString) { + if (pageBreakString[0]) { + strcpy(_pageBreakString, pageBreakString); + displayWaitButton(); + resetPageBreakString(); + } + } +} + +void TextDisplayer_rpg::printDialogueText(const char *str, bool wait) { + assert (strlen(str) < kEobTextBufferSize); + Common::strlcpy(_dialogueBuffer, str, kEobTextBufferSize); + + strcpy(_dialogueBuffer, str); + displayText(_dialogueBuffer); + if (wait) + displayWaitButton(); +} + +void TextDisplayer_rpg::printMessage(const char *str, int textColor, ...) { + int tc = _textDimData[screen()->curDimIndex()].color1; + + if (textColor != -1) + _textDimData[screen()->curDimIndex()].color1 = textColor; + + va_list args; + va_start(args, textColor); + vsnprintf(_dialogueBuffer, kEobTextBufferSize - 1, str, args); + va_end(args); + + displayText(_dialogueBuffer); + + if (vm()->game() != GI_EOB1) + _textDimData[screen()->curDimIndex()].color1 = tc; + + if (!screen()->_curPage) + screen()->updateScreen(); +} + +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()->_bkgColor_1; + clearCurDim(); + return res; +} + +void TextDisplayer_rpg::clearCurDim() { + int d = screen()->curDimIndex(); + const ScreenDim *tmp = screen()->getScreenDim(d); + 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); + + _lineCount = 0; + _textDimData[d].column = _textDimData[d].line = 0; +} + +void TextDisplayer_rpg::textPageBreak() { + if (vm()->game() != GI_LOL) + SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2); + + int cp = _screen->setCurPage(0); + Screen::FontId cf = screen()->setFont(vm()->gameFlags().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT); + + if (vm()->game() == GI_LOL) + vm()->_timer->pauseSingleTimer(11, true); + + 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; + } + + uint32 speechPartTime = 0; + 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->_dialogueButtonW + 3); + int y = 0; + int w = vm()->_dialogueButtonW; + + 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; + y = dim->sy + dim->h - 2; + } + } else { + y = dim->sy + dim->h - 10; + } + } else { + y = vm()->_waitButtonPresY[_waitButtonMode]; + x = vm()->_waitButtonPresX[_waitButtonMode]; + w = vm()->_waitButtonPresW[_waitButtonMode]; + } + + 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()->_dialogueButtonH, vm()->_color1_1, vm()->_color2_1, vm()->_bkgColor_1); + screen()->printText(_pageBreakString, x + (w >> 1) - (vm()->screen()->getTextWidth(_pageBreakString) >> 1), y + 2, vm()->_dialogueButtonLabelCol1, 0); + } + + vm()->removeInputTop(); + + bool loop = true; + bool target = false; + + do { + int inputFlag = vm()->checkInput(0, false) & 0xFF; + vm()->removeInputTop(); + + while (!inputFlag && !_vm->shouldQuit()) { + vm()->update(); + + if (vm()->speechEnabled()) { + if (((vm()->_system->getMillis() > speechPartTime) || (vm()->snd_updateCharacterSpeech() != 2)) && speechPartTime) { + loop = false; + inputFlag = vm()->_keyMap[Common::KEYCODE_RETURN]; + break; + } + } + + inputFlag = vm()->checkInput(0, false) & 0xFF; + vm()->removeInputTop(); + } + + vm()->gui_notifyButtonListChanged(); + + 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->game() == GI_LOL) + target = true; + else + loop = false; + } + } else if (inputFlag == 200 || inputFlag == 202) { + if (target) + loop = false; + } + } while (loop && !_vm->shouldQuit()); + + 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); + + clearCurDim(); + _screen->updateScreen(); + + if (vm()->game() == GI_LOL) + vm()->_timer->pauseSingleTimer(11, false); + + if (vm()->_updateCharNum != -1) { + vm()->_resetPortraitAfterSpeechAnim = resetPortraitAfterSpeechAnim; + if (updatePortraitSpeechAnimDuration > 36) + updatePortraitSpeechAnimDuration -= 36; + else + updatePortraitSpeechAnimDuration >>= 1; + + vm()->_updatePortraitSpeechAnimDuration = updatePortraitSpeechAnimDuration; + } + + screen()->setFont(cf); + screen()->setCurPage(cp); + + if (vm()->game() != GI_LOL) + SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2); + + 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()->_dialogueButtonPosX = &vm()->_waitButtonPresX[_waitButtonMode]; + vm()->_dialogueButtonPosY = &vm()->_waitButtonPresY[_waitButtonMode]; + vm()->_dialogueButtonW = vm()->_waitButtonPresW[_waitButtonMode]; + vm()->_dialogueButtonYoffs = 0; + + SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2); + vm()->drawDialogueButtons(); + + if (!vm()->shouldQuit()) + vm()->removeInputTop(); + + while (!vm()->processDialogue() && !vm()->shouldQuit()) {} + + _screen->fillRect(vm()->_dialogueButtonPosX[0], vm()->_dialogueButtonPosY[0], vm()->_dialogueButtonPosX[0] + vm()->_dialogueButtonW - 1, vm()->_dialogueButtonPosY[0] + vm()->_dialogueButtonH - 1, vm()->_bkgColor_1); + _screen->updateScreen(); + vm()->_dialogueButtonW = 95; + SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2); + clearCurDim(); +} + +} // End of namespace Kyra + +#endif // (ENABLE_EOB || ENABLE_LOL) -- cgit v1.2.3 From 0aa32385230dbe1ab62bb2d02d04ca5cc46d928c Mon Sep 17 00:00:00 2001 From: athrxx Date: Mon, 12 Dec 2011 16:23:01 +0100 Subject: KYRA: (EOB/LOL) - rename some vars (all cases of Eob to EoB, all cases of Lol to LoL, all cases of LolEobCommon to RpgCommon) --- engines/kyra/text_rpg.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engines/kyra/text_rpg.cpp') diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp index bbc3cdbd98..1201cdcb45 100644 --- a/engines/kyra/text_rpg.cpp +++ b/engines/kyra/text_rpg.cpp @@ -32,15 +32,15 @@ namespace Kyra { enum { - kEobTextBufferSize = 2048 + kEoBTextBufferSize = 2048 }; TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen *sScreen) : _vm(engine), _screen(sScreen), _lineCount(0), _printFlag(false), _lineWidth(0), _numCharsTotal(0), _allowPageBreak(true), _numCharsLeft(0), _numCharsPrinted(0), _sjisLineBreakFlag(false), _waitButtonMode(1) { - _dialogueBuffer = new char[kEobTextBufferSize]; - memset(_dialogueBuffer, 0, kEobTextBufferSize); + _dialogueBuffer = new char[kEoBTextBufferSize]; + memset(_dialogueBuffer, 0, kEoBTextBufferSize); _currentLine = new char[85]; memset(_currentLine, 0, 85); @@ -463,8 +463,8 @@ void TextDisplayer_rpg::printLine(char *str) { void TextDisplayer_rpg::printDialogueText(int stringId, const char *pageBreakString) { const char * str = (const char *)(screen()->getCPagePtr(5) + READ_LE_UINT16(&screen()->getCPagePtr(5)[(stringId - 1) << 1])); - assert (strlen(str) < kEobTextBufferSize); - Common::strlcpy(_dialogueBuffer, str, kEobTextBufferSize); + assert (strlen(str) < kEoBTextBufferSize); + Common::strlcpy(_dialogueBuffer, str, kEoBTextBufferSize); displayText(_dialogueBuffer); @@ -478,8 +478,8 @@ void TextDisplayer_rpg::printDialogueText(int stringId, const char *pageBreakStr } void TextDisplayer_rpg::printDialogueText(const char *str, bool wait) { - assert (strlen(str) < kEobTextBufferSize); - Common::strlcpy(_dialogueBuffer, str, kEobTextBufferSize); + assert (strlen(str) < kEoBTextBufferSize); + Common::strlcpy(_dialogueBuffer, str, kEoBTextBufferSize); strcpy(_dialogueBuffer, str); displayText(_dialogueBuffer); @@ -495,7 +495,7 @@ void TextDisplayer_rpg::printMessage(const char *str, int textColor, ...) { va_list args; va_start(args, textColor); - vsnprintf(_dialogueBuffer, kEobTextBufferSize - 1, str, args); + vsnprintf(_dialogueBuffer, kEoBTextBufferSize - 1, str, args); va_end(args); displayText(_dialogueBuffer); -- cgit v1.2.3 From 60330556ff5bf319db7815e6f3c635bc98edecc5 Mon Sep 17 00:00:00 2001 From: athrxx Date: Sat, 17 Dec 2011 22:39:11 +0100 Subject: KYRA: (EOB/LOL) - move eob/lol specific screen code to new class --- engines/kyra/text_rpg.cpp | 48 +++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'engines/kyra/text_rpg.cpp') diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp index 1201cdcb45..ca1fd04269 100644 --- a/engines/kyra/text_rpg.cpp +++ b/engines/kyra/text_rpg.cpp @@ -24,7 +24,7 @@ #if defined(ENABLE_EOB) || defined(ENABLE_LOL) #include "kyra/kyra_rpg.h" -#include "kyra/screen.h" +#include "kyra/screen_rpg.h" #include "kyra/timer.h" #include "common/system.h" @@ -35,7 +35,7 @@ enum { kEoBTextBufferSize = 2048 }; -TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen *sScreen) : _vm(engine), _screen(sScreen), +TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen_Rpg *scr) : _vm(engine), _screen(scr), _lineCount(0), _printFlag(false), _lineWidth(0), _numCharsTotal(0), _allowPageBreak(true), _numCharsLeft(0), _numCharsPrinted(0), _sjisLineBreakFlag(false), _waitButtonMode(1) { @@ -462,7 +462,7 @@ void TextDisplayer_rpg::printLine(char *str) { } void TextDisplayer_rpg::printDialogueText(int stringId, const char *pageBreakString) { - const char * str = (const char *)(screen()->getCPagePtr(5) + READ_LE_UINT16(&screen()->getCPagePtr(5)[(stringId - 1) << 1])); + const char * str = (const char *)(_screen->getCPagePtr(5) + READ_LE_UINT16(&_screen->getCPagePtr(5)[(stringId - 1) << 1])); assert (strlen(str) < kEoBTextBufferSize); Common::strlcpy(_dialogueBuffer, str, kEoBTextBufferSize); @@ -488,10 +488,10 @@ void TextDisplayer_rpg::printDialogueText(const char *str, bool wait) { } void TextDisplayer_rpg::printMessage(const char *str, int textColor, ...) { - int tc = _textDimData[screen()->curDimIndex()].color1; + int tc = _textDimData[_screen->curDimIndex()].color1; if (textColor != -1) - _textDimData[screen()->curDimIndex()].color1 = textColor; + _textDimData[_screen->curDimIndex()].color1 = textColor; va_list args; va_start(args, textColor); @@ -501,28 +501,28 @@ void TextDisplayer_rpg::printMessage(const char *str, int textColor, ...) { displayText(_dialogueBuffer); if (vm()->game() != GI_EOB1) - _textDimData[screen()->curDimIndex()].color1 = tc; + _textDimData[_screen->curDimIndex()].color1 = tc; - if (!screen()->_curPage) - screen()->updateScreen(); + if (!_screen->_curPage) + _screen->updateScreen(); } 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()->_bkgColor_1; + int res = _screen->curDimIndex(); + _screen->setScreenDim(dim); + _textDimData[dim].color1 = _screen->_curDim->unk8; + _textDimData[dim].color2 = vm()->game() == GI_LOL ? _screen->_curDim->unkA : vm()->_bkgColor_1; clearCurDim(); return res; } void TextDisplayer_rpg::clearCurDim() { - int d = screen()->curDimIndex(); - const ScreenDim *tmp = screen()->getScreenDim(d); + int d = _screen->curDimIndex(); + const ScreenDim *tmp = _screen->getScreenDim(d); 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); + _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); + _screen->fillRect(tmp->sx << 3, tmp->sy, ((tmp->sx + tmp->w) << 3) - 1, (tmp->sy + tmp->h) - 1, _textDimData[d].color2); _lineCount = 0; _textDimData[d].column = _textDimData[d].line = 0; @@ -533,7 +533,7 @@ void TextDisplayer_rpg::textPageBreak() { SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2); 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().use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT); if (vm()->game() == GI_LOL) vm()->_timer->pauseSingleTimer(11, true); @@ -554,7 +554,7 @@ void TextDisplayer_rpg::textPageBreak() { if (vm()->speechEnabled() && vm()->_activeVoiceFileTotalTime && _numCharsTotal) speechPartTime = vm()->_system->getMillis() + ((_numCharsPrinted * vm()->_activeVoiceFileTotalTime) / _numCharsTotal); - const ScreenDim *dim = screen()->getScreenDim(screen()->curDimIndex()); + const ScreenDim *dim = _screen->getScreenDim(_screen->curDimIndex()); int x = ((dim->sx + dim->w) << 3) - (_vm->_dialogueButtonW + 3); int y = 0; @@ -579,10 +579,10 @@ void TextDisplayer_rpg::textPageBreak() { 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); + _screen->printText(_pageBreakString, (x + 37 - (strlen(_pageBreakString) << 1) + 4) & ~3, (y + 2) & ~7, 0xc1, 0); } else { vm()->gui_drawBox(x, y, w, vm()->_dialogueButtonH, vm()->_color1_1, vm()->_color2_1, vm()->_bkgColor_1); - screen()->printText(_pageBreakString, x + (w >> 1) - (vm()->screen()->getTextWidth(_pageBreakString) >> 1), y + 2, vm()->_dialogueButtonLabelCol1, 0); + _screen->printText(_pageBreakString, x + (w >> 1) - (vm()->screen()->getTextWidth(_pageBreakString) >> 1), y + 2, vm()->_dialogueButtonLabelCol1, 0); } vm()->removeInputTop(); @@ -627,9 +627,9 @@ void TextDisplayer_rpg::textPageBreak() { } while (loop && !_vm->shouldQuit()); if (vm()->gameFlags().use16ColorMode) - screen()->fillRect(x + 8, y, x + 57, y + 9, _textDimData[screen()->curDimIndex()].color2); + _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); + _screen->fillRect(x, y, x + w - 1, y + 8, _textDimData[_screen->curDimIndex()].color2); clearCurDim(); _screen->updateScreen(); @@ -647,8 +647,8 @@ void TextDisplayer_rpg::textPageBreak() { vm()->_updatePortraitSpeechAnimDuration = updatePortraitSpeechAnimDuration; } - screen()->setFont(cf); - screen()->setCurPage(cp); + _screen->setFont(cf); + _screen->setCurPage(cp); if (vm()->game() != GI_LOL) SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2); -- cgit v1.2.3 From 487e73bd218775dec22818477ad75dd230d97052 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 26 Dec 2011 19:27:20 +0100 Subject: KYRA: Merge Screen_Rpg with Screen (for now). This should(!) fix ARM compilation issues due to virtual inheritance. --- engines/kyra/text_rpg.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'engines/kyra/text_rpg.cpp') diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp index ca1fd04269..78206d3a06 100644 --- a/engines/kyra/text_rpg.cpp +++ b/engines/kyra/text_rpg.cpp @@ -24,7 +24,6 @@ #if defined(ENABLE_EOB) || defined(ENABLE_LOL) #include "kyra/kyra_rpg.h" -#include "kyra/screen_rpg.h" #include "kyra/timer.h" #include "common/system.h" @@ -35,7 +34,7 @@ enum { kEoBTextBufferSize = 2048 }; -TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen_Rpg *scr) : _vm(engine), _screen(scr), +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), _sjisLineBreakFlag(false), _waitButtonMode(1) { -- cgit v1.2.3 From 37c046339dfc70f29c163457c72158e02a6c1cdb Mon Sep 17 00:00:00 2001 From: athrxx Date: Tue, 27 Dec 2011 16:42:05 +0100 Subject: KYRA: (EOB) - cleanup dialog settings a bit --- engines/kyra/text_rpg.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'engines/kyra/text_rpg.cpp') diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp index 78206d3a06..a78adb93d9 100644 --- a/engines/kyra/text_rpg.cpp +++ b/engines/kyra/text_rpg.cpp @@ -73,7 +73,7 @@ TextDisplayer_rpg::~TextDisplayer_rpg() { void TextDisplayer_rpg::setupField(int dim, bool mode) { setPageBreakFlag(); - _textDimData[dim].color2 = _vm->_bkgColor_1; + _textDimData[dim].color2 = _vm->guiSettings()->colors.fill; _screen->setScreenDim(dim); if (mode) @@ -335,13 +335,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()->_waitButtonReverveW; + 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()->_waitButtonReverveW; + w -= vm()->guiSettings()->buttons.waitReserve; } if (ct) { @@ -363,7 +363,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()->_waitButtonReverveW; + w -= vm()->guiSettings()->buttons.waitReserve; w -= _textDimData[sdx].column; @@ -510,7 +510,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()->_bkgColor_1; + _textDimData[dim].color2 = vm()->game() == GI_LOL ? _screen->_curDim->unkA : vm()->guiSettings()->colors.fill; clearCurDim(); return res; } @@ -529,7 +529,7 @@ void TextDisplayer_rpg::clearCurDim() { void TextDisplayer_rpg::textPageBreak() { if (vm()->game() != GI_LOL) - SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2); + 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); @@ -555,9 +555,9 @@ void TextDisplayer_rpg::textPageBreak() { const ScreenDim *dim = _screen->getScreenDim(_screen->curDimIndex()); - int x = ((dim->sx + dim->w) << 3) - (_vm->_dialogueButtonW + 3); + int x = ((dim->sx + dim->w) << 3) - (_vm->_dialogueButtonWidth + 3); int y = 0; - int w = vm()->_dialogueButtonW; + int w = vm()->_dialogueButtonWidth; if (vm()->game() == GI_LOL) { if (vm()->_needSceneRestore && (vm()->_updateFlags & 2)) { @@ -571,17 +571,17 @@ void TextDisplayer_rpg::textPageBreak() { y = dim->sy + dim->h - 10; } } else { - y = vm()->_waitButtonPresY[_waitButtonMode]; - x = vm()->_waitButtonPresX[_waitButtonMode]; - w = vm()->_waitButtonPresW[_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); _screen->printText(_pageBreakString, (x + 37 - (strlen(_pageBreakString) << 1) + 4) & ~3, (y + 2) & ~7, 0xc1, 0); } else { - vm()->gui_drawBox(x, y, w, vm()->_dialogueButtonH, vm()->_color1_1, vm()->_color2_1, vm()->_bkgColor_1); - _screen->printText(_pageBreakString, x + (w >> 1) - (vm()->screen()->getTextWidth(_pageBreakString) >> 1), y + 2, vm()->_dialogueButtonLabelCol1, 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(); @@ -650,7 +650,7 @@ void TextDisplayer_rpg::textPageBreak() { _screen->setCurPage(cp); if (vm()->game() != GI_LOL) - SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2); + SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2); vm()->removeInputTop(); } @@ -662,12 +662,12 @@ void TextDisplayer_rpg::displayWaitButton() { vm()->_dialogueButtonString[2] = 0; vm()->_dialogueHighlightedButton = 0; - vm()->_dialogueButtonPosX = &vm()->_waitButtonPresX[_waitButtonMode]; - vm()->_dialogueButtonPosY = &vm()->_waitButtonPresY[_waitButtonMode]; - vm()->_dialogueButtonW = vm()->_waitButtonPresW[_waitButtonMode]; + 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()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2); + SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2); vm()->drawDialogueButtons(); if (!vm()->shouldQuit()) @@ -675,10 +675,10 @@ void TextDisplayer_rpg::displayWaitButton() { while (!vm()->processDialogue() && !vm()->shouldQuit()) {} - _screen->fillRect(vm()->_dialogueButtonPosX[0], vm()->_dialogueButtonPosY[0], vm()->_dialogueButtonPosX[0] + vm()->_dialogueButtonW - 1, vm()->_dialogueButtonPosY[0] + vm()->_dialogueButtonH - 1, vm()->_bkgColor_1); + _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()->_dialogueButtonW = 95; - SWAP(vm()->_dialogueButtonLabelCol1, vm()->_dialogueButtonLabelCol2); + vm()->_dialogueButtonWidth = 95; + SWAP(vm()->_dialogueButtonLabelColor1, vm()->_dialogueButtonLabelColor2); clearCurDim(); } -- cgit v1.2.3 From 930bcbf2dceebbdd7d29e3e1c478b2f7aafbf933 Mon Sep 17 00:00:00 2001 From: athrxx Date: Tue, 14 Feb 2012 21:38:19 +0100 Subject: KYRA: (EOB) - fix minor text displayer glitch --- engines/kyra/text_rpg.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'engines/kyra/text_rpg.cpp') diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp index a78adb93d9..d0f7b5e532 100644 --- a/engines/kyra/text_rpg.cpp +++ b/engines/kyra/text_rpg.cpp @@ -229,7 +229,7 @@ void TextDisplayer_rpg::displayText(char *str, ...) { break; default: - if (_vm->game() == GI_LOL || c > 30) { + if (_vm->game() == GI_LOL || (unsigned char)c > 30) { _lineWidth += (pc98PrintFlag ? 4 : _screen->getCharWidth((uint8)c)); _currentLine[_numCharsLeft++] = c; _currentLine[_numCharsLeft] = 0; @@ -282,14 +282,18 @@ void TextDisplayer_rpg::readNextPara() { _tempString1 = 0; } - if ((_vm->game() != GI_LOL) && (d & 0x80)) { + // This seems to be some sort of character conversion mechanism. The original doesn't make any use of it, however. + // All necessary conversions take place somewhere else. This code actually causes issues if the character conversions + // don't take place before calling displayText(). So we disable it for now. If some (not yet supported) localized + // versions depend on this code we'll have to look at this again. + /* if ((_vm->game() != GI_LOL) && (d & 0x80)) { d &= 0x7f; c = d & 7; d = (d & 0x78) >> 3; uint8 l = d; c = _table1[(l << 3) + c]; d = _table2[l]; - } + }*/ _ctrl[1] = d; _ctrl[2] = c; -- cgit v1.2.3 From 9671b44df8ecd1db46758508b1303d8ab3f515dd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 5 Mar 2012 20:02:05 +0100 Subject: KYRA: Some formatting fixes. --- engines/kyra/text_rpg.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'engines/kyra/text_rpg.cpp') diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp index d0f7b5e532..b004270055 100644 --- a/engines/kyra/text_rpg.cpp +++ b/engines/kyra/text_rpg.cpp @@ -46,7 +46,7 @@ TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen *scr) : _vm(e _textDimData = new TextDimData[_screen->screenDimTableCount()]; - for (int i = 0; i < _screen->screenDimTableCount(); i++){ + for (int i = 0; i < _screen->screenDimTableCount(); i++) { const ScreenDim *d = _screen->getScreenDim(i); _textDimData[i].color1 = d->unk8; _textDimData[i].color2 = d->unkA; @@ -189,7 +189,7 @@ void TextDisplayer_rpg::displayText(char *str, ...) { break; case 11: - _sjisLineBreakFlag=_sjisLineBreakFlag; + _sjisLineBreakFlag = _sjisLineBreakFlag; // TODO (UNUSED) break; @@ -204,27 +204,27 @@ void TextDisplayer_rpg::displayText(char *str, ...) { break; case 18: - _sjisLineBreakFlag=_sjisLineBreakFlag; + _sjisLineBreakFlag = _sjisLineBreakFlag; // TODO (UNUSED) break; case 23: - _sjisLineBreakFlag=_sjisLineBreakFlag; + _sjisLineBreakFlag = _sjisLineBreakFlag; // TODO (UNUSED) break; case 24: - _sjisLineBreakFlag=_sjisLineBreakFlag; + _sjisLineBreakFlag = _sjisLineBreakFlag; // TODO (UNUSED) break; case 26: - _sjisLineBreakFlag=_sjisLineBreakFlag; + _sjisLineBreakFlag = _sjisLineBreakFlag; // TODO (UNUSED) break; case 28: - _sjisLineBreakFlag=_sjisLineBreakFlag; + _sjisLineBreakFlag = _sjisLineBreakFlag; // TODO (UNUSED) break; @@ -286,14 +286,16 @@ void TextDisplayer_rpg::readNextPara() { // All necessary conversions take place somewhere else. This code actually causes issues if the character conversions // don't take place before calling displayText(). So we disable it for now. If some (not yet supported) localized // versions depend on this code we'll have to look at this again. - /* if ((_vm->game() != GI_LOL) && (d & 0x80)) { +#if 0 + if ((_vm->game() != GI_LOL) && (d & 0x80)) { d &= 0x7f; c = d & 7; d = (d & 0x78) >> 3; uint8 l = d; c = _table1[(l << 3) + c]; d = _table2[l]; - }*/ + } +#endif _ctrl[1] = d; _ctrl[2] = c; @@ -465,8 +467,8 @@ void TextDisplayer_rpg::printLine(char *str) { } void TextDisplayer_rpg::printDialogueText(int stringId, const char *pageBreakString) { - const char * str = (const char *)(_screen->getCPagePtr(5) + READ_LE_UINT16(&_screen->getCPagePtr(5)[(stringId - 1) << 1])); - assert (strlen(str) < kEoBTextBufferSize); + const char *str = (const char *)(_screen->getCPagePtr(5) + READ_LE_UINT16(&_screen->getCPagePtr(5)[(stringId - 1) << 1])); + assert(strlen(str) < kEoBTextBufferSize); Common::strlcpy(_dialogueBuffer, str, kEoBTextBufferSize); displayText(_dialogueBuffer); @@ -481,7 +483,7 @@ void TextDisplayer_rpg::printDialogueText(int stringId, const char *pageBreakStr } void TextDisplayer_rpg::printDialogueText(const char *str, bool wait) { - assert (strlen(str) < kEoBTextBufferSize); + assert(strlen(str) < kEoBTextBufferSize); Common::strlcpy(_dialogueBuffer, str, kEoBTextBufferSize); strcpy(_dialogueBuffer, str); -- cgit v1.2.3 From 398987ad7f83ffc44032658b94db5763fe83d344 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 5 Mar 2012 20:21:46 +0100 Subject: KYRA: Replace debug leftover for unimplemented displayText functions with a warning. --- engines/kyra/text_rpg.cpp | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) (limited to 'engines/kyra/text_rpg.cpp') diff --git a/engines/kyra/text_rpg.cpp b/engines/kyra/text_rpg.cpp index b004270055..52c14c7223 100644 --- a/engines/kyra/text_rpg.cpp +++ b/engines/kyra/text_rpg.cpp @@ -188,11 +188,6 @@ void TextDisplayer_rpg::displayText(char *str, ...) { _textDimData[sdx].column = (_screen->getFontWidth() + _screen->_charWidth) * dv; break; - case 11: - _sjisLineBreakFlag = _sjisLineBreakFlag; - // TODO (UNUSED) - break; - case 12: if (isPc98) _sjisLineBreakFlag = true; @@ -203,29 +198,12 @@ void TextDisplayer_rpg::displayText(char *str, ...) { _textDimData[sdx].line++; break; - case 18: - _sjisLineBreakFlag = _sjisLineBreakFlag; - // TODO (UNUSED) - break; - - case 23: - _sjisLineBreakFlag = _sjisLineBreakFlag; - // TODO (UNUSED) - break; - - case 24: - _sjisLineBreakFlag = _sjisLineBreakFlag; - // TODO (UNUSED) - break; - - case 26: - _sjisLineBreakFlag = _sjisLineBreakFlag; - // TODO (UNUSED) - break; - - case 28: - _sjisLineBreakFlag = _sjisLineBreakFlag; - // TODO (UNUSED) + case 11: case 18: case 23: + case 24: case 26: case 28: + // These are at the time of writing this comment not known to be + // used. In case there is some use of them in some odd version + // we display this warning here. + warning("TextDisplayer_rpg::displayText: Triggered stub function %d", c - 1); break; default: -- cgit v1.2.3