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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Wed May 31 03:50:04 CEST 2006


Revision: 22793
Author:   kirben
Date:     2006-05-31 03:48:40 -0700 (Wed, 31 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22793&view=rev

Log Message:
-----------
Add patch for bug #1452272 - COMI: Verb strings aren't wrapped

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/intern.h
    scummvm/trunk/engines/scumm/saveload.cpp
    scummvm/trunk/engines/scumm/saveload.h
    scummvm/trunk/engines/scumm/script_v8.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/verbs.cpp
Modified: scummvm/trunk/engines/scumm/intern.h
===================================================================
--- scummvm/trunk/engines/scumm/intern.h	2006-05-31 09:49:52 UTC (rev 22792)
+++ scummvm/trunk/engines/scumm/intern.h	2006-05-31 10:48:40 UTC (rev 22793)
@@ -822,7 +822,7 @@
 		int32 offset;
 	};
 	
-	int _verbCharset;
+	int _verbCharset, _verbLineSpacing;
 	bool _existLanguageFile;
 	char *_languageBuffer;
 	LangIndexNode *_languageIndex;

Modified: scummvm/trunk/engines/scumm/saveload.cpp
===================================================================
--- scummvm/trunk/engines/scumm/saveload.cpp	2006-05-31 09:49:52 UTC (rev 22792)
+++ scummvm/trunk/engines/scumm/saveload.cpp	2006-05-31 10:48:40 UTC (rev 22793)
@@ -1197,6 +1197,8 @@
 
 	const SaveLoadEntry V7Entries[] = {
 		MKLINE(ScummEngine_v7, _subtitleQueuePos, sleInt32, VER(61)),
+		MKLINE(ScummEngine_v7, _verbCharset, sleInt32, VER(68)),
+		MKLINE(ScummEngine_v7, _verbLineSpacing, sleInt32, VER(68)),
 		MKEND()
 	};
 

Modified: scummvm/trunk/engines/scumm/saveload.h
===================================================================
--- scummvm/trunk/engines/scumm/saveload.h	2006-05-31 09:49:52 UTC (rev 22792)
+++ scummvm/trunk/engines/scumm/saveload.h	2006-05-31 10:48:40 UTC (rev 22793)
@@ -47,7 +47,7 @@
  * only saves/loads those which are valid for the version of the savegame
  * which is being loaded/saved currently.
  */
-#define CURRENT_VER 67
+#define CURRENT_VER 68
 
 /**
  * An auxillary macro, used to specify savegame versions. We use this instead

Modified: scummvm/trunk/engines/scumm/script_v8.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v8.cpp	2006-05-31 09:49:52 UTC (rev 22792)
+++ scummvm/trunk/engines/scumm/script_v8.cpp	2006-05-31 10:48:40 UTC (rev 22793)
@@ -719,10 +719,9 @@
 	case 0xE6:		// SO_CURSOR_TRANSPARENT Set cursor transparent color
 		setCursorTransparency(pop());
 		break;
-	case 0xE7: {	// SO_CHARSET_SET
+	case 0xE7: 		// SO_CHARSET_SET
 		_verbCharset = pop();
 		break;
-	}
 	case 0xE8:		// SO_CHARSET_COLOR
 		getStackList(args, ARRAYSIZE(args));
 		for (i = 0; i < 16; i++)
@@ -1147,12 +1146,7 @@
 		vs->charset_nr = pop();
 		break;
 	case 0xA7:		// SO_VERB_LINE_SPACING Choose linespacing for verb
-		// FIXME - TODO
-		// Note: it seems that var596 stores the "line spacing". It is used by various
-		// scripts that place verbs for that.
-		// Also, var595 contains the vertical position at which to start placing verbs (330)
-		a = pop();
-		debug(0, "SO_VERB_LINE_SPACING %d: not yet implemented", a);
+		_verbLineSpacing = pop();
 		break;
 	default:
 		error("o8_verbops: default case 0x%x", subOp);
@@ -1466,7 +1460,7 @@
 	msg = transBuf;
 
 	// Temporary set the specified charset id
-	_charset->setCurID(_string[charset].charset);
+	_charset->setCurID(charset);
 	// Determine the strings width
 	width = _charset->getStringWidth(0, msg);
 	// Revert to old font

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-05-31 09:49:52 UTC (rev 22792)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-05-31 10:48:40 UTC (rev 22793)
@@ -920,6 +920,7 @@
 ScummEngine_v7::ScummEngine_v7(OSystem *syst, const DetectorResult &dr)
 	: ScummEngine_v6(syst, dr) {
 	_verbCharset = 0;
+	_verbLineSpacing = 10;
 	_existLanguageFile = false;
 	_languageBuffer = NULL;
 	_languageIndex = NULL;

Modified: scummvm/trunk/engines/scumm/verbs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/verbs.cpp	2006-05-31 09:49:52 UTC (rev 22792)
+++ scummvm/trunk/engines/scumm/verbs.cpp	2006-05-31 10:48:40 UTC (rev 22793)
@@ -687,25 +687,50 @@
 		while (*msg == 0xFF)
 			msg += 4;
 
-		enqueueText(msg, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
-
 		// Set the specified charset id
+		int oldID = _charset->getCurID();
 		_charset->setCurID(vs->charset_nr);
 
 		// Compute the text rect
 		vs->curRect.right = 0;
 		vs->curRect.bottom = 0;
-		while (*msg) {
-			const int charWidth = _charset->getCharWidth(*msg);
-			const int charHeight = _charset->getCharHeight(*msg);
+		const byte *msg2 = msg;
+		while (*msg2) {
+			const int charWidth = _charset->getCharWidth(*msg2);
+			const int charHeight = _charset->getCharHeight(*msg2);
 			vs->curRect.right += charWidth;
 			if (vs->curRect.bottom < charHeight)
 				vs->curRect.bottom = charHeight;
-			msg++;
+			msg2++;
 		}
 		vs->curRect.right += vs->curRect.left;
 		vs->curRect.bottom += vs->curRect.top;
 		vs->oldRect = vs->curRect;
+
+		const int maxWidth = _screenWidth - vs->curRect.left;
+		if (_charset->getStringWidth(0, buf) > maxWidth && _game.version == 8) {
+			byte tmpBuf[384];
+			memcpy(tmpBuf, msg, 384);
+
+			int len = resStrLen(tmpBuf) - 1;
+			while (len >= 0) {
+				if (tmpBuf[len] == ' ') {
+					tmpBuf[len] = 0;
+					if (_charset->getStringWidth(0, tmpBuf) <= maxWidth) {
+						break;
+					}
+				}
+				--len;
+			}
+			enqueueText(tmpBuf, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
+			if (len >= 0) {
+				enqueueText(&msg[len + 1], vs->curRect.left, vs->curRect.top + _verbLineSpacing, color, vs->charset_nr, vs->center);
+				vs->curRect.bottom += _verbLineSpacing;
+			}
+		} else {
+			enqueueText(msg, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
+		}
+		_charset->setCurID(oldID);
 	}
 }
 #endif


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