[Scummvm-cvs-logs] scummvm master -> 7ff3336a65ec19283ef44919d21e7c4542d7cc3f

m-kiewitz m_kiewitz at users.sourceforge.net
Thu Jun 11 21:31:06 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:
7ff3336a65 SHERLOCK: 3DO: load walk.anim for player


Commit: 7ff3336a65ec19283ef44919d21e7c4542d7cc3f
    https://github.com/scummvm/scummvm/commit/7ff3336a65ec19283ef44919d21e7c4542d7cc3f
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-06-11T21:30:32+02:00

Commit Message:
SHERLOCK: 3DO: load walk.anim for player

Changed paths:
    engines/sherlock/animation.cpp
    engines/sherlock/image_file.cpp
    engines/sherlock/image_file.h
    engines/sherlock/people.cpp



diff --git a/engines/sherlock/animation.cpp b/engines/sherlock/animation.cpp
index 45cb666..73f3a92 100644
--- a/engines/sherlock/animation.cpp
+++ b/engines/sherlock/animation.cpp
@@ -169,7 +169,7 @@ bool Animation::play3DO(const Common::String &filename, bool intro, int minDelay
 
 	// Load initial image
 	Common::String graphicsName = "prologue/" + filename + ".3da";
-	ImageFile3DO images(graphicsName, true);
+	ImageFile3DO images(graphicsName);
 
 	events.wait(minDelay);
 
diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp
index 0d60be4..54af3d8 100644
--- a/engines/sherlock/image_file.cpp
+++ b/engines/sherlock/image_file.cpp
@@ -34,6 +34,9 @@ void ImageFile::setVm(SherlockEngine *vm) {
 	_vm = vm;
 }
 
+ImageFile::ImageFile() {
+}
+
 ImageFile::ImageFile(const Common::String &name, bool skipPal, bool animImages) {
 	Common::SeekableReadStream *stream = _vm->_res->load(name);
 
@@ -240,28 +243,29 @@ void ImageFile3DO::setVm(SherlockEngine *vm) {
 	_vm = vm;
 }
 
-ImageFile3DO::ImageFile3DO(const Common::String &name, bool animImages) {
+ImageFile3DO::ImageFile3DO(const Common::String &name) {
 	Common::File *dataStream = new Common::File();
 
 	if (!dataStream->open(name)) {
 		error("unable to open %s\n", name.c_str());
 	}
 
-	load(*dataStream, animImages);
+	load(*dataStream, false); // this is never called for room data
 
 	delete dataStream;
 }
 
-ImageFile3DO::ImageFile3DO(Common::SeekableReadStream &stream) {
+ImageFile3DO::ImageFile3DO(Common::SeekableReadStream &stream, bool roomData) {
 	load(stream, false);
 }
 
 ImageFile3DO::~ImageFile3DO() {
-	for (uint idx = 0; idx < size(); ++idx)
-		(*this)[idx]._frame.free();
+	// already done in ImageFile destructor
+	//for (uint idx = 0; idx < size(); ++idx)
+	//	(*this)[idx]._frame.free();
 }
 
-void ImageFile3DO::load(Common::SeekableReadStream &stream, bool animImages) {
+void ImageFile3DO::load(Common::SeekableReadStream &stream, bool roomData) {
 	uint32 headerId = stream.readUint32BE();
 
 	assert(!stream.eos());
@@ -280,7 +284,7 @@ void ImageFile3DO::load(Common::SeekableReadStream &stream, bool animImages) {
 
 	default:
 		// Sherlock animation file (.3da files)
-		loadAnimationFile(stream, animImages);
+		loadAnimationFile(stream);
 		break;
 	}
 }
@@ -294,7 +298,7 @@ inline uint16 ImageFile3DO::convertPixel(uint16 pixel3DO) {
 	return ((red << 11) | (green << 6) | (blue));
 }
 
-void ImageFile3DO::loadAnimationFile(Common::SeekableReadStream &stream, bool animImages) {
+void ImageFile3DO::loadAnimationFile(Common::SeekableReadStream &stream) {
 	int streamSize = stream.size();
 	uint32 compressedSize = 0;
 
@@ -307,22 +311,14 @@ void ImageFile3DO::loadAnimationFile(Common::SeekableReadStream &stream, bool an
 		frame._height = stream.readByte() + 1; // 1 byte BE height
 		frame._paletteBase = 0;
 
-		if (animImages) {
-			// Animation cutscene image files use a 16-bit x offset
-			frame._offset.x = stream.readUint16BE();
-			frame._rleEncoded = true; // always compressed
-			if (frame._width & 0x8000) {
-				frame._width &= 0x7FFF;
-				compressedSize += 0x10000;
-			}
-			frame._offset.y = stream.readByte();
-		} else {
-			// Standard image files have a separate byte for the RLE flag, and an 8-bit X offset
-			//frame._rleEncoded = stream.readByte() == 1;
-			//frame._offset.x = stream.readByte();
-			//frame._offset.y = stream.readByte();
+		frame._rleEncoded = true; // always compressed
+		if (frame._width & 0x8000) {
+			frame._width &= 0x7FFF;
+			compressedSize += 0x10000;
 		}
 
+		frame._offset.x = stream.readUint16BE();
+		frame._offset.y = stream.readByte();
 		frame._size = 0;
 
 		//warning("getting frame %d from offset %d", this->size(), stream.pos());
diff --git a/engines/sherlock/image_file.h b/engines/sherlock/image_file.h
index 5b280c4..bf41a3b 100644
--- a/engines/sherlock/image_file.h
+++ b/engines/sherlock/image_file.h
@@ -87,6 +87,7 @@ private:
 public:
 	byte _palette[256 * 3];
 public:
+	ImageFile();
 	ImageFile(const Common::String &name, bool skipPal = false, bool animImages = false);
 	ImageFile(Common::SeekableReadStream &stream, bool skipPal = false);
 	~ImageFile();
@@ -97,7 +98,7 @@ struct ImageFile3DOPixelLookupTable {
 	uint16 pixelColor[256];
 };
 
-class ImageFile3DO : public Common::Array<ImageFrame> {
+class ImageFile3DO : public ImageFile { // Common::Array<ImageFrame> {
 private:
 	static SherlockEngine *_vm;
 
@@ -126,11 +127,11 @@ private:
 	/**
 	 * Load animation graphics file
 	 */
-	void loadAnimationFile(Common::SeekableReadStream &stream, bool animImages);
+	void loadAnimationFile(Common::SeekableReadStream &stream);
 
 public:
-	ImageFile3DO(const Common::String &name, bool animImages = false);
-	ImageFile3DO(Common::SeekableReadStream &stream);
+	ImageFile3DO(const Common::String &name);
+	ImageFile3DO(Common::SeekableReadStream &stream, bool roomData = false);
 	~ImageFile3DO();
 	static void setVm(SherlockEngine *vm);
 };
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index 143e532..18621ba 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -198,7 +198,12 @@ bool People::loadWalk() {
 		if (_data[PLAYER]._walkLoaded) {
 			return false;
 		} else {
-			_data[PLAYER]._images = new ImageFile("walk.vgs");
+			if (_vm->getPlatform() != Common::kPlatform3DO) {
+				_data[PLAYER]._images = new ImageFile("walk.vgs");
+			} else {
+				// Load walk.anim on 3DO, which is a cel animation file
+				_data[PLAYER]._images = new ImageFile3DO("walk.anim");
+			}
 			_data[PLAYER].setImageFrame();
 			_data[PLAYER]._walkLoaded = true;
 






More information about the Scummvm-git-logs mailing list