[Scummvm-cvs-logs] CVS: scummvm/scumm script_v2.cpp,2.284,2.285

kirben kirben at users.sourceforge.net
Tue Nov 1 03:28:30 CET 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2467/scumm

Modified Files:
	script_v2.cpp 
Log Message:

Wrap sentance lines in NES maniac.


Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.284
retrieving revision 2.285
diff -u -d -r2.284 -r2.285
--- script_v2.cpp	23 Oct 2005 13:34:06 -0000	2.284
+++ script_v2.cpp	1 Nov 2005 11:27:41 -0000	2.285
@@ -1053,21 +1053,29 @@
 	else
 		_string[2].color = 13;
 
+	byte string[80];
 	char *ptr = sentence;
-	int n = 0;
+	int i = 0, len = 0;
 
-	// Maximum length: 40 printable characters
+	// Maximum length of printable characters
+	int maxChars = (_platform == Common::kPlatformNES) ? 60: 40;
 	while (*ptr) {
 		if (*ptr != '@')
-			n++;
-		if (n > 40) {
-			*ptr = 0;
+			len++;
+		if (len > maxChars) {
 			break;
 		}
-		ptr++;
+
+		string[i++] = *ptr++;
+
+		if (_platform == Common::kPlatformNES && len == 30) {
+			string[i++] = 0xFF;
+			string[i++] = 8;
+		}
 	}
+	string[i] = 0;
 
-	if (_platform == Common::kPlatformNES) {	// TODO - get multiline sentences working
+	if (_platform == Common::kPlatformNES) {
 		sentenceline.top = virtscr[kVerbVirtScreen].topline;
 		sentenceline.bottom = virtscr[kVerbVirtScreen].topline + 16;
 		sentenceline.left = 16;
@@ -1080,7 +1088,7 @@
 	}
 	restoreBG(sentenceline);
 
-	drawString(2, (byte*)sentence);
+	drawString(2, (byte*)string);
 }
 
 void ScummEngine_v2::o2_ifClassOfIs() {





More information about the Scummvm-git-logs mailing list