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

sev- noreply at scummvm.org
Mon Feb 17 10:08:10 UTC 2025


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

Summary:
be909a09ec DIRECTOR: LINGO: Fix kTheIdle entities being wrongly declared as fields
686ed8747a DIRECTOR: XOBJ: Add additional alias for FileIO
1726162cc2 DIRECTOR: LINGO: Fix b_rollOver to support SPRITEREF
a160fed28c DIRECTOR: LINGO: Allow comparing symbol Datums as strings
50193e4365 DIRECTOR: Add support for RichTextCastMember
f078ae3636 DIRECTOR: Add tweaks for GADGET Past as Future
cd64621992 DIRECTOR: Add detection entry for CIBC SmartStart


Commit: be909a09ec61875dea4032fa0e2d1c4dc26271d0
    https://github.com/scummvm/scummvm/commit/be909a09ec61875dea4032fa0e2d1c4dc26271d0
Author: Scott Percival (code at moral.net.au)
Date: 2025-02-17T11:07:59+01:00

Commit Message:
DIRECTOR: LINGO: Fix kTheIdle entities being wrongly declared as fields

Changed paths:
    engines/director/lingo/lingo-the.cpp
    engines/director/lingo/lingo-the.h


diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index e4bf96203cc..ee6338cfba2 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -86,9 +86,11 @@ TheEntity entities[] = {					//	hasId  ver.	isFunction
 	{ kTheFreeBytes,		"freeBytes",		false, 200, true },	// D2 f
 	{ kTheFrontWindow,		"frontWindow",		false, 500, false },//					D5 p
 	{ kTheFullColorPermit,	"fullColorPermit",	false, 200, false },	// D2 p
+	{ kTheIdleHandlerPeriod,"idleHandlerPeriod",false, 500, false },//					D5 p
 	{ kTheIdleLoadMode,		"idleLoadMode",		false, 500, false },//					D5 p
 	{ kTheIdleLoadPeriod,	"idleLoadPeriod",	false, 500, false },//					D5 p
 	{ kTheIdleLoadTag,		"idleLoadTag",		false, 500, false },//					D5 p
+	{ kTheIdleReadChunkSize,"idleReadChunkSize",false, 500, false },//			D5 p
 	{ kTheImageDirect,		"imageDirect",		false, 200, false },	// D2 p
 	{ kTheItemDelimiter,	"itemDelimiter",	false, 400, false },	//			D4 p
 	{ kTheKey,				"key",				false, 200, true },	// D2 f
@@ -231,7 +233,6 @@ const TheEntityField fields[] = {
 	{ kTheCast,		"filename",		kTheFileName,	400 },//				D4 p
 	{ kTheCast,		"foreColor",	kTheForeColor,	400 },//				D4 p
 	{ kTheCast,		"height",		kTheHeight,		400 },//				D4 p
-	{ kTheCast,		"idleReadChunkSize",kTheIdleReadChunkSize,500 },//			D5 p
 	{ kTheCast,		"loaded",		kTheLoaded,		400 },//				D4 p
 	{ kTheCast,		"media",		kTheMedia,		500 },//					D5 p
 	{ kTheCast,		"memberNum",	kTheMemberNum,	500 },//					D5 p
@@ -272,7 +273,6 @@ const TheEntityField fields[] = {
 	{ kTheSprite,	"volume",		kTheVolume,		300 },//		D3.1 p
 
 	// Movie fields
-	{ kTheCast,		"idleHandlerPeriod",kTheIdleHandlerPeriod, 500 },//				D5 p
 	{ kTheCast,		"paletteMapping",	kThePaletteMapping,	500 },//				D5 p
 	{ kTheCast,		"scriptsEnabled",	kTheScriptsEnabled,	500 },//				D5 p
 	{ kTheCast,		"scoreSelection",	kTheScoreSelection,	500 },//				D5 p
diff --git a/engines/director/lingo/lingo-the.h b/engines/director/lingo/lingo-the.h
index 14691f8450f..8615559c1e1 100644
--- a/engines/director/lingo/lingo-the.h
+++ b/engines/director/lingo/lingo-the.h
@@ -67,9 +67,11 @@ enum TheEntityType {
 	kTheFreeBytes,
 	kTheFrontWindow,
 	kTheFullColorPermit,
+	kTheIdleHandlerPeriod,
 	kTheIdleLoadMode,
 	kTheIdleLoadPeriod,
 	kTheIdleLoadTag,
+	kTheIdleReadChunkSize,
 	kTheImageDirect,
 	kTheItemDelimiter,
 	kTheItems,
@@ -208,8 +210,6 @@ enum TheFieldType {
 	kTheHeight,
 	kTheHilite,
 	kTheImmediate,
-	kTheIdleHandlerPeriod,
-	kTheIdleReadChunkSize,
 	kTheInk,
 	kTheLast,
 	kTheLeft,


Commit: 686ed8747a57118588518ba7a49621fa3daa4618
    https://github.com/scummvm/scummvm/commit/686ed8747a57118588518ba7a49621fa3daa4618
Author: Scott Percival (code at moral.net.au)
Date: 2025-02-17T11:07:59+01:00

Commit Message:
DIRECTOR: XOBJ: Add additional alias for FileIO

Changed paths:
    engines/director/lingo/xlibs/fileio.cpp


diff --git a/engines/director/lingo/xlibs/fileio.cpp b/engines/director/lingo/xlibs/fileio.cpp
index 6cb7abae937..c5d95e8d43c 100644
--- a/engines/director/lingo/xlibs/fileio.cpp
+++ b/engines/director/lingo/xlibs/fileio.cpp
@@ -142,6 +142,7 @@ const XlibFileDesc FileIO::fileNames[] = {
 	{ "FileIO",		nullptr },
 	{ "shFILEIO",	nullptr }, // TD loads this up using openXLib("@:shFILEIO.DLL")
 	{ "FILE",		nullptr },
+	{ "FILEIO16",	nullptr },
 	{ nullptr,		nullptr },
 };
 


Commit: 1726162cc21fae5abcf24c9a263d74509feb7313
    https://github.com/scummvm/scummvm/commit/1726162cc21fae5abcf24c9a263d74509feb7313
Author: Scott Percival (code at moral.net.au)
Date: 2025-02-17T11:07:59+01:00

Commit Message:
DIRECTOR: LINGO: Fix b_rollOver to support SPRITEREF

Changed paths:
    engines/director/lingo/lingo-builtins.cpp


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 7705397463b..a3ba86b7bc4 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -2896,7 +2896,12 @@ void LB::b_ramNeeded(int nargs) {
 void LB::b_rollOver(int nargs) {
 	Datum d = g_lingo->pop();
 	Datum res(0);
-	int arg = d.asInt();
+	int arg = 0;
+	if (d.type == SPRITEREF) {
+		arg = d.u.i;
+	} else {
+		arg = d.asInt();
+	}
 
 	Score *score = g_director->getCurrentMovie()->getScore();
 


Commit: a160fed28cb5a5093ad16589de179b00facaa762
    https://github.com/scummvm/scummvm/commit/a160fed28cb5a5093ad16589de179b00facaa762
Author: Scott Percival (code at moral.net.au)
Date: 2025-02-17T11:07:59+01:00

Commit Message:
DIRECTOR: LINGO: Allow comparing symbol Datums as strings

Changed paths:
    engines/director/lingo/lingo.cpp


diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 441e10d8cd9..18356d0bff1 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -979,6 +979,7 @@ void Datum::reset() {
 		case ARGC:
 		case ARGCNORET:
 		case CASTLIBREF:
+		case SPRITEREF:
 			break;
 		case VARREF:
 		case GLOBALREF:
@@ -1478,7 +1479,7 @@ uint32 Datum::compareTo(Datum &d) const {
 		} else {
 			return kCompareGreater;
 		}
-	} else if (alignType == STRING) {
+	} else if (alignType == STRING || alignType == SYMBOL) {
 		int res = compareStrings(asString(), d.asString());
 		if (res < 0) {
 			return kCompareLess;


Commit: 50193e43656ee80491102b08e737fbfd39b3b89c
    https://github.com/scummvm/scummvm/commit/50193e43656ee80491102b08e737fbfd39b3b89c
Author: Scott Percival (code at moral.net.au)
Date: 2025-02-17T11:07:59+01:00

Commit Message:
DIRECTOR: Add support for RichTextCastMember

Changed paths:
  A engines/director/castmember/richtext.cpp
  A engines/director/castmember/richtext.h
    engines/director/cast.cpp
    engines/director/cast.h
    engines/director/castmember/text.cpp
    engines/director/castmember/text.h
    engines/director/module.mk
    engines/director/rte.cpp
    engines/director/rte.h
    engines/director/types.h


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index f27605d78ef..0b9fc7ca07b 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -45,6 +45,7 @@
 #include "director/castmember/filmloop.h"
 #include "director/castmember/movie.h"
 #include "director/castmember/palette.h"
+#include "director/castmember/richtext.h"
 #include "director/castmember/script.h"
 #include "director/castmember/shape.h"
 #include "director/castmember/sound.h"
@@ -277,8 +278,8 @@ bool Cast::duplicateCastMember(CastMember *source, CastMemberInfo *info, int tar
 	case kCastText:
 		target = (CastMember *)(new TextCastMember(this, targetId, *(TextCastMember *)source));
 		break;
-	case kCastRTE:
-		target = (CastMember *)(new RTECastMember(this, targetId, *(RTECastMember *)source));
+	case kCastRichText:
+		target = (CastMember *)(new RichTextCastMember(this, targetId, *(RichTextCastMember *)source));
 		break;
 	case kCastTransition:
 		target = (CastMember *)(new TransitionCastMember(this, targetId, *(TransitionCastMember *)source));
@@ -1077,9 +1078,9 @@ void Cast::loadCastData(Common::SeekableReadStreamEndian &stream, uint16 id, Res
 		debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastLingoScript");
 		_loadedCast->setVal(id, new ScriptCastMember(this, id, castStream, _version));
 		break;
-	case kCastRTE:
-		debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastRTE (%d children)", res->children.size());
-		_loadedCast->setVal(id, new RTECastMember(this, id, castStream, _version));
+	case kCastRichText:
+		debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastRichText (%d children)", res->children.size());
+		_loadedCast->setVal(id, new RichTextCastMember(this, id, castStream, _version));
 		break;
 	case kCastDigitalVideo:
 		debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastDigitalVideo (%d children)", res->children.size());
diff --git a/engines/director/cast.h b/engines/director/cast.h
index ba91b1668de..f4a80f2b123 100644
--- a/engines/director/cast.h
+++ b/engines/director/cast.h
@@ -159,9 +159,9 @@ public:
 
 	Common::HashMap<int, CastMember *> *_loadedCast;
 	Common::HashMap<int, const Stxt *> _loadedStxts;
-	Common::HashMap<int, const RTE0 *> _loadedRTE0s;
-	Common::HashMap<int, const RTE1 *> _loadedRTE1s;
-	Common::HashMap<int, const RTE2 *> _loadedRTE2s;
+	Common::HashMap<uint, const RTE0 *> _loadedRTE0s;
+	Common::HashMap<uint, const RTE1 *> _loadedRTE1s;
+	Common::HashMap<uint, const RTE2 *> _loadedRTE2s;
 	uint16 _castIDoffset;
 	uint16 _castArrayStart;
 	uint16 _castArrayEnd;
diff --git a/engines/director/castmember/richtext.cpp b/engines/director/castmember/richtext.cpp
new file mode 100644
index 00000000000..bb4bc366f07
--- /dev/null
+++ b/engines/director/castmember/richtext.cpp
@@ -0,0 +1,219 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "graphics/macgui/macwidget.h"
+
+#include "director/director.h"
+#include "director/cast.h"
+#include "director/images.h"
+#include "director/movie.h"
+#include "director/picture.h"
+#include "director/rte.h"
+#include "director/score.h"
+#include "director/window.h"
+#include "director/castmember/richtext.h"
+#include "director/lingo/lingo-the.h"
+
+namespace Director {
+
+RichTextCastMember::RichTextCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version)
+		: CastMember(cast, castId, stream) {
+
+	if (version >= kFileVer500 && version < kFileVer600) {
+		_initialRect = Movie::readRect(stream);
+		_boundingRect = Movie::readRect(stream);
+		if (debugChannelSet(5, kDebugLoading)) {
+			debugC(5, kDebugLoading, "RichTextCastMember(): unk");
+			stream.hexdump(12);
+		}
+		stream.seek(12, SEEK_CUR);
+		_bgColor = (stream.readUint16BE() >> 8) << 16;
+		_bgColor |= (stream.readUint16BE() >> 8) << 8;
+		_bgColor |= (stream.readUint16BE() >> 8);
+	} else {
+		warning("RichTextCastMember(): >D5 isn't handled");
+	}
+
+	_type = kCastRichText;
+	_picture = nullptr;
+}
+
+RichTextCastMember::RichTextCastMember(Cast *cast, uint16 castId, RichTextCastMember &source)
+		: CastMember(cast, castId) {
+
+	_type = kCastRichText;
+	_initialRect = source._initialRect;
+	_boundingRect = source._boundingRect;
+	_bgColor = source._bgColor;
+}
+
+RichTextCastMember::~RichTextCastMember() {
+	if (_picture)
+		delete _picture;
+}
+
+void RichTextCastMember::load() {
+	if (_loaded)
+		return;
+
+	uint rte0id = 0;
+	uint rte1id = 0;
+	uint rte2id = 0;
+	for (auto &it : _children) {
+		if (it.tag == MKTAG('R', 'T', 'E', '0')) {
+			rte0id = it.index;
+		} else if (it.tag == MKTAG('R', 'T', 'E', '1')) {
+			rte1id = it.index;
+		} else if (it.tag == MKTAG('R', 'T', 'E', '2')) {
+			rte2id = it.index;
+		}
+	}
+
+	if (_cast->_loadedRTE0s.contains(rte0id)) {
+		// TODO: Copy the formatted text data
+		// There doesn't appear to be a way of using it outside of the Director editor.
+	} else {
+		warning("RichTextCastMember::load(): rte0tid %i isn't loaded", rte0id);
+	}
+	if (_cast->_loadedRTE1s.contains(rte1id)) {
+		const RTE1 *rte1 =  _cast->_loadedRTE1s.getVal(rte1id);
+		_plainText = Common::U32String((const char *)&rte1->data[0], rte1->data.size(), g_director->getPlatformEncoding());
+	} else {
+		warning("RichTextCastMember::load(): rte1tid %i isn't loaded, no plain text!", rte1id);
+	}
+	if (_cast->_loadedRTE2s.contains(rte2id)) {
+		const RTE2 *rte2 =  _cast->_loadedRTE2s.getVal(rte2id);
+		// Create a 24-bit temporary surface, no alpha.
+		Graphics::ManagedSurface temp;
+		temp.create((int16)rte2->width, (int16)rte2->height, Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0));
+		// Fill it with the background colour
+		temp.fillRect(Common::Rect((int16)rte2->width, (int16)rte2->height), _bgColor);
+		// Blit the alpha text map
+		temp.blitFrom(*rte2->_surface, nullptr);
+		_picture = new Picture();
+		_picture->_surface.copyFrom(temp);
+		temp.free();
+	} else {
+		warning("RichTextCastMember::load(): rte2tid %i isn't loaded, no bitmap text!", rte2id);
+	}
+
+	_loaded = true;
+}
+
+
+Graphics::MacWidget *RichTextCastMember::createWidget(Common::Rect &bbox, Channel *channel, SpriteType spriteType) {
+	if (!_picture) {
+		warning("RichTextCastMember::createWidget: No picture");
+		return nullptr;
+	}
+
+	// skip creating widget when the bbox is not available, maybe we should create it using initialRect
+	if (!bbox.width() || !bbox.height())
+		return nullptr;
+
+	// Check if we need to dither the image
+	int dstBpp = g_director->_wm->_pixelformat.bytesPerPixel;
+
+	Graphics::MacWidget *widget = new Graphics::MacWidget(g_director->getCurrentWindow(), bbox.left, bbox.top, bbox.width(), bbox.height(), g_director->_wm, false);
+
+	Graphics::Surface *dithered = nullptr;
+
+	if (dstBpp == 1) {
+		dithered = _picture->_surface.convertTo(g_director->_wm->_pixelformat, nullptr, 0, g_director->_wm->getPalette(), g_director->_wm->getPaletteSize());
+	}
+
+	// scale for drawing a different size sprite
+	copyStretchImg(
+		dithered ? dithered : &_picture->_surface,
+		widget->getSurface()->surfacePtr(),
+		_initialRect,
+		bbox,
+		g_director->_wm->getPalette()
+	);
+
+	if (dithered) {
+		dithered->free();
+		delete dithered;
+	}
+
+	return widget;
+}
+
+
+
+bool RichTextCastMember::hasField(int field) {
+	switch (field) {
+	case kTheHilite:
+	case kTheText:
+	case kThePageHeight:
+	case kTheScrollTop:
+		return true;
+	default:
+		break;
+	}
+	return CastMember::hasField(field);
+}
+
+Datum RichTextCastMember::getField(int field) {
+	Datum d;
+
+	switch (field) {
+	case kTheText:
+	case kTheHilite:
+	case kThePageHeight:
+	case kTheScrollTop:
+	default:
+		d = CastMember::getField(field);
+		break;
+	}
+
+	return d;
+}
+
+bool RichTextCastMember::setField(int field, const Datum &d) {
+	switch (field) {
+	case kTheHilite:
+	case kTheText:
+	case kThePageHeight:
+	case kTheScrollTop:
+	default:
+		break;
+	}
+
+	return CastMember::setField(field, d);
+}
+
+Common::String RichTextCastMember::formatInfo() {
+	// need to pull the data from the STXT resource before the
+	// debug output will be visible
+	load();
+	Common::String format = formatStringForDump(_plainText.encode());
+
+	return Common::String::format(
+		"initialRect: %dx%d@%d,%d, boundingRect: %dx%d@%d,%d, text: \"%s\"",
+		_initialRect.width(), _initialRect.height(),
+		_initialRect.left, _initialRect.top,
+		_boundingRect.width(), _boundingRect.height(),
+		_boundingRect.left, _boundingRect.top,
+		format.c_str()
+	);
+}
+}
diff --git a/engines/director/castmember/richtext.h b/engines/director/castmember/richtext.h
new file mode 100644
index 00000000000..519d20875f1
--- /dev/null
+++ b/engines/director/castmember/richtext.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef DIRECTOR_CASTMEMBER_RICHTEXT_H
+#define DIRECTOR_CASTMEMBER_RICHTEXT_H
+
+#include "director/types.h"
+#include "director/castmember/castmember.h"
+
+namespace Director {
+
+class RichTextCastMember : public CastMember {
+public:
+	RichTextCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version);
+	RichTextCastMember(Cast *cast, uint16 castId, RichTextCastMember &source);
+	~RichTextCastMember();
+
+	void load() override;
+
+	Graphics::MacWidget *createWidget(Common::Rect &bbox, Channel *channel, SpriteType spriteType) override;
+
+	bool hasField(int field) override;
+	Datum getField(int field) override;
+	bool setField(int field, const Datum &value) override;
+
+	Common::String formatInfo() override;
+
+private:
+	Common::U32String _plainText;
+	uint32 _bgColor;
+	Picture *_picture;
+};
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/castmember/text.cpp b/engines/director/castmember/text.cpp
index 7e99a40d725..a27536d3d37 100644
--- a/engines/director/castmember/text.cpp
+++ b/engines/director/castmember/text.cpp
@@ -1017,55 +1017,4 @@ bool TextCastMember::setChunkField(int field, int start, int end, const Datum &d
 	return false;
 }
 
-RTECastMember::RTECastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version)
-		: TextCastMember(cast, castId, stream, version) {
-
-	_type = kCastRTE;
-}
-
-RTECastMember::RTECastMember(Cast *cast, uint16 castId,  RTECastMember &source)
-		: TextCastMember(cast, castId, source) {
-
-	_type = kCastRTE;
-}
-
-void RTECastMember::load() {
-	if (_loaded)
-		return;
-
-	uint rte0id = 0;
-	uint rte1id = 0;
-	uint rte2id = 0;
-	for (auto &it : _children) {
-		if (it.tag == MKTAG('R', 'T', 'E', '0')) {
-			rte0id = it.index;
-			break;
-		} else if (it.tag == MKTAG('R', 'T', 'E', '1')) {
-			rte1id = it.index;
-			break;
-		} else if (it.tag == MKTAG('R', 'T', 'E', '2')) {
-			rte2id = it.index;
-			break;
-		}
-	}
-
-	if (_cast->_loadedRTE0s.contains(rte0id)) {
-		// TODO: Copy the formatted text data
-	} else {
-		warning("RTECastMember::load(): rte0tid %i isn't loaded", rte0id);
-	}
-	if (_cast->_loadedRTE1s.contains(rte1id)) {
-		// TODO: Copy the plain text data
-	} else {
-		warning("RTECastMember::load(): rte1tid %i isn't loaded", rte1id);
-	}
-	if (_cast->_loadedRTE2s.contains(rte2id)) {
-		// TODO: Copy the bitmap data
-	} else {
-		warning("RTECastMember::load(): rte2tid %i isn't loaded", rte2id);
-	}
-
-	_loaded = true;
-}
-
 }
diff --git a/engines/director/castmember/text.h b/engines/director/castmember/text.h
index 477eea794fc..1b7d6a63fa5 100644
--- a/engines/director/castmember/text.h
+++ b/engines/director/castmember/text.h
@@ -117,15 +117,6 @@ private:
 	uint32 _fgcolor;
 };
 
-class RTECastMember : public TextCastMember {
-public:
-	RTECastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version);
-	RTECastMember(Cast *cast, uint16 castId, RTECastMember &source);
-
-	void loadChunks();
-	void load() override;
-};
-
 } // End of namespace Director
 
 #endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 1396616f96d..2fc0e018916 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -33,6 +33,7 @@ MODULE_OBJS = \
 	castmember/filmloop.o \
 	castmember/movie.o \
 	castmember/palette.o \
+	castmember/richtext.o \
 	castmember/script.o \
 	castmember/shape.o \
 	castmember/sound.o \
diff --git a/engines/director/rte.cpp b/engines/director/rte.cpp
index e79a6a6803b..a13697f8870 100644
--- a/engines/director/rte.cpp
+++ b/engines/director/rte.cpp
@@ -19,30 +19,43 @@
  *
  */
 
+#include "common/debug.h"
 #include "common/stream.h"
 #include "common/substream.h"
 
 #include "director/director.h"
 #include "director/cast.h"
+#include "graphics/pixelformat.h"
 #include "director/rte.h"
 
 namespace Director {
 
 RTE0::RTE0(Cast *cast, Common::SeekableReadStreamEndian &stream) : _cast(cast) {
+	if (debugChannelSet(5, kDebugLoading)) {
+		debugC(5, kDebugLoading, "RTE0:");
+		stream.hexdump(stream.size());
+	}
 	data.resize(stream.size(), 0);
 	if (stream.size())
 		stream.read(&data[0], stream.size());
 }
 
 RTE1::RTE1(Cast *cast, Common::SeekableReadStreamEndian &stream) : _cast(cast) {
+	if (debugChannelSet(5, kDebugLoading)) {
+		debugC(5, kDebugLoading, "RTE1:");
+		stream.hexdump(stream.size());
+	}
 	data.resize(stream.size(), 0);
 	if (stream.size())
 		stream.read(&data[0], stream.size());
 }
 
 RTE2::RTE2(Cast *cast, Common::SeekableReadStreamEndian &stream) : _cast(cast) {
-	if (debugChannelSet(2, kDebugText))
+	if (debugChannelSet(5, kDebugLoading)) {
+		debugC(5, kDebugLoading, "RTE2:");
 		stream.hexdump(stream.size());
+	}
+	_surface = nullptr;
 	if (!stream.size())
 		return;
 
@@ -51,35 +64,57 @@ RTE2::RTE2(Cast *cast, Common::SeekableReadStreamEndian &stream) : _cast(cast) {
 	bpp = stream.readUint16BE();
 	int checkMax = (1 << bpp) - 1;
 	debugC(5, kDebugLoading, "RTE2: width: %d, height: %d, bpp: %d", width, height, bpp);
-	alphaMap.resize(width*height, 0);
+	// Create a 32-bit alpha surface for the decoded image
+	_surface = new Graphics::Surface();
+	_surface->create((int16)width, (int16)height, Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
+	uint8 r = 0;
+	uint8 g = 0;
+	uint8 b = 0;
+	uint8 a = 0;
 	for (int y = 0; y < height; y++) {
 		for (int x = 0; x < width;) {
 			uint32 pos = stream.pos();
 			byte check = stream.readByte();
 			if (check == 0x1f) {
-				debugC(9, kDebugLoading, "(%d, %d): %x -> color %d %d %d", x, y, pos, stream.readByte(), stream.readByte(), stream.readByte());
+				r = stream.readByte();
+				g = stream.readByte();
+				b = stream.readByte();
+				debugC(9, kDebugLoading, "[%04x] (%d, %d): color %d %d %d", pos, x, y, r, g, b);
 				continue;
 			}
+			a = ((uint32)check*0xff/((1 << bpp) - 1));
 			if (check == 0 || check == checkMax) {
 				byte count = stream.readByte();
-				debugC(9, kDebugLoading, "(%d, %d): %x -> %02x %02x", x, y, pos, check, count);
+				debugC(9, kDebugLoading, "[%04x] (%d, %d): %02x, count %d", pos, x, y, check, count);
 				if (count == 0x00 && check == 0x00) {
-					// end of line
+					// end of line, fill the remaining colour
+					a = 0;
+					while (x < width) {
+						*(uint32 *)_surface->getBasePtr(x, y) = ((uint32)r << 24) + ((uint32)g << 16) + ((uint32)b << 8) + a;
+						x += 1;
+					}
 					break;
 				}
 				for (byte j = 0; j < count; j++) {
-					alphaMap[width*y + x] = check;
+					*(uint32 *)_surface->getBasePtr(x, y) = ((uint32)r << 24) + ((uint32)g << 16) + ((uint32)b << 8) + a;
 					x += 1;
 					if (x >= width)
 						break;
 				}
 			} else {
-				debugC(9, kDebugLoading, "(%d, %d): %x -> %02x", x, y, pos, check);
-				alphaMap[width*y + x] = check;
+				debugC(9, kDebugLoading, "[%04x] (%d, %d): %02x", pos, x, y, check);
+				*(uint32 *)_surface->getBasePtr(x, y) = ((uint32)r << 24) + ((uint32)g << 16) + ((uint32)b << 8) + a;
 				x += 1;
 			}
 		}
 	}
 }
 
+RTE2::~RTE2() {
+	if (_surface) {
+		_surface->free();
+		delete _surface;
+	}
+}
+
 } // End of namespace Director
diff --git a/engines/director/rte.h b/engines/director/rte.h
index a16dacae312..7d67fc7767d 100644
--- a/engines/director/rte.h
+++ b/engines/director/rte.h
@@ -24,6 +24,8 @@
 
 #include "common/array.h"
 #include "common/stream.h"
+#include "graphics/surface.h"
+
 namespace Common {
 class SeekableReadStreamEndian;
 }
@@ -51,12 +53,13 @@ public:
 class RTE2 {
 public:
 	RTE2(Cast *cast, Common::SeekableReadStreamEndian &stream);
+	~RTE2();
 
 	Cast *_cast;
 	uint16 width;
 	uint16 height;
 	uint32 bpp;
-	Common::Array<byte> alphaMap;
+	Graphics::Surface *_surface;
 };
 
 } // End of namespace Director
diff --git a/engines/director/types.h b/engines/director/types.h
index effb41a6f8a..86ab98fb714 100644
--- a/engines/director/types.h
+++ b/engines/director/types.h
@@ -56,7 +56,7 @@ enum CastType {
 	kCastMovie = 9,
 	kCastDigitalVideo = 10,
 	kCastLingoScript = 11,
-	kCastRTE = 12,
+	kCastRichText = 12,
 	kCastTransition = 14,
 };
 


Commit: f078ae3636074fac46bb8ba882baf8b0b8ce2b62
    https://github.com/scummvm/scummvm/commit/f078ae3636074fac46bb8ba882baf8b0b8ce2b62
Author: Scott Percival (code at moral.net.au)
Date: 2025-02-17T11:07:59+01:00

Commit Message:
DIRECTOR: Add tweaks for GADGET Past as Future

Changed paths:
    engines/director/castmember/richtext.cpp
    engines/director/castmember/richtext.h
    engines/director/detection_tables.h
    engines/director/lingo/lingo-patcher.cpp


diff --git a/engines/director/castmember/richtext.cpp b/engines/director/castmember/richtext.cpp
index bb4bc366f07..f0dfbdd88fc 100644
--- a/engines/director/castmember/richtext.cpp
+++ b/engines/director/castmember/richtext.cpp
@@ -42,9 +42,10 @@ RichTextCastMember::RichTextCastMember(Cast *cast, uint16 castId, Common::Seekab
 		_boundingRect = Movie::readRect(stream);
 		if (debugChannelSet(5, kDebugLoading)) {
 			debugC(5, kDebugLoading, "RichTextCastMember(): unk");
-			stream.hexdump(12);
+			stream.hexdump(8);
 		}
-		stream.seek(12, SEEK_CUR);
+		stream.seek(8, SEEK_CUR);
+		_foreColor = stream.readUint32BE();
 		_bgColor = (stream.readUint16BE() >> 8) << 16;
 		_bgColor |= (stream.readUint16BE() >> 8) << 8;
 		_bgColor |= (stream.readUint16BE() >> 8);
@@ -177,6 +178,8 @@ Datum RichTextCastMember::getField(int field) {
 
 	switch (field) {
 	case kTheText:
+		d = Datum(Common::String(_plainText));
+		break;
 	case kTheHilite:
 	case kThePageHeight:
 	case kTheScrollTop:
@@ -190,8 +193,11 @@ Datum RichTextCastMember::getField(int field) {
 
 bool RichTextCastMember::setField(int field, const Datum &d) {
 	switch (field) {
-	case kTheHilite:
 	case kTheText:
+		_plainText = Common::U32String(d.asString());
+		warning("STUB: RichTextCastMember::setField: text set to \"%s\", but won't rerender!", d.asString().c_str());
+		break;
+	case kTheHilite:
 	case kThePageHeight:
 	case kTheScrollTop:
 	default:
diff --git a/engines/director/castmember/richtext.h b/engines/director/castmember/richtext.h
index 519d20875f1..427e2cffeb6 100644
--- a/engines/director/castmember/richtext.h
+++ b/engines/director/castmember/richtext.h
@@ -45,6 +45,7 @@ public:
 
 private:
 	Common::U32String _plainText;
+	uint32 _foreColor;
 	uint32 _bgColor;
 	Picture *_picture;
 };
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 13ac477531b..fe97347f65a 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -6752,14 +6752,14 @@ static const DirectorGameDescription gameDescriptions[] = {
 	// Other versions are D3
 	PIPGAME1("gadget", "", "GADGET", "d7e907d3933869f055ae59774c87f501", 111000, 501),
 
-	MACGAME1("gadgetpaf",	"",		 "GADGET -Past as Future- (Disc1)", "3b96e0a903130cf68e6f8362bb4d096c", 178907, 501),
-	MACGAME1_l("gadgetpaf", "",		 "GADGET -Past as Future- (Disc1)", "4b2213a9fb04f390ec074c54b916370d", 113169, Common::JA_JPN, 501),
-	WINGAME2("gadgetpaf",	"",		 "GADGET/GADGET.EXE", "t:c8a85e9a0eda2b7dd7974197c02d6469", 1411507,
-									 "DATA/TEXT_E.Cxt", "f:e74119685db701dea9f31f91521fd078", 2457643, 501),
-	WINGAME2("gadgetpaf",	"",		 "GADGET/GADGET.EXE", "1a7acbba10a7246ba58c1d53fc7203f5", 1411507,
-									 "DATA/TEXT_E.Cxt", "5f14330705974a22deb9a12cd8ae6e79", 691046, 501),
-	WINGAME2_l("gadgetpaf", "",		 "GADGET/GADGET.EXE", "1a7acbba10a7246ba58c1d53fc7203f5", 1411507,
-									 "DATA/TEXT_E.Cxt", "056ab5419f65fab51fa50c28ad360e76", 561824, Common::ES_ESP, 501),
+	MACGAME1f("gadgetpaf",	"",		 "GADGET -Past as Future- (Disc1)", "3b96e0a903130cf68e6f8362bb4d096c", 178907, 501, GF_32BPP),
+	MACGAME1f_l("gadgetpaf", "",		 "GADGET -Past as Future- (Disc1)", "4b2213a9fb04f390ec074c54b916370d", 113169, Common::JA_JPN, 501, GF_32BPP),
+	WINGAME2f("gadgetpaf",	"",		 "GADGET/GADGET.EXE", "t:c8a85e9a0eda2b7dd7974197c02d6469", 1411507,
+									 "DATA/TEXT_E.Cxt", "f:e74119685db701dea9f31f91521fd078", 2457643, 501, GF_32BPP),
+	WINGAME2f("gadgetpaf",	"",		 "GADGET/GADGET.EXE", "1a7acbba10a7246ba58c1d53fc7203f5", 1411507,
+									 "DATA/TEXT_E.Cxt", "5f14330705974a22deb9a12cd8ae6e79", 691046, 501, GF_32BPP),
+	WINGAME2f_l("gadgetpaf", "",		 "GADGET/GADGET.EXE", "1a7acbba10a7246ba58c1d53fc7203f5", 1411507,
+									 "DATA/TEXT_E.Cxt", "056ab5419f65fab51fa50c28ad360e76", 561824, Common::ES_ESP, 501, GF_32BPP),
 	WINDEMO2f_l("gadgetpaf", "Demo", "GADGET.exe", "t:7e393434e06153a6413baf1b448f440e", 1647502,
 									 "TEXT_E.Cxt", "h:f2efb64dc4e3e1ea705309426fff7824", 152776, Common::ES_ESP, 501, GF_32BPP),
 
diff --git a/engines/director/lingo/lingo-patcher.cpp b/engines/director/lingo/lingo-patcher.cpp
index a81e1a5c868..c5f6a902b90 100644
--- a/engines/director/lingo/lingo-patcher.cpp
+++ b/engines/director/lingo/lingo-patcher.cpp
@@ -381,6 +381,40 @@ on exitFrame \r\
 end \r\
 ";
 
+/* GADGET: Past As Future was released on 4 CDs, and detects which CD is present by reading
+ * a file "diskid.txt". Replace this with the honour system so we can support merging the
+ * contents of all 4 discs.
+ */
+const char *const gadgetPafDetectionFixAlert = " \
+on exitFrame \r\
+end \r\
+";
+const char *const gadgetPafDetectionFix12 = " \
+on exitFrame \r\
+  go(\"start-ok\")\r\
+end \r\
+";
+const char *const gadgetPafDetectionFix13 = " \
+on exitFrame \r\
+  go(\"load-ok\")\r\
+end \r\
+";
+const char *const gadgetPafDetectionFix4 = " \
+on exitFrame \r\
+  go(\"eject1-ok\")\r\
+end \r\
+";
+const char *const gadgetPafDetectionFix6 = " \
+on exitFrame \r\
+  go(\"eject3-ok\")\r\
+end \r\
+";
+const char *const gadgetPafDetectionFix9 = " \
+on exitFrame \r\
+  go(\"eject2-ok\")\r\
+end \r\
+";
+
 /*
  * Pink Gear Collection has a check to ensure that the CD and hard disk data are on
 * different drive letters by checking if "PINKPINK.TXT" is the first file in the
@@ -435,6 +469,16 @@ struct ScriptHandlerPatch {
 	{"vnc", nullptr, kPlatformWindows, "VNC2\\SHARED.DXR", kMovieScript, 1248, DEFAULT_CAST_LIB, &vncEnableCheats},
 	{"amber", nullptr, kPlatformWindows, "AMBER_F\\AMBER_JB.EXE", kMovieScript, 7, DEFAULT_CAST_LIB, &amberDriveDetectionFix},
 	{"frankenstein", nullptr, kPlatformWindows, "FRANKIE.EXE", kScoreScript, 21, DEFAULT_CAST_LIB, &frankensteinSwapFix},
+	{"gadgetpaf", nullptr, kPlatformWindows, "GADGET\\DISKCNG.DIR", kScoreScript, 2, DEFAULT_CAST_LIB, &gadgetPafDetectionFixAlert},
+	{"gadgetpaf", nullptr, kPlatformWindows, "GADGET\\DISKCNG.DIR", kScoreScript, 8, DEFAULT_CAST_LIB, &gadgetPafDetectionFixAlert},
+	{"gadgetpaf", nullptr, kPlatformWindows, "GADGET\\DISKCNG.DIR", kScoreScript, 10, DEFAULT_CAST_LIB, &gadgetPafDetectionFixAlert},
+	{"gadgetpaf", nullptr, kPlatformWindows, "GADGET\\DISKCNG.DIR", kScoreScript, 11, DEFAULT_CAST_LIB, &gadgetPafDetectionFixAlert},
+	{"gadgetpaf", nullptr, kPlatformWindows, "GADGET\\DISKCNG.DIR", kScoreScript, 18, DEFAULT_CAST_LIB, &gadgetPafDetectionFixAlert},
+	{"gadgetpaf", nullptr, kPlatformWindows, "GADGET\\DISKCNG.DIR", kScoreScript, 12, DEFAULT_CAST_LIB, &gadgetPafDetectionFix12},
+	{"gadgetpaf", nullptr, kPlatformWindows, "GADGET\\DISKCNG.DIR", kScoreScript, 13, DEFAULT_CAST_LIB, &gadgetPafDetectionFix13},
+	{"gadgetpaf", nullptr, kPlatformWindows, "GADGET\\DISKCNG.DIR", kScoreScript, 4, DEFAULT_CAST_LIB, &gadgetPafDetectionFix4},
+	{"gadgetpaf", nullptr, kPlatformWindows, "GADGET\\DISKCNG.DIR", kScoreScript, 6, DEFAULT_CAST_LIB, &gadgetPafDetectionFix6},
+	{"gadgetpaf", nullptr, kPlatformWindows, "GADGET\\GADGET.EXE", kScoreScript, 9, DEFAULT_CAST_LIB, &gadgetPafDetectionFix9},
 	{"pinkgear", nullptr, kPlatformWindows, "GOTOPINK.EXE", kMovieScript, 4, DEFAULT_CAST_LIB, &pinkGearDriveDetectionFix1},
 	{"pinkgear", nullptr, kPlatformWindows, "GOTOPINK.EXE", kScoreScript, 6, DEFAULT_CAST_LIB, &pinkGearDriveDetectionFix2},
 	{nullptr, nullptr, kPlatformUnknown, nullptr, kNoneScript, 0, 0, nullptr},


Commit: cd64621992d1eba0751dab9d282e0e77f9620235
    https://github.com/scummvm/scummvm/commit/cd64621992d1eba0751dab9d282e0e77f9620235
Author: Scott Percival (code at moral.net.au)
Date: 2025-02-17T11:07:59+01:00

Commit Message:
DIRECTOR: Add detection entry for CIBC SmartStart

Changed paths:
    engines/director/detection_tables.h


diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index fe97347f65a..8498d8d603c 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -819,6 +819,7 @@ static const PlainGameDescriptor directorGames[] = {
 	{ "seinfeldondvd",		"Seinfeld on DVD" },
 	{ "sensei",				"Sensei" },
 	{ "simpsontrivia",		"The Simpsons Trivia" },
+	{ "smartstart",			"CIBC SmartStart" },
 	{ "smile",				"SMILE! The Splattering" },
 	{ "sorgato",			"Sylvain Sorgato's Drawings in variable color" },
 	{ "spitwad",			"High School High Spitwad Game" },
@@ -7539,6 +7540,8 @@ static const DirectorGameDescription gameDescriptions[] = {
 	WINDEMO2t_l("smallhouse", "Demo 2", "DEMOSH.EXE",    "73246839eb7cc3acaf10e67b837a32c1", 1411908,
 								 "S_DEMO/OPEN/MAIN.Dxr", "29c1134c7ffe2e7f1d3fc271443405ea", 361806, Common::JA_JPN, 501),
 
+	WINGAME1("smartstart", "", "SSTART.EXE", "t:2c0ba688150dafd663749f0ac6634810", 933967, 501),
+
 	MACGAME1("smarty", "", "Smarty.PPC", "559818fe064f608c69bf86d4c60dee93", 107863, 501),
 	MACGAME2("smarty", "Uplink rerelease", "MacPPC",			"r:d2531c0b8c0553be7c7cd5f6c6a07b78",  107863,
 										   "spStuff/Acres.dxr", "d:91b6ca83c64c64f48c864fa56d6344a4", 2719234, 501),




More information about the Scummvm-git-logs mailing list