diff options
author | Travis Howell | 2009-03-15 13:28:20 +0000 |
---|---|---|
committer | Travis Howell | 2009-03-15 13:28:20 +0000 |
commit | e48637415285b7d1197ef48c1910635e464de965 (patch) | |
tree | b07ba0114db4745e9b2f0f27b2dac4e56417008c | |
parent | 1f299bb24ac9ab8ded2542aaeeffad77b53faa9b (diff) | |
download | scummvm-rg350-e48637415285b7d1197ef48c1910635e464de965.tar.gz scummvm-rg350-e48637415285b7d1197ef48c1910635e464de965.tar.bz2 scummvm-rg350-e48637415285b7d1197ef48c1910635e464de965.zip |
Fix crash regression in the Amiga BRA demo, by checking if mask buffer exists, before using it.
svn-id: r39418
-rw-r--r-- | engines/parallaction/disk_br.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/gfxbase.cpp | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index 57e413e354..97931aa731 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -481,14 +481,14 @@ void AmigaDisk_br::loadScenery(BackgroundInfo& info, const char* name, const cha } #if 0 if (mask) { - stream = tryOpenFile("msk/" + Common::String(path), ".msk"); + stream = tryOpenFile("msk/" + Common::String(mask), ".msk"); if (stream) { Graphics::PackBitsReadStream unpackedStream(*stream); info._mask = new MaskBuffer; + info._path->bigEndian = false; info._mask->create(info.width, info.height); unpackedStream.read(info._mask->data, info._mask->size); // TODO: there is another step to do after decompression... - loadMask(mask, *info._mask); delete stream; } else { debugC(1, kDebugDisk, "AmigaDisk_br::loadScenery: (%s) not found", mask); diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp index a0becfe70e..47bf0000db 100644 --- a/engines/parallaction/gfxbase.cpp +++ b/engines/parallaction/gfxbase.cpp @@ -349,8 +349,12 @@ void Gfx::bltMaskScale(const Common::Rect& r, byte *data, Graphics::Surface *sur } if (*s != transparentColor) { - byte v = _backgroundInfo->_mask->getValue(dp.x + col, dp.y + line); - if (z >= v) *d2 = *s; + if (_backgroundInfo->hasMask()) { + byte v = _backgroundInfo->_mask->getValue(dp.x + col, dp.y + line); + if (z >= v) *d2 = *s; + } else { + *d2 = *s; + } } s++; @@ -395,8 +399,12 @@ void Gfx::bltMaskNoScale(const Common::Rect& r, byte *data, Graphics::Surface *s for (uint16 j = 0; j < q.width(); j++) { if (*s != transparentColor) { - byte v = _backgroundInfo->_mask->getValue(dp.x + j, dp.y + i); - if (z >= v) *d = *s; + if (_backgroundInfo->hasMask()) { + byte v = _backgroundInfo->_mask->getValue(dp.x + j, dp.y + i); + if (z >= v) *d = *s; + } else { + *d = *s; + } } s++; |