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

sev at users.sourceforge.net sev at users.sourceforge.net
Mon Apr 28 17:21:37 CEST 2008


Revision: 31757
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31757&view=rev
Author:   sev
Date:     2008-04-28 08:21:36 -0700 (Mon, 28 Apr 2008)

Log Message:
-----------
Fix Kanji text positioning in DIG. Constants based on disassembly, but
it can bring some regressions to subtitles.

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

Modified: scummvm/trunk/engines/scumm/charset.cpp
===================================================================
--- scummvm/trunk/engines/scumm/charset.cpp	2008-04-28 10:56:21 UTC (rev 31756)
+++ scummvm/trunk/engines/scumm/charset.cpp	2008-04-28 15:21:36 UTC (rev 31757)
@@ -49,6 +49,7 @@
 	Common::File fp;
 	_useCJKMode = false;
 	_textSurfaceMultiplier = 1;
+	_newLineCharacter = 0xfe;
 
 	if (_game.version <= 5 && _game.platform == Common::kPlatformFMTowns && _language == Common::JA_JPN) { // FM-TOWNS v3 / v5 Kanji
 		int numChar = 256 * 32;
@@ -95,15 +96,17 @@
 				fp.seek(2, SEEK_CUR);
 				_2byteWidth = fp.readByte();
 				_2byteHeight = fp.readByte();
+				_newLineCharacter = 0xff;
 				break;
 			case Common::JA_JPN:
 				_2byteWidth = 16;
 				_2byteHeight = 16;
+				_newLineCharacter = 0xfe;
 				break;
 			case Common::ZH_TWN:
 				_2byteWidth = 16;
 				_2byteHeight = 15;
-				// 0xFE -> 0x21. also compared with 0x0d. perhaps a newline
+				_newLineCharacter = 0x21;
 				break;
 			default:
 				break;
@@ -352,7 +355,7 @@
 	int code = (_vm->_game.heversion >= 80) ? 127 : 64;
 
 	while ((chr = text[pos++]) != 0) {
-		if (chr == '\n' || chr == '\r')
+		if (chr == '\n' || chr == '\r' || chr == _vm->_newLineCharacter)
 			break;
 		if (_vm->_game.heversion >= 72) {
 			if (chr == code) {
@@ -479,6 +482,9 @@
 		if (chr == ' ')
 			lastspace = pos - 1;
 
+		if (chr == _vm->_newLineCharacter)
+			lastspace = pos - 1;
+
 		if ((chr & 0x80) && _vm->_useCJKMode) {
 			pos++;
 			curw += _vm->_2byteWidth;

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2008-04-28 10:56:21 UTC (rev 31756)
+++ scummvm/trunk/engines/scumm/scumm.h	2008-04-28 15:21:36 UTC (rev 31757)
@@ -1199,6 +1199,7 @@
 	bool _useCJKMode;
 	int _2byteHeight;
 	int _2byteWidth;
+	byte _newLineCharacter;
 	byte *get2byteCharPtr(int idx);
 
 protected:

Modified: scummvm/trunk/engines/scumm/string.cpp
===================================================================
--- scummvm/trunk/engines/scumm/string.cpp	2008-04-28 10:56:21 UTC (rev 31756)
+++ scummvm/trunk/engines/scumm/string.cpp	2008-04-28 15:21:36 UTC (rev 31757)
@@ -279,6 +279,12 @@
 			break;
 		}
 		c = *buffer++;
+
+		if (c == _newLineCharacter) {
+			c = 13;
+			break;
+		}
+
 		switch (c) {
 		case 1:
 			c = 13; // new line
@@ -479,13 +485,14 @@
 				_string[0].ypos = _screenHeight - 40;
 		}
 
-		if (_string[0].ypos < 1)
-			_string[0].ypos = 1;
+		if (_string[0].ypos < 10)
+			_string[0].ypos = 10;
 
-		if (_string[0].xpos < 80)
-			_string[0].xpos = 80;
-		if (_string[0].xpos > _screenWidth - 80)
-			_string[0].xpos = _screenWidth - 80;
+		if (_string[0].xpos < 5)
+			_string[0].xpos = 5;
+		if (_string[0].xpos > _screenWidth - 10)
+			_string[0].xpos = _screenWidth - 10;
+
 	}
 
 	_charset->_top = _string[0].ypos + _screenTop;
@@ -551,7 +558,7 @@
 	if (_charset->_center) {
 		_nextLeft -= _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) / 2;
 		if (_nextLeft < 0)
-			_nextLeft = 0;
+			_nextLeft = _string[0].xpos;
 	}
 
 	_charset->_disableOffsX = _charset->_firstChar = !_keepText;
@@ -576,6 +583,8 @@
 #endif
 			if (_charset->_center) {
 				_nextLeft -= _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos) / 2;
+				if (_nextLeft < 0)
+					_nextLeft = _string[0].xpos;
 			}
 
 			if (_game.version == 0) {


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