[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.148,1.149 charset.cpp,2.102,2.103 charset.h,2.29,2.30 intern.h,2.207,2.208 script.cpp,1.187,1.188 script_v72he.cpp,2.35,2.36 script_v7he.cpp,2.53,2.54 sound.cpp,1.376,1.377

Travis Howell kirben at users.sourceforge.net
Mon Aug 30 04:53:18 CEST 2004


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

Modified Files:
	akos.cpp charset.cpp charset.h intern.h script.cpp 
	script_v72he.cpp script_v7he.cpp sound.cpp 
Log Message:

Add some WIP code for HE games.
Add some music adjustments



Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.102
retrieving revision 2.103
diff -u -d -r2.102 -r2.103
--- charset.cpp	29 Aug 2004 03:19:09 -0000	2.102
+++ charset.cpp	30 Aug 2004 11:52:33 -0000	2.103
@@ -50,6 +50,30 @@
 	_curId = 0;
 }
 
+int CharsetRenderer::getLetter(int letter) {
+	int offset, result;
+
+	byte *ptr = _vm->getResourceAddress(rtCharset, _curId);
+	if (!ptr)
+		error("CharsetRenderer::getLetter: charset %d not found!", _curId);
+
+	offset = READ_LE_UINT32(ptr + 29 + letter);
+	if (offset == 0)
+		return 0;
+
+	ptr += offset;
+	
+	result = READ_LE_UINT16(ptr + 2);
+	byte start = *ptr;
+
+	if (result >= 0x80) {
+		result = result - 256 + start;
+	} else {
+		result += start;
+	};
+	return (result);
+}
+
 void CharsetRendererCommon::setCurID(byte id) {
 	checkRange(_vm->_numCharsets - 1, 0, id, "Printing with bad charset %d");
 

Index: charset.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.29
retrieving revision 2.30
diff -u -d -r2.29 -r2.30
--- charset.h	23 Aug 2004 08:37:55 -0000	2.29
+++ charset.h	30 Aug 2004 11:52:33 -0000	2.30
@@ -71,6 +71,7 @@
 	virtual void printChar(int chr) = 0;
 	virtual void drawChar(int chr, const Graphics::Surface &s, int x, int y) {}
 
+	int getLetter(int letter);
 	int getStringWidth(int a, const byte *str);
 	void addLinebreaks(int a, byte *str, int pos, int maxwidth);
 	

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.207
retrieving revision 2.208
diff -u -d -r2.207 -r2.208
--- intern.h	29 Aug 2004 11:27:15 -0000	2.207
+++ intern.h	30 Aug 2004 11:52:33 -0000	2.208
@@ -629,10 +629,12 @@
 	void o7_unknownEF();
 	void o7_readINI();
 	void o7_unknownF4();
+	void o7_unknownF5();
 	void o7_unknownF6();
 	void o7_unknownF9();
 	void o7_unknownFA();
 	void o7_unknownFB();
+	void o7_unknownFC();
 };
 
 class ScummEngine_v72he : public ScummEngine_v7he {
@@ -692,6 +694,7 @@
 	void o72_compareStackList();
 	void o72_unknown1C();
 	void o72_unknown50();
+	void o72_unknown5A();
 	void o72_wordArrayInc();
 	void o72_objectX();
 	void o72_objectY();
@@ -720,12 +723,12 @@
 	void o72_pickVarRandom();
 	void o72_redimArray();
 	void o72_readINI();
+	void o72_unknownF1();
 	void o72_unknownF4();
 	void o72_unknownF8();
 	void o72_unknownF9();
 	void o72_unknownFA();
 	void o72_unknownFB();
-	void o72_unknownFC();
 };
 
 class ScummEngine_v7 : public ScummEngine_v6 {

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -d -r1.187 -r1.188
--- script.cpp	29 Aug 2004 06:40:03 -0000	1.187
+++ script.cpp	30 Aug 2004 11:52:33 -0000	1.188
@@ -1065,6 +1065,7 @@
 		while (len--)
 			*dst++ = fetchScriptByte();
 	}
+	*dst = 0;
 
 }
 

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.35
retrieving revision 2.36
diff -u -d -r2.35 -r2.36
--- script_v72he.cpp	29 Aug 2004 12:52:16 -0000	2.35
+++ script_v72he.cpp	30 Aug 2004 11:52:33 -0000	2.36
@@ -158,7 +158,7 @@
 		/* 58 */
 		OPCODE(o72_getTimer),
 		OPCODE(o72_setTimer),
