Skip to content

Commit

Permalink
SHERLOCK: Fix Rose Tattoo scene loading problems from merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed May 23, 2015
1 parent b4b6bf6 commit c8cfca7
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 28 deletions.
9 changes: 6 additions & 3 deletions engines/sherlock/resources.cpp
Expand Up @@ -91,9 +91,12 @@ Resources::Resources(SherlockEngine *vm) : _vm(vm), _cache(vm) {
if (_vm->_interactiveFl) {
addToCache("vgs.lib");
addToCache("talk.lib");
addToCache("sequence.txt");
addToCache("journal.txt");
addToCache("portrait.lib");

if (IS_SERRATED_SCALPEL) {
addToCache("sequence.txt");
addToCache("portrait.lib");
}
}
}

Expand Down Expand Up @@ -310,7 +313,7 @@ void Resources::decompressLZ(Common::SeekableReadStream &source, byte *outBuffer
lzWindowPos = (lzWindowPos + 1) & 0x0FFF;
}
}
} while ((outSize == -1 || outBuffer < outBufferEnd) || (inSize == -1 || source.pos() < endPos));
} while ((outSize == -1 || outBuffer < outBufferEnd) && (inSize == -1 || source.pos() < endPos));
}

/*----------------------------------------------------------------*/
Expand Down
7 changes: 0 additions & 7 deletions engines/sherlock/scalpel/scalpel.cpp
Expand Up @@ -390,13 +390,6 @@ void ScalpelEngine::initialize() {
_flags[3] = true; // Turn on Alley
_flags[39] = true; // Turn on Baker Street

// Add some more files to the cache
_res->addToCache("portrait.lib");
_res->addToCache("sequence.txt");
_res->addToCache("EPILOGUE.SND");
_res->addToCache("snd.snd");
_res->addToCache("title.snd");

if (!isDemo()) {
// Load the map co-ordinates for each scene and sequence data
_map->loadPoints(NUM_PLACES, &MAP_X[0], &MAP_Y[0], &MAP_TRANSLATE[0]);
Expand Down
32 changes: 19 additions & 13 deletions engines/sherlock/scene.cpp
Expand Up @@ -311,27 +311,32 @@ bool Scene::loadScene(const Common::String &filename) {
bgInfo[idx].load(*rrmStream);

// Read information
if (IS_SERRATED_SCALPEL) {
Common::SeekableReadStream *infoStream = !_lzwMode ? rrmStream :
res.decompress(*rrmStream, bgHeader._numStructs * 569 + bgHeader._descSize + bgHeader._seqSize);
if (IS_ROSE_TATTOO) {
// Load shapes
Common::SeekableReadStream *infoStream = !_lzwMode ? rrmStream : res.decompress(*rrmStream, bgHeader._numStructs * 625);

_bgShapes.resize(bgHeader._numStructs);
for (int idx = 0; idx < bgHeader._numStructs; ++idx)
_bgShapes[idx].load(*infoStream, false);
_bgShapes[idx].load(*infoStream, _vm->getGameID() == GType_RoseTattoo);

if (bgHeader._descSize) {
_descText.resize(bgHeader._descSize);
infoStream->read(&_descText[0], bgHeader._descSize);
}
if (_lzwMode)
delete infoStream;

if (bgHeader._seqSize) {
_sequenceBuffer.resize(bgHeader._seqSize);
infoStream->read(&_sequenceBuffer[0], bgHeader._seqSize);
}
// Load description text
_descText.resize(bgHeader._descSize);
if (_lzwMode)
res.decompress(*rrmStream, (byte *)&_descText[0], bgHeader._descSize);
else
rrmStream->read(&_descText[0], bgHeader._descSize);

// Load sequences
_sequenceBuffer.resize(bgHeader._seqSize);
if (_lzwMode)
delete infoStream;
res.decompress(*rrmStream, &_sequenceBuffer[0], bgHeader._seqSize);
else
rrmStream->read(&_sequenceBuffer[0], bgHeader._seqSize);
} else if (!_lzwMode) {
// Serrated Scalpel uncompressed info
_bgShapes.resize(bgHeader._numStructs);
for (int idx = 0; idx < bgHeader._numStructs; ++idx)
_bgShapes[idx].load(*rrmStream, false);
Expand All @@ -346,6 +351,7 @@ bool Scene::loadScene(const Common::String &filename) {
rrmStream->read(&_sequenceBuffer[0], bgHeader._seqSize);
}
} else {
// Serrated Scalpel compressed info
Common::SeekableReadStream *infoStream;

// Read shapes
Expand Down
13 changes: 9 additions & 4 deletions engines/sherlock/sound.cpp
Expand Up @@ -68,11 +68,16 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
_vm->_res->addToCache("TITLE.SND");
else {
_vm->_res->addToCache("MUSIC.LIB");
_vm->_res->addToCache("SND.SND");

if (IS_ROSE_TATTOO) {
_vm->_res->addToCache("SOUND.LIB");
} else {
_vm->_res->addToCache("SND.SND");

if (!_vm->isDemo()) {
_vm->_res->addToCache("TITLE.SND");
_vm->_res->addToCache("EPILOGUE.SND");
if (!_vm->isDemo()) {
_vm->_res->addToCache("TITLE.SND");
_vm->_res->addToCache("EPILOGUE.SND");
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion engines/sherlock/tattoo/tattoo.cpp
Expand Up @@ -44,7 +44,6 @@ void TattooEngine::initialize() {

// Add some more files to the cache
_res->addToCache("walk.lib");
_res->addToCache("sound.lib");

// Starting scene
_scene->_goToScene = 91;
Expand Down

0 comments on commit c8cfca7

Please sign in to comment.