aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/ui
diff options
context:
space:
mode:
authorPeter Kohaut2019-09-07 21:07:31 +0200
committerPeter Kohaut2019-09-07 21:18:20 +0200
commit94b9304014217c57d4e050efb66ba9861f948ae2 (patch)
treee45844431d8707eda3a0a38204b2ee58f06b6bea /engines/bladerunner/ui
parentd99ba0a12675286d81431cb38f6ef55c02e7d497 (diff)
downloadscummvm-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/ui')
-rw-r--r--engines/bladerunner/ui/esper.cpp25
-rw-r--r--engines/bladerunner/ui/kia.cpp42
-rw-r--r--engines/bladerunner/ui/kia.h2
-rw-r--r--engines/bladerunner/ui/kia_section_crimes.cpp4
-rw-r--r--engines/bladerunner/ui/kia_section_settings.cpp46
-rw-r--r--engines/bladerunner/ui/kia_section_suspects.cpp32
-rw-r--r--engines/bladerunner/ui/kia_section_suspects.h2
7 files changed, 95 insertions, 58 deletions
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);