[Scummvm-cvs-logs] scummvm master -> f4a57cfde01268440f30447ddb6c8c78da6ae44e

dreammaster dreammaster at scummvm.org
Sun Oct 4 01:05:05 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:
f4a57cfde0 SHERLOCK: 3DO: Apply walk points fix to 3DO scene loading


Commit: f4a57cfde01268440f30447ddb6c8c78da6ae44e
    https://github.com/scummvm/scummvm/commit/f4a57cfde01268440f30447ddb6c8c78da6ae44e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-10-03T19:04:36-04:00

Commit Message:
SHERLOCK: 3DO: Apply walk points fix to 3DO scene loading

Changed paths:
    engines/sherlock/scene.cpp



diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 37c04c6..c86282f 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -896,28 +896,38 @@ bool Scene::loadScene(const Common::String &filename) {
 		// === WALK DATA === Read in the walk data
 		roomStream->seek(header3DO_walkData_offset);
 
-		int startPos = roomStream->pos();
-		while ((roomStream->pos() - startPos) < (int)header3DO_walkData_size) {
-			_walkPoints.push_back(WalkArray());
-			_walkPoints[_walkPoints.size() - 1]._fileOffset = roomStream->pos() - startPos;
-			_walkPoints[_walkPoints.size() - 1].load(*roomStream, false);
-		}
+		// Read in the walk data
+		Common::SeekableReadStream *walkStream = !_compressed ? roomStream->readStream(header3DO_walkData_size) :
+			res.decompress(*roomStream, header3DO_walkData_size);
 
 		// 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;
+
 		// === EXITS === Read in the exits
 		roomStream->seek(header3DO_exits_offset);
 






More information about the Scummvm-git-logs mailing list