diff options
-rw-r--r-- | engines/parallaction/disk_ns.cpp | 24 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 10 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 2 |
3 files changed, 20 insertions, 16 deletions
diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index c0bb2691ef..7949be4a0b 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -590,19 +590,19 @@ void DosDisk_ns::loadBackground(const char *filename) { 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 @@ void DosDisk_ns::loadMaskAndPath(const char *name) { 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 @@ void AmigaDisk_ns::loadMask(const char *name) { 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(mask); - _vm->_gfx->setMask(buf); - free(buf); delete s; return; diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 4c0f7e74e4..0eba2b8db3 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -757,8 +757,11 @@ void Gfx::setBackground(byte *background) { 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 @@ Gfx::Gfx(Parallaction* vm) : _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(); diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 3ceb6b0ce9..f1104eb27b 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -220,7 +220,7 @@ public: // 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); |