diff options
author | Nicola Mettifogo | 2007-08-06 19:39:00 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-08-06 19:39:00 +0000 |
commit | 14448af3bb57c49a3bfb056c1f368db47161b3ff (patch) | |
tree | 986a195a25256a8a3149cccfa7931f3022ba4dc3 /engines/parallaction | |
parent | 57196e5dd894240320d15a62e02f8af8acfed2d7 (diff) | |
download | scummvm-rg350-14448af3bb57c49a3bfb056c1f368db47161b3ff.tar.gz scummvm-rg350-14448af3bb57c49a3bfb056c1f368db47161b3ff.tar.bz2 scummvm-rg350-14448af3bb57c49a3bfb056c1f368db47161b3ff.zip |
Made disk code directly create mask BitBuffer from resources.
svn-id: r28473
Diffstat (limited to 'engines/parallaction')
-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); |