[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.322,2.322.2.1 script_v100he.cpp,2.30,2.30.2.1 script_v72he.cpp,2.191.2.2,2.191.2.3 script_v7he.cpp,2.122.2.1,2.122.2.2 script_v80he.cpp,2.67.2.1,2.67.2.2 script_v90he.cpp,2.116.2.1,2.116.2.2

kirben kirben at users.sourceforge.net
Sat Mar 12 05:37:18 CET 2005


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

Modified Files:
      Tag: branch-0-7-0
	intern.h script_v100he.cpp script_v72he.cpp script_v7he.cpp 
	script_v80he.cpp script_v90he.cpp 
Log Message:

Backport another Buzzy fix
Backport HE100 fixes
Backport pajama regression fix.


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.322
retrieving revision 2.322.2.1
diff -u -d -r2.322 -r2.322.2.1
--- intern.h	28 Nov 2004 05:33:33 -0000	2.322
+++ intern.h	12 Mar 2005 13:36:33 -0000	2.322.2.1
@@ -644,7 +644,7 @@
 
 	Win32ResExtractor *_win32ResExtractor;
 
-	int _heSndSoundFreq, _heSndOffset, _heSndChannel, _heSndSoundId, _heSndFlags;
+	int _heSndSoundFreq, _heSndOffset, _heSndChannel, _heSndSoundId, _heSndFlags, _heSBNGId;
 
 public:
 	ScummEngine_v70he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]);
@@ -656,6 +656,8 @@
 	
 	virtual void redrawBGAreas();
 
+	int getStringCharWidth(byte chr);
+	virtual int setupStringArray(int size);
 	void appendSubstring(int dst, int src, int len2, int len);
 
 	int findObject(int x, int y, int num, int *args);
@@ -670,9 +672,11 @@
 	void o70_findObject();
 	void o70_quitPauseRestart();
 	void o70_kernelSetFunctions();
+	void o70_copyString();
 	void o70_getStringWidth();
 	void o70_getStringLen();
 	void o70_appendString();
+	void o70_concatString();
 	void o70_compareString();
 	void o70_readINI();
 	void o70_writeINI();
@@ -729,6 +733,7 @@
 	virtual void writeArray(int array, int idx2, int idx1, int value);
 	void redimArray(int arrayId, int newDim2start, int newDim2end, 
 					int newDim1start, int newDim1end, int type);
+	virtual int setupStringArray(int size);
 	int readFileToArray(int slot, int32 size);
 	void writeFileFromArray(int slot, int resID);
 
@@ -782,14 +787,9 @@
 	void o72_getPixel();
 	void o72_pickVarRandom();
 	void o72_redimArray();
-	void o72_copyString();
-	void o72_appendString();
-	void o72_concatString();
 	void o72_checkGlobQueue();
 	void o72_readINI();
 	void o72_writeINI();
-	void o72_unknownF5();
-	void o72_unknownF6();
 	void o72_getResourceSize();
 	void o72_setFilePath();
 	void o72_setWindowCaption();
@@ -928,12 +928,14 @@
 	void o100_unknown28();
 	void o100_resourceRoutines();
 	void o100_wizImageOps();
+	void o100_jumpToScript();
 	void o100_dim2dim2Array();
 	void o100_paletteOps();
 	void o100_redimArray();
 	void o100_roomOps();
 	void o100_startSound();
 	void o100_unknown26();
+	void o100_startScript();
 	void o100_quitPauseRestart();
 	void o100_cursorCommand();
 	void o100_wait();

Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.30
retrieving revision 2.30.2.1
diff -u -d -r2.30 -r2.30.2.1
--- script_v100he.cpp	27 Nov 2004 02:47:45 -0000	2.30
+++ script_v100he.cpp	12 Mar 2005 13:36:33 -0000	2.30.2.1
@@ -65,7 +65,7 @@
 		OPCODE(o6_panCameraTo),
 		/* 10 */
 		OPCODE(o6_invalid),
-		OPCODE(o72_jumpToScript),
+		OPCODE(o100_jumpToScript),
 		OPCODE(o6_setClass),
 		OPCODE(o60_closeFile),
 		/* 14 */
