SCI: Don't add subtitles for monolingual strings.

svn-id: r48697
This commit is contained in:
Walter van Niftrik 2010-04-18 00:56:04 +00:00
parent 6d80424908
commit c0c351c766
2 changed files with 14 additions and 8 deletions

View File

@ -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);
}

View File

@ -190,7 +190,7 @@ public:
kLanguage getSciLanguage();
Common::String getSciLanguageString(const char *str, kLanguage lang) const;
Common::String getSciLanguageString(const char *str, kLanguage lang, kLanguage *lang2 = NULL) const;
public:
GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx