aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorFlorian Kagerer2010-10-17 23:52:33 +0000
committerFlorian Kagerer2010-10-17 23:52:33 +0000
commit1d60fc45f293f62877e39194a797edc38e6593c0 (patch)
tree092ea7ee42da48fb04669b8acd624288b970732d /engines/scumm
parent3dc498c5ece33f790972ead8656b8bafb10c8730 (diff)
downloadscummvm-rg350-1d60fc45f293f62877e39194a797edc38e6593c0.tar.gz
scummvm-rg350-1d60fc45f293f62877e39194a797edc38e6593c0.tar.bz2
scummvm-rg350-1d60fc45f293f62877e39194a797edc38e6593c0.zip
SCUMM/FM-TOWNS: more improvements to japanese font drawing
(MI1 intro is still not right) svn-id: r53558
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/charset.cpp25
-rw-r--r--engines/scumm/string.cpp7
2 files changed, 18 insertions, 14 deletions
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index e0ab9edd5e..3c76773a70 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -383,8 +383,8 @@ int CharsetRendererClassic::getCharWidth(uint16 chr) {
if (_vm->_useCJKMode) {
if (_vm->_game.platform == Common::kPlatformFMTowns) {
- if ((chr & 0xff00) == 0xfd00) {
- chr &= 0xff;
+ if ((chr & 0x00ff) == 0x00fd) {
+ chr >>= 8;
} else if (chr >= 256) {
spacing = 8;
} else if (useTownsFontRomCharacter(chr)) {
@@ -496,8 +496,8 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) {
if (_vm->_useCJKMode) {
if (_vm->_game.platform == Common::kPlatformFMTowns) {
- if ((chr >= 0x80 && chr <= 0x9f) || (chr >= 0xe0 && chr <= 0xfd))
- chr = (chr << 8) | text[pos++];
+ if (checkSJISCode(chr))
+ chr |= (text[pos++] << 8);
} else if (chr & 0x80) {
pos++;
width += _vm->_2byteWidth;
@@ -515,7 +515,7 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) {
void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
int lastspace = -1;
int curw = 1;
- byte chr;
+ uint16 chr;
int oldID = getCurID();
int code = (_vm->_game.heversion >= 80) ? 127 : 64;
@@ -579,8 +579,8 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) {
if (_vm->_useCJKMode) {
if (_vm->_game.platform == Common::kPlatformFMTowns) {
- if ((chr >= 0x80 && chr <= 0x9f) || (chr >= 0xe0 && chr <= 0xfd))
- chr = (chr << 8) | str[pos++];
+ if (checkSJISCode(chr))
+ chr |= (str[pos++] << 8);
curw += getCharWidth(chr);
} else if (chr & 0x80) {
pos++;
@@ -894,13 +894,16 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) {
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
processTownsCharsetColors(_bytesPerPixel);
+ bool noSjis = false;
if (_vm->_game.platform == Common::kPlatformFMTowns && _vm->_useCJKMode) {
- if ((chr & 0xff00) == 0xfd00)
- chr &= 0xff;
+ if ((chr & 0x00ff) == 0x00fd) {
+ chr >>= 8;
+ noSjis = true;
+ }
}
- if (useTownsFontRomCharacter(chr)) {
+ if (useTownsFontRomCharacter(chr) && !noSjis) {
charPtr = 0;
_vm->_cjkChar = chr;
enableShadow(true);
@@ -909,7 +912,7 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) {
offsX = offsY = 0;
} else
#endif
- if (_vm->_useCJKMode && (chr >= 128)) {
+ if (_vm->_useCJKMode && (chr >= 128) && !noSjis) {
enableShadow(true);
origWidth = width = _vm->_2byteWidth;
origHeight = height = _vm->_2byteHeight;
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index 6d90d55f71..92e6ef2f9e 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -1016,6 +1016,7 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize)
uint num = 0;
uint32 val;
byte chr;
+ byte lastChr = 0;
const byte *src;
byte *end;
byte transBuf[384];
@@ -1123,12 +1124,12 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize)
} else if (_game.id == GID_DIG && (chr == 1 || chr == 2 || chr == 3 || chr == 8)) {
// Skip these characters
} else {
- if (!(chr == '@') || (_game.id == GID_CMI && _language == Common::ZH_TWN) ||
+ if ((chr != '@') || (_game.id == GID_CMI && _language == Common::ZH_TWN) ||
(_game.id == GID_LOOM && _game.platform == Common::kPlatformPCEngine && _language == Common::JA_JPN) ||
- (_game.platform == Common::kPlatformFMTowns && _language == Common::JA_JPN))
- {
+ (_game.platform == Common::kPlatformFMTowns && _language == Common::JA_JPN && checkSJISCode(lastChr))) {
*dst++ = chr;
}
+ lastChr = chr;
}
// Check for a buffer overflow