aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2008-08-15 15:08:08 +0000
committerNicola Mettifogo2008-08-15 15:08:08 +0000
commit7891e5afceff341c2a225a1f1856ea870f2e015d (patch)
tree7884c54a37675124039444ba9e9e7ac6d461d5ff /engines
parentb4a2aee9640485b28ca61776c9c620b34747e451 (diff)
downloadscummvm-rg350-7891e5afceff341c2a225a1f1856ea870f2e015d.tar.gz
scummvm-rg350-7891e5afceff341c2a225a1f1856ea870f2e015d.tar.bz2
scummvm-rg350-7891e5afceff341c2a225a1f1856ea870f2e015d.zip
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.
svn-id: r33903
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/exec_ns.cpp7
-rw-r--r--engines/parallaction/graphics.h20
-rw-r--r--engines/parallaction/parser_br.cpp13
3 files changed, 27 insertions, 13 deletions
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index 6ccec4ed17..4ea7d601e0 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -264,8 +264,11 @@ void Parallaction::showZone(ZonePtr z, bool visible) {
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);
+ }
}
}
}
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index 0b5cdb02f2..471f71dfa8 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -213,28 +213,38 @@ public:
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;
}
+ }
+
+ 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));
- printf("MaskBuffer::blt() diffs = %i\n", diffs);
+ 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;
+ }
}
+
};
diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp
index 2a8064264d..20800abc33 100644
--- a/engines/parallaction/parser_br.cpp
+++ b/engines/parallaction/parser_br.cpp
@@ -793,7 +793,7 @@ void LocationParser_br::parseGetData(ZonePtr z) {
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 @@ void LocationParser_br::parseGetData(ZonePtr z) {
} 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 @@ void LocationParser_br::parse(Script *script) {
_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);
}