[Scummvm-git-logs] scummvm master -> b3962f950171896573613154802f028e6ca3dd65

moralrecordings code at moral.net.au
Sun Jun 14 16:04:26 UTC 2020


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:
b3962f9501 DIRECTOR: Fix bitmap compression detection


Commit: b3962f950171896573613154802f028e6ca3dd65
    https://github.com/scummvm/scummvm/commit/b3962f950171896573613154802f028e6ca3dd65
Author: Scott Percival (code at moral.net.au)
Date: 2020-06-15T00:04:09+08:00

Commit Message:
DIRECTOR: Fix bitmap compression detection

Changed paths:
    engines/director/images.cpp
    engines/director/score.cpp


diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index 56b3480d51..7790eb6c6f 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -194,45 +194,39 @@ void BITDDecoder::convertPixelIntoSurface(void* surfacePointer, uint fromBpp, ui
 bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 	int x = 0, y = 0;
 
+	Common::Array<int> pixels;
 	// If the stream has exactly the required number of bits for this image,
 	// we assume it is uncompressed.
-	if (stream.size() * 8 == _surface->pitch * _surface->h) {
+	if (stream.size() * _bitsPerPixel / 8 == _surface->pitch * _surface->h) {
 		debugC(6, kDebugImages, "Skipping compression");
-		for (y = 0; y < _surface->h; y++) {
-			for (x = 0; x < _surface->pitch; ) {
-				byte color = stream.readByte();
-				for (int c = 0; c < 8; c++)
-					*((byte *)_surface->getBasePtr(x++, y)) = (color & (1 << (7 - c))) ? 0 : 0xff;
-			}
+		for (uint i = 0; i < stream.size(); i++) {
+			pixels.push_back((int)stream.readByte());
 		}
-
-		return true;
-	}
-
-	Common::Array<int> pixels;
-	while (!stream.eos()) {
-		// TODO: D3 32-bit bitmap casts seem to just be ARGB pixels in a row and not RLE.
-		// Determine how to distinguish these different types. Maybe stage version.
-		if (_bitsPerPixel == 32) {
-			int data = stream.readByte();
-			pixels.push_back(data);
-		} else {
-			int data = stream.readByte();
-			int len = data + 1;
-			if ((data & 0x80) != 0) {
-				len = ((data ^ 0xFF) & 0xff) + 2;
-				data = stream.readByte();
-				for (int p = 0; p < len; p++) {
-					pixels.push_back(data);
-				}
+	} else {
+		while (!stream.eos()) {
+			// TODO: D3 32-bit bitmap casts seem to just be ARGB pixels in a row and not RLE.
+			// Determine how to distinguish these different types. Maybe stage version.
+			if (_bitsPerPixel == 32) {
+				int data = stream.readByte();
+				pixels.push_back(data);
 			} else {
-				for (int p = 0; p < len; p++) {
+				int data = stream.readByte();
+				int len = data + 1;
+				if ((data & 0x80) != 0) {
+					len = ((data ^ 0xFF) & 0xff) + 2;
 					data = stream.readByte();
-					pixels.push_back(data);
+					for (int p = 0; p < len; p++) {
+						pixels.push_back(data);
+					}
+				} else {
+					for (int p = 0; p < len; p++) {
+						data = stream.readByte();
+						pixels.push_back(data);
+					}
 				}
+				if (_bitsPerPixel == 32 && pixels.size() % (_surface->w * 3) == 0)
+					stream.readUint16BE();
 			}
-			if (_bitsPerPixel == 32 && pixels.size() % (_surface->w * 3) == 0)
-				stream.readUint16BE();
 		}
 	}
 
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 1b2e94621e..e86a260e99 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -548,7 +548,7 @@ void Score::renderSprite(uint16 id) {
 
 	sprite->updateCast();
 
-	debugC(1, kDebugImages, "Score::renderFrame(): channel: %d,  castType: %d", id, sprite->_castType);
+	debugC(1, kDebugImages, "Score::renderSprite(): channel: %d,  castType: %d,  castId: %d", id, sprite->_castType, sprite->_castId);
 	if (sprite->_castType == kCastShape) {
 		renderShape(id);
 	} else {




More information about the Scummvm-git-logs mailing list