DREAMWEB: Added support for Russian fan-translation

This commit is contained in:
Eugene Sandulenko 2020-01-29 00:50:19 +01:00
parent ac83b1d08c
commit 93dfd3922e
8 changed files with 93 additions and 17 deletions

View File

@ -490,9 +490,6 @@ void DreamWebEngine::cls() {
}
uint8 DreamWebEngine::modifyChar(uint8 c) const {
if (c < 128)
return c;
switch (getLanguage()) {
case Common::DE_DEU:
switch (c) {
@ -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;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1789,6 +1789,18 @@ void DreamWebEngine::showTime() {
int minutes = _vars._minuteCount;
int hours = _vars._hourCount;
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(_icons1, 270+5, 21, 32 + minutes / 10, 0);
showFrame(_icons1, 270+11, 21, 32 + minutes % 10, 0);
showFrame(_icons1, 256+5, 21, 32 + hours / 10, 0);
showFrame(_icons1, 256+11, 21, 32 + hours % 10, 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);
@ -1800,12 +1812,16 @@ void DreamWebEngine::showTime() {
showFrame(_charset1, 267+5, 21, 91*3+20, 0);
}
}
void DreamWebEngine::watchCount() {
if (_vars._watchOn == 0)
return;
++_timerCount;
if (_timerCount == 9) {
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) {
@ -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)

View File

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