-		OPCODE(o6_invalid),
+		OPCODE(o72_unknown5A),
 		OPCODE(o72_wordArrayDec),
 		/* 5C */
 		OPCODE(o6_if),
@@ -347,7 +347,7 @@
 		OPCODE(o6_invalid),
 		/* F0 */
 		OPCODE(o6_invalid),
-		OPCODE(o6_invalid),
+		OPCODE(o72_unknownF1),
 		OPCODE(o6_invalid),
 		OPCODE(o72_readINI),
 		/* F4 */
@@ -361,7 +361,7 @@
 		OPCODE(o72_unknownFA),
 		OPCODE(o72_unknownFB),
 		/* FC */
-		OPCODE(o72_unknownFC),
+		OPCODE(o7_unknownFC),
 		OPCODE(o6_invalid),
 		OPCODE(o6_invalid),
 		OPCODE(o6_invalid),
@@ -661,6 +661,12 @@
 	}
 }
 
+void ScummEngine_v72he::o72_unknown5A() {
+	int value = pop();
+	push(4);
+	warning("o72_unknown5A stub (%d)", value);
+}
+
 void ScummEngine_v72he::o72_wordArrayDec() {
 	int var = fetchScriptWord();
 	int base = pop();
@@ -798,6 +804,7 @@
 	case 194:			// SO_ASSIGN_STRING
 		array = fetchScriptWord();
 		len = getStackList(list, ARRAYSIZE(list));
+		pop();
 		ah = defineArray(array, kStringArray, 0, 0, 0, 1024);
 		copyScriptString(ah->data);
 		break;
@@ -941,15 +948,15 @@
 	int mode, slot, l, r;
 	byte filename[100];
 
+	mode = pop();
 	copyScriptString(filename, true);
-	printf("File %s\n", filename);
+	debug(1,"File %s\n", filename);
 	
 	for (r = strlen((char*)filename); r != 0; r--) {
 		if (filename[r - 1] == '\\')
 			break;
 	}
 	
-	mode = pop();
 	slot = -1;
 	for (l = 0; l < 17; l++) {
 		if (_hFileTable[l].isOpen() == false) {
@@ -959,9 +966,9 @@
 	}
 
 	if (slot != -1) {
-		if (mode == -1)
+		if (mode == 1)
 			_hFileTable[slot].open((char*)filename + r, File::kFileReadMode);
-		else if (mode == -2)
+		else if (mode == 2)
 			_hFileTable[slot].open((char*)filename + r, File::kFileWriteMode);
 		else
 			error("o6_openFile(): wrong open file mode %d", mode);
@@ -1212,21 +1219,29 @@
 	int retval;
 
 	// we pretend that we don't have .ini file
+	copyScriptString(name);
 	type = fetchScriptByte();
 	switch (type) {
 	case 6: // number
 		push(0);
 		break;
 	case 7: // string
-		copyScriptString(name);
 		defineArray(0, kStringArray, 0, 0, 0, 0);
 		retval = readVar(0);
 		writeArray(0, 0, 0, 0);
 		push(retval); // var ID string
 		break;
 	default:
-		warning("o72_readINI(..., %d): read-ini string not implemented", type);
+		warning("o72_readINI( read-ini string not implemented", type);
 	}
+	debug(1, "o72_readINI (%d) %s", type, name);
+}
+
+void ScummEngine_v72he::o72_unknownF1() {
+	int a = pop();
+	int b = pop();
+	debug(1,"o7_unknownF1 stub (%d, %d)", b, a);
+	push(-1);
 }
 
 void ScummEngine_v72he::o72_unknownF4() {
@@ -1249,14 +1264,6 @@
 	}
 }
 
-void ScummEngine_v72he::o72_unknownFA() {
-	byte name[100];
-	int id = fetchScriptByte();
-	copyScriptString(name);
-
-	debug(1,"o72_unknownFA: (%d) %s", id, name);
-}
-
 void ScummEngine_v72he::o72_unknownF8() {
 	int a = fetchScriptByte();
 	push(1);
@@ -1266,17 +1273,15 @@
 
 void ScummEngine_v72he::o72_unknownF9() {
 	// File related
-	int r;
-	byte filename[255];
-
-	copyScriptString(filename);
+	warning("stub o72_unknownF9");
+}
 
-	for (r = strlen((char*)filename); r != 0; r--) {
-		if (filename[r - 1] == '\\')
-			break;
-	}
+void ScummEngine_v72he::o72_unknownFA() {
+	byte name[100];
+	int id = fetchScriptByte();
+	copyScriptString(name);
 
-	warning("stub o72_unknownF9(\"%s\")", filename + r);
+	debug(1,"o72_unknownFA: (%d) %s", id, name);
 }
 
 void ScummEngine_v72he::o72_unknownFB() {
@@ -1304,11 +1309,4 @@
 	debug(1, "o72_unknownFB stub");
 }
 
-void ScummEngine_v72he::o72_unknownFC() {
-	int a =	pop();
-	int b =	pop();
-	debug(1,"o7_unknownFC stub (%d, %d)", b, a);
-	push(0);
-}
-
 } // End of namespace Scumm

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.53
retrieving revision 2.54
diff -u -d -r2.53 -r2.54
--- script_v7he.cpp	29 Aug 2004 03:40:22 -0000	2.53
+++ script_v7he.cpp	30 Aug 2004 11:52:33 -0000	2.54
@@ -352,7 +352,7 @@
 		OPCODE(o7_readINI),
 		/* F4 */
 		OPCODE(o7_unknownF4),
-		OPCODE(o6_invalid),
+		OPCODE(o7_unknownF5),
 		OPCODE(o7_unknownF6),
 		OPCODE(o6_invalid),
 		/* F8 */
@@ -361,7 +361,7 @@
 		OPCODE(o7_unknownFA),
 		OPCODE(o7_unknownFB),
 		/* FC */
-		OPCODE(o6_invalid),
+		OPCODE(o7_unknownFC),
 		OPCODE(o6_invalid),
 		OPCODE(o6_invalid),
 		OPCODE(o6_invalid),
@@ -711,12 +711,28 @@
 }
 
 void ScummEngine_v7he::o7_unknownED() {
-	int a, b, c;
-	a = pop();
-	b = pop();
-	c = pop();
-	push(-1);
-	warning("stub o7_unknownED (%d, %d, %d)", c, b, a);
+	int array, pos, len;
+	int letter = 0, result = 0;
+
+	len = pop();
+	pos = pop();
+	array = pop();
+
+	if (len == -1) {
+		pos = 0;
+		len = resStrLen(getStringAddress(array));
+	}
+
+	writeVar(0, array);
+	while (len >= pos) {
+		letter = readArray(0, 0, pos);
+		if (letter)
+			result += _charset->getLetter(letter);
+		pos++;
+	}
+
+	push(result);
+	debug(1,"stub o7_unknownED");
 }
 
 void ScummEngine_v7he::o7_kernelSetFunctions() {
@@ -772,17 +788,48 @@
 	if (!addr)
 		error("o72_stringLen: Reference to zeroed array pointer (%d)", id);
 
-	len = strlen((char *)getStringAddress(id));
+	len = resStrLen(getStringAddress(id));
 	push(len);
 }
 
 void ScummEngine_v7he::o7_unknownEF() {
-	int a, b, c;
-	a = pop();
+	int value;
+	int array, array2, len, len2, len3, offset;
+	int b, size;
+	len = pop();
 	b = pop();
-	c = pop();
-	push(1);
-	warning("stub o7_unknownEF (%d, %d, %d)", c, b, a);
+	array2 = pop();
+
+	size = len - b + 2;
+
+	defineArray(0, kStringArray, 0, size);
+	writeArray(0, 0, 0, 0);
+
+	array = readVar(0);
+
+	if (len = -1) {
+		len2 = resStrLen(getStringAddress(array2));
+		len = 0;
+	} else {
+		len = b;
+	}
+	len3 = resStrLen(getStringAddress(array));
+
+	offset = 0;
+	len2 -= len;
+	len2++;
+	while (offset <= len2) {
+		writeVar(0, array2);
+		value = readArray(0, 0, offset + len);
+		writeVar(0, array);
+		writeArray(0, 0, len3 + offset, value);
+		offset++;
+	}
+
+	writeArray(0, 0, len3 + offset, 0);
+
+	push(array);
+	debug(1,"stub o7_unknownEF (array %d, array2 %d)", array, array2);
 }
 
 void ScummEngine_v7he::o7_readINI() {
@@ -805,7 +852,7 @@
 		push(retval); // var ID string
 		break;
 	default:
-		warning("o7_readINI(..., %d): read-ini string not implemented", type);
+		warning("o7_readINI(%d): read-ini string not implemented", type);
 	}
 }
 
