From 93dfd3922ec9f42677aa783e78b85b303187aa8e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 29 Jan 2020 00:50:19 +0100 Subject: [PATCH] DREAMWEB: Added support for Russian fan-translation --- engines/dreamweb/dreamweb.cpp | 11 ++++--- engines/dreamweb/dreamweb.h | 3 ++ engines/dreamweb/keypad.cpp | 8 +++++ engines/dreamweb/monitor.cpp | 7 ++++- engines/dreamweb/print.cpp | 12 +++++++- engines/dreamweb/saveload.cpp | 4 +++ engines/dreamweb/stubs.cpp | 58 +++++++++++++++++++++++++++++------ engines/dreamweb/talk.cpp | 7 +++++ 8 files changed, 93 insertions(+), 17 deletions(-) diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index 435f91b2952..76db211724b 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -490,12 +490,9 @@ void DreamWebEngine::cls() { } uint8 DreamWebEngine::modifyChar(uint8 c) const { - if (c < 128) - return c; - - switch(getLanguage()) { + switch (getLanguage()) { case Common::DE_DEU: - switch(c) { + switch (c) { case 129: return 'Z' + 3; case 132: @@ -570,6 +567,10 @@ uint8 DreamWebEngine::modifyChar(uint8 c) const { default: return c; } + case Common::RU_RUS: + if (c >= 224) + c -= 48; + // fall through default: return c; } diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 8a5c72c3c9b..542db132335 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -776,6 +776,9 @@ public: void loadRoomData(const Room &room, bool skipDat); void useTempCharset(GraphicsFile *charset); void useCharset1(); + void useCharsetIcons1(); + void useCharsetTempgraphics(); + void resetCharset(); void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered); void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count); bool isItDescribed(const ObjPos *objPos); diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 476e9b5fb73..6c43c741d30 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -440,6 +440,10 @@ void DreamWebEngine::showLeftPage() { showFrame(_folderGraphics2, 0, y, 5, 0); _lineSpacing = 8; _charShift = 91; + + if (getLanguage() == Common::RU_RUS) + _charShift = 182; + uint8 pageIndex = _folderPage - 2; const uint8 *string = getTextInFile1(pageIndex * 2); y = 48; @@ -845,6 +849,10 @@ void DreamWebEngine::diaryKeyN() { void DreamWebEngine::showDiaryPage() { showFrame(_diaryGraphics, kDiaryx, kDiaryy, 0, 0); useTempCharset(&_diaryCharset); + + if (getLanguage() == Common::RU_RUS) + useCharsetTempgraphics(); + _charShift = 91+91; const uint8 *string = getTextInFile1(_diaryPage); uint16 y = kDiaryy + 16; diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 5f0566c8bae..daef8a4c360 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -344,7 +344,12 @@ void DreamWebEngine::printCurs() { height = 11; } else height = 8; - multiGet(_textUnder, x, y, 6, height); + + int w = 6; + if (getLanguage() == Common::RU_RUS) + w = 7; + + multiGet(_textUnder, x, y, w, height); ++_mainTimer; if ((_mainTimer & 16) == 0) showFrame(_monitorCharset, x, y, '/' - 32, 0); diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp index b98d5dda67d..680e2bd0bf4 100644 --- a/engines/dreamweb/print.cpp +++ b/engines/dreamweb/print.cpp @@ -103,7 +103,7 @@ uint8 DreamWebEngine::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 m } if (charCount != 1) { c1 = modifyChar(c1); - _charShift = 91; + _charShift = getLanguage() == Common::RU_RUS ? 182 : 91; uint16 offset2 = offset; printBoth(_charset1, &offset2, y, c1, c2); _charShift = 0; @@ -194,6 +194,16 @@ uint8 DreamWebEngine::getNumber(const GraphicsFile &charSet, const uint8 *string } uint8 DreamWebEngine::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) { + if (getLanguage() == Common::RU_RUS) { + if ((firstChar == 'a') || (firstChar == 'u') || (firstChar == 0xa0) + || (firstChar == 0xa8) || (firstChar == 0xa9) || (firstChar == 0xe9)) { + if ((secondChar == 0xe2) || (secondChar == 'n') || (secondChar == 't') || (secondChar == 'r') || (secondChar == 'i') || (secondChar == 'l')) + return width-1; + + } + return width; + } + if ((firstChar == 'a') || (firstChar == 'u')) { if ((secondChar == 'n') || (secondChar == 't') || (secondChar == 'r') || (secondChar == 'i') || (secondChar == 'l')) return width-1; diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index a104ba727d2..c869c13b3a7 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -780,6 +780,10 @@ void DreamWebEngine::showNames() { } if (_loadingOrSave != 2) { _charShift = 91; + + if (getLanguage() == Common::RU_RUS) + _charShift = 182; + printDirect((const uint8 *)name.c_str(), kOpsx + 21, kOpsy + 10*slot + 10, 200, false); _charShift = 0; continue; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 401ecf038cc..a519bf58b8f 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1789,16 +1789,29 @@ void DreamWebEngine::showTime() { int minutes = _vars._minuteCount; int hours = _vars._hourCount; - showFrame(_charset1, 282+5, 21, 91*3+10 + seconds / 10, 0); - showFrame(_charset1, 282+9, 21, 91*3+10 + seconds % 10, 0); + if (getLanguage() == Common::RU_RUS) { + showFrame(_icons1, 282+5, 21, 32+10 + seconds / 10, 0); + showFrame(_icons1, 282+9, 21, 32+10 + seconds % 10, 0); - showFrame(_charset1, 270+5, 21, 91*3 + minutes / 10, 0); - showFrame(_charset1, 270+11, 21, 91*3 + minutes % 10, 0); + showFrame(_icons1, 270+5, 21, 32 + minutes / 10, 0); + showFrame(_icons1, 270+11, 21, 32 + minutes % 10, 0); - showFrame(_charset1, 256+5, 21, 91*3 + hours / 10, 0); - showFrame(_charset1, 256+11, 21, 91*3 + hours % 10, 0); + showFrame(_icons1, 256+5, 21, 32 + hours / 10, 0); + showFrame(_icons1, 256+11, 21, 32 + hours % 10, 0); - showFrame(_charset1, 267+5, 21, 91*3+20, 0); + showFrame(_icons1, 267+5, 21, 32+20, 0); + } else { + showFrame(_charset1, 282+5, 21, 91*3+10 + seconds / 10, 0); + showFrame(_charset1, 282+9, 21, 91*3+10 + seconds % 10, 0); + + showFrame(_charset1, 270+5, 21, 91*3 + minutes / 10, 0); + showFrame(_charset1, 270+11, 21, 91*3 + minutes % 10, 0); + + showFrame(_charset1, 256+5, 21, 91*3 + hours / 10, 0); + showFrame(_charset1, 256+11, 21, 91*3 + hours % 10, 0); + + showFrame(_charset1, 267+5, 21, 91*3+20, 0); + } } void DreamWebEngine::watchCount() { @@ -1806,7 +1819,10 @@ void DreamWebEngine::watchCount() { return; ++_timerCount; if (_timerCount == 9) { - showFrame(_charset1, 268+4, 21, 91*3+21, 0); + if (getLanguage() == Common::RU_RUS) + showFrame(_icons1, 268+4, 21, 53, 0); + else + showFrame(_charset1, 268+4, 21, 91*3+21, 0); _watchDump = 1; } else if (_timerCount == 18) { _timerCount = 0; @@ -1827,14 +1843,14 @@ void DreamWebEngine::watchCount() { } void DreamWebEngine::roomName() { - printMessage(88, 18, 53, 240, false); + printMessage(88, (getLanguage() == Common::RU_RUS ? 17 : 18), 53, 240, false); uint16 textIndex = _roomNum; if (textIndex >= 32) textIndex -= 32; _lineSpacing = 7; uint8 maxWidth = (_vars._watchOn == 1) ? 120 : 160; const uint8 *string = (const uint8 *)_roomDesc.getString(textIndex); - printDirect(string, 88, 25, maxWidth, false); + printDirect(string, 88, (getLanguage() == Common::RU_RUS ? 26 : 25), maxWidth, false); _lineSpacing = 10; useCharset1(); } @@ -1935,6 +1951,20 @@ void DreamWebEngine::useCharset1() { _currentCharset = &_charset1; } +void DreamWebEngine::resetCharset() { + _charShift = 0; + useCharset1(); +} + +void DreamWebEngine::useCharsetIcons1() { + _currentCharset = &_icons1; + _charShift = 182; +} + +void DreamWebEngine::useCharsetTempgraphics() { + _currentCharset = &_diaryGraphics; +} + void DreamWebEngine::useTempCharset(GraphicsFile *charset) { _currentCharset = charset; } @@ -2304,7 +2334,15 @@ void DreamWebEngine::describeOb() { if (_foreignRelease && _objectType == kSetObjectType1) y = 82; _charShift = 91 + 91; + + if (getLanguage() == Common::RU_RUS) + useCharsetIcons1(); + printDirect(&obText, 33, &y, 241, 241 & 1); + + if (getLanguage() == Common::RU_RUS) + resetCharset(); + _charShift = 0; y = 104; if (_foreignRelease && _objectType == kSetObjectType1) diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index 8bb469b8fdd..0ab25f742d7 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -91,9 +91,16 @@ void DreamWebEngine::startTalk() { uint16 y; _charShift = 91+91; + + if (getLanguage() == Common::RU_RUS) + useCharsetIcons1(); + y = 64; printDirect(&str, 66, &y, 241, true); + if (getLanguage() == Common::RU_RUS) + resetCharset(); + _charShift = 0; y = 80; printDirect(&str, 66, &y, 241, true);