[Scummvm-git-logs] scummvm master -> 5c4af133af5960384600e7910a6251151ba51b87

sev- noreply at scummvm.org
Sat Nov 25 01:03:43 UTC 2023


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
04188be8be DIRECTOR: Fix detection entry for teamxtreme1
24c10f9597 DIRECTOR: Make DigitalVideo scale video to fit the widget
1ac78ddf44 DIRECTOR: Add fast path for kInkTypeCopy
5c4af133af DIRECTOR: Only update _ditheredImg when necessary


Commit: 04188be8bed494e498be2d82478429dd3dab14d6
    https://github.com/scummvm/scummvm/commit/04188be8bed494e498be2d82478429dd3dab14d6
Author: Scott Percival (code at moral.net.au)
Date: 2023-11-25T02:03:38+01:00

Commit Message:
DIRECTOR: Fix detection entry for teamxtreme1

Changed paths:
    engines/director/detection_tables.h
    engines/director/lingo/xlibs/batqt.cpp
    engines/director/lingo/xlibs/blitpict.cpp
    engines/director/lingo/xlibs/findsys.cpp


diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 9715ca10ff0..3a32aa7443c 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -5387,10 +5387,10 @@ static const DirectorGameDescription gameDescriptions[] = {
 	// Original filename is 'SYZYGYSクリックアニメ「スモウ組曲」'
 	MACGAME1_l("syzygys", "", "xn--SYZYGYS-zj5o702ne6ytna4l0a3a5eb1g1hmjwa1h", "17efee018a660458fae80de4364021ac", 483159, Common::JA_JPN, 402),
 
-	WINGAME1("teamxtreme1", "", "XTREME.EXE", "45ab80997efedec388ff5200722e673c", 690123, 400),
+	WINGAME1("teamxtreme1", "", "COPY2HD/XTREME.EXE", "45ab80997efedec388ff5200722e673c", 690123, 404),
 
 	MACGAME1("teamxtreme2", "", "Copy to HD/TX2", "r:f47c738636947451579473d9fe36041c", 507980, 404),
-	WINGAME1("teamxtreme2", "", "COPY2HD/TX2.EXE", "50c80bd2add25e574494838772973beb", 2585471, 400),
+	WINGAME1("teamxtreme2", "", "COPY2HD/TX2.EXE", "50c80bd2add25e574494838772973beb", 2585471, 404),
 
 	// From MacFormat #42
 	MACDEMO1("texturescape", "", "TextureScape Show", "77f4098988d5386794d1530065f514cd", 303961, 400),
diff --git a/engines/director/lingo/xlibs/batqt.cpp b/engines/director/lingo/xlibs/batqt.cpp
index 5858a92e875..c2b440194b5 100644
--- a/engines/director/lingo/xlibs/batqt.cpp
+++ b/engines/director/lingo/xlibs/batqt.cpp
@@ -22,6 +22,7 @@
 /*************************************
  *
  * USED IN:
+ * teamxtreme1-win
  * teamxtreme2-win
  *
  *************************************/
diff --git a/engines/director/lingo/xlibs/blitpict.cpp b/engines/director/lingo/xlibs/blitpict.cpp
index ccbb1f91c16..c6d7aa61ddd 100644
--- a/engines/director/lingo/xlibs/blitpict.cpp
+++ b/engines/director/lingo/xlibs/blitpict.cpp
@@ -22,6 +22,7 @@
 /*************************************
  *
  * USED IN:
+ * teamxtreme1-win
  * teamxtreme2-win
  *
  *************************************/
diff --git a/engines/director/lingo/xlibs/findsys.cpp b/engines/director/lingo/xlibs/findsys.cpp
index 7fd46316687..7748aedf943 100644
--- a/engines/director/lingo/xlibs/findsys.cpp
+++ b/engines/director/lingo/xlibs/findsys.cpp
@@ -22,6 +22,7 @@
 /*************************************
  *
  * USED IN:
+ * teamxtreme1-win
  * teamxtreme2-win
  *
  *************************************/


Commit: 24c10f95970b87b311413723dc10cf8a1a836837
    https://github.com/scummvm/scummvm/commit/24c10f95970b87b311413723dc10cf8a1a836837
Author: Scott Percival (code at moral.net.au)
Date: 2023-11-25T02:03:38+01:00

Commit Message:
DIRECTOR: Make DigitalVideo scale video to fit the widget

Changed paths:
    engines/director/castmember/bitmap.cpp
    engines/director/castmember/bitmap.h
    engines/director/castmember/digitalvideo.cpp
    engines/director/detection.cpp
    engines/director/director.h
    engines/director/game-quirks.cpp
    engines/director/images.cpp
    engines/director/images.h
    engines/director/lingo/lingo-the.cpp


diff --git a/engines/director/castmember/bitmap.cpp b/engines/director/castmember/bitmap.cpp
index fdd2fd7aacd..fa8ad64098c 100644
--- a/engines/director/castmember/bitmap.cpp
+++ b/engines/director/castmember/bitmap.cpp
@@ -255,7 +255,13 @@ Graphics::MacWidget *BitmapCastMember::createWidget(Common::Rect &bbox, Channel
 	Graphics::MacWidget *widget = new Graphics::MacWidget(g_director->getCurrentWindow(), bbox.left, bbox.top, bbox.width(), bbox.height(), g_director->_wm, false);
 
 	// scale for drawing a different size sprite
-	copyStretchImg(widget->getSurface()->surfacePtr(), bbox, pal);
+	copyStretchImg(
+		_ditheredImg ? _ditheredImg : &_picture->_surface,
+		widget->getSurface()->surfacePtr(),
+		_initialRect,
+		bbox,
+		pal
+	);
 
 	return widget;
 }
@@ -352,57 +358,6 @@ Graphics::Surface *BitmapCastMember::getDitherImg() {
 
 }
 
-void BitmapCastMember::copyStretchImg(Graphics::Surface *surface, const Common::Rect &bbox, const byte *pal) {
-	const Graphics::Surface *srcSurf;
-
-	if (_ditheredImg)
-		srcSurf = _ditheredImg;
-	else
-		srcSurf = &_picture->_surface;
-
-	if (bbox.width() != _initialRect.width() || bbox.height() != _initialRect.height()) {
-
-		int scaleX = SCALE_THRESHOLD * _initialRect.width() / bbox.width();
-		int scaleY = SCALE_THRESHOLD * _initialRect.height() / bbox.height();
-
-		for (int y = 0, scaleYCtr = 0; y < bbox.height(); y++, scaleYCtr += scaleY) {
-			if (g_director->_wm->_pixelformat.bytesPerPixel == 1) {
-				for (int x = 0, scaleXCtr = 0; x < bbox.width(); x++, scaleXCtr += scaleX) {
-					const byte *src = (const byte *)srcSurf->getBasePtr(scaleXCtr / SCALE_THRESHOLD, scaleYCtr / SCALE_THRESHOLD);
-					*(byte *)surface->getBasePtr(x, y) = *src;
-				}
-			} else {
-				for (int x = 0, scaleXCtr = 0; x < bbox.width(); x++, scaleXCtr += scaleX) {
-					const void *ptr = srcSurf->getBasePtr(scaleXCtr / SCALE_THRESHOLD, scaleYCtr / SCALE_THRESHOLD);
-					int32 color;
-
-					switch (srcSurf->format.bytesPerPixel) {
-					case 1:
-						{
-							color = *(const byte *)ptr * 3;
-							color = surface->format.RGBToColor(pal[color], pal[color + 1], pal[color + 2]);
-						}
-						break;
-					case 4:
-						color = *(const int32 *)ptr;
-						break;
-					default:
-						error("Unimplemented src bpp: %d", srcSurf->format.bytesPerPixel);
-					}
-
-					*(int32 *)surface->getBasePtr(x, y) = color;
-				}
-			}
-		}
-	} else if (srcSurf->format.bytesPerPixel == g_director->_wm->_pixelformat.bytesPerPixel) {
-		surface->copyFrom(*srcSurf);
-	} else {
-		Graphics::Surface *temp = srcSurf->convertTo(g_director->_wm->_pixelformat, g_director->_wm->getPalette(), g_director->_wm->getPaletteSize(), g_director->_wm->getPalette(), g_director->_wm->getPaletteSize());
-		surface->copyFrom(*temp);
-		delete temp;
-	}
-}
-
 bool BitmapCastMember::isModified() {
 	if (CastMember::isModified()) {
 		// Let's us use "setChanged" when changing the picture through Lingo
@@ -444,7 +399,12 @@ void BitmapCastMember::createMatte(Common::Rect &bbox) {
 	Graphics::Surface tmp;
 	tmp.create(bbox.width(), bbox.height(), g_director->_pixelformat);
 
-	copyStretchImg(&tmp, bbox);
+	copyStretchImg(
+		_ditheredImg ? _ditheredImg : &_picture->_surface,
+		&tmp,
+		_initialRect,
+		bbox
+	);
 
 	_noMatte = true;
 
diff --git a/engines/director/castmember/bitmap.h b/engines/director/castmember/bitmap.h
index 5c10a3ef183..04121e5e6e7 100644
--- a/engines/director/castmember/bitmap.h
+++ b/engines/director/castmember/bitmap.h
@@ -41,7 +41,6 @@ public:
 	void createMatte(Common::Rect &bbox);
 	Graphics::Surface *getMatte(Common::Rect &bbox);
 	Graphics::Surface *getDitherImg();
-	void copyStretchImg(Graphics::Surface *surface, const Common::Rect &bbox, const byte *pal = 0);
 
 	bool hasField(int field) override;
 	Datum getField(int field) override;
diff --git a/engines/director/castmember/digitalvideo.cpp b/engines/director/castmember/digitalvideo.cpp
index 0db90313893..31cac08e901 100644
--- a/engines/director/castmember/digitalvideo.cpp
+++ b/engines/director/castmember/digitalvideo.cpp
@@ -28,6 +28,7 @@
 #include "director/director.h"
 #include "director/cast.h"
 #include "director/channel.h"
+#include "director/images.h"
 #include "director/movie.h"
 #include "director/window.h"
 #include "director/castmember/digitalvideo.h"
@@ -228,7 +229,12 @@ Graphics::MacWidget *DigitalVideoCastMember::createWidget(Common::Rect &bbox, Ch
 		}
 	}
 	if (_lastFrame)
-		widget->getSurface()->blitFrom(*_lastFrame);
+		copyStretchImg(
+			_lastFrame,
+			widget->getSurface()->surfacePtr(),
+			Common::Rect((int16)_video->getWidth(), (int16)_video->getHeight()),
+			bbox
+		);
 
 	if (_getFirstFrame) {
 		_video->stop();
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index ce1524a3446..d1c489e1222 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -72,6 +72,7 @@ static const DebugChannelDef debugFlagList[] = {
 	{Director::kDebugSound, "sound", "Sound playback"},
 	{Director::kDebugText, "text", "Text rendering"},
 	{Director::kDebugXObj, "xobj", "XObjects"},
+	{Director::kDebugLingoThe, "lingothe", "Lingo \"the\" entities"},
 	DEBUG_CHANNEL_END
 };
 
diff --git a/engines/director/director.h b/engines/director/director.h
index 818244af496..74422d1800a 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -84,6 +84,7 @@ enum {
 	kDebugSound			= 1 << 19,
 	kDebugConsole		= 1 << 20,
 	kDebugXObj			= 1 << 21,
+	kDebugLingoThe		= 1 << 22,
 };
 
 enum {
diff --git a/engines/director/game-quirks.cpp b/engines/director/game-quirks.cpp
index ae0d29d2199..3772e329e24 100644
--- a/engines/director/game-quirks.cpp
+++ b/engines/director/game-quirks.cpp
@@ -73,6 +73,13 @@ struct CachedFile {
 		"WOLFGANG.dat",	// It needs an empty file
 			(const byte *)"", 0
 	},
+	{ "teamxtreme1", Common::kPlatformWindows,
+		// In Operation: Weather Disaster, the game will try and check if the
+		// save file exists with getNthFileNameInFolder before attempting to
+		// read it with FileIO (which uses the save data store).
+		"WINDOWS/TX1SAVES",
+			(const byte *)"", 0
+	},
 	{ "teamxtreme2", Common::kPlatformWindows,
 		// In Operation: Eco-Nightmare, the game will try and check if the
 		// save file exists with getNthFileNameInFolder before attempting to
diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index 01124d08624..8206274a362 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -319,4 +319,30 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 	return true;
 }
 
+void copyStretchImg(Graphics::Surface *srcSurface, Graphics::Surface *targetSurface, const Common::Rect &srcRect, const Common::Rect &targetRect, const byte *pal) {
+	if (!(srcSurface) || !(targetSurface))
+		return;
+
+	Graphics::Surface *temp1 = nullptr;
+	Graphics::Surface *temp2 = nullptr;
+	// Convert source surface to target colourspace (if required)
+	if (srcSurface->format.bytesPerPixel != g_director->_wm->_pixelformat.bytesPerPixel) {
+		temp1 = srcSurface->convertTo(g_director->_wm->_pixelformat, g_director->_wm->getPalette(), g_director->_wm->getPaletteSize(), g_director->_wm->getPalette(), g_director->_wm->getPaletteSize());
+	}
+	// Nearest-neighbour scale source surface to target dimensions (if required)
+	if (targetRect.width() != srcRect.width() || targetRect.height() != srcRect.height()) {
+		temp2 = (temp1 ? temp1 : srcSurface)->scale(targetRect.width(), targetRect.height(), false);
+	}
+	targetSurface->copyFrom(*(temp2 ? temp2 : (temp1 ? temp1 : srcSurface)));
+	if (temp1) {
+		temp1->free();
+		delete temp1;
+	}
+	if (temp2) {
+		temp2->free();
+		delete temp2;
+	}
+}
+
+
 } // End of namespace Director
diff --git a/engines/director/images.h b/engines/director/images.h
index 8e815bbaea4..e725a85a953 100644
--- a/engines/director/images.h
+++ b/engines/director/images.h
@@ -26,6 +26,7 @@
 
 namespace Common {
 class SeekableReadStream;
+class Rect;
 }
 
 namespace Graphics {
@@ -80,6 +81,8 @@ private:
 	uint16 _pitch;
 };
 
+void copyStretchImg(Graphics::Surface *srcSurface, Graphics::Surface *targetSurface, const Common::Rect &srcRect, const Common::Rect &targetRect, const byte *pal = 0);
+
 } // End of namespace Director
 
 #endif
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 09363e2f373..c51534815cd 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -361,8 +361,8 @@ const char *Lingo::field2str(int id) {
 	warning("Lingo::getTheEntity(): Unprocessed getting entity %s", entity2str(entity));
 
 Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
-	if (debugChannelSet(3, kDebugLingoExec)) {
-		debugC(3, kDebugLingoExec, "Lingo::getTheEntity(%s, %s, %s)", entity2str(entity), id.asString(true).c_str(), field2str(field));
+	if (debugChannelSet(3, kDebugLingoThe | kDebugLingoExec)) {
+		debugC(3, kDebugLingoThe | kDebugLingoExec, "Lingo::getTheEntity(%s, %s, %s)", entity2str(entity), id.asString(true).c_str(), field2str(field));
 	}
 
 	Datum d;
@@ -921,8 +921,8 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
 	warning("Lingo::setTheEntity: Attempt to set read-only entity %s", entity2str(entity));
 
 void Lingo::setTheEntity(int entity, Datum &id, int field, Datum &d) {
-	if (debugChannelSet(3, kDebugLingoExec)) {
-		debugC(3, kDebugLingoExec, "Lingo::setTheEntity(%s, %s, %s, %s)", entity2str(entity), id.asString(true).c_str(), field2str(field), d.asString(true).c_str());
+	if (debugChannelSet(3, kDebugLingoThe | kDebugLingoExec)) {
+		debugC(3, kDebugLingoThe | kDebugLingoExec, "Lingo::setTheEntity(%s, %s, %s, %s)", entity2str(entity), id.asString(true).c_str(), field2str(field), d.asString(true).c_str());
 	}
 
 	Movie *movie = _vm->getCurrentMovie();


Commit: 1ac78ddf4411d8b342e9620b0fe8732f34992c1c
    https://github.com/scummvm/scummvm/commit/1ac78ddf4411d8b342e9620b0fe8732f34992c1c
Author: Scott Percival (code at moral.net.au)
Date: 2023-11-25T02:03:38+01:00

Commit Message:
DIRECTOR: Add fast path for kInkTypeCopy

Changed paths:
    engines/director/channel.cpp
    engines/director/director.h
    engines/director/graphics.cpp


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index b3d196c5bf2..943165ef670 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -114,8 +114,8 @@ Channel::~Channel() {
 
 DirectorPlotData Channel::getPlotData() {
 	DirectorPlotData pd(g_director, _sprite->_spriteType, _sprite->_ink, _sprite->_blendAmount, _sprite->getBackColor(), _sprite->getForeColor());
-	pd.colorWhite = 0;
-	pd.colorBlack = 255;
+	pd.colorWhite = g_director->getColorWhite();
+	pd.colorBlack = g_director->getColorBlack();
 	pd.dst = nullptr;
 
 	pd.srf = getSurface();
diff --git a/engines/director/director.h b/engines/director/director.h
index 74422d1800a..77390d80151 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -207,6 +207,8 @@ public:
 	void draw();
 
 	Graphics::MacDrawPixPtr getInkDrawPixel();
+	uint32 getColorBlack();
+	uint32 getColorWhite();
 
 	void loadKeyCodes();
 	void setMachineType(int machineType);
diff --git a/engines/director/graphics.cpp b/engines/director/graphics.cpp
index 2a26755d383..e0cc5ad10b2 100644
--- a/engines/director/graphics.cpp
+++ b/engines/director/graphics.cpp
@@ -460,6 +460,28 @@ Graphics::MacDrawPixPtr DirectorEngine::getInkDrawPixel() {
 		return &inkDrawPixel<uint32>;
 }
 
+uint32 DirectorEngine::getColorBlack() {
+	if (_pixelformat.bytesPerPixel == 1)
+		// needs to be the last entry in the palette.
+		// we can't use findBestColor, as it might
+		// pick a different entry that's also black.
+		return 0xff;
+	else
+		// send RGB through findBestColor to avoid endian issues
+		return _wm->findBestColor(0, 0, 0);
+}
+
+uint32 DirectorEngine::getColorWhite() {
+	if (_pixelformat.bytesPerPixel == 1)
+		// needs to be the first entry in the palette.
+		// we can't use findBestColor, as it might
+		// pick a different entry that's also white.
+		return 0x00;
+	else
+		// send RGB through findBestColor to avoid endian issues
+		return _wm->findBestColor(255, 255, 255);
+}
+
 void DirectorPlotData::setApplyColor() {
 	// Director has two ways of rendering an ink setting.
 	// The default is to incorporate the full range of colors in the image.
@@ -633,6 +655,25 @@ void DirectorPlotData::inkBlitSurface(Common::Rect &srcRect, const Graphics::Sur
 	Common::Rect srfClip = srf->getBounds();
 	bool failedBoundsCheck = false;
 
+	// FAST PATH: if we're not doing any per-pixel ops,
+	// use the stock blitter. Your CPU will thank you.
+	if (!applyColor && !alpha && !ms) {
+		Common::Rect offsetRect(
+			Common::Point(abs(srcRect.left - destRect.left), abs(srcRect.top - destRect.top)),
+			destRect.width(),
+			destRect.height()
+		);
+		offsetRect.clip(srfClip);
+		switch (ink) {
+		case kInkTypeCopy:
+			dst->blitFrom(*srf, offsetRect, destRect);
+			return;
+			break;
+		default:
+			break;
+		}
+	}
+
 	// For blit efficiency, surfaces passed here need to be the same
 	// format as the window manager. Most of the time this is
 	// the job of BitmapCastMember::createWidget.


Commit: 5c4af133af5960384600e7910a6251151ba51b87
    https://github.com/scummvm/scummvm/commit/5c4af133af5960384600e7910a6251151ba51b87
Author: Scott Percival (code at moral.net.au)
Date: 2023-11-25T02:03:38+01:00

Commit Message:
DIRECTOR: Only update _ditheredImg when necessary

Previously, BitmapCastMember would update _ditheredImg (if required) in
every call to createWidget. In the case of paletted images, this means
a fairly big penalty of calling Surface::ditherFloyd on every frame.

Instead, we can run it once the first time, and only run it again if
isModified() returns true (i.e. there's been a palette change).

Greatly improves performance in henachoco05.

Changed paths:
    engines/director/castmember/bitmap.cpp


diff --git a/engines/director/castmember/bitmap.cpp b/engines/director/castmember/bitmap.cpp
index fa8ad64098c..9a4626e1b8c 100644
--- a/engines/director/castmember/bitmap.cpp
+++ b/engines/director/castmember/bitmap.cpp
@@ -205,51 +205,57 @@ Graphics::MacWidget *BitmapCastMember::createWidget(Common::Rect &bbox, Channel
 
 	const byte *pal = _picture->_palette;
 	bool previouslyDithered = _ditheredImg != nullptr;
-	if (_ditheredImg) {
-		_ditheredImg->free();
-		delete _ditheredImg;
-		_ditheredImg = nullptr;
-		_ditheredTargetClut = CastMemberID(0, 0);
-	}
 
-	if (dstBpp == 1) {
-		// ScummVM using 8-bit video
+	// _ditheredImg should contain a cached copy of the bitmap after any expensive
+	// colourspace transformations (e.g. palette remapping or dithering).
+	// We also want to make sure that
+	if (isModified() || (((srcBpp == 1) || (srcBpp > 1 && dstBpp == 1)) && !previouslyDithered)) {
+		if (_ditheredImg) {
+			_ditheredImg->free();
+			delete _ditheredImg;
+			_ditheredImg = nullptr;
+			_ditheredTargetClut = CastMemberID(0, 0);
+		}
+
+		if (dstBpp == 1) {
+			// ScummVM using 8-bit video
 
-		if (srcBpp > 1
-		// At least early directors were not remapping 8bpp images. But in case it is
-		// needed, here is the code
+			if (srcBpp > 1
+			// At least early directors were not remapping 8bpp images. But in case it is
+			// needed, here is the code
 #if 0
-		|| (srcBpp == 1 &&
-			memcmp(g_director->_wm->getPalette(), _img->_palette, _img->_paletteSize))
+			|| (srcBpp == 1 &&
+				memcmp(g_director->_wm->getPalette(), _img->_palette, _img->_paletteSize))
 #endif
-			) {
+				) {
 
-			_ditheredImg = _picture->_surface.convertTo(g_director->_wm->_pixelformat, nullptr, 0, g_director->_wm->getPalette(), g_director->_wm->getPaletteSize());
+				_ditheredImg = _picture->_surface.convertTo(g_director->_wm->_pixelformat, nullptr, 0, g_director->_wm->getPalette(), g_director->_wm->getPaletteSize());
 
-			pal = g_director->_wm->getPalette();
-		} else if (srcBpp == 1) {
-			_ditheredImg = getDitherImg();
-		}
-	} else {
-		// ScummVM using 32-bit video
-		//if (srcBpp > 1 && srcBpp != 4) {
-			// non-indexed surface, convert to 32-bit
-		//	_ditheredImg = _picture->_surface.convertTo(g_director->_wm->_pixelformat, nullptr, 0, g_director->_wm->getPalette(), g_director->_wm->getPaletteSize());
-
-		//} else
-		if (srcBpp == 1) {
-			_ditheredImg = getDitherImg();
+				pal = g_director->_wm->getPalette();
+			} else if (srcBpp == 1) {
+				_ditheredImg = getDitherImg();
+			}
+		} else {
+			// ScummVM using 32-bit video
+			//if (srcBpp > 1 && srcBpp != 4) {
+				// non-indexed surface, convert to 32-bit
+			//	_ditheredImg = _picture->_surface.convertTo(g_director->_wm->_pixelformat, nullptr, 0, g_director->_wm->getPalette(), g_director->_wm->getPaletteSize());
+
+			//} else
+			if (srcBpp == 1) {
+				_ditheredImg = getDitherImg();
+			}
 		}
-	}
 
-	Movie *movie = g_director->getCurrentMovie();
-	Score *score = movie->getScore();
+		Movie *movie = g_director->getCurrentMovie();
+		Score *score = movie->getScore();
 
-	if (_ditheredImg) {
-		debugC(4, kDebugImages, "BitmapCastMember::createWidget(): Dithering image from source palette %s to target palette %s", _clut.asString().c_str(), score->getCurrentPalette().asString().c_str());
-	} else if (previouslyDithered) {
-		debugC(4, kDebugImages, "BitmapCastMember::createWidget(): Removed dithered image, score palette %s matches cast member", score->getCurrentPalette().asString().c_str());
+		if (_ditheredImg) {
+			debugC(4, kDebugImages, "BitmapCastMember::createWidget(): Dithering cast %d from source palette %s to target palette %s", _castId, _clut.asString().c_str(), score->getCurrentPalette().asString().c_str());
+		} else if (previouslyDithered) {
+			debugC(4, kDebugImages, "BitmapCastMember::createWidget(): Removed dithered image for cast %d, score palette %s matches cast member", _castId, score->getCurrentPalette().asString().c_str());
 
+		}
 	}
 
 	Graphics::MacWidget *widget = new Graphics::MacWidget(g_director->getCurrentWindow(), bbox.left, bbox.top, bbox.width(), bbox.height(), g_director->_wm, false);
@@ -384,11 +390,7 @@ bool BitmapCastMember::isModified() {
 		if (castPaletteId.isNull())
 			castPaletteId = cast->_defaultPalette;
 
-		if (currentPaletteId == castPaletteId) {
-			return !_ditheredTargetClut.isNull();
-		} else {
-			return !_ditheredTargetClut.isNull() && _ditheredTargetClut != currentPaletteId;
-		}
+		return !_ditheredTargetClut.isNull() && _ditheredTargetClut != currentPaletteId;
 	}
 	return false;
 }




More information about the Scummvm-git-logs mailing list