aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorPaul Gilbert2014-05-20 22:07:53 -0400
committerPaul Gilbert2014-05-20 22:07:53 -0400
commit876ef49a3a7596ff2d26195923d43b1a886ca065 (patch)
treeaf92529540a11927a3a5615c09927402290095cf /engines/mads
parent6bfc9ce8f25d5d08e3a0aa1d5fa55e3dfe93b97f (diff)
downloadscummvm-rg350-876ef49a3a7596ff2d26195923d43b1a886ca065.tar.gz
scummvm-rg350-876ef49a3a7596ff2d26195923d43b1a886ca065.tar.bz2
scummvm-rg350-876ef49a3a7596ff2d26195923d43b1a886ca065.zip
MADS: Fix loading sprite in scene 701
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/compression.cpp20
-rw-r--r--engines/mads/compression.h2
-rw-r--r--engines/mads/nebular/nebular_scenes7.cpp5
3 files changed, 16 insertions, 11 deletions
diff --git a/engines/mads/compression.cpp b/engines/mads/compression.cpp
index 6563de51a3..de893e7b1a 100644
--- a/engines/mads/compression.cpp
+++ b/engines/mads/compression.cpp
@@ -69,18 +69,20 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) {
_items[i].size = READ_LE_UINT32(header + 2);
_items[i].compressedSize = READ_LE_UINT32(header + 6);
- _items[i].data = new byte[_items[i].size];
- if (_items[i].size == _items[i].compressedSize) {
+ byte *sourceData = new byte[_items[i].compressedSize];
+ stream->read(sourceData, _items[i].compressedSize);
+
+ if (_items[i].size == _items[i].compressedSize &&
+ !FabDecompressor::isCompressed(sourceData)) {
// Entry isn't compressed
- stream->read(_items[i].data, _items[i].size);
+ _items[i].data = sourceData;
} else {
// Decompress the entry
- byte *compressedData = new byte[_items[i].compressedSize];
- stream->read(compressedData, _items[i].compressedSize);
+ _items[i].data = new byte[_items[i].size];
FabDecompressor fab;
- fab.decompress(compressedData, _items[i].compressedSize, _items[i].data, _items[i].size);
- delete[] compressedData;
+ fab.decompress(sourceData, _items[i].compressedSize, _items[i].data, _items[i].size);
+ delete[] sourceData;
}
}
@@ -96,6 +98,10 @@ MadsPack::~MadsPack() {
//--------------------------------------------------------------------------
+bool FabDecompressor::isCompressed(const byte *srcData) {
+ return strncmp((const char *)srcData, "FAB", 3) == 0;
+}
+
void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destData, int destSize) {
byte copyLen, copyOfsShift, copyOfsMask, copyLenMask;
unsigned long copyOfs;
diff --git a/engines/mads/compression.h b/engines/mads/compression.h
index c752b570a2..43a966f48c 100644
--- a/engines/mads/compression.h
+++ b/engines/mads/compression.h
@@ -79,6 +79,8 @@ private:
int getBit();
public:
void decompress(const byte *srcData, int srcSize, byte *destData, int destSize);
+
+ static bool isCompressed(const byte *srcData);
};
} // End of namespace MADS
diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp
index b7699392f1..8e04c452f3 100644
--- a/engines/mads/nebular/nebular_scenes7.cpp
+++ b/engines/mads/nebular/nebular_scenes7.cpp
@@ -109,7 +109,7 @@ void Scene701::enter() {
_globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0));
_globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 5));
_globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', 0));
-// _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); // TODO: FIXME: Broken sprite?
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); // TODO: FIXME: Broken sprite?
_globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RM202A1");
_globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 8));
@@ -162,15 +162,12 @@ void Scene701::enter() {
break;
}
-// TODO: Enable once sprite 3 can be loaded properly
-/*
if (_globals[kLineStatus] == LINE_DROPPED || _globals[kLineStatus] == LINE_TIED) {
_globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1);
_scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8);
int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0));
_fishingLineId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 129), FACING_NORTHEAST);
}
-*/
if (_scene->_priorSceneId == 702) {
_game._player._playerPos = Common::Point(309, 138);