diff options
| author | Paweł Kołodziejski | 2003-09-13 20:54:12 +0000 | 
|---|---|---|
| committer | Paweł Kołodziejski | 2003-09-13 20:54:12 +0000 | 
| commit | b735d9031dddc13dd032b0dfb5de61284894dc8d (patch) | |
| tree | 3169ef2a03aed92cb8027bba8b082326fc25117f | |
| parent | 52ff6acc1fa224b3027d5e6268e37e681fdf2031 (diff) | |
| download | scummvm-rg350-b735d9031dddc13dd032b0dfb5de61284894dc8d.tar.gz scummvm-rg350-b735d9031dddc13dd032b0dfb5de61284894dc8d.tar.bz2 scummvm-rg350-b735d9031dddc13dd032b0dfb5de61284894dc8d.zip | |
implemented fileWrite opcode
svn-id: r10242
| -rw-r--r-- | scumm/intern.h | 5 | ||||
| -rw-r--r-- | scumm/script_v6.cpp | 28 | 
2 files changed, 30 insertions, 3 deletions
| diff --git a/scumm/intern.h b/scumm/intern.h index e13f79d7df..864c24274a 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -317,8 +317,7 @@ protected:  	};  	const OpcodeEntryV6 *_opcodesV6; - -	File _hFileTable[17]; +	  public:  	Scumm_v6(GameDetector *detector, OSystem *syst) : Scumm(detector, syst)  	{ @@ -346,6 +345,7 @@ protected:  	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 @@ protected:  	void o6_closeFile();  	void o6_deleteFile();  	void o6_readFile(); +	void o6_writeFile();  	void o6_findAllObjects();  	void o6_pickVarRandom();  	void o6_getDateTime(); diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index ad601e5915..9e3c4aa895 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -320,7 +320,7 @@ void Scumm_v6::setupOpcodes() {  		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 @@ void Scumm_v6::o6_kernelSetFunctions() {  		}  	} 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; @@ -2913,6 +2917,28 @@ void Scumm_v6::o6_readFile() {  	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() {  	// FIXME is this even remotely correct?  	// see http://users.bigpond.net.au/tgray2/findallobjects.txt | 
