diff options
author | Peter Kohaut | 2019-09-07 21:07:31 +0200 |
---|---|---|
committer | Peter Kohaut | 2019-09-07 21:18:20 +0200 |
commit | 94b9304014217c57d4e050efb66ba9861f948ae2 (patch) | |
tree | e45844431d8707eda3a0a38204b2ee58f06b6bea /engines/bladerunner | |
parent | d99ba0a12675286d81431cb38f6ef55c02e7d497 (diff) | |
download | scummvm-rg350-94b9304014217c57d4e050efb66ba9861f948ae2.tar.gz scummvm-rg350-94b9304014217c57d4e050efb66ba9861f948ae2.tar.bz2 scummvm-rg350-94b9304014217c57d4e050efb66ba9861f948ae2.zip |
BLADERUNNER: Improved support for Russian translations
Adds support for Home Systems, Inc. + Siberian Studio R4 translation
patch.
Added name scrambling algorithm from R4 patch.
Fixed R3 support (previously was not named).
closes #11102
Diffstat (limited to 'engines/bladerunner')
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 13 | ||||
-rw-r--r-- | engines/bladerunner/bladerunner.h | 1 | ||||
-rw-r--r-- | engines/bladerunner/detection_tables.h | 34 | ||||
-rw-r--r-- | engines/bladerunner/ui/esper.cpp | 25 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia.cpp | 42 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia.h | 2 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_crimes.cpp | 4 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_settings.cpp | 46 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_suspects.cpp | 32 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_suspects.h | 2 |
10 files changed, 136 insertions, 65 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index fa0d79e0ba..cc4570036c 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -625,6 +625,8 @@ bool BladeRunnerEngine::startup(bool hasSavegames) { if (!_textOptions->open("OPTIONS")) return false; + _russianCP1251 = ((uint8)_textOptions->getText(0)[0]) == 209; + _dialogueMenu = new DialogueMenu(this); if (!_dialogueMenu->loadText("DLGMENU")) return false; @@ -1925,13 +1927,22 @@ void BladeRunnerEngine::setSubtitlesEnabled(bool newVal) { } Common::SeekableReadStream *BladeRunnerEngine::getResourceStream(const Common::String &name) { + // If the file is extracted from MIX files use it directly, it is used by Russian translation patched by Siberian Studio + if (Common::File::exists(name)) { + Common::File directFile; + if (directFile.open(name)) { + Common::SeekableReadStream *stream = directFile.readStream(directFile.size()); + directFile.close(); + return stream; + } + } + for (int i = 0; i != kArchiveCount; ++i) { if (!_archives[i].isOpen()) { continue; } // debug("getResource: Searching archive %s for %s.", _archives[i].getName().c_str(), name.c_str()); - Common::SeekableReadStream *stream = _archives[i].createReadStreamForMember(name); if (stream) { return stream; diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h index ab1179569f..95b85f3708 100644 --- a/engines/bladerunner/bladerunner.h +++ b/engines/bladerunner/bladerunner.h @@ -126,6 +126,7 @@ public: Common::String _languageCode; Common::Language _language; + bool _russianCP1251; ActorDialogueQueue *_actorDialogueQueue; ScreenEffects *_screenEffects; diff --git a/engines/bladerunner/detection_tables.h b/engines/bladerunner/detection_tables.h index be41d84b3e..7f45c611c4 100644 --- a/engines/bladerunner/detection_tables.h +++ b/engines/bladerunner/detection_tables.h @@ -76,7 +76,18 @@ static const ADGameDescription gameDescriptions[] = { GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY) }, - // BladeRunner (Russian) + // BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc.) + { + "bladerunner", + 0, + AD_ENTRY1s("STARTUP.MIX", "bf42af841d9f4b643665013a348c81e0", 2483111), + Common::RU_RUS, + Common::kPlatformWindows, + ADGF_TESTING, + GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY) + }, + + // BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc. + Siberian Studio, R3) { "bladerunner", 0, @@ -87,11 +98,11 @@ static const ADGameDescription gameDescriptions[] = { GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY) }, - // BladeRunner (Russian - Fargus version) + // BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc. + Siberian Studio, R4) { "bladerunner", 0, - AD_ENTRY1s("STARTUP.MIX", "bf42af841d9f4b643665013a348c81e0", 2483111), + AD_ENTRY1s("STARTUP.MIX", "d62498a7415682bb3ff86a894303c836", 2810053), Common::RU_RUS, Common::kPlatformWindows, ADGF_TESTING, @@ -155,7 +166,18 @@ static const ADGameDescription gameDescriptions[] = { GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY) }, - // BladeRunner (Russian) + // BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc.) + { + "bladerunner-final", + 0, + AD_ENTRY1s("STARTUP.MIX", "bf42af841d9f4b643665013a348c81e0", 2483111), + Common::RU_RUS, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY) + }, + + // BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc. + Siberian Studio, R3) { "bladerunner-final", 0, @@ -166,11 +188,11 @@ static const ADGameDescription gameDescriptions[] = { GUIO2(GAMEOPTION_SITCOM, GAMEOPTION_SHORTY) }, - // BladeRunner (Russian - Fargus version) + // BladeRunner (Russian - Fargus Multimedia + Home Systems, Inc. + Siberian Studio, R4) { "bladerunner-final", 0, - AD_ENTRY1s("STARTUP.MIX", "bf42af841d9f4b643665013a348c81e0", 2483111), + AD_ENTRY1s("STARTUP.MIX", "d62498a7415682bb3ff86a894303c836", 2810053), Common::RU_RUS, Common::kPlatformWindows, ADGF_UNSTABLE, diff --git a/engines/bladerunner/ui/esper.cpp b/engines/bladerunner/ui/esper.cpp index fe59805153..ef72049a4c 100644 --- a/engines/bladerunner/ui/esper.cpp +++ b/engines/bladerunner/ui/esper.cpp @@ -1039,15 +1039,26 @@ void ESPER::drawVideoFrame(Graphics::Surface &surface) { } void ESPER::drawTextCoords(Graphics::Surface &surface) { + const char *zm = "ZM %04.0f"; + const char *ns = "NS %04d"; + const char *ew = "EW %04d"; if (_vm->_language == Common::RU_RUS) { - _vm->_mainFont->drawString(&surface, Common::String::format("gh %04.0f", _zoom / _zoomMin * 2.0f ), 155, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); - _vm->_mainFont->drawString(&surface, Common::String::format("dh %04d", 12 * _viewport.top + 98), 260, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); - _vm->_mainFont->drawString(&surface, Common::String::format("uh %04d", 12 * _viewport.left + 167), 364, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); - } else { - _vm->_mainFont->drawString(&surface, Common::String::format("ZM %04.0f", _zoom / _zoomMin * 2.0f ), 155, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); - _vm->_mainFont->drawString(&surface, Common::String::format("NS %04d", 12 * _viewport.top + 98), 260, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); - _vm->_mainFont->drawString(&surface, Common::String::format("EW %04d", 12 * _viewport.left + 167), 364, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); + // ПР, ВР, ГР + if (_vm->_russianCP1251) { + // Patched transalation by Siberian Studio is using Windows-1251 encoding + zm = "\xcf\xd0 %04.0f"; + ns = "\xc2\xd0 %04d"; + ew = "\xc3\xd0 %04d"; + } else { + // Original release uses custom encoding + zm = "gh %04.0f"; + ns = "dh %04d"; + ew = "uh %04d"; + } } + _vm->_mainFont->drawString(&surface, Common::String::format(zm, _zoom / _zoomMin * 2.0f ), 155, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); + _vm->_mainFont->drawString(&surface, Common::String::format(ns, 12 * _viewport.top + 98), 260, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); + _vm->_mainFont->drawString(&surface, Common::String::format(ew, 12 * _viewport.left + 167), 364, 364, surface.w, surface.format.RGBToColor(0, 0, 255)); } void ESPER::drawMouse(Graphics::Surface &surface) { diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp index 3e9011e0c0..9ec9d686c0 100644 --- a/engines/bladerunner/ui/kia.cpp +++ b/engines/bladerunner/ui/kia.cpp @@ -599,6 +599,48 @@ void KIA::playImage(const Graphics::Surface &image) { _playerImage.convertToInPlace(screenPixelFormat()); } +const char *KIA::scrambleSuspectsName(const char *name) { + static char buffer[32]; + + unsigned char *bufferPtr = (unsigned char *)buffer; + const unsigned char *namePtr = (const unsigned char *)name; + + for (int i = 0 ; i < 6; ++i) { + if (_vm->_language == Common::RU_RUS && _vm->_russianCP1251) { + // Algorithm added by Siberian Studio in R4 patch + if (*namePtr >= 0xC0) { + unsigned char upper = *namePtr & 0xDF; + if (upper < 201) { + *bufferPtr++ = upper - 143; /* Map А-И to 1-9 */ + } else { + *bufferPtr++ = upper - 136; /* Map Й-Я to A-W */ + } + } else { + *bufferPtr++ = '0'; + } + } else { + if (Common::isAlpha(*namePtr)) { + char upper = toupper(*namePtr); + if ( upper < 'J' ) { + *bufferPtr++ = upper - 16; /* Map A-I to 1-9 */ + } else { + *bufferPtr++ = upper - 9; /* Map J-Z to A-Q */ + } + } else { + *bufferPtr++ = '0'; + } + } + if (*namePtr) { + ++namePtr; + } + if (i == 1) { + *bufferPtr++ = '-'; + } + } + *bufferPtr = 0; + return buffer; +} + void KIA::mouseDownCallback(int buttonId, void *callbackData) { KIA *self = (KIA *)callbackData; switch (buttonId) { diff --git a/engines/bladerunner/ui/kia.h b/engines/bladerunner/ui/kia.h index 2a87f5df6a..dc106234d5 100644 --- a/engines/bladerunner/ui/kia.h +++ b/engines/bladerunner/ui/kia.h @@ -151,6 +151,8 @@ public: void playPhotograph(int photographId); void playImage(const Graphics::Surface &image); + const char *scrambleSuspectsName(const char *name); + private: static void mouseDownCallback(int buttonId, void *callbackData); static void mouseUpCallback(int buttonId, void *callbackData); diff --git a/engines/bladerunner/ui/kia_section_crimes.cpp b/engines/bladerunner/ui/kia_section_crimes.cpp index 8729002cf8..b87ec1fe68 100644 --- a/engines/bladerunner/ui/kia_section_crimes.cpp +++ b/engines/bladerunner/ui/kia_section_crimes.cpp @@ -175,10 +175,10 @@ void KIASectionCrimes::draw(Graphics::Surface &surface) { if (_suspectsWithIdentity[_suspectSelected]) { text = suspectName; } else if (_vm->_suspectsDatabase->get(_suspectSelected)->getSex()) { - sprintf(generatedText, "%s %s", _vm->_textKIA->getText(20), KIASectionSuspects::scrambleSuspectsName(suspectName)); + sprintf(generatedText, "%s %s", _vm->_textKIA->getText(20), _vm->_kia->scrambleSuspectsName(suspectName)); text = generatedText; } else { - sprintf(generatedText, "%s %s", _vm->_textKIA->getText(21), KIASectionSuspects::scrambleSuspectsName(suspectName)); + sprintf(generatedText, "%s %s", _vm->_textKIA->getText(21), _vm->_kia->scrambleSuspectsName(suspectName)); text = generatedText; } } diff --git a/engines/bladerunner/ui/kia_section_settings.cpp b/engines/bladerunner/ui/kia_section_settings.cpp index 4a85ed718a..8388d12e65 100644 --- a/engines/bladerunner/ui/kia_section_settings.cpp +++ b/engines/bladerunner/ui/kia_section_settings.cpp @@ -199,25 +199,37 @@ void KIASectionSettings::draw(Graphics::Surface &surface) { if (_vm->_subtitles->isSystemActive()) { // Allow this to be loading as an extra text item in the resource for text options - const char *subtitlesTranslation = "Subtitles"; - if (_vm->_language == Common::EN_ANY) { - subtitlesTranslation = "Subtitles"; // EN_ANY - } else if (_vm->_language == Common::DE_DEU) { - subtitlesTranslation = "Untertitel"; // DE_DEU - } else if (_vm->_language == Common::FR_FRA) { - subtitlesTranslation = "Sous-titres"; // FR_FRA - } else if (_vm->_language == Common::IT_ITA) { - subtitlesTranslation = "Sottotitoli"; // IT_ITA - } else if (_vm->_language == Common::RU_RUS) { - // The supported Russian version is using its own KIA6PT.FON - // where it has replaced the mapping of Latin characters to Russian characters - // So the character string here does not make sense, but it will appear correctly - subtitlesTranslation = "CE,NBNHS"; // RU_RUS "Subtitry" - } else if (_vm->_language == Common::ES_ESP) { - subtitlesTranslation = "Subtitulos"; // ES_ESP + const char *subtitlesTranslation = nullptr; + switch (_vm->_language) { + case Common::EN_ANY: + default: + subtitlesTranslation = "Subtitles"; + break; + case Common::DE_DEU: + subtitlesTranslation = "Untertitel"; + break; + case Common::FR_FRA: + subtitlesTranslation = "Sous-titres"; + break; + case Common::IT_ITA: + subtitlesTranslation = "Sottotitoli"; + break; + case Common::ES_ESP: + subtitlesTranslation = "Subtitulos"; + break; + case Common::RU_RUS: + // субтитры + if (_vm->_russianCP1251) { + // Patched transalation by Siberian Studio is using Windows-1251 encoding + subtitlesTranslation = "\xf1\xf3\xe1\xf2\xe8\xf2\xf0\xfb"; + } else { + // Original release uses custom encoding + subtitlesTranslation = "CE,NBNHS"; + } + break; } - const char *textSubtitles = strcmp(_vm->_textOptions->getText(42), "") == 0? subtitlesTranslation : _vm->_textOptions->getText(42); // +1 to the max of original index of textOptions which is 41 + const char *textSubtitles = strcmp(_vm->_textOptions->getText(42), "") == 0 ? subtitlesTranslation : _vm->_textOptions->getText(42); // +1 to the max of original index of textOptions which is 41 if (_vm->_language == Common::RU_RUS) { _vm->_mainFont->drawString(&surface, textSubtitles, 288, 376, surface.w, surface.format.RGBToColor(232, 208, 136)); // special case for Russian version, put the option in a new line to avoid overlap diff --git a/engines/bladerunner/ui/kia_section_suspects.cpp b/engines/bladerunner/ui/kia_section_suspects.cpp index c98c2c77bf..962d0a332f 100644 --- a/engines/bladerunner/ui/kia_section_suspects.cpp +++ b/engines/bladerunner/ui/kia_section_suspects.cpp @@ -211,10 +211,10 @@ void KIASectionSuspects::draw(Graphics::Surface &surface) { if (_suspectsWithIdentity[_suspectSelected]) { text = suspectName; } else if (_vm->_suspectsDatabase->get(_suspectSelected)->getSex()) { - sprintf(generatedText, "%s %s", _vm->_textKIA->getText(20), scrambleSuspectsName(suspectName)); + sprintf(generatedText, "%s %s", _vm->_textKIA->getText(20), _vm->_kia->scrambleSuspectsName(suspectName)); text = generatedText; } else { - sprintf(generatedText, "%s %s", _vm->_textKIA->getText(21), scrambleSuspectsName(suspectName)); + sprintf(generatedText, "%s %s", _vm->_textKIA->getText(21), _vm->_kia->scrambleSuspectsName(suspectName)); text = generatedText; } } @@ -283,34 +283,6 @@ void KIASectionSuspects::selectSuspect(int suspectId) { updateSuspectPhoto(); } -const char *KIASectionSuspects::scrambleSuspectsName(const char *name) { - static char buffer[32]; - - char *bufferPtr = buffer; - const char *namePtr = name; - - for (int i = 0 ; i < 6; ++i) { - if (Common::isAlpha(*namePtr)) { - char upper = toupper(*namePtr); - if ( upper < 'J' ) { - *bufferPtr++ = upper - 16; - } else { - *bufferPtr++ = upper - 9; - } - } else { - *bufferPtr++ = '0'; - } - if (*namePtr) { - ++namePtr; - } - if (i == 1) { - *bufferPtr++ = '-'; - } - } - *bufferPtr = 0; - return buffer; -} - void KIASectionSuspects::scrollBoxCallback(void *callbackData, void *source, int lineData, int mouseButton) { KIASectionSuspects *self = (KIASectionSuspects *)callbackData; diff --git a/engines/bladerunner/ui/kia_section_suspects.h b/engines/bladerunner/ui/kia_section_suspects.h index 33563288a1..c4ff35b417 100644 --- a/engines/bladerunner/ui/kia_section_suspects.h +++ b/engines/bladerunner/ui/kia_section_suspects.h @@ -105,8 +105,6 @@ public: void selectSuspect(int suspectId); - static const char *scrambleSuspectsName(const char *name); - private: static void scrollBoxCallback(void *callbackData, void *source, int lineData, int mouseButton); static void checkBoxCallback(void *callbackData, void *source); |