aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2015-06-12 13:25:08 +0200
committerMartin Kiewitz2015-06-12 13:25:08 +0200
commit3cca918ec745418bad4081b38211f82d47e1091e (patch)
treec8d73dbb3b2618db108aea718246c57c299e65f8 /engines
parent6c2c0cdfefa7941b7b27d2567be7dd0d14b02dee (diff)
downloadscummvm-rg350-3cca918ec745418bad4081b38211f82d47e1091e.tar.gz
scummvm-rg350-3cca918ec745418bad4081b38211f82d47e1091e.tar.bz2
scummvm-rg350-3cca918ec745418bad4081b38211f82d47e1091e.zip
SHERLOCK: 3DO: fix multiple frame decoding
when multiple frames were decoded, all but the last one were free()d
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/image_file.cpp37
-rw-r--r--engines/sherlock/scene.cpp1
2 files changed, 19 insertions, 19 deletions
diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp
index 265be52253..d47f2c59a3 100644
--- a/engines/sherlock/image_file.cpp
+++ b/engines/sherlock/image_file.cpp
@@ -354,8 +354,6 @@ void ImageFile3DO::load3DOCelFile(Common::SeekableReadStream &stream) {
uint32 chunkSize = 0;
byte *chunkDataPtr = NULL;
- ImageFrame imageFrame;
-
// ANIM chunk (animation header for animation files)
bool animFound = false;
uint32 animVersion = 0;
@@ -477,7 +475,7 @@ void ImageFile3DO::load3DOCelFile(Common::SeekableReadStream &stream) {
// Unknown contents, occurs right before PDAT
break;
- case MKTAG('P', 'D', 'A', 'T'):
+ case MKTAG('P', 'D', 'A', 'T'): {
// pixel data for one frame
// may be compressed or uncompressed pixels
@@ -496,6 +494,8 @@ void ImageFile3DO::load3DOCelFile(Common::SeekableReadStream &stream) {
stream.read(chunkDataPtr, dataSize);
// Set up frame
+ ImageFrame imageFrame;
+
imageFrame._width = ccbWidth;
imageFrame._height = ccbHeight;
imageFrame._paletteBase = 0;
@@ -515,6 +515,7 @@ void ImageFile3DO::load3DOCelFile(Common::SeekableReadStream &stream) {
push_back(imageFrame);
break;
+ }
case MKTAG('O', 'F', 'S', 'T'): // 3DOSplash.cel
// unknown contents
@@ -534,8 +535,6 @@ void ImageFile3DO::load3DOCelRoomData(Common::SeekableReadStream &stream) {
int streamSize = stream.size();
uint16 roomDataHeader_size = 0;
- ImageFrame imageFrame;
-
// CCB chunk (cel control block)
uint32 ccbFlags = 0;
bool ccbFlags_compressed = false;
@@ -551,8 +550,6 @@ void ImageFile3DO::load3DOCelRoomData(Common::SeekableReadStream &stream) {
byte *celDataPtr = NULL;
while (stream.pos() < streamSize) {
- ImageFrame frame;
-
// 3DO sherlock holmes room data header
stream.skip(4); // Possibly UINT16 width, UINT16 height?!?!
roomDataHeader_size = stream.readUint16BE();
@@ -593,20 +590,24 @@ void ImageFile3DO::load3DOCelRoomData(Common::SeekableReadStream &stream) {
stream.read(celDataPtr, celDataSize);
// Set up frame
- imageFrame._width = ccbWidth;
- imageFrame._height = ccbHeight;
- imageFrame._paletteBase = 0;
- imageFrame._offset.x = 0;
- imageFrame._offset.y = 0;
- imageFrame._rleEncoded = ccbFlags_compressed;
- imageFrame._size = 0;
+ {
+ ImageFrame imageFrame;
- // Decompress/copy this frame
- decompress3DOCelFrame(imageFrame, celDataPtr, celDataSize, ccbPRE0_bitsPerPixel, NULL);
+ imageFrame._width = ccbWidth;
+ imageFrame._height = ccbHeight;
+ imageFrame._paletteBase = 0;
+ imageFrame._offset.x = 0;
+ imageFrame._offset.y = 0;
+ imageFrame._rleEncoded = ccbFlags_compressed;
+ imageFrame._size = 0;
- delete[] celDataPtr;
+ // Decompress/copy this frame
+ decompress3DOCelFrame(imageFrame, celDataPtr, celDataSize, ccbPRE0_bitsPerPixel, NULL);
+
+ delete[] celDataPtr;
- push_back(imageFrame);
+ push_back(imageFrame);
+ }
}
}
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 385c75174a..609fd17a56 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -668,7 +668,6 @@ bool Scene::loadScene(const Common::String &filename) {
// === BGSHAPES === Set up the bgShapes
for (int idx = 0; idx < header3DO_numStructs; ++idx) {
- warning("%d", _bgShapes[idx]._misc);
_bgShapes[idx]._images = _images[_bgShapes[idx]._misc]._images;
_bgShapes[idx]._imageFrame = !_bgShapes[idx]._images ? (ImageFrame *)nullptr :
&(*_bgShapes[idx]._images)[0];