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

m-kiewitz m_kiewitz at users.sourceforge.net
Mon Jun 8 12:47:51 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:
ae64cca8f0 SHERLOCK: bit of work on 3DO graphic resources


Commit: ae64cca8f01f4e56873ac6afa58610366ea8238a
    https://github.com/scummvm/scummvm/commit/ae64cca8f01f4e56873ac6afa58610366ea8238a
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-06-08T12:47:38+02:00

Commit Message:
SHERLOCK: bit of work on 3DO graphic resources

Changed paths:
    engines/sherlock/resources.cpp
    engines/sherlock/resources.h



diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp
index c581496..ab5c6ab 100644
--- a/engines/sherlock/resources.cpp
+++ b/engines/sherlock/resources.cpp
@@ -600,6 +600,39 @@ ImageFile3DO::~ImageFile3DO() {
 }
 
 void ImageFile3DO::load(Common::SeekableReadStream &stream, bool animImages) {
+	uint32 headerId = stream.readUint32BE();
+
+	// Sekk back to the start
+	stream.seek(0);
+
+	// Identify type of file
+	switch (headerId) {
+	case MKTAG('C', 'C', 'B', ' '):
+		// .cel file (title1a.cel etc.)
+		load3DOCelFile(stream);
+		break;
+
+	case MKTAG('A', 'N', 'I', 'M'):
+		// 3DO animation file (walk.anim)
+		break;
+
+	default:
+		// Sherlock animation file (.3da files)
+		loadAnimationFile(stream, animImages);
+		break;
+	}
+}
+
+// 3DO uses RGB555, we use RGB565 internally so that more platforms are able to run us
+inline uint16 ImageFile3DO::convertPixel(uint16 pixel3DO) {
+	byte red   = (pixel3DO >> 10) & 0x1F;
+	byte green = (pixel3DO >> 5) & 0x1F;
+	byte blue  = pixel3DO & 0x1F;;
+
+	return ((red << 11) | (green << 6) | (blue));
+}
+
+void ImageFile3DO::loadAnimationFile(Common::SeekableReadStream &stream, bool animImages) {
 	int streamSize = stream.size();
 	uint32 compressedSize = 0;
 
@@ -635,23 +668,18 @@ void ImageFile3DO::load(Common::SeekableReadStream &stream, bool animImages) {
 		// Load data for frame and decompress it
 		byte *data = new byte[compressedSize];
 		stream.read(data, compressedSize);
-		decompressFrame(&stream, frame, data);
+		decompressAnimationFrame(&stream, frame, data);
 		delete[] data;
 
 		push_back(frame);
 	}
 }
 
-// 3DO uses RGB555, we use RGB565 internally so that more platforms are able to run us
-inline uint16 ImageFile3DO::convertPixel(uint16 pixel3DO) {
-	byte red   = (pixel3DO >> 10) & 0x1F;
-	byte green = (pixel3DO >> 5) & 0x1F;
-	byte blue  = pixel3DO & 0x1F;;
-
-	return ((red << 11) | (green << 6) | (blue));
-}
-
-void ImageFile3DO::decompressFrame(Common::SeekableReadStream *stream, ImageFrame &frame, const byte *src) {
+// Decompresses an animation frame of a .3DA file
+// note: the .3DA files seem to use an "in memory" format, which uses the same compression technique
+// as regular 3DO cel files, but every scanline is started with a length UINT16 and each scanline
+// also starts on UINT32 boundaries
+void ImageFile3DO::decompressAnimationFrame(Common::SeekableReadStream *stream, ImageFrame &frame, const byte *src) {
 	frame._frame.create(frame._width, frame._height, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
 	uint16 *dest = (uint16 *)frame._frame.getPixels();
 	Common::fill(dest, dest + frame._width * frame._height, 0);
@@ -722,4 +750,8 @@ void ImageFile3DO::decompressFrame(Common::SeekableReadStream *stream, ImageFram
 	}
 }
 
+void ImageFile3DO::load3DOCelFile(Common::SeekableReadStream &stream) {
+	warning("3DO-cel file loader currently missing");
+}
+
 } // End of namespace Sherlock
diff --git a/engines/sherlock/resources.h b/engines/sherlock/resources.h
index 0d820be..44da810 100644
--- a/engines/sherlock/resources.h
+++ b/engines/sherlock/resources.h
@@ -232,12 +232,25 @@ private:
 	void load(Common::SeekableReadStream &stream, bool animImages);
 
 	/**
-	 * Decompress a single frame for the sprite
+	 * convert pixel RGB values from RGB555 to RGB565
 	 */
-	void decompressFrame(Common::SeekableReadStream *stream, ImageFrame  &frame, const byte *src);
-
 	inline uint16 convertPixel(uint16 pixel3DO);
 
+	/**
+	 * Load 3DO cel file
+	 */
+	void load3DOCelFile(Common::SeekableReadStream &stream);
+
+	/**
+	 * Load animation graphics file
+	 */
+	void loadAnimationFile(Common::SeekableReadStream &stream, bool animImages);
+
+	/**
+	 * Decompress a single frame for the sprite
+	 */
+	void decompressAnimationFrame(Common::SeekableReadStream *stream, ImageFrame  &frame, const byte *src);
+
 public:
 	ImageFile3DO(const Common::String &name, bool animImages = false);
 	ImageFile3DO(Common::SeekableReadStream &stream);






More information about the Scummvm-git-logs mailing list