[Scummvm-cvs-logs] scummvm master -> 3053cd2cae6f8c9ed90e09eabc662357e7798847

dreammaster dreammaster at scummvm.org
Sun Oct 4 00:24:55 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3053cd2cae SHERLOCK: SS: Fix loading points between scene walkable areas


Commit: 3053cd2cae6f8c9ed90e09eabc662357e7798847
    https://github.com/scummvm/scummvm/commit/3053cd2cae6f8c9ed90e09eabc662357e7798847
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-10-03T18:20:46-04:00

Commit Message:
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

Changed paths:
    engines/sherlock/scene.cpp



diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index ea12faf..37c04c6 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);






More information about the Scummvm-git-logs mailing list