diff options
author | Walter van Niftrik | 2010-04-18 00:56:04 +0000 |
---|---|---|
committer | Walter van Niftrik | 2010-04-18 00:56:04 +0000 |
commit | c0c351c76662998bdbb203758047d4b88da53b76 (patch) | |
tree | d4ecdfe8d0619fd99005a110aa25bb468c70183c /engines/sci/engine | |
parent | 6d8042490891f3864bf1a6492de77b572932a212 (diff) | |
download | scummvm-rg350-c0c351c76662998bdbb203758047d4b88da53b76.tar.gz scummvm-rg350-c0c351c76662998bdbb203758047d4b88da53b76.tar.bz2 scummvm-rg350-c0c351c76662998bdbb203758047d4b88da53b76.zip |
SCI: Don't add subtitles for monolingual strings.
svn-id: r48697
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/state.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index fb7359e343..ea33b0e668 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -124,7 +124,7 @@ static kLanguage charToLanguage(const char c) { } } -Common::String SciEngine::getSciLanguageString(const char *str, kLanguage lang) const { +Common::String SciEngine::getSciLanguageString(const char *str, kLanguage lang, kLanguage *lang2) const { kLanguage secondLang = K_LANG_NONE; const char *seeker = str; @@ -139,10 +139,9 @@ Common::String SciEngine::getSciLanguageString(const char *str, kLanguage lang) seeker++; } - //if ((secondLang == K_LANG_JAPANESE) && (*(seeker + 1) == 'J')) { - // // FIXME: Add Kanji support - // lang = K_LANG_ENGLISH; - //} + // Return the secondary language found in the string + if (lang2) + *lang2 = secondLang; if (secondLang == lang) return Common::String(seeker + 2); @@ -211,9 +210,16 @@ Common::String SciEngine::strSplit(const char *str, const char *sep) { subLang = (kLanguage)GET_SEL32V(_gamestate->_segMan, _gamestate->_gameObj, SELECTOR(subtitleLang)); } - Common::String retval = getSciLanguageString(str, lang); + kLanguage secondLang; + Common::String retval = getSciLanguageString(str, lang, &secondLang); - if ((subLang != K_LANG_NONE) && (sep != NULL)) { + // 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)) + return retval; + + // Add subtitle, unless the subtitle language doesn't match the languages in the string + if ((subLang == K_LANG_ENGLISH) || (subLang == secondLang)) { retval += sep; retval += getSciLanguageString(str, subLang); } |