@@ -839,17 +886,65 @@
 		debug(1, "o7_unknownF4(%d, %d, \"%s\", \"%s\")", a, b, filename1, filename2);
 		break;
 	}
-	warning("o7_unknownF4 stub");
+	debug(1,"o7_unknownF4 stub");
+}
+
+void ScummEngine_v7he::o7_unknownF5() {
+	int letter, ebx;
+	int array, len, pos, result = 0;
+	ebx = pop();
+	pos = pop();
+	array = pop();
+
+	len = resStrLen(getStringAddress(array));
+	writeVar(0, array);
+
+	while (len <= pos) {
+		letter = readArray(0, 0, pos);
+		result += _charset->getLetter(letter);
+		if (result >= ebx)
+			break;
+		pos++;
+	}
+
+	push(result);
+	debug(1,"stub o7_unknownF5");
 }
 
 void ScummEngine_v7he::o7_unknownF6() {
-	int a, b, c, d;
-	a = pop();
-	b = pop();
-	c = pop();
-	d = pop();
-	push(0);
-	warning("stub o7_unknownF6 (%d, %d, %d, %d)", d, c, b, a);
+	int len, pos, value, array;
+	value = pop();
+	len = pop();
+	pos = pop();
+	array = pop();
+
+	if (len < 0)
+		len = resStrLen(getStringAddress(array));
+
+	if (pos < 0)
+		pos = 0;
+
+	writeVar(0, array);
+	if (len < pos) {
+		while (len < pos) {
+			if (readArray(0, 0, pos) == value) {
+				push(pos);
+				return;
+			}
+			pos--;
+		}
+	} else {
+		while (len >= pos) {
+			if (readArray(0, 0, pos) == value) {
+				push(pos);
+				return;
+			}
+			pos++;
+		}
+	}
+
+	push(-1);
+	debug(1,"stub o7_unknownF6");
 }
 
 void ScummEngine_v7he::o7_unknownF9() {
@@ -867,13 +962,13 @@
 			break;
 	}
 
