[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.111,2.112 script_v6.cpp,1.193,1.194

Pawel Kolodziejski aquadran at users.sourceforge.net
Sat Sep 13 13:55:04 CEST 2003


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

Modified Files:
	intern.h script_v6.cpp 
Log Message:
implemented fileWrite opcode

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.111
retrieving revision 2.112
diff -u -d -r2.111 -r2.112
--- intern.h	13 Sep 2003 16:25:33 -0000	2.111
+++ intern.h	13 Sep 2003 20:54:12 -0000	2.112
@@ -317,8 +317,7 @@
 	};
 	
 	const OpcodeEntryV6 *_opcodesV6;
-
-	File _hFileTable[17];
+	
 public:
 	Scumm_v6(GameDetector *detector, OSystem *syst) : Scumm(detector, syst)
 	{
@@ -346,6 +345,7 @@
 	void shuffleArray(int num, int minIdx, int maxIdx);
 	void unknownEA_func(int a, int b, int c, int d, int e);
 	int readFileToArray(int slot, int32 size);
+	void writeFileFromArray(int slot, int resID);
 
 	/* Version 6 script opcodes */
 	void o6_setBlastObjectWindow();
@@ -505,6 +505,7 @@
 	void o6_closeFile();
 	void o6_deleteFile();
 	void o6_readFile();
+	void o6_writeFile();
 	void o6_findAllObjects();
 	void o6_pickVarRandom();
 	void o6_getDateTime();

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -d -r1.193 -r1.194
--- script_v6.cpp	13 Sep 2003 18:45:56 -0000	1.193
+++ script_v6.cpp	13 Sep 2003 20:54:12 -0000	1.194
@@ -320,7 +320,7 @@
 		OPCODE(o6_openFile),
 		OPCODE(o6_readFile),
 		/* DC */
-		OPCODE(o6_invalid),
+		OPCODE(o6_writeFile),
 		OPCODE(o6_findAllObjects),
 		OPCODE(o6_deleteFile),
 		OPCODE(o6_invalid),
@@ -2546,6 +2546,10 @@
 		}
 	} else {
 		switch (args[0]) {
+		case 1:
+			//func(args[1], args[2], args[3], args[4], args[5]);
+			warning("o6_kernelSetFunctions: nothing in 1");
+			break;
 		case 3:
 			warning("o6_kernelSetFunctions: nothing in 3");
 			break;
@@ -2911,6 +2915,28 @@
 		push(readFileToArray(slot, size));
 	}
 	warning("o6_readFile(%d, %d)", slot, size);
+}
+
+void Scumm_v6::writeFileFromArray(int slot, int resID) {
+	byte *ptr = getResourceAddress(rtString, resID);
+	// FIXME: hack for proper size: / 2 - 5
+	int32 size = getResourceSize(rtString, resID) / 2 - 5;
+	_hFileTable[slot].write(ptr, size);
+}
+
+void Scumm_v6::o6_writeFile() {
+	int32 size = pop();
+	int16 resID = pop();
+	int slot = pop();
+
+	if (size == -2) {
+		_hFileTable[slot].writeUint16LE(resID);
+	} else if (size == -1) {
+		_hFileTable[slot].writeByte(resID);
+	} else {
+		writeFileFromArray(slot, resID);
+	}
+	warning("o6_writeFile(%d, %d)", slot, resID);
 }
 
 void Scumm_v6::o6_findAllObjects() {





More information about the Scummvm-git-logs mailing list