aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorathrxx2019-11-26 22:07:32 +0100
committerathrxx2019-12-18 20:50:44 +0100
commit5a1162e99929d4a4d6351f91b8527fc0f205ad0f (patch)
tree1c4783b434cf9f4dbd1d26342b9f675ac26ab852 /engines/kyra
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')
-rw-r--r--engines/kyra/engine/chargen.cpp3
-rw-r--r--engines/kyra/engine/eob.cpp12
-rw-r--r--engines/kyra/engine/eob.h1
-rw-r--r--engines/kyra/engine/eobcommon.cpp10
-rw-r--r--engines/kyra/engine/kyra_rpg.cpp8
-rw-r--r--engines/kyra/engine/kyra_rpg.h1
-rw-r--r--engines/kyra/engine/magic_eob.cpp2
-rw-r--r--engines/kyra/engine/timer_eob.cpp2
-rw-r--r--engines/kyra/graphics/screen.cpp33
-rw-r--r--engines/kyra/graphics/screen.h130
-rw-r--r--engines/kyra/graphics/screen_eob.cpp349
-rw-r--r--engines/kyra/graphics/screen_eob.h150
-rw-r--r--engines/kyra/gui/gui_eob.cpp89
-rw-r--r--engines/kyra/gui/saveload_eob.cpp2
-rw-r--r--engines/kyra/resource/staticres_eob.cpp19
-rw-r--r--engines/kyra/resource/staticres_lol.cpp2
-rw-r--r--engines/kyra/text/text_rpg.cpp33
-rw-r--r--engines/kyra/text/text_rpg.h4
18 files changed, 548 insertions, 302 deletions
diff --git a/engines/kyra/engine/chargen.cpp b/engines/kyra/engine/chargen.cpp
index 6ddc360630..a1bd85ad9d 100644
--- a/engines/kyra/engine/chargen.cpp
+++ b/engines/kyra/engine/chargen.cpp
@@ -980,8 +980,9 @@ void CharacterGenerator::printStats(int index, int mode) {
}
void CharacterGenerator::processNameInput(int index, int textColor) {
- Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
+ Screen::FontId of = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
_screen->fillRect(_chargenNameFieldX[index], _chargenNameFieldY[index], _chargenNameFieldX[index] + 59, _chargenNameFieldY[index] + 5, _vm->guiSettings()->colors.guiColorBlack);
+ _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_SMALL_FNT : Screen::FID_6_FNT);
int xOffs = (60 - _screen->getTextWidth(_characters[index].name)) >> 1;
_screen->printText(_characters[index].name, _chargenNameFieldX[index] + xOffs, _chargenNameFieldY[index], textColor, 0);
_screen->updateScreen();
diff --git a/engines/kyra/engine/eob.cpp b/engines/kyra/engine/eob.cpp
index d9c401b385..bb8627fb04 100644
--- a/engines/kyra/engine/eob.cpp
+++ b/engines/kyra/engine/eob.cpp
@@ -70,11 +70,13 @@ Common::Error EoBEngine::init() {
_screen->modifyScreenDim(7, 0x01, 0xB3, 0x22, 0x12);
_screen->modifyScreenDim(9, 0x01, 0x7D, 0x26, 0x3F);
- _screen->modifyScreenDim(12, 0x01, 0x04, 0x14, 0xA0);
- // adjust main menu coords for EOB I PC-98
- if (_flags.platform == Common::kPlatformPC98)
+ if (_flags.platform == Common::kPlatformPC98) {
_screen->modifyScreenDim(28, 0x0A, 0xA4, 0x15, 0x18);
+ _screen->modifyScreenDim(12, 0x01, 0x04, 0x14, 0x9A);
+ } else {
+ _screen->modifyScreenDim(12, 0x01, 0x04, 0x14, 0xA0);
+ }
_scriptTimersCount = 1;
@@ -628,8 +630,10 @@ void EoBEngine::healParty() {
const KyraRpgGUISettings *EoBEngine::guiSettings() const {
if (_flags.platform == Common::kPlatformAmiga)
return _useMainMenuGUISettings ? &_guiSettingsAmigaMainMenu : &_guiSettingsAmiga;
- else if (_flags.platform == Common::kPlatformPC98 || _configRenderMode == Common::kRenderCGA || _configRenderMode == Common::kRenderEGA)
+ else if (_configRenderMode == Common::kRenderCGA || _configRenderMode == Common::kRenderEGA)
return &_guiSettingsEGA;
+ else if (_flags.platform == Common::kPlatformPC98)
+ return &_guiSettingsPC98;
else
return &_guiSettingsVGA;
}
diff --git a/engines/kyra/engine/eob.h b/engines/kyra/engine/eob.h
index 309636e7f9..174f9b9c7a 100644
--- a/engines/kyra/engine/eob.h
+++ b/engines/kyra/engine/eob.h
@@ -148,6 +148,7 @@ private:
static const KyraRpgGUISettings _guiSettingsVGA;
static const KyraRpgGUISettings _guiSettingsEGA;
+ static const KyraRpgGUISettings _guiSettingsPC98;
static const KyraRpgGUISettings _guiSettingsAmiga;
static const KyraRpgGUISettings _guiSettingsAmigaMainMenu;
static const uint8 _egaDefaultPalette[];
diff --git a/engines/kyra/engine/eobcommon.cpp b/engines/kyra/engine/eobcommon.cpp
index 238f1404bd..fc0f563e1b 100644
--- a/engines/kyra/engine/eobcommon.cpp
+++ b/engines/kyra/engine/eobcommon.cpp
@@ -675,7 +675,7 @@ void EoBCoreEngine::runLoop() {
_flashShapeTimer = 0;
_drawSceneTimer = _system->getMillis();
- _screen->setFont(Screen::FID_6_FNT);
+ _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
_screen->setScreenDim(7);
_runFlag = true;
@@ -719,10 +719,10 @@ bool EoBCoreEngine::checkPartyStatus(bool handleDeath) {
gui_drawAllCharPortraitsWithStats();
if (checkPartyStatusExtra()) {
- _screen->setFont(Screen::FID_8_FNT);
+ Screen::FontId of = _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
gui_updateControls();
if (_gui->runLoadMenu(0, 0)) {
- _screen->setFont(Screen::FID_6_FNT);
+ _screen->setFont(of);
return true;
}
}
@@ -1720,7 +1720,7 @@ int EoBCoreEngine::runDialogue(int dialogueTextId, int numStr, ...) {
void EoBCoreEngine::restParty_displayWarning(const char *str) {
int od = _screen->curDimIndex();
_screen->setScreenDim(7);
- Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
+ Screen::FontId of = _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
_screen->setCurPage(0);
_txt->printMessage(Common::String::format("\r%s\r", str).c_str());
@@ -1737,7 +1737,7 @@ bool EoBCoreEngine::restParty_updateMonsters() {
for (int i = 0; i < 5; i++) {
_partyResting = true;
- Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
+ Screen::FontId of = _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
int od = _screen->curDimIndex();
_screen->setScreenDim(7);
updateMonsters(0);
diff --git a/engines/kyra/engine/kyra_rpg.cpp b/engines/kyra/engine/kyra_rpg.cpp
index 9a41c0269c..fc3e04d95b 100644
--- a/engines/kyra/engine/kyra_rpg.cpp
+++ b/engines/kyra/engine/kyra_rpg.cpp
@@ -232,17 +232,19 @@ void KyraRpgEngine::drawDialogueButtons() {
for (int i = 0; i < _dialogueNumButtons; i++) {
int x = _dialogueButtonPosX[i];
- if (_flags.lang == Common::JA_JPN && _flags.use16ColorMode) {
+ if (_flags.gameID == GI_LOL && _flags.use16ColorMode) {
gui_drawBox(x, ((_dialogueButtonYoffs + _dialogueButtonPosY[i]) & ~7) - 1, 74, 10, 0xEE, 0xCC, -1);
screen()->printText(_dialogueButtonString[i], (x + 37 - (screen()->getTextWidth(_dialogueButtonString[i])) / 2) & ~3,
((_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2) & ~7, _dialogueHighlightedButton == i ? 0xC1 : 0xE1, 0);
} else {
- int sjisYOffset = (_flags.gameID == GI_EOB2 && _flags.platform == Common::kPlatformFMTowns) ? 1 : ((_flags.lang == Common::JA_JPN && (_dialogueButtonString[i][0] & 0x80)) ? 2 : 0);
+ int yOffset = guiSettings()->buttons.txtOffsY;
+ if (_flags.gameID == GI_LOL && _flags.lang == Common::JA_JPN && (_dialogueButtonString[i][0] & 0x80))
+ yOffset = 0;
screen()->set16bitShadingLevel(4);
gui_drawBox(x, (_dialogueButtonYoffs + _dialogueButtonPosY[i]), _dialogueButtonWidth, guiSettings()->buttons.height, guiSettings()->colors.frame1, guiSettings()->colors.frame2, guiSettings()->colors.fill);
screen()->set16bitShadingLevel(0);
screen()->printText(_dialogueButtonString[i], x + (_dialogueButtonWidth >> 1) - (screen()->getTextWidth(_dialogueButtonString[i])) / 2,
- (_dialogueButtonYoffs + _dialogueButtonPosY[i]) + 2 - sjisYOffset, _dialogueHighlightedButton == i ? _dialogueButtonLabelColor1 : _dialogueButtonLabelColor2, 0);
+ (_dialogueButtonYoffs + _dialogueButtonPosY[i]) + yOffset, _dialogueHighlightedButton == i ? _dialogueButtonLabelColor1 : _dialogueButtonLabelColor2, 0);
}
}
screen()->setFont(of);
diff --git a/engines/kyra/engine/kyra_rpg.h b/engines/kyra/engine/kyra_rpg.h
index 8c88a9dfdd..eb23c086e6 100644
--- a/engines/kyra/engine/kyra_rpg.h
+++ b/engines/kyra/engine/kyra_rpg.h
@@ -86,6 +86,7 @@ struct KyraRpgGUISettings {
uint8 labelColor2;
uint16 width;
uint16 height;
+ int16 txtOffsY;
int waitReserve;
uint16 waitX[2];
uint8 waitY[2];
diff --git a/engines/kyra/engine/magic_eob.cpp b/engines/kyra/engine/magic_eob.cpp
index b6add0888a..d615077842 100644
--- a/engines/kyra/engine/magic_eob.cpp
+++ b/engines/kyra/engine/magic_eob.cpp
@@ -238,7 +238,7 @@ void EoBCoreEngine::removeCharacterEffect(int spell, int charIndex, int showWarn
if (showWarning) {
int od = _screen->curDimIndex();
- Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
+ Screen::FontId of = _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
_screen->setScreenDim(7);
printWarning(Common::String::format(_magicStrings3[_flags.gameID == GI_EOB1 ? 3 : 2], c->name, s->name).c_str());
_screen->setScreenDim(od);
diff --git a/engines/kyra/engine/timer_eob.cpp b/engines/kyra/engine/timer_eob.cpp
index 8bc81b324a..f12f986152 100644
--- a/engines/kyra/engine/timer_eob.cpp
+++ b/engines/kyra/engine/timer_eob.cpp
@@ -305,7 +305,7 @@ void EoBCoreEngine::timerSpecialCharacterUpdate(int timerNum) {
}
int od = _screen->curDimIndex();
- Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
+ Screen::FontId of = _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
_screen->setScreenDim(7);
switch (evt) {
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index 268cf36094..dd22507c3e 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -68,6 +68,7 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system, const ScreenDim *dimTable, co
_currentFont = FID_8_FNT;
_currentFontType = FTYPE_ASCII;
_paletteChanged = true;
+ _textMarginRight = SCREEN_W;
_curDim = 0;
}
@@ -163,20 +164,23 @@ bool Screen::init() {
if (_useSJIS) {
Common::SharedPtr<Graphics::FontSJIS> font(Graphics::FontSJIS::createFont(_vm->gameFlags().platform));
-
if (!font.get())
error("Could not load any SJIS font, neither the original nor ScummVM's 'SJIS.FNT'");
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);
+ _fonts[FID_SJIS_TEXTMODE_FNT] = new SJISFont(font, _sjisInvisibleColor, true, false, 0);
+ if (_vm->game() == GI_EOB1) {
+ int temp;
+ _fonts[FID_SJIS_FNT] = new SJISFontEoB1PC98(font, 12, _vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable1, temp), _vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable2, temp));
+ }
} 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);
+ _fonts[FID_SJIS_FNT] = new SJISFont(font, _sjisInvisibleColor, false, _vm->game() != GI_LOL && _vm->game() != GI_EOB2, _vm->game() == GI_LOL ? 1 : 0);
}
- if (_vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns)
- _fonts[FID_SJIS_LARGE_FNT] = new SJISFontLarge(font);
+ if (_vm->game() == GI_EOB2 && _vm->gameFlags().platform == Common::kPlatformFMTowns) {
+ _fonts[FID_SJIS_FNT]->setStyle(Font::kFSFat);
+ _fonts[FID_SJIS_LARGE_FNT] = new SJISFontLarge(font);
+ }
}
}
@@ -1383,13 +1387,6 @@ bool Screen::loadFont(FontId fontId, const char *filename) {
if (!fnt) {
if (_vm->game() == GI_KYRA1 && _isAmiga)
fnt = new AMIGAFont();
-#ifdef ENABLE_EOB
- else if (_isAmiga)
- fnt = new AmigaDOSFont(_vm->resource(), _vm->game() == GI_EOB2 && _vm->gameFlags().lang == Common::DE_DEU);
- else if (_vm->game() == GI_EOB1 || _vm->game() == GI_EOB2)
- // We use normal VGA rendering in EOB II, since we do the complete EGA dithering in updateScreen().
- fnt = new OldDOSFont(_useHiResEGADithering ? Common::kRenderVGA : _renderMode);
-#endif // ENABLE_EOB
else
fnt = new DOSFont();
@@ -1498,7 +1495,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2
y += (charHeightFnt + _charOffset);
} else {
int charWidth = getCharWidth(c);
- if (x + charWidth > SCREEN_W) {
+ if (x + charWidth > _textMarginRight) {
x = x_start;
y += (charHeightFnt + _charOffset);
if (y >= SCREEN_H)
@@ -3785,8 +3782,8 @@ void AMIGAFont::unload() {
memset(_chars, 0, sizeof(_chars));
}
-SJISFont::SJISFont(Common::SharedPtr<Graphics::FontSJIS> &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) {
+SJISFont::SJISFont(Common::SharedPtr<Graphics::FontSJIS> &font, const uint8 invisColor, bool is16Color, bool drawOutline, int extraSpacing)
+ : _colorMap(0), _font(font), _invisColor(invisColor), _isTextMode(is16Color), _style(kFSNone), _drawOutline(drawOutline), _sjisWidthOffset(extraSpacing) {
assert(_font);
_sjisWidth = _font->getMaxFontWidth() >> 1;
_fontHeight = _font->getFontHeight() >> 1;
@@ -3830,7 +3827,7 @@ void SJISFont::drawChar(uint16 c, byte *dst, int pitch, int) const {
else
_font->setDrawingMode(_drawOutline ? Graphics::FontSJIS::kOutlineMode : Graphics::FontSJIS::kDefaultMode);
- _font->toggleFatPrint(_fatPrint);
+ _font->toggleFatPrint(_style == kFSFat);
_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 8f86a18615..d90e1cdfea 100644
--- a/engines/kyra/graphics/screen.h
+++ b/engines/kyra/graphics/screen.h
@@ -98,6 +98,17 @@ public:
* Sets a text 16bit palette map. Only used in in EOB II FM-Towns. The map contains 2 entries.
*/
virtual void set16bitColorMap(const uint16 *src) {}
+
+ enum FontStyle {
+ kFSNone = 0,
+ kFSLeftShadow,
+ kFSFat
+ };
+
+ /**
+ * Sets a drawing style. Only rudimentary implementation based on what is needed.
+ */
+ virtual void setStyle(FontStyle style) {}
/**
* Draws a specific character.
@@ -144,115 +155,6 @@ private:
uint16 *_bitmapOffsets;
};
-#ifdef ENABLE_EOB
-/**
-* Implementation of the Font interface for old DOS fonts used
-* in EOB and EOB II.
-*
-*/
-class OldDOSFont : public Font {
-public:
- OldDOSFont(Common::RenderMode mode);
- ~OldDOSFont();
-
- bool load(Common::SeekableReadStream &file);
- int getHeight() const { return _height; }
- int getWidth() const { return _width; }
- int getCharWidth(uint16 c) const;
- void setColorMap(const uint8 *src) { _colorMap8bit = src; }
- void set16bitColorMap(const uint16 *src) { _colorMap16bit = src; }
- void drawChar(uint16 c, byte *dst, int pitch, int bpp) const;
-
-private:
- void unload();
-
- uint8 *_data;
- uint16 *_bitmapOffsets;
-
- int _width, _height;
- const uint8 *_colorMap8bit;
- const uint16 *_colorMap16bit;
-
- int _numGlyphs;
-
- Common::RenderMode _renderMode;
-
- static uint16 *_cgaDitheringTable;
- static int _numRef;
-};
-
-/**
- * Implementation of the Font interface for native AmigaDOS system fonts (normally to be loaded via diskfont.library)
- */
-class Resource;
-class AmigaDOSFont : public Font {
-public:
- AmigaDOSFont(Resource *res, bool needsLocalizedFont = false);
- ~AmigaDOSFont() { unload(); }
-
- bool load(Common::SeekableReadStream &file);
- int getHeight() const { return _height; }
- int getWidth() const { return _width; }
- int getCharWidth(uint16 c) const;
- void setColorMap(const uint8 *src) { _colorMap = src; }
- void drawChar(uint16 c, byte *dst, int pitch, int) const;
-
- static void errorDialog(int index);
-
-private:
- void unload();
-
- struct TextFont {
- TextFont() : data(0), bitmap(0), location(0), spacing(0), kerning(0), height(0), width(0), baseLine(0), firstChar(0), lastChar(0), modulo(0) {}
- ~TextFont() {
- delete[] data;
- }
-
- uint16 height;
- uint16 width;
- uint16 baseLine;
- uint8 firstChar;
- uint8 lastChar;
- uint16 modulo;
- const uint8 *data;
- const uint8 *bitmap;
- const uint16 *location;
- const int16 *spacing;
- const int16 *kerning;
- };
-
- TextFont *loadContentFile(const Common::String fileName);
- void selectMode(int mode);
-
- struct FontContent {
- FontContent() : height(0), style(0), flags(0) {}
- ~FontContent() {
- data.reset();
- }
-
- Common::String contentFile;
- Common::SharedPtr<TextFont> data;
- uint16 height;
- uint8 style;
- uint8 flags;
- };
-
- int _width, _height;
- uint8 _first, _last;
- FontContent *_content;
- uint16 _numElements;
- uint16 _selectedElement;
-
- const uint8 *_colorMap;
- const uint16 _maxPathLen;
- const bool _needsLocalizedFont;
-
- static uint8 _errorDialogDisplayed;
-
- Resource *_res;
-};
-#endif // ENABLE_EOB
-
/**
* Implementation of the Font interface for Kyra 1 style (non-native AmigaDOS) AMIGA fonts.
*/
@@ -290,7 +192,7 @@ private:
*/
class SJISFont : public Font {
public:
- SJISFont(Common::SharedPtr<Graphics::FontSJIS> &font, const uint8 invisColor, bool is16Color, bool drawOutline, bool fatPrint, int extraSpacing);
+ SJISFont(Common::SharedPtr<Graphics::FontSJIS> &font, const uint8 invisColor, bool is16Color, bool drawOutline, int extraSpacing);
virtual ~SJISFont() {}
virtual bool usesOverlay() const { return true; }
@@ -298,8 +200,9 @@ public:
bool load(Common::SeekableReadStream &) { return true; }
int getHeight() const;
int getWidth() const;
- int getCharWidth(uint16 c) const;
+ virtual int getCharWidth(uint16 c) const;
void setColorMap(const uint8 *src);
+ void setStyle(FontStyle style) { _style = style; }
virtual void drawChar(uint16 c, byte *dst, int pitch, int) const;
protected:
@@ -308,7 +211,7 @@ protected:
int _sjisWidth, _asciiWidth;
int _fontHeight;
const bool _drawOutline;
- const bool _fatPrint;
+ FontStyle _style;
private:
const uint8 _invisColor;
@@ -587,6 +490,9 @@ public:
void setScreenDim(int dim);
int curDimIndex() const { return _curDimIndex; }
+ void setTextMarginRight(int x) { _textMarginRight = x; }
+ uint16 _textMarginRight;
+
const ScreenDim *_curDim;
// shape handling
diff --git a/engines/kyra/graphics/screen_eob.cpp b/engines/kyra/graphics/screen_eob.cpp
index 93be64ae3b..371b673760 100644
--- a/engines/kyra/graphics/screen_eob.cpp
+++ b/engines/kyra/graphics/screen_eob.cpp
@@ -92,6 +92,8 @@ bool Screen_EoB::init() {
_convertHiColorBuffer = new uint8[SCREEN_H * SCREEN_W];
enableHiColorMode(true);
loadFont(FID_SJIS_SMALL_FNT, "FONT.DMP");
+ } else if (_vm->game() == GI_EOB1 && _vm->gameFlags().platform == Common::kPlatformPC98) {
+ loadFont(FID_SJIS_SMALL_FNT, "FONT12.FNT");
}
if (_vm->gameFlags().useHiRes && _renderMode == Common::kRenderEGA) {
@@ -145,7 +147,7 @@ void Screen_EoB::setClearScreenDim(int dim) {
void Screen_EoB::clearCurDim() {
static const uint8 amigaColorMap[16] = { 0x00, 0x06, 0x1d, 0x1b, 0x1a, 0x17, 0x18, 0x0e, 0x19, 0x1c, 0x1c, 0x1e, 0x13, 0x0a, 0x11, 0x1f };
- fillRect(_curDim->sx << 3, _curDim->sy, ((_curDim->sx + _curDim->w) << 3) - 1, (_curDim->sy + _curDim->h) - 1, _isAmiga ? amigaColorMap[_curDim->unkA] : _curDim->unkA);
+ fillRect(_curDim->sx << 3, _curDim->sy, ((_curDim->sx + _curDim->w) << 3) - 1, (_curDim->sy + _curDim->h) - 1, _isAmiga ? amigaColorMap[_curDim->unkA] : _use16ColorMode ? 0 : _curDim->unkA);
}
void Screen_EoB::setMouseCursor(int x, int y, const byte *shape) {
@@ -236,14 +238,21 @@ void Screen_EoB::loadFileDataToPage(Common::SeekableReadStream *s, int pageNum,
}
void Screen_EoB::printShadedText(const char *string, int x, int y, int col1, int col2, int shadowCol) {
- if (_vm->gameFlags().platform != Common::kPlatformFMTowns) {
+ if (_vm->gameFlags().lang != Common::JA_JPN) {
printText(string, x - 1, y, shadowCol, col2);
printText(string, x, y + 1, shadowCol, 0);
printText(string, x - 1, y + 1, shadowCol, 0);
} else if (col2) {
fillRect(x, y, x + getTextWidth(string) - 1, y + getFontHeight() - 1, col2);
}
+
+ if (_vm->gameFlags().use16ColorMode)
+ _fonts[_currentFont]->setStyle(Font::kFSLeftShadow);
+
printText(string, x, y, col1, 0);
+
+ if (_vm->gameFlags().use16ColorMode)
+ _fonts[_currentFont]->setStyle(Font::kFSNone);
}
void Screen_EoB::loadShapeSetBitmap(const char *file, int tempPage, int destPage) {
@@ -1472,19 +1481,23 @@ const uint8 *Screen_EoB::getEGADitheringTable() {
}
bool Screen_EoB::loadFont(FontId fontId, const char *filename) {
- if (scumm_stricmp(filename, "FONT.DMP"))
- return Screen::loadFont(fontId, filename);
-
Font *&fnt = _fonts[fontId];
- int temp;
+ int temp = 0;
+ if (fnt)
+ delete fnt;
+
+ if (!scumm_stricmp(filename, "FONT.DMP"))
+ fnt = new SJISFont12x12(_vm->staticres()->loadRawDataBe16(kEoB2FontDmpSearchTbl, temp));
+ else if (!scumm_stricmp(filename, "FONT12.FNT"))
+ fnt = new Font12x12PC98(12, _vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable1, temp),
+ _vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable2, temp), _vm->staticres()->loadRawData(kEoB1FontLookupTable, temp));
+ else if (_isAmiga)
+ fnt = new AmigaDOSFont(_vm->resource(), _vm->game() == GI_EOB2 && _vm->gameFlags().lang == Common::DE_DEU);
+ else
+ // We use normal VGA rendering in EOB II, since we do the complete EGA dithering in updateScreen().
+ fnt = new OldDOSFont(_useHiResEGADithering ? Common::kRenderVGA : _renderMode, 12);
- const uint16 *tbl = _vm->staticres()->loadRawDataBe16(kEoB2FontDmpSearchTbl, temp);
- assert(tbl);
-
- if (!fnt) {
- fnt = new SJISFont12x12(tbl);
- assert(fnt);
- }
+ assert(fnt);
Common::SeekableReadStream *file = _vm->resource()->createReadStream(filename);
if (!file)
@@ -2037,10 +2050,11 @@ const uint8 Screen_EoB::_egaMatchTable[] = {
uint16 *OldDOSFont::_cgaDitheringTable = 0;
int OldDOSFont::_numRef = 0;
-OldDOSFont::OldDOSFont(Common::RenderMode mode) : _renderMode(mode) {
+OldDOSFont::OldDOSFont(Common::RenderMode mode, uint8 shadowColor) : _renderMode(mode), _shadowColor(shadowColor) {
_data = 0;
_width = _height = _numGlyphs = 0;
_bitmapOffsets = 0;
+ _style = kFSNone;
_numRef++;
if (!_cgaDitheringTable && _numRef == 1) {
@@ -2097,61 +2111,35 @@ int OldDOSFont::getCharWidth(uint16 c) const {
return _width;
}
+void OldDOSFont::setColorMap(const uint8 *src) {
+ _colorMap8bit = src;
+}
+
void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch, int bpp) const {
- static const uint8 renderMaskTable6[] = { 0xFC, 0x00, 0x7E, 0x00, 0x3F, 0x00, 0x1F, 0x80, 0x0F, 0xC0, 0x07, 0xE0, 0x03, 0xF0, 0x01, 0xF8 };
- static const uint8 renderMaskTable8[] = { 0xFF, 0x00, 0x7F, 0x80, 0x3F, 0xC0, 0x1F, 0xE0, 0x0F, 0xF0, 0x07, 0xF8, 0x03, 0xFC, 0x01, 0xFE };
+ uint16 color1 = _colorMap8bit[1];
+ uint16 color2 = _colorMap8bit[0];
- if (_width != 8 && _width != 6)
- error("EOB font rendering not implemented for other font widths than 6 and 8.");
+ if (_style == kFSLeftShadow) {
+ drawCharIntern(c, dst + pitch, pitch, 1, _shadowColor, 0);
+ drawCharIntern(c, dst - 1, pitch, 1, _shadowColor, 0);
+ drawCharIntern(c, dst - 1 + pitch, pitch, 1, _shadowColor, 0);
+ }
- if (_width == 6) {
- switch (c) {
- case 0x81:
- case 0x9A:
- c = 0x5D;
- break;
- case 0x84:
- case 0x8E:
- c = 0x5B;
- break;
- case 0x94:
- case 0x99:
- c = 0x40;
- case 0xE1:
- // TODO: recheck this: no conversion for 'ß' ?
- break;
- default:
- break;
- }
- } else if (_width == 8) {
- switch (c) {
- case 0x81:
- case 0x9A:
- case 0x5D:
- c = 0x1D;
- break;
- case 0x84:
- case 0x5B:
- c = 0x1E;
- break;
- case 0x94:
- case 0x40:
- c = 0x1F;
- break;
- case 0x8E:
- c = 0x1B;
- break;
- case 0x99:
- c = 0x1C;
- break;
- case 0xE1:
- c = 0x19;
- break;
- default:
- break;
- }
+ if (bpp == 2) {
+ color1 = _colorMap16bit[1];
+ color2 = _colorMap16bit[0];
}
+ drawCharIntern(c, dst, pitch, bpp, color1, color2);
+}
+
+void OldDOSFont::drawCharIntern(uint16 c, byte *dst, int pitch, int bpp, int col1, int col2) const {
+ static const uint16 renderMaskTable[] = {
+ 0x0000, 0x8000, 0xc000, 0xe000, 0xf000, 0xf800, 0xfc00, 0xfe00, 0xff00, 0xff80, 0xffc0, 0xffe0, 0xfff0, 0xfff8, 0xfffc, 0xfffe, 0xffff
+ };
+
+ c = convert(c);
+
if (c >= _numGlyphs)
return;
@@ -2162,43 +2150,36 @@ void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch, int bpp) const {
int w = (_width - 1) >> 3;
pitch -= _width * bpp;
- uint16 color1 = _colorMap8bit[1];
- uint16 color2 = _colorMap8bit[0];
-
- if (bpp == 2) {
- color1 = _colorMap16bit[1];
- color2 = _colorMap16bit[0];
- } else if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderEGA) {
- color1 &= 0x0F;
- color2 &= 0x0F;
+ if (_renderMode == Common::kRenderCGA || _renderMode == Common::kRenderEGA) {
+ col1 &= 0x0F;
+ col2 &= 0x0F;
}
static const uint16 cgaColorMask[] = { 0, 0x5555, 0xAAAA, 0xFFFF };
- uint16 cgaMask1 = cgaColorMask[color1 & 3];
- uint16 cgaMask2 = cgaColorMask[color2 & 3];
+ uint16 cgaMask1 = cgaColorMask[col1 & 3];
+ uint16 cgaMask2 = cgaColorMask[col2 & 3];
int cH = _height;
while (cH--) {
int cW = w;
- uint8 last = 0;
- const uint8 *mtbl = _width == 8 ? renderMaskTable8 : renderMaskTable6;
+ uint16 mask = renderMaskTable[_width];
if (_renderMode == Common::kRenderCGA) {
- uint8 s = *src++;
- uint8 m = *mtbl++;
+ uint16 s = (*src++) << 8;
+ if (_width > 8)
+ s |= *src++;
- uint8 in = s | last;
uint16 cmp1 = 0;
uint16 cmp2 = 0;
- if (color1) {
- in &= m;
- cmp1 = _cgaDitheringTable[in];
+ if (col1) {
+ s &= mask;
+ cmp1 = _cgaDitheringTable[s >> 8];
}
- if (color2) {
- in = ~in & m;
- cmp2 = _cgaDitheringTable[in];
+ if (col2) {
+ s = ~s & mask;
+ cmp2 = _cgaDitheringTable[s >> 8];
}
uint16 cDst = 0;
@@ -2215,36 +2196,36 @@ void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch, int bpp) const {
*dst++ = (out >> sh) & 3;
sh = (sh - 2) & 0x0F;
}
-
- last = s;
-
} else {
for (bool runWidthLoop = true; runWidthLoop;) {
- uint8 s = *src++;
- uint8 m = *mtbl++;
+ uint16 s = (*src++) << 8;
+ if (_width > 8)
+ s |= *src++;
- for (uint8 i = 0x80; i; i >>= 1) {
- if (!(m & i)) {
+ for (uint16 i = 0x8000; i; i >>= 1) {
+ if (!(mask & i)) {
runWidthLoop = false;
break;
}
if (s & i) {
if (bpp == 2)
- *(uint16*)dst = color1;
- else if (color1)
- *dst = color1;
+ *(uint16*)dst = col1;
+ else if (col1)
+ *dst = col1;
} else {
if (bpp == 2) {
- if (color2 != 0xFFFF)
- *(uint16*)dst = color2;
- } else if (color2) {
- *dst = color2;
+ if (col2 != 0xFFFF)
+ *(uint16*)dst = col2;
+ } else if (col2) {
+ *dst = col2;
}
}
dst += bpp;
}
+ mask >>= 1;
+
if (cW)
cW--;
else
@@ -2257,6 +2238,53 @@ void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch, int bpp) const {
}
}
+uint16 OldDOSFont::convert(uint16 c) const {
+ if (_width == 6) {
+ switch (c) {
+ case 0x81:
+ case 0x9A:
+ c = 0x5D;
+ break;
+ case 0x84:
+ case 0x8E:
+ c = 0x5B;
+ break;
+ case 0x94:
+ case 0x99:
+ c = 0x40;
+ case 0xE1:
+ // TODO: recheck this: no conversion for 'ß' ?
+ break;
+ }
+ } else if (_width == 8) {
+ switch (c) {
+ case 0x81:
+ case 0x9A:
+ case 0x5D:
+ c = 0x1D;
+ break;
+ case 0x84:
+ case 0x5B:
+ c = 0x1E;
+ break;
+ case 0x94:
+ case 0x40:
+ c = 0x1F;
+ break;
+ case 0x8E:
+ c = 0x1B;
+ break;
+ case 0x99:
+ c = 0x1C;
+ break;
+ case 0xE1:
+ c = 0x19;
+ break;
+ }
+ }
+ return c;
+}
+
void OldDOSFont::unload() {
delete[] _data;
_data = 0;
@@ -2509,7 +2537,126 @@ void AmigaDOSFont::selectMode(int mode) {
_last = _content[mode].data->lastChar;
}
-SJISFontLarge::SJISFontLarge(Common::SharedPtr<Graphics::FontSJIS> &font) : SJISFont(font, 0, false, false, false, 0) {
+SJISFontEoB1PC98::SJISFontEoB1PC98(Common::SharedPtr<Graphics::FontSJIS> &font, uint8 shadowColor, const uint16 *convTable1, const uint16 *convTable2) : SJISFont(font, 0, false, false, 0),
+ _shadowColor(shadowColor), _convTable1(convTable1), _convTable2(convTable2), _defaultConv(true) {
+ assert(_convTable1);
+ assert(_convTable2);
+}
+
+int SJISFontEoB1PC98::getCharWidth(uint16 c) const {
+ return SJISFont::getCharWidth(convert(c));
+}
+
+void SJISFontEoB1PC98::drawChar(uint16 c, byte *dst, int pitch, int) const {
+ c = convert(c);
+ _font->setDrawingMode(_style == kFSLeftShadow ? Graphics::FontSJIS::kShadowLeftMode : Graphics::FontSJIS::kDefaultMode);
+ _font->toggleFatPrint(false);
+ _font->drawChar(dst, c, 640, 1, _colorMap[1], _colorMap[0], 640, 400);
+}
+
+uint16 SJISFontEoB1PC98::convert(uint16 c) const {
+ uint8 l = c & 0xFF;
+ uint8 h = c >> 8;
+
+ if (c < 128) {
+ c = _convTable2[l - 32];
+ } else if (l > 160 && l < 225) {
+ bool done = false;
+ if (_defaultConv) {
+ if (h == 0xDE) {
+ if ((l >= 182 && l <= 196) || (l >= 202 && l <= 206)) {
+ c = _convTable1[l - 182];
+ done = true;
+ }
+ } else if (h == 0xDF) {
+ if (l >= 202 && l <= 206) {
+ c = _convTable1[l - 177];
+ done = true;
+ }
+ }
+ }
+ if (!done)
+ c = _convTable2[l - 64];
+ }
+
+ return c;
+}
+
+Font12x12PC98::Font12x12PC98(uint8 shadowColor, const uint16 *convTable1, const uint16 *convTable2, const uint8 *lookupTable) : OldDOSFont(Common::kRenderDefault, 12),
+ _convTable1(convTable1), _convTable2(convTable2) {
+ assert(convTable1);
+ assert(convTable2);
+ assert(lookupTable);
+
+ _width = _height = 12;
+ _numGlyphs = 275;
+ _bmpOffs = new uint16[_numGlyphs];
+ for (int i = 0; i < _numGlyphs; ++i)
+ _bmpOffs[i] = lookupTable[i] * 24;
+}
+
+Font12x12PC98::~Font12x12PC98() {
+ delete[] _bmpOffs;
+}
+
+bool Font12x12PC98::load(Common::SeekableReadStream &file) {
+ unload();
+
+ _width = _height = 12;
+ _numGlyphs = 275;
+ _bitmapOffsets = _bmpOffs;
+
+ _data = new uint8[file.size()];
+ assert(_data);
+
+ file.read(_data, file.size());
+ if (file.err())
+ return false;
+
+ return true;
+}
+
+uint16 Font12x12PC98::convert(uint16 c) const {
+ uint8 l = c & 0xFF;
+ uint8 h = c >> 8;
+
+ if (c < 128) {
+ c = _convTable2[l - 32];
+ } else if (l > 160 && l < 225) {
+ bool done = false;
+ if (1) {
+ if (h == 0xDE) {
+ if ((l >= 182 && l <= 196) || (l >= 202 && l <= 206)) {
+ c = _convTable1[l - 182];
+ done = true;
+ }
+ } else if (h == 0xDF) {
+ if (l >= 202 && l <= 206) {
+ c = _convTable1[l - 177];
+ done = true;
+ }
+ }
+ }
+ if (!done)
+ c = _convTable2[l - 64];
+ }
+
+ c = SWAP_BYTES_16(c);
+ if (c < 0x813F)
+ c = 1;
+ else if (c < 0x824F)
+ c -= 0x813F;
+ else if (c < 0x833F)
+ c -= 0x81EE;
+ else if (c > 0x839F)
+ c = 1;
+ else
+ c -= 0x828D;
+
+ return c;
+}
+
+SJISFontLarge::SJISFontLarge(Common::SharedPtr<Graphics::FontSJIS> &font) : SJISFont(font, 0, false, false, 0) {
_sjisWidth = _font->getMaxFontWidth();
_fontHeight = _font->getFontHeight();
_asciiWidth = _font->getCharWidth('a');
diff --git a/engines/kyra/graphics/screen_eob.h b/engines/kyra/graphics/screen_eob.h
index 6d39ffe809..9c6e17caad 100644
--- a/engines/kyra/graphics/screen_eob.h
+++ b/engines/kyra/graphics/screen_eob.h
@@ -155,7 +155,155 @@ private:
};
/**
-* SJIS Font variant used in the intro and outro of EOB II FM-Towns. It appears twice as large, since it is not rendered on the hires overlay pages
+* Implementation of the Font interface for old DOS fonts used
+* in EOB and EOB II.
+*
+*/
+class OldDOSFont : public Font {
+public:
+ OldDOSFont(Common::RenderMode mode, uint8 shadowColor);
+ virtual ~OldDOSFont();
+
+ virtual bool load(Common::SeekableReadStream &file);
+ int getHeight() const { return _height; }
+ int getWidth() const { return _width; }
+ int getCharWidth(uint16 c) const;
+ void setColorMap(const uint8 *src);
+ void set16bitColorMap(const uint16 *src) { _colorMap16bit = src; }
+ virtual void setStyle(FontStyle style) { _style = style; }
+ void drawChar(uint16 c, byte *dst, int pitch, int bpp) const;
+
+protected:
+ void unload();
+
+ FontStyle _style;
+ const uint8 *_colorMap8bit;
+ uint8 *_data;
+ uint16 *_bitmapOffsets;
+ int _width, _height;
+ int _numGlyphs;
+ uint8 _shadowColor;
+
+private:
+ void drawCharIntern(uint16 c, byte *dst, int pitch, int bpp, int col1, int col2) const;
+ virtual uint16 convert(uint16 c) const;
+ Common::RenderMode _renderMode;
+ const uint16 *_colorMap16bit;
+
+ static uint16 *_cgaDitheringTable;
+ static int _numRef;
+};
+
+/**
+ * Implementation of the Font interface for native AmigaDOS system fonts (normally to be loaded via diskfont.library)
+ */
+class Resource;
+class AmigaDOSFont : public Font {
+public:
+ AmigaDOSFont(Resource *res, bool needsLocalizedFont = false);
+ ~AmigaDOSFont() { unload(); }
+
+ bool load(Common::SeekableReadStream &file);
+ int getHeight() const { return _height; }
+ int getWidth() const { return _width; }
+ int getCharWidth(uint16 c) const;
+ void setColorMap(const uint8 *src) { _colorMap = src; }
+ void drawChar(uint16 c, byte *dst, int pitch, int) const;
+
+ static void errorDialog(int index);
+
+private:
+ void unload();
+
+ struct TextFont {
+ TextFont() : data(0), bitmap(0), location(0), spacing(0), kerning(0), height(0), width(0), baseLine(0), firstChar(0), lastChar(0), modulo(0) {}
+ ~TextFont() {
+ delete[] data;
+ }
+
+ uint16 height;
+ uint16 width;
+ uint16 baseLine;
+ uint8 firstChar;
+ uint8 lastChar;
+ uint16 modulo;
+ const uint8 *data;
+ const uint8 *bitmap;
+ const uint16 *location;
+ const int16 *spacing;
+ const int16 *kerning;
+ };
+
+ TextFont *loadContentFile(const Common::String fileName);
+ void selectMode(int mode);
+
+ struct FontContent {
+ FontContent() : height(0), style(0), flags(0) {}
+ ~FontContent() {
+ data.reset();
+ }
+
+ Common::String contentFile;
+ Common::SharedPtr<TextFont> data;
+ uint16 height;
+ uint8 style;
+ uint8 flags;
+ };
+
+ int _width, _height;
+ uint8 _first, _last;
+ FontContent *_content;
+ uint16 _numElements;
+ uint16 _selectedElement;
+
+ const uint8 *_colorMap;
+ const uint16 _maxPathLen;
+ const bool _needsLocalizedFont;
+
+ static uint8 _errorDialogDisplayed;
+
+ Resource *_res;
+};
+
+/**
+* SJIS Font variant used in EOB I PC-98. It converts 1-byte characters into 2-byte characters and has a specific shadowing to the left.
+*/
+class SJISFontEoB1PC98 : public SJISFont {
+public:
+ SJISFontEoB1PC98(Common::SharedPtr<Graphics::FontSJIS> &font, uint8 shadowColor, const uint16 *convTable1, const uint16 *convTable2);
+ virtual ~SJISFontEoB1PC98() {}
+ virtual int getCharWidth(uint16 c) const;
+ virtual void drawChar(uint16 c, byte *dst, int pitch, int) const;
+
+private:
+ uint16 convert(uint16 c) const;
+ const uint16 *_convTable1, *_convTable2;
+ bool _defaultConv;
+ uint8 _shadowColor;
+};
+
+/**
+* OldDOSFont variant used in EOB I PC-98. It uses the same drawing routine, but has a different loader. It contains
+* ASCII and Katakana characters and requires several conversion tables to display these. It gets drawn on the SJIS overlay.
+*/
+class Font12x12PC98 : public OldDOSFont{
+public:
+ Font12x12PC98(uint8 shadowColor, const uint16 *convTable1, const uint16 *convTable2, const uint8 *lookupTable);
+ virtual ~Font12x12PC98();
+ bool usesOverlay() const { return true; }
+ int getHeight() const { return _height >> 1; }
+ int getWidth() const { return _width >> 1; }
+ int getCharWidth(uint16 c) const { return _width >> 1; };
+ virtual bool load(Common::SeekableReadStream &file);
+
+private:
+ virtual uint16 convert(uint16 c) const;
+ const uint16 *_convTable1, *_convTable2;
+ uint16 *_bmpOffs;
+};
+
+/**
+* SJIS Font variant used in the intro and outro of EOB II FM-Towns. It appears twice as large, since it is not rendered on the hires overlay pages.
*/
class SJISFontLarge : public SJISFont {
public:
diff --git a/engines/kyra/gui/gui_eob.cpp b/engines/kyra/gui/gui_eob.cpp
index adc5312702..37370b552d 100644
--- a/engines/kyra/gui/gui_eob.cpp
+++ b/engines/kyra/gui/gui_eob.cpp
@@ -103,16 +103,19 @@ void EoBCoreEngine::gui_drawCharPortraitWithStats(int index) {
if (_currentControlMode == 0) {
int x2 = charPortraitPosX[index & 1];
int y2 = charPortraitPosY[index >> 1];
- Screen::FontId cf = _screen->setFont(Screen::FID_6_FNT);
-
+
_screen->copyRegion(176, 168, x2 , y2, 64, 24, 2, 2, Screen::CR_NO_P_CHECK);
_screen->copyRegion(240, 168, x2, y2 + 24, 64, 26, 2, 2, Screen::CR_NO_P_CHECK);
int cp = _screen->setCurPage(2);
+ Screen::FontId cf = _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_SMALL_FNT : Screen::FID_6_FNT);
+
if (index == _exchangeCharacterId)
_screen->printText(_characterGuiStringsSt[0], x2 + 2, y2 + 2, guiSettings()->colors.guiColorDarkRed, guiSettings()->colors.fill);
else
- _screen->printText(c->name, x2 + 2, y2 + (_flags.platform == Common::kPlatformFMTowns ? 1 : 2), txtCol1, guiSettings()->colors.fill);
+ _screen->printText(c->name, x2 + 2, y2 + (_flags.platform == Common::kPlatformFMTowns ? 1 : 2), txtCol1, _flags.use16ColorMode ? 0 : guiSettings()->colors.fill);
+
+ _screen->setFont(Screen::FID_6_FNT);
gui_drawFaceShape(index);
gui_drawWeaponSlot(index, 0);
@@ -139,16 +142,17 @@ void EoBCoreEngine::gui_drawCharPortraitWithStats(int index) {
_screen->copyRegion(176, 0, 0, 0, 144, 168, 2, 2, Screen::CR_NO_P_CHECK);
_screen->_curPage = 2;
gui_drawFaceShape(index);
+ Screen::FontId cf = _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_SMALL_FNT : Screen::FID_6_FNT);
_screen->printShadedText(c->name, 219, 6, txtCol2, 0, guiSettings()->colors.guiColorBlack);
+ _screen->setFont(Screen::FID_6_FNT);
gui_drawHitpoints(index);
gui_drawFoodStatusGraph(index);
if (_currentControlMode == 1) {
- Screen::FontId cf = _screen->setFont(Screen::FID_6_FNT);
int statusTxtY = 158;
- if (_flags.platform == Common::kPlatformFMTowns) {
+ if (_flags.lang == Common::JA_JPN) {
statusTxtY = 157;
- _screen->setFont(Screen::FID_8_FNT);
+ _screen->setFont(_flags.platform == Common::kPlatformFMTowns ? Screen::FID_8_FNT : Screen::FID_SJIS_FNT);
}
if (c->hitPointsCur == -10)
@@ -164,12 +168,14 @@ void EoBCoreEngine::gui_drawCharPortraitWithStats(int index) {
else if (c->flags & 8)
_screen->printShadedText(_characterGuiStringsSt[6], 232, statusTxtY, guiSettings()->colors.guiColorLightRed, 0, guiSettings()->colors.guiColorBlack);
- _screen->setFont(cf);
+ _screen->setFont(Screen::FID_6_FNT);
for (int i = 0; i < 27; i++)
gui_drawInventoryItem(i, 0, 2);
gui_drawInventoryItem(16, 1, 2);
+ _screen->setFont(cf);
+
} else {
static const uint16 cm2X1[] = { 179, 272, 301 };
static const uint16 cm2Y1[] = { 36, 51, 51 };
@@ -179,6 +185,8 @@ void EoBCoreEngine::gui_drawCharPortraitWithStats(int index) {
for (int i = 0; i < 3; i++)
_screen->fillRect(cm2X1[i], cm2Y1[i], cm2X2[i], cm2Y2[i], guiSettings()->colors.sfill);
+ _screen->setFont(cf);
+
_screen->printShadedText(_characterGuiStringsIn[0], 183, 42, guiSettings()->colors.guiColorWhite, guiSettings()->colors.sfill, guiSettings()->colors.guiColorBlack);
_screen->printText(_chargenClassStrings[c->cClass], 183, 55, guiSettings()->colors.guiColorBlack, guiSettings()->colors.sfill);
_screen->printText(_chargenAlignmentStrings[c->alignment], 183, 62, guiSettings()->colors.guiColorBlack, guiSettings()->colors.sfill);
@@ -521,8 +529,10 @@ void EoBCoreEngine::gui_drawInventoryItem(int slot, int redraw, int pageNum) {
_screen->fillRect(227, 65, 238, 69, guiSettings()->colors.guiColorBlack);
int cnt = countQueuedItems(_characters[_updateCharNum].inventory[slot], -1, -1, 1, 1);
x = cnt >= 10 ? 227 : 233;
+ Screen::FontId cf = _screen->setFont(Screen::FID_6_FNT);
Common::String str = Common::String::format("%d", cnt);
_screen->printText(str.c_str(), x, 65, guiSettings()->colors.guiColorWhite, 0);
+ _screen->setFont(cf);
}
}
@@ -563,6 +573,8 @@ void EoBCoreEngine::gui_drawSpellbook() {
int numTab = (_flags.gameID == GI_EOB1) ? 5 : 6;
_screen->copyRegion(64, 121, 64, 121, 112, 56, 0, 2, Screen::CR_NO_P_CHECK);
+ Screen::FontId of = (_flags.gameID == GI_EOB1 && _flags.platform == Common::kPlatformPC98) ? _screen->setFont(Screen::FID_SJIS_SMALL_FNT) : _screen->_currentFont;
+
for (int i = 0; i < numTab; i++) {
int col1 = 0;
int col2 = 1;
@@ -627,12 +639,15 @@ void EoBCoreEngine::gui_drawSpellbook() {
col5 = textCol1;
}
+ int textCol3 = _flags.use16ColorMode ? 0 : textCol2;
+ int textCol4 = _flags.use16ColorMode ? 0 : col3;
+
for (int i = 0; i < 7; i++) {
int d = _openBookAvailableSpells[_openBookSpellLevel * 10 + _openBookSpellListOffset + i];
if (_openBookSpellSelectedItem == i) {
if (d >= 0 && i < 6 && (i + _openBookSpellListOffset) < 9) {
_screen->fillRect(textXs, 132 + 6 * i, textXs + _screen->getTextWidth(_openBookSpellList[d]) - 1, 137 + 6 * i, textCol2);
- _screen->printText(_openBookSpellList[d], textXs, 132 + 6 * i, textCol1, textCol2);
+ _screen->printText(_openBookSpellList[d], textXs, 132 + 6 * i, textCol1, textCol3);
} else if (i == 6) {
if (_flags.gameID == GI_EOB2)
_screen->fillRect(69, 169, 144, 175, textCol2);
@@ -640,7 +655,7 @@ void EoBCoreEngine::gui_drawSpellbook() {
}
} else {
if (d >= 0 && i < 6 && (i + _openBookSpellListOffset) < 9)
- _screen->printText(_openBookSpellList[d], textXs, 132 + 6 * i, textCol1, col3);
+ _screen->printText(_openBookSpellList[d], textXs, 132 + 6 * i, textCol1, textCol4);
else
_screen->printText(_magicStrings1[0], textXa, textY, col5, col4);
}
@@ -658,6 +673,7 @@ void EoBCoreEngine::gui_drawSpellbook() {
if (_openBookAvailableSpells[_openBookSpellLevel * 10 + 6] <= 0)
_screen->drawShape(2, _blackBoxWideGrid, 146, 168, 0);
+ _screen->setFont(of);
_screen->setCurPage(0);
_screen->copyRegion(64, 121, 64, 121, 112, 56, 2, 0, Screen::CR_NO_P_CHECK);
if (!_loading)
@@ -818,11 +834,12 @@ int EoBCoreEngine::clickedCamp(Button *button) {
_gui->runCampMenu();
+ _screen->fillRect(0, 0, 175, 143, 0, 2);
_screen->copyRegion(0, 0, 0, 120, 176, 24, 12, 2, Screen::CR_NO_P_CHECK);
_screen->setScreenDim(cd);
_thumbNail.free();
-
+
drawScene(0);
for (int i = 0; i < 6; i++)
@@ -2067,7 +2084,7 @@ void GUI_EoB::simpleMenu_flashSelection(const char *str, int x, int y, int color
}
void GUI_EoB::runCampMenu() {
- Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
+ Screen::FontId of = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
Button *highlightButton = 0;
Button *prevHighlightButton = 0;
@@ -2233,9 +2250,9 @@ void GUI_EoB::runCampMenu() {
_vm->dropCharacter(selectCharacterDialogue(53));
_vm->gui_drawPlayField(false);
_screen->copyRegion(0, 120, 0, 0, 176, 24, 0, 12, Screen::CR_NO_P_CHECK);
- _screen->setFont(Screen::FID_6_FNT);
+ Screen::FontId cfn = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
_vm->gui_drawAllCharPortraitsWithStats();
- _screen->setFont(Screen::FID_8_FNT);
+ _screen->setFont(cfn);
} else {
displayTextBox(45);
}
@@ -2349,7 +2366,7 @@ bool GUI_EoB::runLoadMenu(int x, int y, bool fromMainMenu) {
bool GUI_EoB::confirmDialogue2(int dim, int id, int deflt) {
int od = _screen->curDimIndex();
- Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
+ Screen::FontId of = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
_screen->setScreenDim(dim);
drawTextBox(dim, id);
@@ -2418,7 +2435,7 @@ bool GUI_EoB::confirmDialogue2(int dim, int id, int deflt) {
void GUI_EoB::messageDialogue(int dim, int id, int buttonTextCol) {
int od = _screen->curDimIndex();
_screen->setScreenDim(dim);
- Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
+ Screen::FontId of = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
drawTextBox(dim, id);
const ScreenDim *dm = _screen->getScreenDim(dim);
@@ -2554,7 +2571,7 @@ int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
_menuCur = -1;
printKatakanaOptions(0);
- int bytesPerChar = (_vm->_flags.lang == Common::JA_JPN) ? 2 : 1;
+ int bytesPerChar = (_vm->_flags.platform == Common::kPlatformFMTowns) ? 2 : 1;
int in = 0;
do {
@@ -2632,7 +2649,8 @@ int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
} else if ((in > 31 && in < 126) || (in == 0x89)) {
if (!(in == 32 && pos == 0)) {
- if (in >= 97 && in <= 122)
+ // EOBI/PC-98 is the only version that allows small characters
+ if (in >= 97 && in <= 122 && !_vm->_flags.use16ColorMode)
in -= 32;
if (pos < len) {
@@ -2999,6 +3017,8 @@ int GUI_EoB::selectSaveSlotDialogue(int x, int y, int id) {
_screen->printShadedText(title, 52, 5, col1, 0, _vm->guiSettings()->colors.guiColorBlack);
_screen->copyRegion(0, 0, x, y, 176, 144, 2, 0, Screen::CR_NO_P_CHECK);
+ _screen->fillRect(0, 0, 175, 143, 0, 2);
+
_screen->setCurPage(0);
_screen->updateScreen();
@@ -3333,9 +3353,9 @@ void GUI_EoB::runMemorizePrayMenu(int charIndex, int spellType) {
releaseButtons(buttonList);
updateBoxFrameHighLight(-1);
- _screen->setFont(Screen::FID_6_FNT);
+ Screen::FontId of = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
_vm->gui_drawCharPortraitWithStats(charIndex);
- _screen->setFont(Screen::FID_8_FNT);
+ _screen->setFont(of);
memset(charSpellList, 0, 80);
if (spellType && _vm->game() == GI_EOB2)
@@ -3378,7 +3398,6 @@ void GUI_EoB::runMemorizePrayMenu(int charIndex, int spellType) {
delete[] lh;
}
-
void GUI_EoB::scribeScrollDialogue() {
int16 *scrollInvSlot = new int16[32];
int16 *scrollCharacter = new int16[32];
@@ -3560,7 +3579,7 @@ bool GUI_EoB::restParty() {
}
_screen->setClearScreenDim(7);
- _screen->setFont(Screen::FID_6_FNT);
+ Screen::FontId of = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
restParty_updateRestTime(hours, true);
@@ -3708,7 +3727,6 @@ bool GUI_EoB::restParty() {
if (_vm->_characters[i].food) {
if (_vm->_characters[i].hitPointsCur < _vm->_characters[i].hitPointsMax) {
_vm->_characters[i].hitPointsCur++;
- _screen->setFont(Screen::FID_6_FNT);
_vm->gui_drawCharPortraitWithStats(i);
}
@@ -3725,7 +3743,6 @@ bool GUI_EoB::restParty() {
continue;
_vm->inflictCharacterDamage(i, 1);
starving = true;
- _screen->setFont(Screen::FID_6_FNT);
_vm->gui_drawCharPortraitWithStats(i);
}
}
@@ -3771,7 +3788,7 @@ bool GUI_EoB::restParty() {
_vm->removeInputTop();
_screen->setScreenDim(4);
- _screen->setFont(Screen::FID_8_FNT);
+ _screen->setFont(of);
if (!res) {
if (!injured)
@@ -3785,7 +3802,7 @@ bool GUI_EoB::restParty() {
bool GUI_EoB::confirmDialogue(int id) {
int od = _screen->curDimIndex();
- Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
+ Screen::FontId of = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
Button *buttonList = initMenu(5);
@@ -3899,7 +3916,7 @@ int GUI_EoB::selectCharacterDialogue(int id) {
_screen->drawShape(0, _vm->_blackBoxSmallGrid, selX[i] + 48, selY[i], 0);
_charSelectRedraw = true;
}
-
+ _screen->updateScreen();
if (count == 1) {
int l = _vm->getCharacterLevelIndex(4, _vm->_characters[result].cClass);
@@ -3925,7 +3942,7 @@ int GUI_EoB::selectCharacterDialogue(int id) {
}
}
- Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
+ Screen::FontId of = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
while (result == -2 && !_vm->shouldQuit()) {
int inputFlag = _vm->checkInput(buttonList, false, 0);
@@ -3958,13 +3975,13 @@ int GUI_EoB::selectCharacterDialogue(int id) {
result = hlCur;
} else if (inputFlag == _vm->_keyMap[Common::KEYCODE_ESCAPE] || inputFlag == 0x8010) {
- _screen->setFont(Screen::FID_8_FNT);
+ _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
drawMenuButton(buttonList, true, true, true);
_screen->updateScreen();
_vm->_system->delayMillis(80);
drawMenuButton(buttonList, false, false, true);
_screen->updateScreen();
- _screen->setFont(Screen::FID_6_FNT);
+ _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
result = -1;
} else if (inputFlag > 0x8010 && inputFlag < 0x8017) {
@@ -3978,7 +3995,7 @@ int GUI_EoB::selectCharacterDialogue(int id) {
if (hlCur >= 0)
_vm->gui_drawCharPortraitWithStats(hlCur);
- _screen->setFont(Screen::FID_8_FNT);
+ _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
if (result != -1 && id != 53) {
if (flags & 4) {
@@ -4006,12 +4023,14 @@ int GUI_EoB::selectCharacterDialogue(int id) {
void GUI_EoB::displayTextBox(int id) {
int op = _screen->setCurPage(2);
int od = _screen->curDimIndex();
- Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
+ Screen::FontId of = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
_screen->setClearScreenDim(11);
const ScreenDim *dm = _screen->getScreenDim(11);
drawMenuButtonBox(dm->sx << 3, dm->sy, dm->w << 3, dm->h, false, false);
+ _screen->setTextMarginRight((dm->sx + dm->w) << 3);
_screen->printShadedText(getMenuString(id), (dm->sx << 3) + 5, dm->sy + 5, _vm->guiSettings()->colors.guiColorWhite, 0, _vm->guiSettings()->colors.guiColorBlack);
+ _screen->setTextMarginRight(Screen::SCREEN_W);
_screen->copyRegion(dm->sx << 3, dm->sy, dm->sx << 3, dm->sy, dm->w << 3, dm->h, 2, 0, Screen::CR_NO_P_CHECK);
_screen->updateScreen();
@@ -4037,10 +4056,12 @@ Button *GUI_EoB::initMenu(int id) {
const ScreenDim *dm = _screen->getScreenDim(m->dim);
_screen->fillRect(dm->sx << 3, dm->sy, ((dm->sx + dm->w) << 3) - 1, (dm->sy + dm->h) - 1, _vm->guiSettings()->colors.fill);
_screen->setScreenDim(m->dim);
+ _screen->setTextMarginRight((dm->sx + dm->w) << 3);
drawMenuButtonBox(dm->sx << 3, dm->sy, dm->w << 3, dm->h, false, false);
}
_screen->printShadedText(getMenuString(m->titleStrId), 5, 5, m->titleCol, 0, _vm->guiSettings()->colors.guiColorBlack);
+ _screen->setTextMarginRight(Screen::SCREEN_W);
Button *buttons = 0;
for (int i = 0; i < m->numButtons; i++) {
@@ -4123,7 +4144,7 @@ void GUI_EoB::drawTextBox(int dim, int id) {
int od = _screen->curDimIndex();
_screen->setScreenDim(dim);
const ScreenDim *dm = _screen->getScreenDim(dim);
- Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
+ Screen::FontId of = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
if (dm->w <= 22 && dm->h <= 84)
_screen->copyRegion(dm->sx << 3, dm->sy, 0, dm->h, dm->w << 3, dm->h, 0, 2, Screen::CR_NO_P_CHECK);
@@ -4179,7 +4200,7 @@ void GUI_EoB::memorizePrayMenuPrintString(int spellId, int bookPageIndex, int sp
if (spellId) {
Common::String s;
- if (_vm->_flags.platform == Common::kPlatformFMTowns) {
+ if (_vm->_flags.lang == Common::JA_JPN) {
s = spellType ? _vm->_clericSpellList[spellId] : _vm->_mageSpellList[spellId];
for (int i = s.size() >> 1; i < 17; ++i)
s.insertChar(' ', s.size());
@@ -4327,7 +4348,7 @@ void GUI_EoB::sortSaveSlots() {
}
void GUI_EoB::restParty_updateRestTime(int hours, bool init) {
- Screen::FontId of = _screen->setFont(Screen::FID_8_FNT);
+ Screen::FontId of = _screen->setFont(_vm->_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_8_FNT);
int od = _screen->curDimIndex();
_screen->setScreenDim(10);
diff --git a/engines/kyra/gui/saveload_eob.cpp b/engines/kyra/gui/saveload_eob.cpp
index 07c99d5b95..1bf6b1da2c 100644
--- a/engines/kyra/gui/saveload_eob.cpp
+++ b/engines/kyra/gui/saveload_eob.cpp
@@ -280,7 +280,7 @@ Common::Error EoBCoreEngine::loadGameState(int slot) {
_screen->setScreenPalette(_screen->getPalette(0));
_sceneUpdateRequired = true;
- _screen->setFont(Screen::FID_6_FNT);
+ _screen->setFont(_flags.use16ColorMode ? Screen::FID_SJIS_FNT : Screen::FID_6_FNT);
for (int i = 0; i < 6; i++) {
for (int ii = 0; ii < 10; ii++) {
diff --git a/engines/kyra/resource/staticres_eob.cpp b/engines/kyra/resource/staticres_eob.cpp
index 7186603df9..edfa6b3dfe 100644
--- a/engines/kyra/resource/staticres_eob.cpp
+++ b/engines/kyra/resource/staticres_eob.cpp
@@ -1326,22 +1326,27 @@ void EoBEngine::initSpells() {
}
const KyraRpgGUISettings EoBEngine::_guiSettingsVGA = {
- { 9, 15, 95, 9, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
+ { 9, 15, 95, 9, 2, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
{ 135, 130, 132, 180, 133, 17, 23, 20, 184, 177, 180, 184, 177, 180, 15, 6, 8, 9, 2, 5, 4, 3, 12 }
};
const KyraRpgGUISettings EoBEngine::_guiSettingsEGA = {
- { 9, 15, 95, 9, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
+ { 9, 15, 95, 9, 2, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
+ { 13, 9, 2, 14, 2, 6, 13, 8, 13, 15, 14, 13, 15, 14, 15, 6, 8, 9, 2, 5, 4, 3, 12 }
+};
+
+const KyraRpgGUISettings EoBEngine::_guiSettingsPC98 = {
+ { 9, 15, 95, 11, 1, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
{ 13, 9, 2, 14, 2, 6, 13, 8, 13, 15, 14, 13, 15, 14, 15, 6, 8, 9, 2, 5, 4, 3, 12 }
};
const KyraRpgGUISettings EoBEngine::_guiSettingsAmiga = {
- { 28, 31, 95, 9, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
+ { 28, 31, 95, 9, 2, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
{ 18, 17, 10, 17, 11, 24, 22, 25, 18, 9, 10, 18, 9, 10, 31, 24, 25, 28, 29, 7, 26, 27, 19 }
};
const KyraRpgGUISettings EoBEngine::_guiSettingsAmigaMainMenu = {
- { 28, 31, 95, 9, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
+ { 28, 31, 95, 9, 2, 7, { 285, 139 }, { 189, 162 }, { 31, 31 } },
{ 22, 28, 30, 17, 11, 24, 22, 25, 18, 9, 10, 18, 9, 10, 31, 24, 25, 28, 29, 7, 26, 27, 19 }
};
@@ -1491,17 +1496,17 @@ void DarkMoonEngine::initSpells() {
}
const KyraRpgGUISettings DarkMoonEngine::_guiSettingsFMTowns = {
- { 9, 15, 95, 11, 7, { 221, 76 }, { 187, 162 }, { 95, 95 } },
+ { 9, 15, 95, 11, 1, 7, { 221, 76 }, { 187, 162 }, { 95, 95 } },
{ 186, 181, 183, 183, 184, 17, 23, 20, 186, 181, 183, 182, 177, 180, 15, 6, 8, 9, 2, 5, 4, 3, 12 }
};
const KyraRpgGUISettings DarkMoonEngine::_guiSettingsDOS = {
- { 9, 15, 95, 9, 7, { 221, 76 }, { 189, 162 }, { 95, 95 } },
+ { 9, 15, 95, 9, 2, 7, { 221, 76 }, { 189, 162 }, { 95, 95 } },
{ 186, 181, 183, 183, 184, 17, 23, 20, 186, 181, 183, 182, 177, 180, 15, 6, 8, 9, 2, 5, 4, 3, 12 }
};
const KyraRpgGUISettings DarkMoonEngine::_guiSettingsAmiga = {
- { 28, 31, 95, 9, 7, { 221, 76 }, { 189, 162 }, { 95, 95 } },
+ { 28, 31, 95, 9, 2, 7, { 221, 76 }, { 189, 162 }, { 95, 95 } },
{ 18, 17, 10, 17, 11, 10, 12, 25, 18, 9, 10, 18, 9, 10, 31, 24, 25, 28, 29, 7, 26, 27, 19 }
};
diff --git a/engines/kyra/resource/staticres_lol.cpp b/engines/kyra/resource/staticres_lol.cpp
index 24076aaef7..7d0ada1597 100644
--- a/engines/kyra/resource/staticres_lol.cpp
+++ b/engines/kyra/resource/staticres_lol.cpp
@@ -778,7 +778,7 @@ const int8 LoLEngine::_mapCoords[12][4] = {
};
const KyraRpgGUISettings LoLEngine::_guiSettings = {
- { 144, 254, 74, 9, 80, { 0, 0 }, { 0, 0 }, { 0, 0 } },
+ { 144, 254, 74, 9, 2, 80, { 0, 0 }, { 0, 0 }, { 0, 0 } },
{ 136, 251, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
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];
};