[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.24,2.25 script_v8.cpp,2.62,2.63

Max Horn fingolfin at users.sourceforge.net
Fri Dec 27 07:33:02 CET 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv19653

Modified Files:
	intern.h script_v8.cpp 
Log Message:
implemented V8 verbops fully, based on V6 - this contains some guessing and may contain mistakes. Also added string width opcode

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.24
retrieving revision 2.25
diff -u -d -r2.24 -r2.25
--- intern.h	26 Dec 2002 23:24:27 -0000	2.24
+++ intern.h	27 Dec 2002 15:32:27 -0000	2.25
@@ -436,6 +436,8 @@
 	void o8_getObjectImageY();
 	void o8_getObjectImageWidth();
 	void o8_getObjectImageHeight();
+	
+	void o8_getStringWidth();
 };
 
 

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.62
retrieving revision 2.63
diff -u -d -r2.62 -r2.63
--- script_v8.cpp	27 Dec 2002 14:36:28 -0000	2.62
+++ script_v8.cpp	27 Dec 2002 15:32:27 -0000	2.63
@@ -350,7 +350,7 @@
 		/* F4 */
 		OPCODE(o6_invalid),
 		OPCODE(o6_invalid),
-		OPCODE(o6_invalid),
+		OPCODE(o8_getStringWidth),
 		OPCODE(o6_invalid),
 		/* F8 */
 		OPCODE(o6_invalid),
@@ -1207,6 +1207,7 @@
 	// TODO
 	byte subOp = fetchScriptByte();
 	VerbSlot *vs = NULL;
+	int slot, a, b;
 
 	if (0 <= _curVerbSlot && _curVerbSlot < _maxVerbs)
 		vs = &_verbs[_curVerbSlot];
@@ -1218,10 +1219,40 @@
 		checkRange(_maxVerbs - 1, 0, _curVerbSlot, "Illegal new verb slot %d");
 		break;
 	case 0x97:		// SO_VERB_NEW New verb
+		slot = getVerbSlot(_curVerb, 0);
+		if (slot == 0) {
+			for (slot = 1; slot < _maxVerbs; slot++) {
+				if (_verbs[slot].verbid == 0)
+					break;
+			}
+			if (slot == _maxVerbs)
+				error("Too many verbs");
+			_curVerbSlot = slot;
+		}
+		vs = &_verbs[slot];
+		vs->verbid = _curVerb;
+		vs->color = 2;
+		vs->hicolor = 0;
+		vs->dimcolor = 8;
+		vs->type = kTextVerbType;
+		vs->charset_nr = _string[0].t_charset;
+		vs->curmode = 0;
+		vs->saveid = 0;
+		vs->key = 0;
+		vs->center = 0;
+		vs->imgindex = 0;
+		break;
 	case 0x98:		// SO_VERB_DELETE Delete verb
+		killVerb(_curVerbSlot);
+		break;
 	case 0x99:		// SO_VERB_NAME Set verb name
+		loadPtrToResource(rtVerb, _curVerbSlot, NULL);
+		vs->type = kTextVerbType;
+		vs->imgindex = 0;
+		break;
 	case 0x9A:		// SO_VERB_AT Set verb (X,Y) placement
-		error("o8_verbops: default case %d", subOp);
+		vs->y = pop();
+		vs->x = pop();
 		break;
 	case 0x9B:		// SO_VERB_ON Turn verb on
 		vs->curmode = 1;
@@ -1245,8 +1276,23 @@
 		vs->key = pop();
 		break;
 	case 0xA3:		// SO_VERB_IMAGE Set verb image
+		b = pop();
+		a = pop();
+		if (_curVerbSlot && a != vs->imgindex) {
+			setVerbObject(b, a, _curVerbSlot);
+			vs->type = kImageVerbType;
+			vs->imgindex = a;
+		}
+		break;
 	case 0xA4:		// SO_VERB_NAME_STR Set verb name
-		error("o8_verbops: default case %d", subOp);
+		a = pop();
+		if (a == 0) {
+			loadPtrToResource(rtVerb, _curVerbSlot, (byte *)"");
+		} else {
+			loadPtrToResource(rtVerb, _curVerbSlot, getStringAddress(a));
+		}
+		vs->type = kTextVerbType;
+		vs->imgindex = 0;
 		break;
 	case 0xA5:		// SO_VERB_CENTER Center verb
 		vs->center = 1;
@@ -1468,6 +1514,15 @@
 	int i = getObjectIndex(pop());
 	push(_objs[i].height);
 }
+
+void Scumm_v8::o8_getStringWidth()
+{
+	int len = resStrLen((char*)_scriptPointer);
+	int width = _charset->getStringWidth(0, _scriptPointer);
+	push(width);
+	_scriptPointer += len + 1;
+}
+
 
 /*
 





More information about the Scummvm-git-logs mailing list