[Scummvm-cvs-logs] SF.net SVN: scummvm:[53558] scummvm/trunk/engines/scumm

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Mon Oct 18 01:52:33 CEST 2010


Revision: 53558
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53558&view=rev
Author:   athrxx
Date:     2010-10-17 23:52:33 +0000 (Sun, 17 Oct 2010)

Log Message:
-----------
SCUMM/FM-TOWNS: more improvements to japanese font drawing

(MI1 intro is still not right)

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/charset.cpp
    scummvm/trunk/engines/scumm/string.cpp

Modified: scummvm/trunk/engines/scumm/charset.cpp
===================================================================
--- scummvm/trunk/engines/scumm/charset.cpp	2010-10-17 23:45:57 UTC (rev 53557)
+++ scummvm/trunk/engines/scumm/charset.cpp	2010-10-17 23:52:33 UTC (rev 53558)
@@ -383,8 +383,8 @@
 
 	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 @@
 
 		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 @@
 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 @@
 
 		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 @@
 
 #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 @@
 		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;

Modified: scummvm/trunk/engines/scumm/string.cpp
===================================================================
--- scummvm/trunk/engines/scumm/string.cpp	2010-10-17 23:45:57 UTC (rev 53557)
+++ scummvm/trunk/engines/scumm/string.cpp	2010-10-17 23:52:33 UTC (rev 53558)
@@ -1016,6 +1016,7 @@
 	uint num = 0;
 	uint32 val;
 	byte chr;
+	byte lastChr = 0;
 	const byte *src;
 	byte *end;
 	byte transBuf[384];
@@ -1123,12 +1124,12 @@
 		} 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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list