[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.502,2.503 script_v8.cpp,2.291,2.292 scumm.h,1.630,1.631 verbs.cpp,1.136,1.137

Max Horn fingolfin at users.sourceforge.net
Thu May 26 09:40:49 CEST 2005


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

Modified Files:
	intern.h script_v8.cpp scumm.h verbs.cpp 
Log Message:
In V7/V8 games, use the blast text system to render verbs (this fixes bug #1208956, but certainly will cause new regressions ;-)

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.502
retrieving revision 2.503
diff -u -d -r2.502 -r2.503
--- intern.h	23 May 2005 09:30:42 -0000	2.502
+++ intern.h	26 May 2005 16:39:39 -0000	2.503
@@ -1298,6 +1298,8 @@
 	virtual void translateText(const byte *text, byte *trans_buff);
 	virtual void loadLanguageBundle();
 	void playSpeech(const byte *ptr);
+
+	virtual void drawVerb(int verb, int mode);
 };
 
 class ScummEngine_v8 : public ScummEngine_v7 {

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.291
retrieving revision 2.292
diff -u -d -r2.291 -r2.292
--- script_v8.cpp	10 May 2005 23:48:38 -0000	2.291
+++ script_v8.cpp	26 May 2005 16:39:39 -0000	2.292
@@ -1475,7 +1475,7 @@
 
 void ScummEngine_v8::o8_getStringWidth() {
 	int charset = pop();
-	int oldID = _charset->getCurID(); 
+	int oldID = _charset->getCurID();
 	int width;
 	const byte *msg = _scriptPointer;
 	byte transBuf[512];

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.630
retrieving revision 1.631
diff -u -d -r1.630 -r1.631
--- scumm.h	26 May 2005 14:14:31 -0000	1.630
+++ scumm.h	26 May 2005 16:39:39 -0000	1.631
@@ -830,7 +830,7 @@
 	void checkExecVerbs();
 	void verbMouseOver(int verb);
 	int findVerbAtPos(int x, int y) const;
-	void drawVerb(int verb, int mode);
+	virtual void drawVerb(int verb, int mode);
 	void runInputScript(int a, int cmd, int mode);
 	void restoreVerbBG(int verb);
 	void drawVerbBitmap(int verb, int x, int y);

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- verbs.cpp	24 May 2005 00:29:29 -0000	1.136
+++ verbs.cpp	26 May 2005 16:39:40 -0000	1.137
@@ -486,6 +486,61 @@
 	return 0;
 }
 
+void ScummEngine_v7::drawVerb(int verb, int mode) {
+	VerbSlot *vs;
+
+	if (!verb)
+		return;
+
+	vs = &_verbs[verb];
+
+	if (!vs->saveid && vs->curmode && vs->verbid) {
+		if (vs->type == kImageVerbType) {
+			drawVerbBitmap(verb, vs->curRect.left, vs->curRect.top);
+			return;
+		}
+
+		uint8 color = vs->color;
+		if (vs->curmode == 2)
+			color = vs->dimcolor;
+		else if (mode && vs->hicolor)
+			color = vs->hicolor;
+
+		const byte *msg = getResourceAddress(rtVerb, verb);
+		if (!msg)
+			return;
+
+		// Convert the message, and skip a few remaining 0xFF codes (they
+		// occur in FT; subtype 10, which is used for the speech associated
+		// with the string).
+		byte buf[384];
+		convertMessageToString(msg, buf, sizeof(buf));
+		msg = buf;
+		while (*msg == 0xFF)
+			msg += 4;
+
+		enqueueText(msg, vs->curRect.left, vs->curRect.top, color, vs->charset_nr, vs->center);
+		
+		// Set the specified charset id
+		_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);
+			vs->curRect.right += charWidth;
+			if (vs->curRect.bottom < charHeight)
+				vs->curRect.bottom = charHeight;
+			msg++;
+		}
+		vs->curRect.right += vs->curRect.left;
+		vs->curRect.bottom += vs->curRect.top;
+		vs->oldRect = vs->curRect;
+	}
+}
+
 void ScummEngine::drawVerb(int verb, int mode) {
 	VerbSlot *vs;
 	bool tmp;
@@ -527,7 +582,6 @@
 			return;
 
 		tmp = _charset->_center;
-		_charset->_center = 0;
 		drawString(4, msg);
 		_charset->_center = tmp;
 
@@ -546,9 +600,7 @@
 
 	vs = &_verbs[verb];
 
-	if (_gameId == GID_FT) {
-		restoreBG(vs->curRect, vs->bkcolor);
-	} else if (vs->oldRect.left != -1) {
+	if (vs->oldRect.left != -1) {
 		restoreBG(vs->oldRect, vs->bkcolor);
 		vs->oldRect.left = -1;
 	}





More information about the Scummvm-git-logs mailing list