[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.241,2.242 script_v72he.cpp,2.81,2.82 script_v7he.cpp,2.75,2.76 scumm.cpp,1.194,1.195

Travis Howell kirben at users.sourceforge.net
Sun Sep 12 19:10:07 CEST 2004


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

Modified Files:
	intern.h script_v72he.cpp script_v7he.cpp scumm.cpp 
Log Message:

Set correct array length in HE 72+ games.
Add some stubs


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.241
retrieving revision 2.242
diff -u -d -r2.241 -r2.242
--- intern.h	12 Sep 2004 11:15:24 -0000	2.241
+++ intern.h	13 Sep 2004 02:09:35 -0000	2.242
@@ -617,7 +617,7 @@
 	virtual const char *getOpcodeDesc(byte i);
 
 	byte stringLen(byte *);
-	int getCharsetOffset(int letter);
+	int getCharsetOffsets(int chr);
 	void arrrays_unk2(int dst, int src, int len2, int len);
 
 	/* HE version 70 script opcodes */
@@ -705,7 +705,7 @@
 
 	virtual void decodeParseString(int a, int b);
 	void decodeScriptString(byte *dst, bool scriptString = false);
-	int copyScriptString(byte *dst);
+	void copyScriptString(byte *dst);
 
 	const byte *findWrappedBlock(uint32 tag, const byte *ptr, int state, bool flagError);
 

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.81
retrieving revision 2.82
diff -u -d -r2.81 -r2.82
--- script_v72he.cpp	12 Sep 2004 13:21:44 -0000	2.81
+++ script_v72he.cpp	13 Sep 2004 02:09:35 -0000	2.82
@@ -512,7 +512,7 @@
 	}
 }
 
-int ScummEngine_v72he::copyScriptString(byte *dst) {
+void ScummEngine_v72he::copyScriptString(byte *dst) {
 	int i = 0;
 	byte b;
 
@@ -529,8 +529,6 @@
 		}
 	}
 	*dst = 0;
-
-	return i;
 }
 
 void ScummEngine_v72he::decodeScriptString(byte *dst, bool scriptString) {
@@ -548,7 +546,8 @@
 		len = resStrLen(_scriptPointer);
 		_scriptPointer += len + 1;
 	} else {
-		len = copyScriptString(string);
+		copyScriptString(string);
+		len = resStrLen(string) + 1;
 	}
 
 	// The boot script in some HE games just set data file name
@@ -567,7 +566,7 @@
 			if (chr == 0x64)
 				dst += snprintf((char *)dst, 5, "%d", args[val++]);
 			else if (chr == 0x73)
-				dst += addStringToStack(dst, 256, args[val++]);
+				dst += addStringToStack(dst, 1024, args[val++]);
 			continue;
 		}
 		*dst++ = chr;
