diff options
author | ניב באר | 2018-09-03 22:29:19 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2020-01-01 00:31:21 +0100 |
commit | 72471ec431c76f6aee63ef67cf4fd475f942ac47 (patch) | |
tree | 3b7a078b2f7da96bc9af7c797a06dccef0e79fcc /engines/scumm | |
parent | c05b911563a8016c4e978dabd4715403febe3648 (diff) | |
download | scummvm-rg350-72471ec431c76f6aee63ef67cf4fd475f942ac47.tar.gz scummvm-rg350-72471ec431c76f6aee63ef67cf4fd475f942ac47.tar.bz2 scummvm-rg350-72471ec431c76f6aee63ef67cf4fd475f942ac47.zip |
SCUMM: rtl support for scumm-7-8
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/smush/smush_font.cpp | 11 | ||||
-rw-r--r-- | engines/scumm/string.cpp | 43 | ||||
-rw-r--r-- | engines/scumm/verbs.cpp | 16 |
3 files changed, 65 insertions, 5 deletions
diff --git a/engines/scumm/smush/smush_font.cpp b/engines/scumm/smush/smush_font.cpp index 01ac202d37..bad1b02d37 100644 --- a/engines/scumm/smush/smush_font.cpp +++ b/engines/scumm/smush/smush_font.cpp @@ -191,8 +191,11 @@ void SmushFont::drawSubstring(const char *str, byte *buffer, int dst_width, int // to have to check for it. if (x < 0) x = 0; + + //for (int i = 0; str[i] != 0; i++) { - for (int i = 0; str[i] != 0; i++) { + int len = strlen(str); + for (int i = len; i >= 0; i--) { if ((byte)str[i] >= 0x80 && _vm->_useCJKMode) { x += draw2byte(buffer, dst_width, x, y, (byte)str[i] + 256 * (byte)str[i+1]); i++; @@ -207,6 +210,12 @@ void SmushFont::drawSubstring(const char *str, byte *buffer, int dst_width, int void SmushFont::drawString(const char *str, byte *buffer, int dst_width, int dst_height, int x, int y, bool center) { debugC(DEBUG_SMUSH, "SmushFont::drawString(%s, %d, %d, %d)", str, x, y, center); + + //char rev[384] = {0}; + //int len = strlen(str); + //for (int l = 0; l < len; l++) { + // rev[l] = str[len - l - 1]; + //} while (str) { char line[256]; const char *pos = strchr(str, '\n'); diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index 421c72b21d..112f4127cc 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -237,8 +237,10 @@ void ScummEngine_v7::addSubtitleToQueue(const byte *text, const Common::Point &p assert(_subtitleQueuePos < ARRAYSIZE(_subtitleQueue)); SubtitleText *st = &_subtitleQueue[_subtitleQueuePos]; int i = 0; + + int len = strlen((const char *)text); while (1) { - st->text[i] = text[i]; + st->text[i] = text[len - i - 1]; if (!text[i]) break; ++i; @@ -1247,7 +1249,20 @@ int ScummEngine::convertNameMessage(byte *dst, int dstSize, int var) { if (num) { const byte *ptr = getObjOrActorName(num); if (ptr) { - return convertMessageToString(ptr, dst, dstSize); + int retval = convertMessageToString(ptr, dst, dstSize); + + if (_game.version >= 7 && (_language == Common::HE_ISR || true)) { + byte rev[384] = {0}; + int lens = strlen((const char *)dst); + + for (int l = 0; l < lens; l++) { + rev[l] = dst[lens - l - 1]; + } + rev[lens] = '\0'; + strcpy((char *)dst, (const char *)rev); + } + + return retval; } } return 0; @@ -1275,7 +1290,19 @@ int ScummEngine::convertStringMessage(byte *dst, int dstSize, int var) { if (var) { ptr = getStringAddress(var); if (ptr) { - return convertMessageToString(ptr, dst, dstSize); + int retval = convertMessageToString(ptr, dst, dstSize); + + if (_game.version >= 7 && (_language == Common::HE_ISR || true)) { + byte rev[384] = {0}; + int lens = strlen((const char *)dst); + + for (int l = 0; l < lens; l++) { + rev[l] = dst[lens - l - 1]; + } + rev[lens] = '\0'; + strcpy((char *)dst, (const char *)rev); + } + return retval; } } return 0; @@ -1575,6 +1602,16 @@ void ScummEngine_v7::translateText(const byte *text, byte *trans_buff) { } if (found != NULL) { + //char rev[384] = {0}; + //strcpy(rev, _languageBuffer + found->offset); + //int len = strlen(rev); + //for (int l = 0; l < len; l++) { + // trans_buff[l] = rev[len - l - 1]; + //} + //trans_buff[len] = '\0'; + + // OR + strcpy((char *)trans_buff, _languageBuffer + found->offset); if ((_game.id == GID_DIG) && !(_game.features & GF_DEMO)) { diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index 9675bd8f5a..9d8548aadb 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -1001,17 +1001,31 @@ void ScummEngine_v7::drawVerb(int verb, int mode) { // Convert the message, and skip a few remaining 0xFF codes (they // occur in FT; subtype 10, which is used for the speech associated // with the string). - byte buf[384]; + byte buf[384] = {0}; + byte rev[384] = {0}; + convertMessageToString(msg, buf, sizeof(buf)); msg = buf; while (*msg == 0xFF) msg += 4; + // reverse string for rtl support + if (_language == Common::HE_ISR || true) { + int lens = strlen((const char *)msg); + + for (int l = 0; l < lens; l++) { + rev[l] = msg[lens - l - 1]; + } + rev[lens] = '\0'; + msg = rev; + } + // Set the specified charset id int oldID = _charset->getCurID(); _charset->setCurID(vs->charset_nr); // Compute the text rect + vs->curRect.left = _screenWidth - _charset->getStringWidth(0, buf); vs->curRect.right = 0; vs->curRect.bottom = 0; const byte *msg2 = msg; |