aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-10-03 18:20:46 -0400
committerPaul Gilbert2015-10-03 18:20:46 -0400
commit3053cd2cae6f8c9ed90e09eabc662357e7798847 (patch)
treeb8fce1c68fc12e5c26713384168d85312389c3f8 /engines/sherlock
parent711d77c04ab4d79397bcd7495a54eb284f5b266b (diff)
downloadscummvm-rg350-3053cd2cae6f8c9ed90e09eabc662357e7798847.tar.gz
scummvm-rg350-3053cd2cae6f8c9ed90e09eabc662357e7798847.tar.bz2
scummvm-rg350-3053cd2cae6f8c9ed90e09eabc662357e7798847.zip
SHERLOCK: SS: Fix loading points between scene walkable areas
Rose Tattoo had the zone lists cleanly listed end to end, but Serrated Sclapel has, at least for Outside Scotland Yard, a whole bunch of garbage at the start of the walk data block
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/scene.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index ea12fafd7b..37c04c681a 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -563,34 +563,37 @@ bool Scene::loadScene(const Common::String &filename) {
// Read in the walk data
size = rrmStream->readUint16LE();
- Common::SeekableReadStream *walkStream = !_compressed ? rrmStream :
+ Common::SeekableReadStream *walkStream = !_compressed ? rrmStream->readStream(size) :
res.decompress(*rrmStream, size);
- int startPos = walkStream->pos();
- while ((walkStream->pos() - startPos) < size) {
- _walkPoints.push_back(WalkArray());
- _walkPoints[_walkPoints.size() - 1]._fileOffset = walkStream->pos() - startPos;
- _walkPoints[_walkPoints.size() - 1].load(*walkStream, IS_ROSE_TATTOO);
- }
-
- if (_compressed)
- delete walkStream;
-
// Translate the file offsets of the walk directory to indexes in the loaded walk data
for (uint idx1 = 0; idx1 < _zones.size(); ++idx1) {
for (uint idx2 = 0; idx2 < _zones.size(); ++idx2) {
- int fileOffset = _walkDirectory[idx1][idx2];
- if (fileOffset == -1)
+ int dataOffset = _walkDirectory[idx1][idx2];
+ if (dataOffset == -1)
continue;
+ // Check to see if we've already loaded the walk set for the given data offset
uint dataIndex = 0;
- while (dataIndex < _walkPoints.size() && _walkPoints[dataIndex]._fileOffset != fileOffset)
+ while (dataIndex < _walkPoints.size() && _walkPoints[dataIndex]._fileOffset != dataOffset)
++dataIndex;
- assert(dataIndex < _walkPoints.size());
+
+ if (dataIndex == _walkPoints.size()) {
+ // Walk data for that offset hasn't been loaded yet, so load it now
+ _walkPoints.push_back(WalkArray());
+
+ walkStream->seek(dataOffset);
+ _walkPoints[_walkPoints.size() - 1]._fileOffset = dataOffset;
+ _walkPoints[_walkPoints.size() - 1].load(*walkStream, IS_ROSE_TATTOO);
+ dataIndex = _walkPoints.size() - 1;
+ }
+
_walkDirectory[idx1][idx2] = dataIndex;
}
}
+ delete walkStream;
+
if (IS_ROSE_TATTOO) {
// Read in the entrance
_entrance.load(*rrmStream);