-	warning("stub o7_unknownF9(\"%s\")", filename + r);
+	debug(1,"stub o7_unknownF9(\"%s\")", filename + r);
 }
 
 void ScummEngine_v7he::o7_unknownFA() {
 	int num = fetchScriptByte();
 	int len = resStrLen(_scriptPointer);
-	warning("stub o7_unknownFA(%d, \"%s\")", num, _scriptPointer);
+	debug(1,"stub o7_unknownFA(%d, \"%s\")", num, _scriptPointer);
 	_scriptPointer += len + 1;
 }
 
@@ -899,7 +994,14 @@
 		pop();
 		break;
 	}
-	warning("o7_unknownFB stub");
+	debug(1,"o7_unknownFB stub");
+}
+
+void ScummEngine_v7he::o7_unknownFC() {
+	int a = pop();
+	int b = pop();
+	debug(1,"o7_unknownFC (%d, %d) stub", b, a);
+	push(1);
 }
 
 } // End of namespace Scumm

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.376
retrieving revision 1.377
diff -u -d -r1.376 -r1.377
--- sound.cpp	30 Aug 2004 09:43:21 -0000	1.376
+++ sound.cpp	30 Aug 2004 11:52:33 -0000	1.377
@@ -754,7 +754,7 @@
 		} else if (sound == -1 || sound == 10000 || sound == _currentMusic) {
 			// getSoundStatus(), with a -1, will return the
 			// ID number of the first active music it finds.
-			if (_currentMusic)
+			if (_vm->_heversion >= 70  || _currentMusic)
 				return (_musicChannelHandle.isActive()) ? 1 : 0;
 			else if (_vm->_imuse)
 				return (_vm->_imuse->getSoundStatus(sound));
@@ -834,9 +834,9 @@
 			// Stop current sfx
 		} else if (a == -1 || a == 10000) {
 			// Stop current music
-			if (_currentMusic)
+			if (_vm->_heversion >= 70  || _currentMusic)
 				_vm->_mixer->stopID(_currentMusic);
-			else
+			else if (_vm->_imuse)
 				_vm->_imuse->stopSound(_vm->_imuse->getSoundStatus(-1));
 		}
 	}





More information about the Scummvm-git-logs mailing list