@@ -199,7 +199,7 @@
 		OPCODE(o6_stampObject),
 		OPCODE(o72_startObject),
 		/* 7C */
-		OPCODE(o72_startScript),
+		OPCODE(o100_startScript),
 		OPCODE(o6_startScriptQuick),
 		OPCODE(o80_setState),
 		OPCODE(o6_stopObjectScript),
@@ -325,9 +325,9 @@
 		OPCODE(o6_getState),
 		/* E0 */
 		OPCODE(o70_compareString),
-		OPCODE(o72_copyString),
-		OPCODE(o72_appendString),
-		OPCODE(o72_concatString),
+		OPCODE(o70_copyString),
+		OPCODE(o70_appendString),
+		OPCODE(o70_concatString),
 		/* E4 */
 		OPCODE(o70_getStringLen),
 		OPCODE(o70_getStringLenForWidth),
@@ -701,6 +701,18 @@
 	}
 }
 
+void ScummEngine_v100he::o100_jumpToScript() {
+	int args[25];
+	int script;
+	byte flags;
+
+	getStackList(args, ARRAYSIZE(args));
+	script = pop();
+	flags = fetchScriptByte();
+	stopObjectCode();
+	runScript(script, (flags == 128 || flags == 129), (flags == 130 || flags == 129), args);
+}
+
 void ScummEngine_v100he::o100_dim2dimArray() {
 	int a, b, data;
 	int type = fetchScriptByte();
@@ -1405,20 +1417,32 @@
 	debug(1,"o100_unknown26 stub (%d)", subOp);
 }
 
+void ScummEngine_v100he::o100_startScript() {
+	int args[25];
+	int script;
+	byte flags;
+
+	getStackList(args, ARRAYSIZE(args));
+	script = pop();
+	flags = fetchScriptByte();
+	runScript(script, (flags == 128 || flags == 129), (flags == 130 || flags == 129), args);
+}
+
 void ScummEngine_v100he::o100_quitPauseRestart() {
 	byte subOp = fetchScriptByte();
 	subOp -= 61;
 
 	switch (subOp) {
+	case 0:		// SO_RESTART
+		restart();
+		break;
 	case 67:
 		clearDrawObjectQueue();
 		break;
+	case 71:
 	case 72:
 		shutDown();
 		break;
-	case 73:		// SO_RESTART
-		restart();
-		break;
 	case 75:
 		// Clear screen
 		// Update palette

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.191.2.2
retrieving revision 2.191.2.3
diff -u -d -r2.191.2.2 -r2.191.2.3
--- script_v72he.cpp	12 Mar 2005 12:59:11 -0000	2.191.2.2
+++ script_v72he.cpp	12 Mar 2005 13:36:34 -0000	2.191.2.3
@@ -340,12 +340,12 @@
 		OPCODE(o72_redimArray),
 		OPCODE(o60_readFilePos),
 		/* EC */
-		OPCODE(o72_copyString),
+		OPCODE(o70_copyString),
 		OPCODE(o70_getStringWidth),
 		OPCODE(o70_getStringLen),
-		OPCODE(o72_appendString),
+		OPCODE(o70_appendString),
 		/* F0 */
-		OPCODE(o72_concatString),
+		OPCODE(o70_concatString),
 		OPCODE(o70_compareString),
 		OPCODE(o72_checkGlobQueue),
 		OPCODE(o72_readINI),
@@ -496,6 +496,13 @@
 	}
 }
 
+int ScummEngine_v72he::setupStringArray(int size) {
+	writeVar(0, 0);
+	defineArray(0, kStringArray, 0, 0, 0, size + 1);
+	writeArray(0, 0, 0, 0);
+	return readVar(0);
+}
+
 void ScummEngine_v72he::readArrayFromIndexFile() {
 	int num;
 	int a, b, c;
@@ -1831,66 +1838,6 @@
 	ah->dim2end = TO_LE_32(newDim2end);
 }
 
