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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Fri Aug 15 17:08:09 CEST 2008


Revision: 33903
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33903&view=rev
Author:   peres001
Date:     2008-08-15 15:08:08 +0000 (Fri, 15 Aug 2008)

Log Message:
-----------
Implemented raster operation for masks and postponed blitting of zones after everything in the location has been loaded. This fixes the remaining problems with animations not being masked by items.

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

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-08-15 14:38:25 UTC (rev 33902)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-08-15 15:08:08 UTC (rev 33903)
@@ -264,8 +264,11 @@
 
 		GetData *data = z->u.get;
 		if (data->hasMask && _gfx->_backgroundInfo->hasMask) {
-			int frame = visible ? 0 : 1;
-			_gfx->_backgroundInfo->mask.blt(data->gfxobj->x, data->gfxobj->y, data->_mask[frame], 0, 0, data->_mask->w, data->_mask->h);
+			if (visible) {
+				_gfx->_backgroundInfo->mask.bltOr(data->gfxobj->x, data->gfxobj->y, data->_mask[0], 0, 0, data->_mask->w, data->_mask->h);
+			} else {
+				_gfx->_backgroundInfo->mask.bltCopy(data->gfxobj->x, data->gfxobj->y, data->_mask[1], 0, 0, data->_mask->w, data->_mask->h);
+			}
 		}
 	}
 }

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-08-15 14:38:25 UTC (rev 33902)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-08-15 15:08:08 UTC (rev 33903)
@@ -213,28 +213,38 @@
 		return data + (x >> 2) + y * internalWidth;
 	}
 
-	void blt(uint16 dx, uint16 dy, const MaskBuffer &src, uint16 sx, uint16 sy, uint width, uint height) {
+	void bltOr(uint16 dx, uint16 dy, const MaskBuffer &src, uint16 sx, uint16 sy, uint width, uint height) {
 		assert((width <= w) && (width <= src.w) && (height <= h) && (height <= src.h));
 
 		byte *s = src.getPtr(sx, sy);
 		byte *d = getPtr(dx, dy);
 
-		uint diffs = 0;
-
 		// this code assumes buffers are aligned on 4-pixels boundaries, as the original does
 		uint16 linewidth = width >> 2;
 		for (uint16 i = 0; i < height; i++) {
 			for (uint16 j = 0; j < linewidth; j++) {
-				if (*s) diffs++;
 				*d++ |= *s++;
 			}
 			d += internalWidth - linewidth;
 			s += src.internalWidth - linewidth;
 		}
+	}
 
-		printf("MaskBuffer::blt() diffs = %i\n", diffs);
+	void bltCopy(uint16 dx, uint16 dy, const MaskBuffer &src, uint16 sx, uint16 sy, uint width, uint height) {
+		assert((width <= w) && (width <= src.w) && (height <= h) && (height <= src.h));
+
+		byte *s = src.getPtr(sx, sy);
+		byte *d = getPtr(dx, dy);
+
+		// this code assumes buffers are aligned on 4-pixels boundaries, as the original does
+		for (uint16 i = 0; i < height; i++) {
+			memcpy(d, s, (width >> 2));
+			d += internalWidth;
+			s += src.internalWidth;
+		}
 	}
 
+
 };
 
 

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2008-08-15 14:38:25 UTC (rev 33902)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2008-08-15 15:08:08 UTC (rev 33903)
@@ -793,7 +793,7 @@
 				data->_mask[0].create(rect.width(), rect.height());
 				_vm->_disk->loadMask(_tokens[1], data->_mask[0]);
 				data->_mask[1].create(rect.width(), rect.height());
-				data->_mask[1].blt(0, 0, ctxt.info->mask, data->gfxobj->x, data->gfxobj->y, data->_mask->w, data->_mask->h);
+				data->_mask[1].bltCopy(0, 0, ctxt.info->mask, data->gfxobj->x, data->gfxobj->y, data->_mask->w, data->_mask->h);
 				data->hasMask = true;
 			} else {
 				warning("Mask for zone '%s' ignored, since background doesn't have one", z->_name);
@@ -812,11 +812,6 @@
 	} while (scumm_stricmp(_tokens[0], "endzone"));
 
 	z->u.get = data;
-
-	// FIXME: right now showZone doesn't work properly when called during location
-	// parsing. In fact, the main backgroundInfo is not properly set yet.
-	bool visible = (z->_flags & kFlagsRemove) == 0;
-	_vm->showZone(z, visible);
 }
 
 void LocationParser_br::parseZoneTypeBlock(ZonePtr z) {
@@ -1252,6 +1247,12 @@
 	_vm->_pathBuffer = &ctxt.info->path;
 
 
+	ZoneList::iterator it = _vm->_location._zones.begin();
+	for ( ; it != _vm->_location._zones.end(); it++) {
+		bool visible = ((*it)->_flags & kFlagsRemove) == 0;
+		_vm->showZone((*it), visible);
+	}
+
 	if (ctxt.characterName) {
 		_vm->changeCharacter(ctxt.characterName);
 	}


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