aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/text
diff options
context:
space:
mode:
authorathrxx2019-11-26 22:07:32 +0100
committerathrxx2019-12-18 20:50:44 +0100
commit5a1162e99929d4a4d6351f91b8527fc0f205ad0f (patch)
tree1c4783b434cf9f4dbd1d26342b9f675ac26ab852 /engines/kyra/text
parent1f42999a7cd3b35df4f5611cf27c7d98974e8673 (diff)
downloadscummvm-rg350-5a1162e99929d4a4d6351f91b8527fc0f205ad0f.tar.gz
scummvm-rg350-5a1162e99929d4a4d6351f91b8527fc0f205ad0f.tar.bz2
scummvm-rg350-5a1162e99929d4a4d6351f91b8527fc0f205ad0f.zip
KYRA: (EOB/PC98) - fix Japanese text display
Diffstat (limited to 'engines/kyra/text')
-rw-r--r--engines/kyra/text/text_rpg.cpp33
-rw-r--r--engines/kyra/text/text_rpg.h4
2 files changed, 25 insertions, 12 deletions
diff --git a/engines/kyra/text/text_rpg.cpp b/engines/kyra/text/text_rpg.cpp
index a1baa976a4..439491c35a 100644
--- a/engines/kyra/text/text_rpg.cpp
+++ b/engines/kyra/text/text_rpg.cpp
@@ -36,7 +36,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),
- _pc98TextMode(engine->gameFlags().use16ColorMode && engine->game() == GI_LOL) {
+ _pc98TextMode(engine->gameFlags().use16ColorMode && engine->game() == GI_LOL),
+ _waitButtonFont(Screen::FID_6_FNT) {
static const uint8 amigaColorMap[16] = {
0x00, 0x06, 0x1d, 0x1b, 0x1a, 0x17, 0x18, 0x0e, 0x19, 0x1c, 0x1c, 0x1e, 0x13, 0x0a, 0x11, 0x1f
@@ -48,6 +49,13 @@ TextDisplayer_rpg::TextDisplayer_rpg(KyraRpgEngine *engine, Screen *scr) : _vm(e
_currentLine = new char[85];
memset(_currentLine, 0, 85);
+ if (_pc98TextMode)
+ _waitButtonFont = Screen::FID_SJIS_TEXTMODE_FNT;
+ else if ((_vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns))
+ _waitButtonFont = Screen::FID_8_FNT;
+ else if ((_vm->game() == GI_EOB1 && _vm->gameFlags().platform == Common::kPlatformPC98))
+ _waitButtonFont = Screen::FID_SJIS_FNT;
+
_textDimData = new TextDimData[_screen->screenDimTableCount()];
for (int i = 0; i < 256; ++i)
@@ -140,7 +148,7 @@ void TextDisplayer_rpg::displayText(char *str, ...) {
int sdx = _screen->curDimIndex();
bool sjisTextMode = (_pc98TextMode && (sdx == 3 || sdx == 4 || sdx == 5 || sdx == 15)) ? true : false;
- int sjisOffs = (sjisTextMode || _vm->game() == GI_EOB2) ? 8 : 9;
+ int sjisOffs = (sjisTextMode || _vm->game() != GI_LOL) ? 8 : 9;
Screen::FontId of = (_vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns) ? _screen->setFont(Screen::FID_8_FNT) : _screen->_currentFont;
uint16 charsPerLine = (sd->w << 3) / (_screen->getFontWidth() + _screen->_charWidth);
@@ -174,6 +182,8 @@ void TextDisplayer_rpg::displayText(char *str, ...) {
_currentLine[_numCharsLeft] = '\0';
_lineWidth += sjisOffs;
+ if (_vm->game() == GI_EOB1 && ((sd->w << 3) - sjisOffs) <= (_textDimData[sdx].column + _lineWidth))
+ printLine(_currentLine);
c = parseCommand();
continue;
}
@@ -218,6 +228,7 @@ void TextDisplayer_rpg::displayText(char *str, ...) {
_sjisTextModeLineBreak = true;
printLine(_currentLine);
_sjisTextModeLineBreak = false;
+ //_lineWidth = 0;
_lineCount++;
_textDimData[sdx].column = 0;
_textDimData[sdx].line++;
@@ -309,7 +320,8 @@ void TextDisplayer_rpg::readNextPara() {
void TextDisplayer_rpg::printLine(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_LOL) ? 8 : 9;
int fh = (_screen->_currentFont == Screen::FID_SJIS_TEXTMODE_FNT) ? 9 : (_screen->getFontHeight() + _screen->_charOffset);
int lines = (sd->h - _screen->_charOffset) / fh;
@@ -379,7 +391,7 @@ void TextDisplayer_rpg::printLine(char *str) {
for (int i = 0; i < s; ++i) {
uint8 cu = (uint8) str[i];
if (cu >= 0xE0 || (cu > 0x80 && cu < 0xA0))
- twoByteCharOffs = 8;
+ twoByteCharOffs = (_vm->game() == GI_EOB1) ? 16 : 8;
}
}
@@ -401,7 +413,7 @@ void TextDisplayer_rpg::printLine(char *str) {
for (strPos = 0; strPos < s; ++strPos) {
uint8 cu = (uint8) str[strPos];
if (cu >= 0xE0 || (cu > 0x80 && cu < 0xA0)) {
- lw += 9;
+ lw += sjisOffs;
strPos++;
} else {
lw += _screen->getCharWidth((uint8)c);
@@ -585,7 +597,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 (_pc98TextMode) {
_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);
@@ -599,7 +611,7 @@ void TextDisplayer_rpg::textPageBreak() {
SWAP(_vm->_dialogueButtonLabelColor1, _vm->_dialogueButtonLabelColor2);
int cp = _screen->setCurPage(0);
- 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));
+ Screen::FontId cf = _screen->setFont(_waitButtonFont);
if (_vm->game() == GI_LOL)
_vm->_timer->pauseSingleTimer(11, true);
@@ -643,15 +655,14 @@ void TextDisplayer_rpg::textPageBreak() {
w = _vm->guiSettings()->buttons.waitWidth[_waitButtonMode];
}
- if (_vm->gameFlags().use16ColorMode) {
+ if (_vm->game() == GI_LOL && _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 {
- int yOffs = (_vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns) ? 1 : 2;
_screen->set16bitShadingLevel(4);
_vm->gui_drawBox(x, y, w, _vm->guiSettings()->buttons.height, _vm->guiSettings()->colors.frame1, _vm->guiSettings()->colors.frame2, _vm->guiSettings()->colors.fill);
_screen->set16bitShadingLevel(0);
- _screen->printText(_pageBreakString, x + (w >> 1) - (_vm->screen()->getTextWidth(_pageBreakString) >> 1), y + yOffs, _vm->_dialogueButtonLabelColor1, 0);
+ _screen->printText(_pageBreakString, x + (w >> 1) - (_vm->screen()->getTextWidth(_pageBreakString) >> 1), y + _vm->guiSettings()->buttons.txtOffsY, _vm->_dialogueButtonLabelColor1, 0);
}
_vm->removeInputTop();
@@ -696,7 +707,7 @@ void TextDisplayer_rpg::textPageBreak() {
} while (loop && !_vm->shouldQuit());
_screen->set16bitShadingLevel(4);
- if (_vm->gameFlags().use16ColorMode)
+ if (_vm->game() == GI_LOL && _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 + _vm->guiSettings()->buttons.height - 1, _textDimData[_screen->curDimIndex()].color2);
diff --git a/engines/kyra/text/text_rpg.h b/engines/kyra/text/text_rpg.h
index 68a5b51dd0..ed7940d7f7 100644
--- a/engines/kyra/text/text_rpg.h
+++ b/engines/kyra/text/text_rpg.h
@@ -26,10 +26,10 @@
#define KYRA_TEXT_EOB_H
#include "common/scummsys.h"
+#include "kyra/graphics/screen.h"
namespace Kyra {
-class Screen;
class KyraRpgEngine;
class TextDisplayer_rpg {
@@ -111,6 +111,8 @@ private:
char *_table1;
char *_table2;
+ Screen::FontId _waitButtonFont;
+
uint8 _colorMap[256];
};