-void ScummEngine_v72he::o72_copyString() {
-	int dst, size;
-	int src = pop();
-
-	size = resStrLen(getStringAddress(src)) + 1;
-
-	writeVar(0, 0);
-	defineArray(0, kStringArray, 0, 0, 0, size);
-	writeArray(0, 0, 0, 0);
-	dst = readVar(0);
-
-	appendSubstring(dst, src, -1, -1);
-
-	push(dst);
-	debug(1,"o72_copyString");
-}
-
-void ScummEngine_v72he::o72_appendString() {
-	int dst, size;
-
-	int len = pop();
-	int srcOffs = pop();
-	int src = pop();
-
-	size = len - srcOffs + 2;
-
-	writeVar(0, 0);
-	defineArray(0, kStringArray, 0, 0, 0, size);
-	writeArray(0, 0, 0, 0);
-
-	dst = readVar(0);
-
-	appendSubstring(dst, src, srcOffs, len);
-
-	push(dst);
-	debug(1,"o72_appendString");
-}
-
-void ScummEngine_v72he::o72_concatString() {
-	int dst, size;
-
-	int src2 = pop();
-	int src1 = pop();
-
-	size = resStrLen(getStringAddress(src1));
-	size += resStrLen(getStringAddress(src2)) + 1;
-
-	writeVar(0, 0);
-	defineArray(0, kStringArray, 0, 0, 0, size);
-	writeArray(0, 0, 0, 0);
-
-	dst = readVar(0);
-
-	appendSubstring(dst, src1, 0, -1);
-	appendSubstring(dst, src2, 0, -1);
-
-	push(dst);
-	debug(1,"o72_concatString");
-}
-
 void ScummEngine_v72he::o72_checkGlobQueue() {
 	byte subOp = fetchScriptByte();
 	int idx = pop();

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.122.2.1
retrieving revision 2.122.2.2
diff -u -d -r2.122.2.1 -r2.122.2.2
--- script_v7he.cpp	12 Mar 2005 12:59:12 -0000	2.122.2.1
+++ script_v7he.cpp	12 Mar 2005 13:36:34 -0000	2.122.2.2
@@ -341,12 +341,12 @@
 		OPCODE(o60_redimArray),
 		OPCODE(o60_readFilePos),
 		/* EC */
-		OPCODE(o6_invalid),
+		OPCODE(o70_copyString),
 		OPCODE(o70_getStringWidth),
 		OPCODE(o70_getStringLen),
 		OPCODE(o70_appendString),
 		/* F0 */
-		OPCODE(o6_invalid),
+		OPCODE(o70_concatString),
 		OPCODE(o70_compareString),
 		OPCODE(o6_invalid),
 		OPCODE(o70_readINI),
@@ -379,6 +379,31 @@
 	return _opcodesv70he[i].desc;
 }
 
+int ScummEngine_v70he::getStringCharWidth(byte chr) {
+	int charset = _string[0]._default.charset;
+
+	byte *ptr = getResourceAddress(rtCharset, charset);
+	if (ptr == 0)
+		error("getStringCharWidth::charset %d not found!", charset);
+	ptr += 29;
+
+	int spacing = 0;
+
+	int offs = READ_LE_UINT32(ptr + chr * 4 + 4);
+	if (offs) {
+		spacing = ptr[offs] + (signed char)ptr[offs + 2];
+	}
+	
+	return spacing;
+}
+
+int ScummEngine_v70he::setupStringArray(int size) {
+	writeVar(0, 0);
+	defineArray(0, kStringArray, 0, size + 1);
+	writeArray(0, 0, 0, 0);
+	return readVar(0);
+}
+
 void ScummEngine_v70he::appendSubstring(int dst, int src, int srcOffs, int len) {
 	int dstOffs, value;
 	int i = 0;
@@ -718,6 +743,19 @@
 	}
 }
 
+void ScummEngine_v70he::o70_copyString() {
+	int dst, size;
+	int src = pop();
+
+	size = resStrLen(getStringAddress(src)) + 1;
+	dst = setupStringArray(size);
+
+	appendSubstring(dst, src, -1, -1);
+
+	push(dst);
+	debug(1,"o70_copyString");
+}
+
 void ScummEngine_v70he::o70_getStringWidth() {
 	int array, pos, len;
 	int chr, width = 0;
@@ -736,7 +774,7 @@
 		chr = readArray(0, 0, pos);
 		if (chr == 0)
 			break;
-		width += _charset->getCharWidth(chr);
+		width += getStringCharWidth(chr);
 		pos++;
 	}
 
