[Scummvm-cvs-logs] scummvm master -> 8ffd8793ed1f50872c572c6886a5e9100e8312e4
m-kiewitz
m_kiewitz at users.sourceforge.net
Sun Nov 2 15:42:52 CET 2014
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:
8ffd8793ed SCI: add support for \n and \r in Japanese text
Commit: 8ffd8793ed1f50872c572c6886a5e9100e8312e4
https://github.com/scummvm/scummvm/commit/8ffd8793ed1f50872c572c6886a5e9100e8312e4
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2014-11-02T15:44:22+01:00
Commit Message:
SCI: add support for \n and \r in Japanese text
fixes Police Quest 2 Japanese intro
thx to wjp for helping
Changed paths:
engines/sci/engine/state.cpp
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 7701822..1b7fa76 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -227,26 +227,53 @@ Common::String SciEngine::getSciLanguageString(const Common::String &str, kLangu
// Japanese including Kanji, displayed with system font
// Convert half-width characters to full-width equivalents
Common::String fullWidth;
- byte c;
+ byte curChar, curChar2;
+ uint16 mappedChar;
+
+ seeker++;
+
+ while (1) {
+ curChar = *(seeker);
+
+ switch (curChar) {
+ case 0: // Terminator NUL
+ return fullWidth;
+ case '\\':
+ // "\n", "\N", "\r" and "\R" were overwritten with SPACE + 0x0D in PC-9801 SSCI
+ // inside GetLongest() (text16). We do it here, because it's much cleaner and
+ // we have to process the text here anyway.
+ // Occurs for example in Police Quest 2 intro
+ curChar2 = *(seeker + 1);
+ switch (curChar2) {
+ case 'n':
+ case 'N':
+ case 'r':
+ case 'R':
+ fullWidth += ' ';
+ fullWidth += 0x0D; // CR
+ seeker += 2;
+ continue;
+ }
+ }
+
+ seeker++;
- while ((c = *(++seeker))) {
- uint16 mappedChar = s_halfWidthSJISMap[c];
+ mappedChar = s_halfWidthSJISMap[curChar];
if (mappedChar) {
fullWidth += mappedChar >> 8;
fullWidth += mappedChar & 0xFF;
} else {
// Copy double-byte character
- char c2 = *(++seeker);
- if (!c2) {
- error("SJIS character %02X is missing second byte", c);
+ curChar2 = *(seeker++);
+ if (!curChar) {
+ error("SJIS character %02X is missing second byte", curChar);
break;
}
- fullWidth += c;
- fullWidth += c2;
+ fullWidth += curChar;
+ fullWidth += curChar2;
}
}
- return fullWidth;
} else {
return Common::String(seeker + 1);
}
More information about the Scummvm-git-logs
mailing list