[Scummvm-git-logs] scummvm master -> 58fb91e1bd1a0d2905687e68c9612c3ca8f20dac
AndywinXp
noreply at scummvm.org
Wed Sep 14 20:27:42 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
58fb91e1bd SCUMM: COMI: Fix mishandling of control characters
Commit: 58fb91e1bd1a0d2905687e68c9612c3ca8f20dac
https://github.com/scummvm/scummvm/commit/58fb91e1bd1a0d2905687e68c9612c3ca8f20dac
Author: AndywinXp (andywinxp at gmail.com)
Date: 2022-09-14T22:27:31+02:00
Commit Message:
SCUMM: COMI: Fix mishandling of control characters
This fixes the appearence of the debug message "Machine rating is "
Changed paths:
engines/scumm/script.cpp
engines/scumm/string.cpp
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index 993c6baee2d..792f5b11792 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -1549,7 +1549,10 @@ int ScummEngine::resStrLen(const byte *src) {
}
while ((chr = *src++) != 0) {
num++;
- if (_game.heversion <= 71 && chr == 0xFF) {
+ if (_game.version == 8 && chr == 0xFF) {
+ src += 5;
+ num += 5;
+ } else if (_game.heversion <= 71 && chr == 0xFF) {
chr = *src++;
num++;
@@ -1560,13 +1563,8 @@ int ScummEngine::resStrLen(const byte *src) {
}
if (chr != 1 && chr != 2 && chr != 3 && chr != 8) {
- if (_game.version == 8) {
- src += 4;
- num += 4;
- } else {
- src += 2;
- num += 2;
- }
+ src += 2;
+ num += 2;
}
}
}
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index db6f2d31e5d..d23398ecdd7 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -1787,23 +1787,30 @@ void ScummEngine_v7::translateText(const byte *text, byte *trans_buff, int trans
if (found != NULL) {
Common::strlcpy((char *)trans_buff, _languageBuffer + found->offset, transBufferSize);
- if ((_game.id == GID_DIG) && !(_game.features & GF_DEMO)) {
- // Replace any '%___' by the corresponding special codes in the source text
+ if (((_game.id == GID_DIG) && !(_game.features & GF_DEMO)) || _game.version == 8) {
+ // Replace any '%___' (or '%<var-name>%' for v8) by the corresponding special codes in the source text
const byte *src = text;
char *dst = (char *)trans_buff;
- while ((dst = strstr(dst, "%___"))) {
+ while ((dst = (_game.version == 8 ? strchr(dst, '%') : strstr(dst, "%___")))) {
// Search for a special code in the message.
while (*src && *src != 0xFF) {
src++;
}
- // Replace the %___ by the special code. Luckily, we can do
- // that in-place.
+ // Replace the %___ (or %<var-name>%) by the special code.
+ // Luckily, we can do that in-place.
if (*src == 0xFF) {
- memcpy(dst, src, 4);
- src += 4;
- dst += 4;
+ if (_game.version == 7) {
+ memcpy(dst, src, 4);
+ src += 4;
+ dst += 4;
+ } else {
+ memcpy(dst, src, 6);
+ src += 6;
+ dst += 6;
+ *dst = '\0';
+ }
} else
break;
}
More information about the Scummvm-git-logs
mailing list