@@ -821,12 +859,7 @@
 	int src = pop();
 
 	size = len - srcOffs + 2;
-
-	writeVar(0, 0);
-	defineArray(0, kStringArray, 0, size);
-	writeArray(0, 0, 0, 0);
-
-	dst = readVar(0);
+	dst = setupStringArray(size);
 
 	appendSubstring(dst, src, srcOffs, len);
 
@@ -834,6 +867,23 @@
 	debug(1,"o70_appendString");
 }
 
+void ScummEngine_v70he::o70_concatString() {
+	int dst, size;
+
+	int src2 = pop();
+	int src1 = pop();
+
+	size = resStrLen(getStringAddress(src1));
+	size += resStrLen(getStringAddress(src2)) + 1;
+	dst = setupStringArray(size);
+
+	appendSubstring(dst, src1, 0, -1);
+	appendSubstring(dst, src2, 0, -1);
+
+	push(dst);
+	debug(1,"o70_concatString");
+}
+
 void ScummEngine_v70he::o70_compareString() {
 	int result;
 
@@ -934,7 +984,7 @@
 	writeVar(0, array);
 	while (pos <= len) {
 		chr = readArray(0, 0, pos);
-		width += _charset->getCharWidth(chr);
+		width += getStringCharWidth(chr);
 		if (width >= max) {
 			push(pos);
 			return;

Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.67.2.1
retrieving revision 2.67.2.2
diff -u -d -r2.67.2.1 -r2.67.2.2
--- script_v80he.cpp	19 Dec 2004 11:02:07 -0000	2.67.2.1
+++ script_v80he.cpp	12 Mar 2005 13:36:34 -0000	2.67.2.2
@@ -339,12 +339,12 @@
 		OPCODE(o72_redimArray),
 		OPCODE(o60_readFilePos),
 		/* EC */
-		OPCODE(o72_copyString),
+		OPCODE(o70_copyString),
 		OPCODE(o70_getStringWidth),
 		OPCODE(o70_getStringLen),
-		OPCODE(o72_appendString),
+		OPCODE(o70_appendString),
 		/* F0 */
-		OPCODE(o72_concatString),
+		OPCODE(o70_concatString),
 		OPCODE(o70_compareString),
 		OPCODE(o72_checkGlobQueue),
 		OPCODE(o72_readINI),
@@ -383,17 +383,20 @@
 
 	switch (subOp) {
 	case 27:
-		pop();
 		//loadSBNG(_heSBNGId, pop();
+		pop();
 		break;
 	case 217:
 		//loadSBNG(_heSBNGId, -1);
 		break;
 	case 232:
-		//_heSBNGId = pop();
+		_heSBNGId = pop();
+		break;
+	case 255:
+		// dummy case
 		break;
 	default:
-		warning("o80_loadSBNG: default case %d", subOp);
+		error("o80_loadSBNG: default case %d", subOp);
 	}
 	debug(1,"o80_loadSBNG stub (%d)",subOp);
 }

Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.116.2.1
retrieving revision 2.116.2.2
diff -u -d -r2.116.2.1 -r2.116.2.2
--- script_v90he.cpp	19 Dec 2004 09:24:55 -0000	2.116.2.1
+++ script_v90he.cpp	12 Mar 2005 13:36:34 -0000	2.116.2.2
@@ -339,12 +339,12 @@
 		OPCODE(o72_redimArray),
 		OPCODE(o60_readFilePos),
 		/* EC */
-		OPCODE(o72_copyString),
+		OPCODE(o70_copyString),
 		OPCODE(o70_getStringWidth),
 		OPCODE(o70_getStringLen),
-		OPCODE(o72_appendString),
+		OPCODE(o70_appendString),
 		/* F0 */
-		OPCODE(o72_concatString),
+		OPCODE(o70_concatString),
 		OPCODE(o70_compareString),
 		OPCODE(o72_checkGlobQueue),
 		OPCODE(o72_readINI),





More information about the Scummvm-git-logs mailing list