aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBLooperZ2019-12-31 21:43:03 +0200
committerEugene Sandulenko2020-01-01 00:31:21 +0100
commita96b82203bcb403bd5f2b82d07c8cd8da96b220f (patch)
tree6e52c8dd2116cc3882421b5553a054a90e3f7543
parente411a539cbc8de8758ed9294fd151b536402c309 (diff)
downloadscummvm-rg350-a96b82203bcb403bd5f2b82d07c8cd8da96b220f.tar.gz
scummvm-rg350-a96b82203bcb403bd5f2b82d07c8cd8da96b220f.tar.bz2
scummvm-rg350-a96b82203bcb403bd5f2b82d07c8cd8da96b220f.zip
SCUMM: add comments and fix formatting
-rw-r--r--engines/scumm/string.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index a94d4b8303..633a67792c 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -181,7 +181,7 @@ void ScummEngine_v6::drawBlastTexts() {
// Some localizations may override colors
// See credits in Chinese COMI
if (_game.id == GID_CMI && _language == Common::ZH_TWN &&
- c == '^' && (buf == _blastTextQueue[i].text + 1)) {
+ c == '^' && (buf == _blastTextQueue[i].text + 1)) {
if (*buf == 'c') {
int color = buf[3] - '0' + 10 *(buf[2] - '0');
_charset->setColor(color);
@@ -464,6 +464,9 @@ bool ScummEngine::newLine() {
}
void ScummEngine::fakeBidiString(char *ltext, bool ignoreVerb) {
+ // Provides custom made BiDi mechanism.
+ // Reverses texts on each line marked by control characters (considering different control characters used in verbs panel)
+ // While preserving original order of numbers (also negative numbers and comma separated)
int ll = 0;
if (_game.id == GID_INDY4 && ltext[ll] == 127) {
ll++;
@@ -473,9 +476,9 @@ void ScummEngine::fakeBidiString(char *ltext, bool ignoreVerb) {
}
int ipos = 0;
int start = 0;
- char* text = ltext + ll;
- char* current = text;
- while(1) {
+ char *text = ltext + ll;
+ char *current = text;
+ while (1) {
if (*current == 13 || *current == 0 || *current == -1 || *current == -2) {
// ignore the line break for verbs texts
@@ -540,7 +543,7 @@ void ScummEngine::fakeBidiString(char *ltext, bool ignoreVerb) {
break;
}
if (!ignoreVerb && _game.id == GID_INDY4 && ltext[0] == 127) {
- ltext[start + ipos + ll] = (char) 128;
+ ltext[start + ipos + ll] = '\x80';
ltext[start + ipos + ll + 1] = '\0';
}
}
@@ -633,7 +636,7 @@ void ScummEngine::CHARSET_1() {
return;
if ((_game.version <= 6 && _haveMsg == 1) ||
- (_game.version == 7 && _haveMsg != 1)) {
+ (_game.version == 7 && _haveMsg != 1)) {
if (_game.heversion >= 60) {
if (_sound->isSoundRunning(1) == 0)
@@ -1034,6 +1037,7 @@ void ScummEngine::drawString(int a, const byte *msg) {
if (_charset->_center) {
_charset->_left -= _charset->getStringWidth(a, buf) / 2;
} else if (_game.version >= 4 && _game.version < 7 && _game.id != GID_SAMNMAX && _language == Common::HE_ISR) {
+ // Ignore INDY4 verbs (but allow dialogue)
if (_game.id != GID_INDY4 || buf[0] == 127) {
int ll = 0;
if (_game.id == GID_INDY4 && buf[0] == 127) {
@@ -1041,7 +1045,8 @@ void ScummEngine::drawString(int a, const byte *msg) {
ll++;
}
- byte* ltext = buf;
+ // Skip control characters as they might contain '\0' which results in incorrect string width.
+ byte *ltext = buf;
while (ltext[ll] == 0xFF) {
ll += 4;
}
@@ -1100,8 +1105,9 @@ void ScummEngine::drawString(int a, const byte *msg) {
if (_charset->_center) {
_charset->_left = _charset->_startLeft - _charset->getStringWidth(a, buf + i);
} else if (_game.version >= 4 && _game.version < 7 && _language == Common::HE_ISR) {
+ // Skip control characters as they might contain '\0' which results in incorrect string width.
int ll = 0;
- byte* ltext = buf + i;
+ byte *ltext = buf + i;
while (ltext[ll] == 0xFF) {
ll += 4;
}