diff options
author | Martin Kiewitz | 2014-11-04 22:01:21 +0100 |
---|---|---|
committer | Martin Kiewitz | 2014-11-04 22:01:21 +0100 |
commit | eff78c442474185ecb1bde59bfc54c276178c480 (patch) | |
tree | 583021de254265f55a71e057cb5441973a3a4d48 /engines/sci | |
parent | ad8dbd364203a463fbae935b751cf96f76c38cf5 (diff) | |
download | scummvm-rg350-eff78c442474185ecb1bde59bfc54c276178c480.tar.gz scummvm-rg350-eff78c442474185ecb1bde59bfc54c276178c480.tar.bz2 scummvm-rg350-eff78c442474185ecb1bde59bfc54c276178c480.zip |
SCI: fix Japanese Space Quest 4 (intro + buttons)
At least SQ4 uses #j text prefix as signal for the
interpreter to not use the PC9801 hires font, but
to use the internal low res font instead
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 33 | ||||
-rw-r--r-- | engines/sci/engine/state.cpp | 84 | ||||
-rw-r--r-- | engines/sci/graphics/controls16.cpp | 12 | ||||
-rw-r--r-- | engines/sci/graphics/controls16.h | 6 | ||||
-rw-r--r-- | engines/sci/graphics/paint16.cpp | 6 | ||||
-rw-r--r-- | engines/sci/graphics/paint16.h | 2 | ||||
-rw-r--r-- | engines/sci/graphics/text16.cpp | 24 | ||||
-rw-r--r-- | engines/sci/graphics/text16.h | 13 | ||||
-rw-r--r-- | engines/sci/sci.h | 7 |
9 files changed, 112 insertions, 75 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index c2089bcd4d..ee2249bd9d 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -354,13 +354,16 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) { } textWidth = dest[3].toUint16(); textHeight = dest[2].toUint16(); + + uint16 languageSplitter = 0; + Common::String splitText = g_sci->strSplitLanguage(text.c_str(), &languageSplitter, sep); #ifdef ENABLE_SCI32 if (g_sci->_gfxText32) - g_sci->_gfxText32->kernelTextSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight); + g_sci->_gfxText32->kernelTextSize(splitText.c_str(), font_nr, maxwidth, &textWidth, &textHeight); else #endif - g_sci->_gfxText16->kernelTextSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight); + g_sci->_gfxText16->kernelTextSize(splitText.c_str(), languageSplitter, font_nr, maxwidth, &textWidth, &textHeight); // One of the game texts in LB2 German contains loads of spaces in // its end. We trim the text here, otherwise the graphics code will @@ -376,7 +379,7 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) { // Copy over the trimmed string... s->_segMan->strcpy(argv[1], text.c_str()); // ...and recalculate bounding box dimensions - g_sci->_gfxText16->kernelTextSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight); + g_sci->_gfxText16->kernelTextSize(splitText.c_str(), languageSplitter, font_nr, maxwidth, &textWidth, &textHeight); } } @@ -818,16 +821,29 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { if (!textReference.isNull()) text = s->_segMan->getString(textReference); + uint16 languageSplitter = 0; + Common::String splitText; + + switch (type) { + case SCI_CONTROLS_TYPE_BUTTON: + case SCI_CONTROLS_TYPE_TEXTEDIT: + splitText = g_sci->strSplitLanguage(text.c_str(), &languageSplitter, NULL); + break; + case SCI_CONTROLS_TYPE_TEXT: + splitText = g_sci->strSplitLanguage(text.c_str(), &languageSplitter); + break; + } + switch (type) { case SCI_CONTROLS_TYPE_BUTTON: debugC(kDebugLevelGraphics, "drawing button %04x:%04x to %d,%d", PRINT_REG(controlObject), x, y); - g_sci->_gfxControls16->kernelDrawButton(rect, controlObject, g_sci->strSplit(text.c_str(), NULL).c_str(), fontId, style, hilite); + g_sci->_gfxControls16->kernelDrawButton(rect, controlObject, splitText.c_str(), languageSplitter, fontId, style, hilite); return; case SCI_CONTROLS_TYPE_TEXT: alignment = readSelectorValue(s->_segMan, controlObject, SELECTOR(mode)); debugC(kDebugLevelGraphics, "drawing text %04x:%04x ('%s') to %d,%d, mode=%d", PRINT_REG(controlObject), text.c_str(), x, y, alignment); - g_sci->_gfxControls16->kernelDrawText(rect, controlObject, g_sci->strSplit(text.c_str()).c_str(), fontId, alignment, style, hilite); + g_sci->_gfxControls16->kernelDrawText(rect, controlObject, splitText.c_str(), languageSplitter, fontId, alignment, style, hilite); s->r_acc = g_sci->_gfxText16->allocAndFillReferenceRectArray(); return; @@ -841,7 +857,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { writeSelectorValue(s->_segMan, controlObject, SELECTOR(cursor), cursorPos); } debugC(kDebugLevelGraphics, "drawing edit control %04x:%04x (text %04x:%04x, '%s') to %d,%d", PRINT_REG(controlObject), PRINT_REG(textReference), text.c_str(), x, y); - g_sci->_gfxControls16->kernelDrawTextEdit(rect, controlObject, g_sci->strSplit(text.c_str(), NULL).c_str(), fontId, mode, style, cursorPos, maxChars, hilite); + g_sci->_gfxControls16->kernelDrawTextEdit(rect, controlObject, splitText.c_str(), languageSplitter, fontId, mode, style, cursorPos, maxChars, hilite); return; case SCI_CONTROLS_TYPE_ICON: @@ -1165,8 +1181,11 @@ reg_t kDisplay(EngineState *s, int argc, reg_t *argv) { argc--; argc--; argv++; argv++; text = g_sci->getKernel()->lookupText(textp, index); } + + uint16 languageSplitter = 0; + Common::String splitText = g_sci->strSplitLanguage(text.c_str(), &languageSplitter); - return g_sci->_gfxPaint16->kernelDisplay(g_sci->strSplit(text.c_str()).c_str(), argc, argv); + return g_sci->_gfxPaint16->kernelDisplay(splitText.c_str(), languageSplitter, argc, argv); } reg_t kSetVideoMode(EngineState *s, int argc, reg_t *argv) { diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 1b7fa7699e..c07dc925e0 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -203,37 +203,45 @@ static kLanguage charToLanguage(const char c) { } } -Common::String SciEngine::getSciLanguageString(const Common::String &str, kLanguage lang, kLanguage *lang2) const { - kLanguage secondLang = K_LANG_NONE; - - const char *seeker = str.c_str(); - while (*seeker) { - if ((*seeker == '%') || (*seeker == '#')) { - secondLang = charToLanguage(*(seeker + 1)); - - if (secondLang != K_LANG_NONE) +Common::String SciEngine::getSciLanguageString(const Common::String &str, kLanguage requestedLanguage, kLanguage *secondaryLanguage, uint16 *languageSplitter) const { + kLanguage foundLanguage = K_LANG_NONE; + const byte *textPtr = (byte *)str.c_str(); + byte curChar = 0; + byte curChar2 = 0; + + while (1) { + curChar = *textPtr; + if (!curChar) + break; + + if ((curChar == '%') || (curChar == '#')) { + curChar2 = *(textPtr + 1); + foundLanguage = charToLanguage(curChar2); + + if (foundLanguage != K_LANG_NONE) { + // Return language splitter + if (languageSplitter) + *languageSplitter = curChar | ( curChar2 << 8 ); + // Return the secondary language found in the string + if (secondaryLanguage) + *secondaryLanguage = foundLanguage; break; + } } - - ++seeker; + textPtr++; } - // Return the secondary language found in the string - if (lang2) - *lang2 = secondLang; - - if (secondLang == lang) { - if (*(++seeker) == 'J') { + if (foundLanguage == requestedLanguage) { + if (curChar2 == 'J') { // Japanese including Kanji, displayed with system font // Convert half-width characters to full-width equivalents Common::String fullWidth; - byte curChar, curChar2; uint16 mappedChar; - seeker++; + textPtr += 2; // skip over language splitter while (1) { - curChar = *(seeker); + curChar = *textPtr; switch (curChar) { case 0: // Terminator NUL @@ -243,7 +251,7 @@ Common::String SciEngine::getSciLanguageString(const Common::String &str, kLangu // inside GetLongest() (text16). We do it here, because it's much cleaner and // we have to process the text here anyway. // Occurs for example in Police Quest 2 intro - curChar2 = *(seeker + 1); + curChar2 = *(textPtr + 1); switch (curChar2) { case 'n': case 'N': @@ -251,12 +259,12 @@ Common::String SciEngine::getSciLanguageString(const Common::String &str, kLangu case 'R': fullWidth += ' '; fullWidth += 0x0D; // CR - seeker += 2; + textPtr += 2; continue; } } - seeker++; + textPtr++; mappedChar = s_halfWidthSJISMap[curChar]; if (mappedChar) { @@ -264,7 +272,7 @@ Common::String SciEngine::getSciLanguageString(const Common::String &str, kLangu fullWidth += mappedChar & 0xFF; } else { // Copy double-byte character - curChar2 = *(seeker++); + curChar2 = *(textPtr++); if (!curChar) { error("SJIS character %02X is missing second byte", curChar); break; @@ -275,14 +283,14 @@ Common::String SciEngine::getSciLanguageString(const Common::String &str, kLangu } } else { - return Common::String(seeker + 1); + return Common::String((const char *)(textPtr + 2)); } } - if (*seeker) - return Common::String(str.c_str(), seeker - str.c_str()); - else - return str; + if (curChar) + return Common::String(str.c_str(), (const char *)textPtr - str.c_str()); + + return str; } kLanguage SciEngine::getSciLanguage() { @@ -341,25 +349,25 @@ void SciEngine::setSciLanguage() { setSciLanguage(getSciLanguage()); } -Common::String SciEngine::strSplit(const char *str, const char *sep) { - kLanguage lang = getSciLanguage(); - kLanguage subLang = K_LANG_NONE; +Common::String SciEngine::strSplitLanguage(const char *str, uint16 *languageSplitter, const char *sep) { + kLanguage activeLanguage = getSciLanguage(); + kLanguage subtitleLanguage = K_LANG_NONE; if (SELECTOR(subtitleLang) != -1) - subLang = (kLanguage)readSelectorValue(_gamestate->_segMan, _gameObjectAddress, SELECTOR(subtitleLang)); + subtitleLanguage = (kLanguage)readSelectorValue(_gamestate->_segMan, _gameObjectAddress, SELECTOR(subtitleLang)); - kLanguage secondLang; - Common::String retval = getSciLanguageString(str, lang, &secondLang); + kLanguage foundLanguage; + Common::String retval = getSciLanguageString(str, activeLanguage, &foundLanguage, languageSplitter); // Don't add subtitle when separator is not set, subtitle language is not set, or // string contains only one language - if ((sep == NULL) || (subLang == K_LANG_NONE) || (secondLang == K_LANG_NONE)) + if ((sep == NULL) || (subtitleLanguage == K_LANG_NONE) || (foundLanguage == K_LANG_NONE)) return retval; // Add subtitle, unless the subtitle language doesn't match the languages in the string - if ((subLang == K_LANG_ENGLISH) || (subLang == secondLang)) { + if ((subtitleLanguage == K_LANG_ENGLISH) || (subtitleLanguage == foundLanguage)) { retval += sep; - retval += getSciLanguageString(str, subLang); + retval += getSciLanguageString(str, subtitleLanguage); } return retval; diff --git a/engines/sci/graphics/controls16.cpp b/engines/sci/graphics/controls16.cpp index f2b2ccdfe6..e2e250cf9d 100644 --- a/engines/sci/graphics/controls16.cpp +++ b/engines/sci/graphics/controls16.cpp @@ -280,7 +280,7 @@ int GfxControls16::getPicNotValid() { return _screen->_picNotValid; } -void GfxControls16::kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite) { +void GfxControls16::kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, uint16 languageSplitter, int16 fontId, int16 style, bool hilite) { int16 sci0EarlyPen = 0, sci0EarlyBack = 0; if (!hilite) { if (getSciVersion() == SCI_VERSION_0_EARLY) { @@ -295,7 +295,7 @@ void GfxControls16::kernelDrawButton(Common::Rect rect, reg_t obj, const char *t _paint16->frameRect(rect); rect.grow(-2); _ports->textGreyedOutput(!(style & SCI_CONTROLS_STYLE_ENABLED)); - _text16->Box(text, false, rect, SCI_TEXT16_ALIGNMENT_CENTER, fontId); + _text16->Box(text, languageSplitter, false, rect, SCI_TEXT16_ALIGNMENT_CENTER, fontId); _ports->textGreyedOutput(false); rect.grow(1); if (style & SCI_CONTROLS_STYLE_SELECTED) @@ -318,12 +318,12 @@ void GfxControls16::kernelDrawButton(Common::Rect rect, reg_t obj, const char *t } } -void GfxControls16::kernelDrawText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, TextAlignment alignment, int16 style, bool hilite) { +void GfxControls16::kernelDrawText(Common::Rect rect, reg_t obj, const char *text, uint16 languageSplitter, int16 fontId, TextAlignment alignment, int16 style, bool hilite) { if (!hilite) { rect.grow(1); _paint16->eraseRect(rect); rect.grow(-1); - _text16->Box(text, false, rect, alignment, fontId); + _text16->Box(text, languageSplitter, false, rect, alignment, fontId); if (style & SCI_CONTROLS_STYLE_SELECTED) { _paint16->frameRect(rect); } @@ -335,7 +335,7 @@ void GfxControls16::kernelDrawText(Common::Rect rect, reg_t obj, const char *tex } } -void GfxControls16::kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite) { +void GfxControls16::kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char *text, uint16 languageSplitter, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite) { Common::Rect textRect = rect; uint16 oldFontId = _text16->GetFontId(); @@ -343,7 +343,7 @@ void GfxControls16::kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char _texteditCursorVisible = false; texteditCursorErase(); _paint16->eraseRect(rect); - _text16->Box(text, false, textRect, SCI_TEXT16_ALIGNMENT_LEFT, fontId); + _text16->Box(text, languageSplitter, false, textRect, SCI_TEXT16_ALIGNMENT_LEFT, fontId); _paint16->frameRect(rect); if (style & SCI_CONTROLS_STYLE_SELECTED) { _text16->SetFont(fontId); diff --git a/engines/sci/graphics/controls16.h b/engines/sci/graphics/controls16.h index 6a70c71aae..39ffa243fb 100644 --- a/engines/sci/graphics/controls16.h +++ b/engines/sci/graphics/controls16.h @@ -55,9 +55,9 @@ public: GfxControls16(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen); ~GfxControls16(); - void kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite); - void kernelDrawText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 alignment, int16 style, bool hilite); - void kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite); + void kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, uint16 languageSplitter, int16 fontId, int16 style, bool hilite); + void kernelDrawText(Common::Rect rect, reg_t obj, const char *text, uint16 languageSplitter, int16 fontId, int16 alignment, int16 style, bool hilite); + void kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char *text, uint16 languageSplitter, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite); void kernelDrawIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, int16 loopNo, int16 celNo, int16 priority, int16 style, bool hilite); void kernelDrawList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite); void kernelTexteditChange(reg_t controlObject, reg_t eventObject); diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp index b835eb92ca..f80703e14d 100644 --- a/engines/sci/graphics/paint16.cpp +++ b/engines/sci/graphics/paint16.cpp @@ -476,7 +476,7 @@ void GfxPaint16::kernelGraphRedrawBox(Common::Rect rect) { #define SCI_DISPLAY_DUMMY3 117 #define SCI_DISPLAY_DONTSHOWBITS 121 -reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) { +reg_t GfxPaint16::kernelDisplay(const char *text, uint16 languageSplitter, int argc, reg_t *argv) { reg_t displayArg; TextAlignment alignment = SCI_TEXT16_ALIGNMENT_LEFT; int16 colorPen = -1, colorBack = -1, width = -1, bRedraw = 1; @@ -572,7 +572,7 @@ reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) { } // now drawing the text - _text16->Size(rect, text, -1, width); + _text16->Size(rect, text, languageSplitter, -1, width); rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop); // Note: This code has been found in SCI1 middle and newer games. It was // previously only for SCI1 late and newer, but the LSL1 interpreter contains @@ -588,7 +588,7 @@ reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) { result = bitsSave(rect, GFX_SCREEN_MASK_VISUAL); if (colorBack != -1) fillRect(rect, GFX_SCREEN_MASK_VISUAL, colorBack, 0, 0); - _text16->Box(text, false, rect, alignment, -1); + _text16->Box(text, languageSplitter, false, rect, alignment, -1); if (_screen->_picNotValid == 0 && bRedraw) bitsShow(rect); // restoring port and cursor pos diff --git a/engines/sci/graphics/paint16.h b/engines/sci/graphics/paint16.h index 882f311a5b..955cfdec8f 100644 --- a/engines/sci/graphics/paint16.h +++ b/engines/sci/graphics/paint16.h @@ -80,7 +80,7 @@ public: void kernelGraphUpdateBox(const Common::Rect &rect, bool hiresMode); void kernelGraphRedrawBox(Common::Rect rect); - reg_t kernelDisplay(const char *text, int argc, reg_t *argv); + reg_t kernelDisplay(const char *text, uint16 languageSplitter, int argc, reg_t *argv); reg_t kernelPortraitLoad(const Common::String &resourceName); void kernelPortraitShow(const Common::String &resourceName, Common::Point position, uint16 resourceNum, uint16 noun, uint16 verb, uint16 cond, uint16 seq); diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp index 7552cb89ef..edeef31a5f 100644 --- a/engines/sci/graphics/text16.cpp +++ b/engines/sci/graphics/text16.cpp @@ -353,7 +353,7 @@ void GfxText16::DrawString(const char *str, GuiResourceId orgFontId, int16 orgPe Draw(str, 0, (int16)strlen(str), orgFontId, orgPenColor); } -int16 GfxText16::Size(Common::Rect &rect, const char *text, GuiResourceId fontId, int16 maxWidth) { +int16 GfxText16::Size(Common::Rect &rect, const char *text, uint16 languageSplitter, GuiResourceId fontId, int16 maxWidth) { GuiResourceId previousFontId = GetFontId(); int16 previousPenColor = _ports->_curPort->penClr; int16 charCount; @@ -369,7 +369,7 @@ int16 GfxText16::Size(Common::Rect &rect, const char *text, GuiResourceId fontId if (maxWidth < 0) { // force output as single line if (g_sci->getLanguage() == Common::JA_JPN) - SwitchToFont900OnSjis(text); + SwitchToFont900OnSjis(text, languageSplitter); StringWidth(text, fontId, textWidth, textHeight); rect.bottom = textHeight; @@ -383,7 +383,7 @@ int16 GfxText16::Size(Common::Rect &rect, const char *text, GuiResourceId fontId while (*curTextPos) { // We need to check for Shift-JIS every line if (g_sci->getLanguage() == Common::JA_JPN) - SwitchToFont900OnSjis(curTextPos); + SwitchToFont900OnSjis(curTextPos, languageSplitter); charCount = GetLongest(curTextPos, rect.right, fontId); if (charCount == 0) @@ -458,7 +458,7 @@ void GfxText16::Show(const char *text, int16 from, int16 len, GuiResourceId orgF } // Draws a text in rect. -void GfxText16::Box(const char *text, bool show, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId) { +void GfxText16::Box(const char *text, uint16 languageSplitter, bool show, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId) { int16 textWidth, maxTextWidth, textHeight, charCount; int16 offset = 0; int16 hline = 0; @@ -482,7 +482,7 @@ void GfxText16::Box(const char *text, bool show, const Common::Rect &rect, TextA // We need to check for Shift-JIS every line // Police Quest 2 PC-9801 often draws English + Japanese text during the same call if (g_sci->getLanguage() == Common::JA_JPN) { - if (SwitchToFont900OnSjis(curTextPos)) + if (SwitchToFont900OnSjis(curTextPos, languageSplitter)) doubleByteMode = true; } @@ -576,11 +576,13 @@ void GfxText16::DrawStatus(const char *text) { // Sierra did this in their PC98 interpreter only, they identify a text as being // sjis and then switch to font 900 -bool GfxText16::SwitchToFont900OnSjis(const char *text) { +bool GfxText16::SwitchToFont900OnSjis(const char *text, uint16 languageSplitter) { byte firstChar = (*(const byte *)text++); - if (((firstChar >= 0x81) && (firstChar <= 0x9F)) || ((firstChar >= 0xE0) && (firstChar <= 0xEF))) { - SetFont(900); - return true; + if (languageSplitter != 0x6a23) { // #j prefix as language splitter + if (((firstChar >= 0x81) && (firstChar <= 0x9F)) || ((firstChar >= 0xE0) && (firstChar <= 0xEF))) { + SetFont(900); + return true; + } } return false; } @@ -609,9 +611,9 @@ reg_t GfxText16::allocAndFillReferenceRectArray() { return NULL_REG; } -void GfxText16::kernelTextSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) { +void GfxText16::kernelTextSize(const char *text, uint16 languageSplitter, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) { Common::Rect rect(0, 0, 0, 0); - Size(rect, text, font, maxWidth); + Size(rect, text, languageSplitter, font, maxWidth); *textWidth = rect.width(); *textHeight = rect.height(); } diff --git a/engines/sci/graphics/text16.h b/engines/sci/graphics/text16.h index 715891be44..2724d97347 100644 --- a/engines/sci/graphics/text16.h +++ b/engines/sci/graphics/text16.h @@ -56,10 +56,15 @@ public: void StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight); void ShowString(const char *str, GuiResourceId orgFontId, int16 orgPenColor); void DrawString(const char *str, GuiResourceId orgFontId, int16 orgPenColor); - int16 Size(Common::Rect &rect, const char *text, GuiResourceId fontId, int16 maxWidth); + int16 Size(Common::Rect &rect, const char *text, uint16 textLanguage, GuiResourceId fontId, int16 maxWidth); void Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor); void Show(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 orgPenColor); - void Box(const char *text, bool show, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId); + void Box(const char *text, uint16 languageSplitter, bool show, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId); + + void Box(const char *text, bool show, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId) { + Box(text, 0, show, rect, alignment, fontId); + } + void DrawString(const char *text); void DrawStatus(const char *text); @@ -67,13 +72,13 @@ public: reg_t allocAndFillReferenceRectArray(); - void kernelTextSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight); + void kernelTextSize(const char *text, uint16 textLanguage, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight); void kernelTextFonts(int argc, reg_t *argv); void kernelTextColors(int argc, reg_t *argv); private: void init(); - bool SwitchToFont900OnSjis(const char *text); + bool SwitchToFont900OnSjis(const char *text, uint16 languageSplitter); GfxCache *_cache; GfxPorts *_ports; diff --git a/engines/sci/sci.h b/engines/sci/sci.h index 2377386c72..4928fd1b4e 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -314,13 +314,16 @@ public: * if NULL is passed no subtitle will be added to the returned string * @return processed string */ - Common::String strSplit(const char *str, const char *sep = "\r----------\r"); + Common::String strSplitLanguage(const char *str, uint16 *splitLanguage, const char *sep = "\r----------\r"); + Common::String strSplit(const char *str, const char *sep = "\r----------\r") { + return strSplitLanguage(str, NULL, sep); + } kLanguage getSciLanguage(); void setSciLanguage(kLanguage lang); void setSciLanguage(); - Common::String getSciLanguageString(const Common::String &str, kLanguage lang, kLanguage *lang2 = NULL) const; + Common::String getSciLanguageString(const Common::String &str, kLanguage lang, kLanguage *lang2 = NULL, uint16 *languageSplitter = NULL) const; // Check if vocabulary needs to get switched (in multilingual parser games) void checkVocabularySwitch(); |