[Scummvm-cvs-logs] SF.net SVN: scummvm: [28473] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Aug 6 21:39:00 CEST 2007


Revision: 28473
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28473&view=rev
Author:   peres001
Date:     2007-08-06 12:39:00 -0700 (Mon, 06 Aug 2007)

Log Message:
-----------
Made disk code directly create mask BitBuffer from resources.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/disk_ns.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h

Modified: scummvm/trunk/engines/parallaction/disk_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_ns.cpp	2007-08-06 19:19:59 UTC (rev 28472)
+++ scummvm/trunk/engines/parallaction/disk_ns.cpp	2007-08-06 19:39:00 UTC (rev 28473)
@@ -590,19 +590,19 @@
 	parseBackground(_resArchive);
 
 	byte *bg = (byte*)calloc(1, _vm->_screenSize);
-	byte *mask = (byte*)calloc(1, _vm->_screenMaskSize);
+	BitBuffer *mask = new BitBuffer;
+	mask->create(_vm->_screenWidth, _vm->_screenHeight);
 	byte *path = (byte*)calloc(1, _vm->_screenPathSize);
 
 
 	Graphics::PackBitsReadStream stream(_resArchive);
-	unpackBackground(&stream, bg, mask, path);
+	unpackBackground(&stream, bg, mask->data, path);
 
 	_vm->_gfx->setBackground(bg);
 	_vm->_gfx->setMask(mask);
 	_vm->setPath(path);
 
 	free(bg);
-	free(mask);
 	free(path);
 
 	return;
@@ -621,15 +621,16 @@
 	if (!_resArchive.openArchivedFile(path))
 		errorFileNotFound(name);
 
-	byte *maskBuf = (byte*)calloc(1, _vm->_screenMaskSize);
+	BitBuffer *mask = new BitBuffer;
+	mask->create(_vm->_screenWidth, _vm->_screenHeight);
 	byte *pathBuf = (byte*)calloc(1, _vm->_screenPathSize);
 
 	parseDepths(_resArchive);
 
 	_resArchive.read(pathBuf, _vm->_screenPathSize);
-	_resArchive.read(maskBuf, _vm->_screenMaskSize);
+	_resArchive.read(mask->data, _vm->_screenMaskSize);
 
-	_vm->_gfx->setMask(maskBuf);
+	_vm->_gfx->setMask(mask);
 	_vm->setPath(pathBuf);
 
 	return;
@@ -1236,12 +1237,13 @@
 	s->seek(0x126, SEEK_SET);	// HACK: skipping IFF/ILBM header should be done by analysis, not magic
 	Graphics::PackBitsReadStream stream(*s);
 
-	byte *buf = (byte*)malloc(_vm->_screenMaskSize);
-	stream.read(buf, _vm->_screenMaskSize);
-	buildMask(buf);
+	BitBuffer *mask = new BitBuffer;
+	mask->create(_vm->_screenWidth, _vm->_screenHeight);
+	stream.read(mask->data, _vm->_screenMaskSize);
+	buildMask(mask->data);
 
-	_vm->_gfx->setMask(buf);
-	free(buf);
+	_vm->_gfx->setMask(mask);
+
 	delete s;
 
 	return;

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-08-06 19:19:59 UTC (rev 28472)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-08-06 19:39:00 UTC (rev 28473)
@@ -757,8 +757,11 @@
 	copyScreen(kBitBack, kBit2);
 }
 
-void Gfx::setMask(byte *mask) {
-	memcpy(_depthMask->data, mask, _vm->_screenMaskSize);
+void Gfx::setMask(BitBuffer *buffer) {
+	if (_depthMask)
+		delete _depthMask;
+
+	_depthMask = buffer;
 }
 
 
@@ -847,8 +850,7 @@
 	_buffers[kBit2] = new Graphics::Surface;
 	_buffers[kBit2]->create(_vm->_screenWidth, _vm->_screenHeight, 1);
 
-	_depthMask = new BitBuffer;
-	_depthMask->create(_vm->_screenWidth, _vm->_screenHeight);
+	_depthMask = 0;
 
 	setBlackPalette();
 

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2007-08-06 19:19:59 UTC (rev 28472)
+++ scummvm/trunk/engines/parallaction/graphics.h	2007-08-06 19:39:00 UTC (rev 28473)
@@ -220,7 +220,7 @@
 
 	// location
 	void setBackground(byte *background);
-	void setMask(byte *mask);
+	void setMask(BitBuffer *buffer);
 	int16 queryMask(int16 v);
 	void intGrottaHackMask();
 	void restoreBackground(const Common::Rect& r);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list