@@ -1158,24 +1157,66 @@
 void ScummEngine_v72he::o72_arrayOps() {
 	byte subOp = fetchScriptByte();
 	int array = fetchScriptWord();
-	int b, c, d, len;
+	int a, b, c, d;
+	int id, len = 0;
 	ArrayHeader *ah;
 	int list[128];
+	byte string[2048];
 
 	switch (subOp) {
 	case 7:			// SO_ASSIGN_STRING
-		ah = defineArray(array, kStringArray, 0, 0, 0, 1024);
-		copyScriptString(ah->data);
+		copyScriptString(string);
+		len = resStrLen(string) + 1;
+		ah = defineArray(array, kStringArray, 0, 0, 0, len);
+		memcpy(ah->data, string, len);
+		break;
+
+	case 126:
+		len = getStackList(list, ARRAYSIZE(list));
+		a = pop();
+		b = pop();
+		c = pop();
+		d = pop();
+		id = readVar(array);
+		if (id == 0) {
+			defineArray(array, kDwordArray, d, c, b, a);
+		}
+		// TODO write array
+		break;
+	case 127:
+		// TODO
+		fetchScriptWord();
+		pop();
+		pop();
+		pop();
+		pop();
+		pop();
+		pop();
+		pop();
+		pop();
+		break;
+	case 128:
+		a = pop();
+		b = pop();
+		c = pop();
+		d = pop();
+		id = readVar(array);
+		if (id == 0) {
+			defineArray(array, kDwordArray, d, c, b, a);
+		}
+		// TODO write array
 		break;
 	case 194:			// SO_ASSIGN_STRING
-		ah = defineArray(array, kStringArray, 0, 0, 0, 4096);
-		decodeScriptString(ah->data);
+		decodeScriptString(string);
+		len = resStrLen(string) + 1;
+		ah = defineArray(array, kStringArray, 0, 0, 0, len);
+		memcpy(ah->data, string, len);
 		break;
 	case 208:		// SO_ASSIGN_INT_LIST
 		b = pop();
 		c = pop();
-		d = readVar(array);
-		if (d == 0) {
+		id = readVar(array);
+		if (id == 0) {
 			defineArray(array, kDwordArray, 0, 0, 0, b + c);
 		}
 		while (c--) {
@@ -1184,8 +1225,8 @@
 		break;
 	case 212:		// SO_ASSIGN_2DIM_LIST
 		len = getStackList(list, ARRAYSIZE(list));
-		d = readVar(array);
-		if (d == 0)
+		id = readVar(array);
+		if (id == 0)
 			error("Must DIM a two dimensional array before assigning");
 		c = pop();
 		while (--len >= 0) {
@@ -1710,7 +1751,7 @@
 
 void ScummEngine_v72he::o72_unknownED() {
 	int array, pos, len;
-	int letter = 0, result = 0;
+	int chr, result = 0;
 
 	len = pop();
 	pos = pop();
@@ -1723,9 +1764,8 @@
 
 	writeVar(0, array);
 	while (pos <= len) {
-		letter = readArray(0, 0, pos);
-		if (letter)
-			result += getCharsetOffset(letter);
+		chr = readArray(0, 0, pos);
+		result += getCharsetOffsets(chr);
 		pos++;
 	}
 
@@ -1859,19 +1899,19 @@
 }
 
 void ScummEngine_v72he::o72_unknownF5() {
-	int letter, ebx;
+	int chr, max;
 	int array, len, pos, result = 0;
-	ebx = pop();
+	max = pop();
 	pos = pop();
 	array = pop();
 
 	len = resStrLen(getStringAddress(array));
-	writeVar(0, array);
 
+	writeVar(0, array);
 	while (pos < len) {
-		letter = readArray(0, 0, pos);
-		result += getCharsetOffset(letter);
-		if (result >= ebx)
+		chr = readArray(0, 0, pos);
+		result += getCharsetOffsets(chr);
+		if (result >= max)
 			break;
 		pos++;
 	}

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.75
retrieving revision 2.76
diff -u -d -r2.75 -r2.76
--- script_v7he.cpp	12 Sep 2004 17:33:18 -0000	2.75
+++ script_v7he.cpp	13 Sep 2004 02:09:35 -0000	2.76
@@ -404,25 +404,25 @@
 	return len;
 }
 
-int ScummEngine_v7he::getCharsetOffset(int letter) {
-	int offset, result;
+int ScummEngine_v7he::getCharsetOffsets(int chr) {
+	int width, offsX;
+	int result = 0;
 
-	byte *ptr = getResourceAddress(rtCharset, _string[0]._default.charset);
-	if (!ptr)
-		error("getCharsetOffset: charset %d not found!", _string[0]._default.charset);
+	byte *fontPtr = getResourceAddress(rtCharset, _string[0]._default.charset);
+	if (!fontPtr)
+		error("getCharsetOffsets: charset %d not found!", _string[0]._default.charset);
 
-	offset = READ_LE_UINT32(ptr + 29 + letter * 4 + 4);
-	if (offset == 0)
+	int offs = READ_LE_UINT32(fontPtr + 29 + chr * 4 + 4);
+	if (!offs)
 		return 0;
 
-	ptr += offset;
-	result = READ_LE_UINT16(ptr + 2);
-	byte start = *ptr;
-
-	if (result >= 0x80)
-		result = (result & 0xff) - 256 + start;
+	width = fontPtr[offs] + (signed char)fontPtr[offs + 0];
+	offsX = fontPtr[offs] + (signed char)fontPtr[offs + 2];
+	
+	if (offsX >= 0x80)
+		result = (offsX & 0xff) + width - 256;
 	else
-		result = (result & 0xff) + start;
+		result = (offsX & 0xff) + width;
 
 	return result;
 }
@@ -433,12 +433,6 @@
 	int subOp = fetchScriptByte();
 
 	switch (subOp) {
-	case 0x13:		// HE 7.2 (Not all games)
-	case 0x14:
-		// Loads cursors from another resource
-		a = pop();
-		debug(1, "o7_cursorCommand: case %x (%d)", subOp, a);
-		break;
 	case 0x90:		// SO_CURSOR_ON Turn cursor on
 		_cursor.state = 1;
 		verbMouseOver(0);
@@ -740,7 +734,7 @@
 
 void ScummEngine_v7he::o7_unknownED() {
 	int array, pos, len;
-	int letter = 0, result = 0;
+	int chr, result = 0;
 
 	len = pop();
 	pos = pop();
@@ -753,9 +747,8 @@
 
 	writeVar(0, array);
 	while (pos <= len) {
-		letter = readArray(0, 0, pos);
-		if (letter)
-			result += getCharsetOffset(letter);
+		chr = readArray(0, 0, pos);
+		result += getCharsetOffsets(chr);
 		pos++;
 	}
 
@@ -928,19 +921,19 @@
 }
 
 void ScummEngine_v7he::o7_unknownF5() {
-	int letter, ebx;
+	int chr, max;
 	int array, len, pos, result = 0;
-	ebx = pop();
+	max = pop();
 	pos = pop();
 	array = pop();
 
 	len = resStrLen(getStringAddress(array));
-	writeVar(0, array);
 
+	writeVar(0, array);
 	while (pos < len) {
-		letter = readArray(0, 0, pos);
-		result += getCharsetOffset(letter);
-		if (result >= ebx)
+		chr = readArray(0, 0, pos);
+		result += getCharsetOffsets(chr);
+		if (result >= max)
 			break;
 		pos++;
 	}

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -d -r1.194 -r1.195
--- scumm.cpp	12 Sep 2004 16:17:14 -0000	1.194
+++ scumm.cpp	13 Sep 2004 02:09:35 -0000	1.195
@@ -313,8 +313,6 @@
 	// and INIB chunk in the .he0
 	{"lost", "Pajama Sam's Lost & Found", GID_HEGAME, 6, 98, MDT_NONE,
 	 GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
-	{"smaller", "Pajama Sam's Lost & Found (Test)", GID_HEGAME, 6, 98, MDT_NONE,
-	 GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
 	{"racedemo", "Putt-Putt Enters the Race (Demo)", GID_HEGAME, 6, 98, MDT_NONE,
 	 GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
 	{"puttrace", "Putt-Putt Enters the Race", GID_HEGAME, 6, 98, MDT_NONE,
@@ -324,6 +322,8 @@
 
 	// Engine moved to c++ 
 	// Humongous Entertainment Scumm Version 9.9 ?  Scummsys.99
+	{"smaller", "Pajama Sam's Lost & Found (Test)", GID_HEGAME, 6, 99, MDT_NONE,
+	 GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
 	{"freddi4", "Freddi Fish 4: The Case of the Hogfish Rustlers of Briny Gulch", GID_HEGAME, 6, 99, MDT_NONE,
 	 GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
 	{"f4-demo", "Freddi Fish 4: The Case of the Hogfish Rustlers of Briny Gulch (Demo)", GID_HEGAME, 6, 99, MDT_NONE,





More information about the Scummvm-git-logs mailing list