KYRA: (EOB/SegaCD/Japanese) - text related fixes and cleanup

This commit is contained in:
athrxx 2020-11-27 20:24:07 +01:00
parent 3b73691be5
commit f1f8214f3b
18 changed files with 185 additions and 71 deletions

View File

@ -89,6 +89,8 @@ private:
uint16 _chargenMinStats[7];
uint16 _chargenMaxStats[7];
const uint8 _menuColor1, _menuColor2, _menuColor3;
const char *const *_chargenStrings1;
const char *const *_chargenStrings2;
const char *const *_chargenStatStrings;
@ -133,7 +135,10 @@ private:
CharacterGenerator::CharacterGenerator(EoBCoreEngine *vm, Screen_EoB *screen) : _vm(vm), _screen(screen),
_characters(0), _faceShapes(0), _chargenMagicShapes(0), _chargenMagicShapeTimer(0), _wndBackgrnd(0),
_updateBoxShapesIndex(0), _lastUpdateBoxShapesIndex(0), _magicShapesBox(6), _activeBox(0) {
_updateBoxShapesIndex(0), _lastUpdateBoxShapesIndex(0), _magicShapesBox(6), _activeBox(0),
_menuColor1(vm->gameFlags().platform == Common::kPlatformSegaCD ? 0xFF : (vm->_configRenderMode == Common::kRenderCGA ? 1 : vm->guiSettings()->colors.guiColorWhite)),
_menuColor2(vm->gameFlags().platform == Common::kPlatformSegaCD ? 0x55 : vm->guiSettings()->colors.guiColorLightRed),
_menuColor3(vm->gameFlags().platform == Common::kPlatformSegaCD ? 0x99 : vm->guiSettings()->colors.guiColorBlack) {
_chargenStatStrings = _vm->_chargenStatStrings;
_chargenRaceSexStrings = _vm->_chargenRaceSexStrings;
@ -474,7 +479,7 @@ void CharacterGenerator::checkForCompleteParty() {
if (_vm->gameFlags().platform == Common::kPlatformSegaCD) {
_screen->sega_loadTextBackground(_wndBackgrnd, 10240);
_screen->sega_getRenderer()->fillRectWithTiles(0, 18, 8, 20, 16, 0);
cs = _screen->setFontStyles(_screen->_currentFont, _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat);
cs = _screen->setFontStyles(_screen->_currentFont, _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleNone : Font::kStyleFullWidth);
_vm->_txt->printShadedText(_chargenStrings1[8], 0, 0, -1, 0x99);
} else {
_screen->printShadedText(_chargenStrings1[8], x, 16, _vm->guiSettings()->colors.guiColorWhite, 0, _vm->guiSettings()->colors.guiColorBlack);
@ -698,7 +703,7 @@ int CharacterGenerator::raceSexMenu() {
}
_vm->removeInputTop();
_vm->_gui->simpleMenu_setup(1, 0, _chargenRaceSexStrings, -1, 0, 0);
_vm->_gui->simpleMenu_setup(1, 0, _chargenRaceSexStrings, -1, 0, 0, _menuColor1, _menuColor2, _menuColor3);
if (_vm->_flags.platform == Common::kPlatformSegaCD)
_screen->sega_getRenderer()->render(0, 18, 8, 20, 16);
_screen->updateScreen();
@ -738,7 +743,7 @@ int CharacterGenerator::classMenu(int raceSex) {
drawButton(5, 0, 0);
itemsMask &= _classMenuMasks[raceSex / 2];
_vm->_gui->simpleMenu_setup(2, 15, _chargenClassStrings, itemsMask, 0, 0);
_vm->_gui->simpleMenu_setup(2, 15, _chargenClassStrings, itemsMask, 0, 0, _menuColor1, _menuColor2, _menuColor3);
if (_vm->_flags.platform == Common::kPlatformSegaCD)
_screen->sega_getRenderer()->render(0, 18, 8, 20, 16);
_screen->updateScreen();
@ -798,7 +803,7 @@ int CharacterGenerator::alignmentMenu(int cClass) {
drawButton(5, 0, 0);
itemsMask &= _alignmentMenuMasks[cClass];
_vm->_gui->simpleMenu_setup(3, 9, _chargenAlignmentStrings, itemsMask, 0, 0);
_vm->_gui->simpleMenu_setup(3, 9, _chargenAlignmentStrings, itemsMask, 0, 0, _menuColor1, _menuColor2, _menuColor3);
if (_vm->_flags.platform == Common::kPlatformSegaCD)
_screen->sega_getRenderer()->render(0, 18, 8, 20, 16);
_screen->updateScreen();

View File

@ -1051,7 +1051,7 @@ void EoBEngine::displayParchment(int id) {
_screen->sega_getAnimator()->clearSprites();
_screen->sega_getAnimator()->update();
_screen->sega_selectPalette(54, 2);
int cs = _screen->setFontStyles(_screen->_currentFont, _flags.lang == Common::JA_JPN ? Font::kStyleFixedWidth | Font::kStyleNarrow2 : Font::kStyleForceTwoByte | Font::kStyleFat | Font::kStyleNarrow2);
int cs = _screen->setFontStyles(_screen->_currentFont, (_flags.lang == Common::JA_JPN ? Font::kStyleNone : Font::kStyleFullWidth) | Font::kStyleNarrow2);
snd_stopSound();
uint8 *data = _res->fileData("LT", 0);
@ -1151,7 +1151,7 @@ bool EoBEngine::checkPartyStatusExtra() {
r->fillRectWithTiles(1, 0, 3, 32, 16, 0x2281, true);
r->fillRectWithTiles(1, 32, 3, 8, 16, 0x2481, true);
int cs = _screen->setFontStyles(_screen->_currentFont, _flags.lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat);
int cs = _screen->setFontStyles(_screen->_currentFont, _flags.lang == Common::JA_JPN ? Font::kStyleNone : Font::kStyleFullWidth);
_screen->sega_clearTextBuffer(0);
_txt->printShadedText(_menuStringsDefeat[0], 12, 0, 0xff, 0xcc, 304, 48, 0, false);
_txt->printShadedText(_menuStringsDefeat[1], 20, 16, 0xff, 0xcc, 304, 48, 0, false);

View File

@ -596,7 +596,7 @@ void EoBCoreEngine::loadFonts() {
_conFont = _invFont3 = Screen::FID_SJIS_FNT;
} else if (_flags.platform == Common::kPlatformSegaCD) {
_screen->loadFont(Screen::FID_8_FNT, "FONTK12");
_screen->setFontStyles(Screen::FID_8_FNT, _flags.lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleFat);
_screen->setFontStyles(Screen::FID_8_FNT, Font::kStyleNone);
_invFont1 = _invFont2 = _conFont = Screen::FID_8_FNT;
}
}

View File

@ -496,7 +496,12 @@ void EoBCoreEngine::printFullItemName(Item item) {
tmpString = (itm->flags & 0x40) ? nameId : nameUnid;
}
int cs = (_flags.platform == Common::kPlatformSegaCD && _flags.lang == Common::JA_JPN && _screen->getNumberOfCharacters((tmpString).c_str()) >= 17) ? _screen->setFontStyles(_screen->_currentFont, Font::kStyleNarrow2) : -1;
_txt->printMessage(convertAsciiToSjis(tmpString).c_str());
if (cs != -1)
_screen->setFontStyles(_screen->_currentFont, cs);
}
void EoBCoreEngine::identifyQueuedItems(Item itemQueue) {

View File

@ -220,8 +220,14 @@ void EoBCoreEngine::castSpell(int spell, int weaponSlot) {
}
}
int cs = (_flags.platform == Common::kPlatformSegaCD && _flags.lang == Common::JA_JPN) ? _screen->setFontStyles(_screen->_currentFont, Font::kStyleNarrow1) : -1;
_txt->printMessage(_magicStrings1[4], -1, c->name, s->name);
if (cs != -1)
_screen->setFontStyles(_screen->_currentFont, cs);
if (s->flags & 0x20) {
castOnWhomDialogue();
return;

View File

@ -1408,6 +1408,13 @@ int Screen::getTextWidth(const char *str, bool nextWordOnly) {
return MAX(curLineLen, maxLineLen);
}
int Screen::getNumberOfCharacters(const char *str) {
int res = 0;
while (fetchChar(str))
++res;
return res;
}
void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2, int pitch) {
uint16 cmap16[2];
if (_16bitPalette) {

View File

@ -126,8 +126,8 @@ public:
kStyleFat = 1 << 1,
kStyleNarrow1 = 1 << 2,
kStyleNarrow2 = 1 << 3,
kStyleForceTwoByte = 1 << 4,
kStyleFixedWidth = 1 << 5
kStyleFullWidth = 1 << 4,
kStyleForceOneByte = 1 << 5
};
/**
@ -508,6 +508,7 @@ public:
int getCharWidth(uint16 c) const;
int getCharHeight(uint16 c) const;
int getTextWidth(const char *str, bool nextWordOnly = false);
int getNumberOfCharacters(const char *str);
void printText(const char *str, int x, int y, uint8 color1, uint8 color2, int pitch = -1);

View File

@ -1523,7 +1523,7 @@ bool Screen_EoB::loadFont(FontId fontId, const char *filename) {
} else if (_isAmiga) {
fnt = new AmigaDOSFont(_vm->resource(), _vm->game() == GI_EOB2 && _vm->gameFlags().lang == Common::DE_DEU);
} else if (_isSegaCD) {
fnt = new SegaCDFont(_vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable1, temp), _vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable2, temp),
fnt = new SegaCDFont(_vm->gameFlags().lang, _vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable1, temp), _vm->staticres()->loadRawDataBe16(kEoB1Ascii2SjisTable2, temp),
_vm->staticres()->loadRawData(kEoB1CharWidthTable1, temp), _vm->staticres()->loadRawData(kEoB1CharWidthTable2, temp), _vm->staticres()->loadRawData(kEoB1CharWidthTable3, temp));
} else {
// We use normal VGA rendering in EOB II, since we do the complete EGA dithering in updateScreen().

View File

@ -414,11 +414,11 @@ private:
class SegaCDFont : public Font {
public:
SegaCDFont(const uint16 *convTable1, const uint16 *convTable2, const uint8 *widthTable1, const uint8 *widthTable2, const uint8 *widthTable3);
SegaCDFont(Common::Language lang, const uint16 *convTable1, const uint16 *convTable2, const uint8 *widthTable1, const uint8 *widthTable2, const uint8 *widthTable3);
~SegaCDFont() override;
bool load(Common::SeekableReadStream &file) override;
Type getType() const override { return kSJIS; }
Type getType() const override { return _forceOneByte ? kASCII : kSJIS; }
int getHeight() const override { return _height; }
int getWidth() const override { return _width; }
int getCharWidth(uint16 c) const override;
@ -434,7 +434,8 @@ private:
const uint8 *_data;
const uint8 *_buffer;
bool _forceTwoByte;
bool _fixedWidth;
bool _forceOneByte;
Common::Language _lang;
uint8 _style;
const uint8 *_colorMap;

View File

@ -1046,8 +1046,8 @@ void SegaAnimator::update() {
_needUpdate = false;
}
SegaCDFont::SegaCDFont(const uint16 *convTable1, const uint16 *convTable2, const uint8 *widthTable1, const uint8 *widthTable2, const uint8 *widthTable3) : Font(),
_style(0), _forceTwoByte(false), _fixedWidth(false), _convTable1(convTable1), _convTable2(convTable2), _widthTable1(widthTable1), _widthTable2(widthTable2),
SegaCDFont::SegaCDFont(Common::Language lang, const uint16 *convTable1, const uint16 *convTable2, const uint8 *widthTable1, const uint8 *widthTable2, const uint8 *widthTable3) : Font(),
_lang(lang), _style(0), _forceTwoByte(false), _forceOneByte(false), _convTable1(convTable1), _convTable2(convTable2), _widthTable1(widthTable1), _widthTable2(widthTable2),
_widthTable3(widthTable3), _buffer(0), _data(0), _colorMap(0), _width(12), _height(12) {
}
@ -1064,6 +1064,11 @@ bool SegaCDFont::load(Common::SeekableReadStream &file) {
uint8 *newData = new uint8[size];
file.read(newData, size);
_buffer = newData;
_data = _buffer;
if (_lang == Common::EN_ANY)
_data += 131072;
else if (_lang != Common::JA_JPN)
error("SegaCDFont::load(): Unsupported language");
return true;
}
@ -1082,9 +1087,8 @@ int SegaCDFont::getCharHeight(uint16 c) const {
void SegaCDFont::setStyles(int styles) {
assert(_buffer);
_forceTwoByte = (styles & kStyleForceTwoByte);
_data = (styles & kStyleFat) ? _buffer + 131072 : _buffer;
_fixedWidth = (styles & kStyleFixedWidth);
_forceTwoByte = (styles & kStyleFullWidth);
_forceOneByte = (styles & kStyleForceOneByte);
_style = (styles & kStyleNarrow1) ? 1 : (styles & kStyleNarrow2 ? 2 : 0);
}
@ -1144,7 +1148,7 @@ const uint8 *SegaCDFont::getGlyphData(uint16 c, uint8 &charWidth, uint8 &charHei
lo = c & 0xFF;
} else {
if (c < 128) {
if (c >= 96)
if (_lang != Common::JA_JPN && c >= 96)
c += 96;
else
c -= 32;
@ -1196,15 +1200,19 @@ const uint8 *SegaCDFont::getGlyphData(uint16 c, uint8 &charWidth, uint8 &charHei
vrnt = 1;
if (vrnt == 0) {
charWidth = (!_fixedWidth && (c < 188)) ? _widthTable1[c] : 12;
charWidth = (_lang != Common::JA_JPN && (c < 188)) ? _widthTable1[c] : 12;
charHeight = pitch = 12;
res = &_data[0x19A0 + 18 * c];
} else if (_lang == Common::JA_JPN) {
charWidth = pitch = 8;
charHeight = 12;
res = &_data[0x800 + 12 * c];
} else if (_style == 2) {
charWidth = (!_fixedWidth && (c < 188)) ? _widthTable3[c] : 12;
charWidth = (c < 188) ? _widthTable3[c] : 8;
charHeight = pitch = 12;
res = &_data[0x3410 + 18 * c];
} else {
charWidth = (!_fixedWidth && (c < 188)) ? _widthTable2[c] : 12;
charWidth = (c < 188) ? _widthTable2[c] : 8;
charHeight = 12;
pitch = 8;
res = &_data[0x800 + 12 * c];

View File

@ -1524,6 +1524,7 @@ GUI_EoB::GUI_EoB(EoBCoreEngine *vm) : GUI(vm), _vm(vm), _screen(vm->_screen), _n
_menuLineSpacing = 0;
_menuLastInFlags = 0;
_menuTextColor = _menuHighlightColor = _menuShadowColor = 0;
_menuCur = 0;
_menuNumItems = 0;
@ -2072,7 +2073,7 @@ int GUI_EoB::processButtonList(Kyra::Button *buttonList, uint16 inputFlags, int8
return result;
}
void GUI_EoB::simpleMenu_setup(int sd, int maxItem, const char *const *strings, int32 menuItemsMask, int itemOffset, int lineSpacing) {
void GUI_EoB::simpleMenu_setup(int sd, int maxItem, const char *const *strings, int32 menuItemsMask, int itemOffset, int lineSpacing, int textColor, int highlightColor, int shadowColor) {
simpleMenu_initMenuItemsMask(sd, maxItem, menuItemsMask, itemOffset);
const ScreenDim *dm = _screen->getScreenDim(19 + sd);
@ -2085,16 +2086,19 @@ void GUI_EoB::simpleMenu_setup(int sd, int maxItem, const char *const *strings,
int item = simpleMenu_getMenuItem(i, menuItemsMask, itemOffset);
int ty = i * (lineSpacing + _screen->getCharHeight(' '));
if (_vm->gameFlags().platform == Common::kPlatformSegaCD) {
_vm->_txt->printShadedText(strings[item], 4, (sd == 8 ? 2 : 20) + ty, item == v ? 0x55 : 0xff, sd == 8 ? 0x11 : 0x99);
_vm->_txt->printShadedText(strings[item], 4, (sd == 8 ? 2 : 20) + ty, item == v ? highlightColor : textColor, shadowColor);
} else {
_screen->printShadedText(strings[item], x, y + ty, (_vm->_configRenderMode == Common::kRenderCGA) ? 1 : _vm->guiSettings()->colors.guiColorWhite, 0, _vm->guiSettings()->colors.guiColorBlack);
_screen->printShadedText(strings[item], x, y + ty, textColor, 0, shadowColor);
if (item == v)
_screen->printText(strings[item], x, y + ty, _vm->guiSettings()->colors.guiColorLightRed, 0);
_screen->printText(strings[item], x, y + ty, highlightColor, 0);
}
}
_menuLineSpacing = lineSpacing;
_menuLastInFlags = 0;
_menuTextColor = textColor;
_menuHighlightColor = highlightColor;
_menuShadowColor = shadowColor;
_vm->removeInputTop();
}
@ -2141,17 +2145,17 @@ int GUI_EoB::simpleMenu_process(int sd, const char *const *strings, void *b, int
if (newItem != currentItem) {
if (_vm->gameFlags().platform == Common::kPlatformSegaCD) {
_vm->_txt->printShadedText(strings[simpleMenu_getMenuItem(currentItem, menuItemsMask, itemOffset)], 4, (sd == 8 ? 2 : 20) + currentItem * lineH, 0xFF, sd == 8 ? 0x11 : 0x99);
_vm->_txt->printShadedText(strings[simpleMenu_getMenuItem(newItem, menuItemsMask, itemOffset)], 4, (sd == 8 ? 2 : 20) + newItem * lineH, 0x55, sd == 8 ? 0x11 : 0x99);
_vm->_txt->printShadedText(strings[simpleMenu_getMenuItem(currentItem, menuItemsMask, itemOffset)], 4, (sd == 8 ? 2 : 20) + currentItem * lineH, _menuTextColor, _menuShadowColor);
_vm->_txt->printShadedText(strings[simpleMenu_getMenuItem(newItem, menuItemsMask, itemOffset)], 4, (sd == 8 ? 2 : 20) + newItem * lineH, _menuHighlightColor, _menuShadowColor);
} else {
_screen->printText(strings[simpleMenu_getMenuItem(currentItem, menuItemsMask, itemOffset)], x, y + currentItem * lineH, (_vm->_configRenderMode == Common::kRenderCGA) ? 1 : _vm->guiSettings()->colors.guiColorWhite, 0);
_screen->printText(strings[simpleMenu_getMenuItem(newItem, menuItemsMask, itemOffset)], x, y + newItem * lineH, _vm->guiSettings()->colors.guiColorLightRed, 0);
_screen->printText(strings[simpleMenu_getMenuItem(currentItem, menuItemsMask, itemOffset)], x, y + currentItem * lineH, _menuTextColor, 0);
_screen->printText(strings[simpleMenu_getMenuItem(newItem, menuItemsMask, itemOffset)], x, y + newItem * lineH, _menuHighlightColor, 0);
}
}
if (result != -1) {
result = simpleMenu_getMenuItem(result, menuItemsMask, itemOffset);
simpleMenu_flashSelection(strings[result], x, y + newItem * lineH, _vm->guiSettings()->colors.guiColorWhite, _vm->guiSettings()->colors.guiColorLightRed, 0);
simpleMenu_flashSelection(strings[result], x, y + newItem * lineH, _vm->guiSettings()->colors.guiColorWhite, _menuHighlightColor, 0);
}
_menuCur = newItem;
@ -2835,7 +2839,7 @@ int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
if (len == destMaxLen)
dest[len * bytesPerChar] = 0;
} else {
dest[pos++] = in;
dest[pos++] = (in == 0x89 && _csjis[1]) ? _csjis[0] : in;
if (len == destMaxLen)
dest[len] = 0;
}
@ -2850,7 +2854,7 @@ int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
dest[pos * bytesPerChar + 1] = _csjis[1];
dest[++pos * bytesPerChar] = 0;
} else {
dest[pos++] = in;
dest[pos++] = (in == 0x89 && _csjis[1]) ? _csjis[0] : in;
dest[pos] = 0;
}
}
@ -2866,7 +2870,9 @@ int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
if (_vm->_flags.platform == Common::kPlatformSegaCD) {
memset(segaCharBuf, 0, destMaxLen << 5);
_screen->sega_setTextBuffer(segaCharBuf, destMaxLen << 5);
int cs = _screen->setFontStyles(_screen->_currentFont, Font::kStyleForceOneByte);
_vm->_txt->printShadedText(dest, 0, 0, textColor1, 0, -1, -1, 0, false);
_screen->setFontStyles(_screen->_currentFont, cs);
_screen->sega_loadTextBufferToVRAM(0, ((y >> 3) * 40 + x + 1) << 5, destMaxLen << 5);
_screen->sega_getRenderer()->render(0, x, y >> 3, destMaxLen, 1);
_screen->sega_setTextBuffer(0, 0);
@ -2910,7 +2916,7 @@ int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
return _keyPressed.keycode == Common::KEYCODE_ESCAPE ? -1 : len;
}
int GUI_EoB::checkClickableCharactersSelection() {
uint16 GUI_EoB::checkClickableCharactersSelection() {
if (_vm->_flags.platform != Common::kPlatformFMTowns)
return 0;
@ -3826,6 +3832,8 @@ bool GUI_EoB::restParty() {
for (int l = 0; !res && restLoop && !_vm->shouldQuit();) {
l++;
int cs = (_vm->gameFlags().platform == Common::kPlatformSegaCD && _vm->gameFlags().lang == Common::JA_JPN) ? _screen->setFontStyles(_screen->_currentFont, Font::kStyleNarrow1) : -1;
// Regenerate spells
for (int i = 0; i < 6; i++) {
crs[i]++;
@ -3915,6 +3923,7 @@ bool GUI_EoB::restParty() {
injured--;
_vm->_txt->printMessage(Common::String::format(_vm->_menuStringsRest2[2], _vm->_characters[i].name, _vm->_characters[injured].name).c_str());
_vm->delay(80);
_vm->_characters[injured].hitPointsCur += healHp;
@ -3926,6 +3935,9 @@ bool GUI_EoB::restParty() {
}
}
if (cs != -1)
_screen->setFontStyles(_screen->_currentFont, cs);
if (l == 6) {
l = 0;
restParty_updateRestTime(++hours, false);

View File

@ -55,7 +55,7 @@ public:
int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel) override;
// Non button based menu handling (main menu, character generation)
void simpleMenu_setup(int sd, int maxItem, const char *const *strings, int32 menuItemsMask, int itemOffset, int lineSpacing);
void simpleMenu_setup(int sd, int maxItem, const char *const *strings, int32 menuItemsMask, int itemOffset, int lineSpacing, int textColor, int highlightColor, int shadowColor);
int simpleMenu_process(int sd, const char *const *strings, void *b, int32 menuItemsMask, int itemOffset);
// Button based menus (camp menu, load menu)
@ -149,6 +149,9 @@ private:
int _menuLineSpacing;
int _menuLastInFlags;
int _menuTextColor;
int _menuHighlightColor;
int _menuShadowColor;
uint8 _numPages;
uint8 _numVisPages;
@ -173,7 +176,7 @@ private:
static const uint8 _highlightColorTableSegaCD[];
// FM-Towns / SegaCD specific
virtual int checkClickableCharactersSelection();
virtual uint16 checkClickableCharactersSelection();
virtual void printClickableCharacters(int page);
};

View File

@ -216,7 +216,7 @@ void EoBEngine::gui_drawCharacterStatsPage() {
printStatsString(Common::String::format("%2d", c->dexterityCur).c_str(), 13, 11);
printStatsString(Common::String::format("%2d", c->constitutionCur).c_str(), 13, 12);
printStatsString(Common::String::format("%2d", c->charismaCur).c_str(), 13, 13);
printStatsString(Common::String::format("%2d", c->armorClass).c_str(), 5, 14);
printStatsString(Common::String::format("%2d", c->armorClass).c_str(), _flags.lang == Common::JA_JPN ? 9 : 5, 14);
for (int i = 0; i < 3; i++) {
int t = getCharacterClassType(c->cClass, i);
@ -264,7 +264,8 @@ void EoBEngine::gui_displayMap() {
r->loadStreamToVRAM(in, 0x80);
delete in;
int cs = _screen->setFontStyles(_screen->_currentFont, _flags.lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat);
int cs = _screen->setFontStyles(_screen->_currentFont, _flags.lang == Common::JA_JPN ? Font::kStyleNone : Font::kStyleFullWidth);
_screen->sega_clearTextBuffer(0);
for (int i = 0; i < 3; ++i)
@ -499,6 +500,7 @@ void EoBEngine::makeNameShapes(int charId) {
_screen->sega_getRenderer()->fillRectWithTiles(1, 0, 0, 40, 28, 0x2000);
_screen->sega_getRenderer()->fillRectWithTiles(0, 0, 0, 30, 28, 0x600A, true);
_screen->sega_clearTextBuffer(0);
int cs = _screen->setFontStyles(_screen->_currentFont, Font::kStyleForceOneByte);
uint8 *in = _res->fileData("FACE", 0);
for (int i = first; i <= last; ++i) {
@ -524,6 +526,7 @@ void EoBEngine::makeNameShapes(int charId) {
_screen->clearPage(2);
_screen->setCurPage(cp);
_screen->sega_clearTextBuffer(0);
_screen->setFontStyles(_screen->_currentFont, cs);
_txt->clearDim(4);
_txt->clearDim(cd);
@ -558,9 +561,42 @@ void EoBEngine::printStatsString(const char *str, int x, int y) {
void EoBEngine::printSpellbookString(uint16 *dst, const char *str, uint16 ntbl) {
assert(str);
for (uint8 c = (uint8)*str++; c; c = (uint8)*str++) {
if (c > 31 && c < 128)
*dst = ntbl + c - 32;
const uint8 *in = (const uint8*)str;
for (uint8 c = *in++; c; c = *in++) {
if (_flags.lang == Common::JA_JPN) {
if (c > 165 && c < 222)
*dst = ntbl + c - 166;
else if (c == 32)
*dst = ntbl + 82;
else if (c > 47 && c < 58)
*dst = ntbl + c + 35;
else if (c == 47)
*dst = ntbl + 93;
else if (c == 165)
*dst = ntbl + 94;
else if (c == 43)
*dst = ntbl + 95;
if (*in == 222) {
if (c > 181 && c < 197) {
*dst = ntbl + c - 121;
++in;
} else if (c > 201 && c < 207) {
*dst = ntbl + c - 126;
++in;
} else if (c == 179) {
*dst = ntbl + c + 81;
++in;
}
} else if (*in == 223 && c > 201 && c < 207) {
*dst = ntbl + c - 146;
++in;
}
} else {
if (c > 31 && c < 128)
*dst = ntbl + c - 32;
}
dst++;
}
}
@ -574,7 +610,7 @@ void EoBEngine::drawMapButton(const char *str, int x, int y) {
void EoBEngine::drawMapPage(int level) {
_screen->sega_clearTextBuffer(0);
int cs = _screen->setFontStyles(_screen->_currentFont, (_flags.lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat) | Font::kStyleNarrow1);
int cs = _screen->setFontStyles(_screen->_currentFont, (_flags.lang == Common::JA_JPN ? Font::kStyleNone : Font::kStyleFullWidth) | Font::kStyleNarrow1);
_txt->printShadedText(_mapStrings3[level - 1], 0, 0, 0xCC, 0, 48, 16, 0, false);
_screen->setFontStyles(_screen->_currentFont, cs);
_screen->sega_loadTextBufferToVRAM(0, 0x7920, 384);
@ -620,9 +656,9 @@ void EoBEngine::drawDialogueButtons() {
_screen->sega_clearTextBuffer(0);
for (int i = 0; i < _dialogueNumButtons; i++) {
int cs = _screen->setFontStyles(_screen->_currentFont, (_flags.lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat) | Font::kStyleNarrow2);
int cs = _screen->setFontStyles(_screen->_currentFont, (_flags.lang == Common::JA_JPN ? Font::kStyleNone : Font::kStyleFullWidth) | Font::kStyleNarrow2);
if (_screen->getTextWidth(_dialogueButtonString[i]) > 90)
_screen->setFontStyles(_screen->_currentFont, (_flags.lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat) | Font::kStyleNarrow1);
_screen->setFontStyles(_screen->_currentFont, (_flags.lang == Common::JA_JPN ? Font::kStyleNone : Font::kStyleFullWidth) | Font::kStyleNarrow1);
_screen->sega_drawClippedLine(38, 6, _dialogueButtonPosX[i], _dialogueButtonPosY[i], 90, 14, 0x99);
_screen->sega_drawClippedLine(38, 6, _dialogueButtonPosX[i], _dialogueButtonPosY[i] + 1, 89, 13, 0xBB);
_screen->sega_drawClippedLine(38, 6, _dialogueButtonPosX[i] + 1, _dialogueButtonPosY[i] + 1, 88, 12, 0xAA);
@ -707,7 +743,7 @@ void GUI_EoB_SegaCD::drawSaveSlotDialog(int x, int y, int id) {
_screen->sega_clearTextBuffer(0);
_saveLoadCancelButton->x = ((const EoBMenuButtonDef*)_saveLoadCancelButton->extButtonDef)->x + x - (x ? 8 : 0);
_saveLoadCancelButton->y = ((const EoBMenuButtonDef*)_saveLoadCancelButton->extButtonDef)->y + y;
int cs = _screen->setFontStyles(_screen->_currentFont, _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat);
int cs = _screen->setFontStyles(_screen->_currentFont, _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleNone : Font::kStyleFullWidth);
_vm->_txt->printShadedText(_vm->_saveLoadStrings[2 + id], 0, 3, 0xFF, 0xCC, 160, 16, 0, false);
_screen->setFontStyles(_screen->_currentFont, cs);
_screen->sega_loadTextBufferToVRAM(0, 0x5060, 1280);
@ -717,7 +753,7 @@ void GUI_EoB_SegaCD::drawSaveSlotDialog(int x, int y, int id) {
bool GUI_EoB_SegaCD::confirmDialogue(int id) {
_screen->sega_clearTextBuffer(0);
int cs = _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleFixedWidth : (Font::kStyleForceTwoByte | Font::kStyleFat);
int cs = _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleNone : Font::kStyleFullWidth;
if (id == 47) {
cs |= Font::kStyleNarrow2;
_screen->_charSpacing = 1;
@ -789,7 +825,7 @@ bool GUI_EoB_SegaCD::confirmDialogue(int id) {
void GUI_EoB_SegaCD::displayTextBox(int id, int textColor, bool wait) {
_screen->sega_getRenderer()->fillRectWithTiles(0, 0, 0, 22, 20, 0);
_screen->sega_clearTextBuffer(0);
int cs = _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat;
int cs = _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleNone : Font::kStyleFullWidth;
if (id == 23 || id == 26 || id == 49)
cs |= Font::kStyleNarrow2;
cs = _screen->setFontStyles(_screen->_currentFont, cs);
@ -862,6 +898,12 @@ void GUI_EoB_SegaCD::memorizePrayMenuPrintString(int spellId, int bookPageIndex,
if (spellId) {
memset(_vm->_tempPattern, 0, 924);
Common::String s = Common::String::format(_vm->_menuStringsMgc[0], spellType ? _vm->_clericSpellList[spellId] : _vm->_mageSpellList[spellId], _numAssignedSpellsOfType[spellId * 2 - 2]);
if (_vm->gameFlags().lang == Common::JA_JPN) {
for (int i = 0; i < 19; ++i) {
if (s[i] == -34 || s[i] == -33)
s.insertChar(' ', 18);
}
}
_vm->printSpellbookString(_vm->_tempPattern, s.c_str(), highLight ? 0x6223 : 0x63C9);
_screen->sega_getRenderer()->fillRectWithTiles(0, 1, 10 + bookPageIndex, 20, 1, 0, true, true, _vm->_tempPattern);
} else {
@ -894,10 +936,10 @@ void GUI_EoB_SegaCD::restParty_updateRestTime(int hours, bool init) {
r->fillRectWithTiles(0, 1, 4, 20, 17, 0);
_screen->sega_clearTextBuffer(0);
int cs = _screen->setFontStyles(_screen->_currentFont, _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat);
int cs = _screen->setFontStyles(_screen->_currentFont, Font::kStyleFullWidth);
_vm->_txt->printShadedText(getMenuString(42), 0, 0, 0xFF, 0xCC, 160, 48, 0, false);
_vm->_txt->printShadedText(_vm->_menuStringsRest2[3], 0, 16, 0xFF, 0xCC, 160, 48, 0, false);
_vm->_txt->printShadedText(Common::String::format("%3d", hours).c_str(), 117, 16, 0xFF, 0xCC, 160, 48, 0, false);
_vm->_txt->printShadedText(Common::String::format("%3d", hours).c_str(), _vm->gameFlags().lang == Common::JA_JPN ? 60 : 117, 16, 0xFF, 0xCC, 160, 48, 0, false);
_screen->setFontStyles(_screen->_currentFont, cs);
_screen->sega_loadTextBufferToVRAM(0, 0x5060, 5120);
@ -908,7 +950,7 @@ void GUI_EoB_SegaCD::restParty_updateRestTime(int hours, bool init) {
_vm->delay(160);
}
int GUI_EoB_SegaCD::checkClickableCharactersSelection() {
uint16 GUI_EoB_SegaCD::checkClickableCharactersSelection() {
Common::Point mousePos = _vm->getMousePos();
int highlight = -1;
@ -960,7 +1002,8 @@ int GUI_EoB_SegaCD::checkClickableCharactersSelection() {
break;
default:
_csjis[0] = fetchClickableCharacter(highlight);
return _csjis[0];
_csjis[1] = '\x1';
return 0x89;
}
}

View File

@ -51,7 +51,7 @@ private:
void updateOptionsStrings() override;
void restParty_updateRestTime(int hours, bool init) override;
int checkClickableCharactersSelection() override;
uint16 checkClickableCharactersSelection() override;
void printClickableCharacters(int page) override;
void printClickableCharacter(int id, int col);
char fetchClickableCharacter(int id) const;

View File

@ -595,7 +595,7 @@ void SegaSequencePlayer::s_displayTextEn(const uint8 *pos) {
_vm->_txt->clearDim(2);
if (_playingID >= 55) {
int cs = _screen->setFontStyles(_screen->_currentFont, Font::kStyleForceTwoByte | Font::kStyleFat);
int cs = _screen->setFontStyles(_screen->_currentFont, Font::kStyleFullWidth);
_vm->_txt->printShadedText(str, 0, 0, -1, 0xEE);
_screen->setFontStyles(_screen->_currentFont, cs);
} else {

View File

@ -206,7 +206,7 @@ int DarkMoonEngine::mainMenuLoop() {
int sel = -1;
do {
_screen->setScreenDim(6);
_gui->simpleMenu_setup(6, 0, _mainMenuStrings, -1, 0, 0);
_gui->simpleMenu_setup(6, 0, _mainMenuStrings, -1, 0, 0, _configRenderMode == Common::kRenderCGA ? 1 : guiSettings()->colors.guiColorWhite, guiSettings()->colors.guiColorLightRed, guiSettings()->colors.guiColorBlack);
_screen->updateScreen();
while (sel == -1 && !shouldQuit()) {
@ -227,7 +227,7 @@ void DarkMoonEngine::townsUtilitiesMenu() {
_screen->copyRegion(78, 99, 78, 99, 172, 43, 2, 0, Screen::CR_NO_P_CHECK);
int sel = -1;
do {
_gui->simpleMenu_setup(8, 0, _utilMenuStrings, -1, 0, 0);
_gui->simpleMenu_setup(8, 0, _utilMenuStrings, -1, 0, 0, _configRenderMode == Common::kRenderCGA ? 1 : guiSettings()->colors.guiColorWhite, guiSettings()->colors.guiColorLightRed, guiSettings()->colors.guiColorBlack);
_screen->updateScreen();
while (sel == -1 && !shouldQuit()) {
sel = _gui->simpleMenu_process(8, _utilMenuStrings, 0, -1, 0);

View File

@ -408,8 +408,10 @@ void EoBIntroPlayer::start(int part) {
if (part != kOnlyIntro) {
openingCredits();
if (part == kOnlyCredits)
if (part == kOnlyCredits) {
_vm->_allowSkip = false;
return;
}
if (!_vm->shouldQuit() && !_vm->skipFlag()) {
_vm->snd_playSong(2);
@ -2174,8 +2176,13 @@ int EoBEngine::mainMenu() {
_screen->sega_getRenderer()->fillRectWithTiles(1, 7, 25, 25, 1, 0x4E3, true);
_screen->sega_getRenderer()->fillRectWithTiles(1, 6, 21, 1, 5, 0);
_screen->setFontStyles(_screen->_currentFont, Font::kStyleNarrow1);
// Apparently the Japanese version does not have halfwidth versions of the Latin small characters.
// We can't use the fullwidth characters either, since their height is too large. So we just use
// capital letters...
if (_flags.lang == Common::JA_JPN)
versionString.toUppercase();
_txt->printShadedText(versionString.c_str(), 200 - versionString.size() * 8, _ttlCfg->versionStrYOffs, 0x88);
_screen->setFontStyles(_screen->_currentFont, _flags.lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat);
_screen->setFontStyles(_screen->_currentFont, Font::kStyleFullWidth);
} else {
_screen->_curPage = 2;
of = _screen->setFont(Screen::FID_6_FNT);
@ -2195,8 +2202,8 @@ int EoBEngine::mainMenu() {
menuChoice = mainMenuLoop();
_allowImport = false;
if (_flags.platform == Common::kPlatformSegaCD && _flags.lang != Common::JA_JPN)
_screen->setFontStyles(_screen->_currentFont, Font::kStyleFat);
if (_flags.platform == Common::kPlatformSegaCD)
_screen->setFontStyles(_screen->_currentFont, Font::kStyleNone);
}
break;
@ -2256,9 +2263,20 @@ int EoBEngine::mainMenu() {
int EoBEngine::mainMenuLoop() {
int sel = -1;
int col1 = (_configRenderMode == Common::kRenderCGA) ? 1 : guiSettings()->colors.guiColorWhite;
int col2 = guiSettings()->colors.guiColorLightRed;
int col3 = guiSettings()->colors.guiColorBlack;
if (_flags.platform == Common::kPlatformSegaCD) {
col1 = 0xff;
col2 = 0x55;
col3 = _flags.lang == Common::JA_JPN ? 0 : 0x11;
}
do {
_screen->setScreenDim(28);
_gui->simpleMenu_setup(8, 0, _mainMenuStrings, -1, 0, 0);
_gui->simpleMenu_setup(8, 0, _mainMenuStrings, -1, 0, 0, col1, col2, col3);
if (_flags.platform == Common::kPlatformSegaCD)
_screen->sega_getRenderer()->render(0);
_screen->updateScreen();
@ -2610,19 +2628,23 @@ void EoBEngine::seq_segaFinalCredits() {
curStr++;
} else {
int styles = _flags.lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat;
//int extraSpacing = 6;
int styles = /*_flags.lang == Common::JA_JPN ? Font::kStyleNone :*/ Font::kStyleFullWidth;
int charSpacing1 = _flags.lang == Common::JA_JPN ? 2 : 0;
int charSpacing2 = 6;
if (c == '<') {
styles |= Font::kStyleNarrow1;
//extraSpacing = 4;
pos++;
charSpacing2 = 4;
c = *pos++;
}
if (c == ';')
if (c == ';') {
pos++;
charSpacing1 = 0;
}
_screen->setFontStyles(_screen->_currentFont, styles);
_txt->printShadedText(pos, 120 - (_screen->getTextWidth(pos) >> 1), 0, 0xFF, 0xCC, -1, -1, 0, false);
int x = 120 - (_flags.lang == Common::JA_JPN ? _screen->getNumberOfCharacters(pos) * ((charSpacing1 >> 1) + charSpacing2) : (_screen->getTextWidth(pos) >> 1));
_txt->printShadedText(pos, x, 0, 0xFF, 0xCC, -1, -1, 0, false);
curStr++;
}
} else {
@ -2638,7 +2660,7 @@ void EoBEngine::seq_segaFinalCredits() {
_screen->sega_fadeToBlack(1);
_screen->setFontStyles(_screen->_currentFont, _flags.lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleFat);
_screen->setFontStyles(_screen->_currentFont, Font::kStyleNone);
r->setupPlaneAB(512, 512);
scrMan->setVScrollTimers(0, 1, 0, 0, 1, 0);
scrMan->updateScrollTimers();
@ -2667,7 +2689,7 @@ void EoBEngine::seq_segaShowStats() {
SegaRenderer *r = _screen->sega_getRenderer();
_txt->clearDim(5);
int styles = _flags.lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleForceTwoByte | Font::kStyleFat;
int styles = Font::kStyleFullWidth;
int cs = _screen->setFontStyles(_screen->_currentFont, styles);
_txt->printShadedText(_finBonusStrings[2], 199 - _screen->getTextWidth(_finBonusStrings[2]), 8, 0xFF, 0x00, -1, -1, 0, false);

View File

@ -52,7 +52,7 @@ void TextDisplayer_SegaCD::printDialogueText(int id, const char *string1, const
}
void TextDisplayer_SegaCD::printDialogueText(const char *str, bool wait) {
int cs = _screen->setFontStyles(Screen::FID_8_FNT, _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleFat | Font::kStyleForceTwoByte);
int cs = _screen->setFontStyles(Screen::FID_8_FNT, _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleNone : Font::kStyleFullWidth);
clearDim(_curDim);
if (wait) {
@ -112,7 +112,8 @@ int TextDisplayer_SegaCD::clearDim(int dim) {
void TextDisplayer_SegaCD::displayText(char *str, ...) {
_screen->sega_setTextBuffer(_msgRenderBuffer, _msgRenderBufferSize);
int cs = _screen->setFontStyles(Screen::FID_8_FNT, _vm->gameFlags().lang == Common::JA_JPN ? Font::kStyleFixedWidth : Font::kStyleFat | Font::kStyleForceTwoByte);
int cs = _screen->setFontStyles(Screen::FID_8_FNT, Font::kStyleFullWidth);
_screen->setFontStyles(Screen::FID_8_FNT, cs | Font::kStyleFullWidth);
char tmp[3] = " ";
int posX = _curPosX;
bool updated = false;