[Scummvm-git-logs] scummvm master -> 0a5b2d7ce02e92035bc653e4edfad812966888af

elasota noreply at scummvm.org
Sat Feb 10 16:18:54 UTC 2024


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:
0a5b2d7ce0 MTROPOLIS: Permit empty mToon frames.  Fixes error on MTI credits.


Commit: 0a5b2d7ce02e92035bc653e4edfad812966888af
    https://github.com/scummvm/scummvm/commit/0a5b2d7ce02e92035bc653e4edfad812966888af
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2024-02-10T11:18:32-05:00

Commit Message:
MTROPOLIS: Permit empty mToon frames.  Fixes error on MTI credits.

Changed paths:
    engines/mtropolis/assets.cpp


diff --git a/engines/mtropolis/assets.cpp b/engines/mtropolis/assets.cpp
index 64c28574580..9ec0ae4d249 100644
--- a/engines/mtropolis/assets.cpp
+++ b/engines/mtropolis/assets.cpp
@@ -211,16 +211,29 @@ template<class TNumber, uint32 TLiteralMask, uint32 TTransparentRowSkipMask>
 bool CachedMToon::decompressMToonRLE(const RleFrame &frame, const Common::Array<TNumber> &coefsArray, Graphics::ManagedSurface &surface, bool isBottomUp, bool isKeyFrame, uint hackFlags) {
 	assert(sizeof(TNumber) == surface.format.bytesPerPixel);
 
+	size_t w = surface.w;
+	size_t h = surface.h;
+
 	size_t size = coefsArray.size();
-	if (size == 0)
-		return false;
+	if (size == 0) {
+		if (isKeyFrame) {
+			TNumber fillColor = 0;
+			if (surface.format.bytesPerPixel > 1)
+				fillColor = surface.format.RGBToColor(0, 0, 0);
+
+			for (size_t y = 0; y < h; y++) {
+				TNumber *rowData = static_cast<TNumber *>(surface.getBasePtr(0, y));
+				for (size_t x = 0; x < w; x++)
+					rowData[x] = fillColor;
+			}
+		}
+		return true;
+	}
 
 	const TNumber *coefs = &coefsArray[0];
 
 	size_t x = 0;
 	size_t y = 0;
-	size_t w = surface.w;
-	size_t h = surface.h;
 
 	if (w != frame.width || h != frame.height)
 		return false;
@@ -371,6 +384,11 @@ void CachedMToon::loadRLEFrames(const Common::Array<uint8> &data) {
 
 		size_t baseOffset = frameDef.dataOffset;
 
+		if (frameDef.compressedSize == 0) {
+			rleFrame.isKeyframe = (i == 0);	// ???
+			continue;
+		}
+
 		if (frameDef.compressedSize < 20)
 			error("Invalid compressed data size");
 




More information about the Scummvm-git-logs mailing list