[Scummvm-git-logs] scummvm master -> 7f497cdb8cfdd669fc5e411ee8f1d7ea43983c1a

elasota noreply at scummvm.org
Sun Nov 13 03:08:55 UTC 2022


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:
7f497cdb8c MTROPOLIS: Add more things to get SPQR to boot.


Commit: 7f497cdb8cfdd669fc5e411ee8f1d7ea43983c1a
    https://github.com/scummvm/scummvm/commit/7f497cdb8cfdd669fc5e411ee8f1d7ea43983c1a
Author: elasota (ejlasota at gmail.com)
Date: 2022-11-12T20:43:25-05:00

Commit Message:
MTROPOLIS: Add more things to get SPQR to boot.

Changed paths:
  A engines/mtropolis/plugin/spqr.cpp
  A engines/mtropolis/plugin/spqr.h
  A engines/mtropolis/plugin/spqr_data.cpp
  A engines/mtropolis/plugin/spqr_data.h
    engines/mtropolis/boot.cpp
    engines/mtropolis/data.cpp
    engines/mtropolis/data.h
    engines/mtropolis/modifier_factory.cpp
    engines/mtropolis/modifiers.cpp
    engines/mtropolis/modifiers.h
    engines/mtropolis/module.mk
    engines/mtropolis/plugin/mti.cpp
    engines/mtropolis/plugin/mti.h
    engines/mtropolis/plugin/mti_data.cpp
    engines/mtropolis/plugin/mti_data.h
    engines/mtropolis/plugin/standard.cpp
    engines/mtropolis/plugin/standard.h
    engines/mtropolis/plugin/standard_data.cpp
    engines/mtropolis/plugin/standard_data.h
    engines/mtropolis/plugins.h


diff --git a/engines/mtropolis/boot.cpp b/engines/mtropolis/boot.cpp
index 7821af797e9..cf6ce5414a8 100644
--- a/engines/mtropolis/boot.cpp
+++ b/engines/mtropolis/boot.cpp
@@ -37,6 +37,7 @@
 
 #include "mtropolis/plugin/mti.h"
 #include "mtropolis/plugin/obsidian.h"
+#include "mtropolis/plugin/spqr.h"
 #include "mtropolis/plugin/standard.h"
 #include "mtropolis/plugins.h"
 
@@ -397,7 +398,7 @@ MTIGameDataHandler::MTIGameDataHandler(const Game &game, const MTropolisGameDesc
 }
 
 void MTIGameDataHandler::addPlugIns(ProjectDescription &projectDesc, const Common::Array<FileIdentification> &files) {
-	Common::SharedPtr<MTropolis::PlugIn> mtiPlugIn(new MTI::MTIPlugIn());
+	Common::SharedPtr<MTropolis::PlugIn> mtiPlugIn(PlugIns::createMTI());
 	projectDesc.addPlugIn(mtiPlugIn);
 
 	Common::SharedPtr<MTropolis::PlugIn> standardPlugIn = PlugIns::createStandard();
@@ -409,6 +410,7 @@ class SPQRGameDataHandler : public GameDataHandler {
 public:
 	SPQRGameDataHandler(const Game &game, const MTropolisGameDescription &gameDesc);
 
+	void addPlugIns(ProjectDescription &projectDesc, const Common::Array<FileIdentification> &files) override;
 	void unpackAdditionalFiles(Common::Array<Common::SharedPtr<ProjectPersistentResource> > &persistentResources, Common::Array<FileIdentification> &files) override;
 
 private:
@@ -668,53 +670,63 @@ bool SPQRGameDataHandler::VISE3Archive::getFileDescIndex(const Common::Path &pat
 SPQRGameDataHandler::SPQRGameDataHandler(const Game &game, const MTropolisGameDescription &gameDesc) : GameDataHandler(game, gameDesc), _isMac(gameDesc.desc.platform == Common::kPlatformMacintosh) {
 }
 
+void SPQRGameDataHandler::addPlugIns(ProjectDescription &projectDesc, const Common::Array<FileIdentification> &files) {
+	Common::SharedPtr<MTropolis::PlugIn> standardPlugIn = PlugIns::createStandard();
+	projectDesc.addPlugIn(standardPlugIn);
+
+	Common::SharedPtr<MTropolis::PlugIn> spqrPlugIn = PlugIns::createSPQR();
+	projectDesc.addPlugIn(spqrPlugIn);
+}
+
 void SPQRGameDataHandler::unpackAdditionalFiles(Common::Array<Common::SharedPtr<ProjectPersistentResource> > &persistentResources, Common::Array<FileIdentification> &files) {
-	const MacVISE3InstallerUnpackRequest unpackRequests[] = {
-		{"Basic.rPP", false, true, MTFT_EXTENSION},
-		{"Extras.rPP", false, true, MTFT_EXTENSION},
-		{"mCursors.cPP", false, true, MTFT_EXTENSION},
-		{"SPQR PPC Start", false, true, MTFT_PLAYER},
-		{"Data File SPQR", true, false, MTFT_MAIN},
-	};
+	if (_isMac) {
+		const MacVISE3InstallerUnpackRequest unpackRequests[] = {
+			{"Basic.rPP", false, true, MTFT_EXTENSION},
+			{"Extras.rPP", false, true, MTFT_EXTENSION},
+			{"mCursors.cPP", false, true, MTFT_EXTENSION},
+			{"SPQR PPC Start", false, true, MTFT_PLAYER},
+			{"Data File SPQR", true, false, MTFT_MAIN},
+		};
 
-	Common::SharedPtr<Common::MacResManager> installerResMan(new Common::MacResManager());
+		Common::SharedPtr<Common::MacResManager> installerResMan(new Common::MacResManager());
 
-	if (!installerResMan->open("Install.vct"))
-		error("Failed to open SPQR installer");
+		if (!installerResMan->open("Install.vct"))
+			error("Failed to open SPQR installer");
 
-	if (!installerResMan->hasDataFork())
-		error("SPQR installer has no data fork");
+		if (!installerResMan->hasDataFork())
+			error("SPQR installer has no data fork");
 
-	Common::SharedPtr<Common::SeekableReadStream> installerDataForkStream(installerResMan->getDataFork());
+		Common::SharedPtr<Common::SeekableReadStream> installerDataForkStream(installerResMan->getDataFork());
 
-	VISE3Archive archive(installerDataForkStream.get());
+		VISE3Archive archive(installerDataForkStream.get());
 
-	debug(1, "Unpacking files...");
+		debug(1, "Unpacking files...");
 
-	for (const MacVISE3InstallerUnpackRequest &request : unpackRequests) {
-		const VISE3FileDesc *fileDesc = archive.getFileDesc(request.fileName);
+		for (const MacVISE3InstallerUnpackRequest &request : unpackRequests) {
+			const VISE3FileDesc *fileDesc = archive.getFileDesc(request.fileName);
 
-		if (!fileDesc)
-			error("Couldn't find file '%s' in VISE 3 archive", request.fileName);
+			if (!fileDesc)
+				error("Couldn't find file '%s' in VISE 3 archive", request.fileName);
 
-		FileIdentification ident;
-		ident.fileName = fileDesc->fileName;
-		ident.macCreator.value = MKTAG(fileDesc->creator[0], fileDesc->creator[1], fileDesc->creator[2], fileDesc->creator[3]);
-		ident.macType.value = MKTAG(fileDesc->type[0], fileDesc->type[1], fileDesc->type[2], fileDesc->type[3]);
-		ident.category = request.fileType;
+			FileIdentification ident;
+			ident.fileName = fileDesc->fileName;
+			ident.macCreator.value = MKTAG(fileDesc->creator[0], fileDesc->creator[1], fileDesc->creator[2], fileDesc->creator[3]);
+			ident.macType.value = MKTAG(fileDesc->type[0], fileDesc->type[1], fileDesc->type[2], fileDesc->type[3]);
+			ident.category = request.fileType;
 
-		if (request.extractResources) {
-			Common::SharedPtr<Common::MacResManager> resMan(new Common::MacResManager());
-			if (!resMan->open(request.fileName, archive))
-				error("Failed to open Mac res manager for file '%s'", request.fileName);
+			if (request.extractResources) {
+				Common::SharedPtr<Common::MacResManager> resMan(new Common::MacResManager());
+				if (!resMan->open(request.fileName, archive))
+					error("Failed to open Mac res manager for file '%s'", request.fileName);
 
-			ident.resMan = resMan;
-		}
+				ident.resMan = resMan;
+			}
 
-		if (request.extractData)
-			ident.stream.reset(archive.createReadStreamForMember(request.fileName));
+			if (request.extractData)
+				ident.stream.reset(archive.createReadStreamForMember(request.fileName));
 
-		files.push_back(ident);
+			files.push_back(ident);
+		}
 	}
 }
 
@@ -1214,7 +1226,7 @@ const Game games[] = {
 		spqrRetailWinEnFiles,
 		spqrRetailWinDirectories,
 		nullptr,
-		GameDataHandlerFactory<GameDataHandler>::create
+		GameDataHandlerFactory<SPQRGameDataHandler>::create
 	},
 	// SPQR: The Empire's Darkest Hour - Retail - Macintosh - English
 	{
diff --git a/engines/mtropolis/data.cpp b/engines/mtropolis/data.cpp
index 83f0158856a..f84ad535b96 100644
--- a/engines/mtropolis/data.cpp
+++ b/engines/mtropolis/data.cpp
@@ -1729,6 +1729,45 @@ DataReadErrorCode ImageEffectModifier::load(DataReader &reader) {
 	return kDataReadErrorNone;
 }
 
+ReturnModifier::ReturnModifier()  {
+}
+
+DataReadErrorCode ReturnModifier::load(DataReader &reader) {
+	if (_revision != 1001)
+		return kDataReadErrorUnsupportedRevision;
+
+	if (!modHeader.load(reader) || !executeWhen.load(reader) || !reader.readU16(unknown1))
+		return kDataReadErrorReadFailed;
+
+	return kDataReadErrorNone;
+}
+
+CursorModifierV1::CursorModifierV1() : hasMacOnlyPart(false) {
+}
+
+DataReadErrorCode CursorModifierV1::load(DataReader &reader) {
+	if (_revision != 1001)
+		return kDataReadErrorUnsupportedRevision;
+
+	int64 startPos = reader.tell();
+
+	if (!modHeader.load(reader))
+		return kDataReadErrorReadFailed;
+
+	int64 distFromStart = reader.tell() - startPos + 6;
+	if (reader.getProjectFormat() == kProjectFormatMacintosh || modHeader.sizeIncludingTag > distFromStart) {
+		hasMacOnlyPart = true;
+
+		if (!macOnlyPart.applyWhen.load(reader) || !reader.readU32(macOnlyPart.unknown1) || !reader.readU16(macOnlyPart.unknown2) || !reader.readU32(macOnlyPart.cursorIndex))
+			return kDataReadErrorReadFailed;
+	}
+
+	return kDataReadErrorNone;
+}
+
+CursorModifierV1::MacOnlyPart::MacOnlyPart() : unknown1(0), unknown2(0), cursorIndex(0) {
+}
+
 CompoundVariableModifier::CompoundVariableModifier()
 	: modifierFlags(0), sizeIncludingTag(0), unknown1{0, 0}, guid(0), unknown4{0, 0, 0, 0, 0, 0}, unknown5(0),
 	  lengthOfName(0), numChildren(0), unknown7{0, 0, 0, 0} {
@@ -2482,6 +2521,12 @@ DataReadErrorCode loadDataObject(const PlugInModifierRegistry &registry, DataRea
 	case DataObjectTypes::kImageEffectModifier:
 		dataObject = new ImageEffectModifier();
 		break;
+	case DataObjectTypes::kReturnModifier:
+		dataObject = new ReturnModifier();
+		break;
+	case DataObjectTypes::kCursorModifierV1:
+		dataObject = new CursorModifierV1();
+		break;
 
 	case DataObjectTypes::kColorTableAsset:
 		dataObject = new ColorTableAsset();
diff --git a/engines/mtropolis/data.h b/engines/mtropolis/data.h
index 5daeb035a72..463380f0008 100644
--- a/engines/mtropolis/data.h
+++ b/engines/mtropolis/data.h
@@ -102,7 +102,7 @@ enum DataObjectType {
 
 	kAliasModifier							= 0x27,
 	kChangeSceneModifier					= 0x136,
-	kReturnModifier							= 0x140,	// NYI
+	kReturnModifier							= 0x140,
 	kSoundEffectModifier					= 0x1a4,
 	kDragMotionModifier						= 0x208,
 	kPathMotionModifierV1					= 0x21c,
@@ -123,7 +123,7 @@ enum DataObjectType {
 	kGraphicModifier						= 0x334,
 	kImageEffectModifier					= 0x384,
 	kMiniscriptModifier						= 0x3c0,
-	kCursorModifierV1						= 0x3ca,	// NYI - Obsolete version
+	kCursorModifierV1						= 0x3ca,
 	kGradientModifier						= 0x4b0,	// NYI
 	kColorTableModifier						= 0x4c4,
 	kSoundFadeModifier						= 0x4ce,
@@ -1592,6 +1592,39 @@ protected:
 	DataReadErrorCode load(DataReader &reader) override;
 };
 
+struct ReturnModifier : public DataObject {
+	ReturnModifier();
+
+	TypicalModifierHeader modHeader;
+
+	Event executeWhen;
+	uint16 unknown1;
+
+protected:
+	DataReadErrorCode load(DataReader &reader) override;
+};
+
+struct CursorModifierV1 : public DataObject {
+	CursorModifierV1();
+
+	struct MacOnlyPart {
+		MacOnlyPart();
+
+		Event applyWhen;
+		uint32 unknown1;
+		uint16 unknown2;
+		uint32 cursorIndex;
+	};
+
+	TypicalModifierHeader modHeader;
+
+	bool hasMacOnlyPart;
+	MacOnlyPart macOnlyPart;
+
+protected:
+	DataReadErrorCode load(DataReader &reader) override;
+};
+
 struct CompoundVariableModifier : public DataObject {
 	CompoundVariableModifier();
 
diff --git a/engines/mtropolis/modifier_factory.cpp b/engines/mtropolis/modifier_factory.cpp
index 434781b719d..63abe4bf6da 100644
--- a/engines/mtropolis/modifier_factory.cpp
+++ b/engines/mtropolis/modifier_factory.cpp
@@ -114,6 +114,10 @@ SIModifierFactory *getModifierFactoryForDataObjectType(const Data::DataObjectTyp
 		return ModifierFactory<GraphicModifier, Data::GraphicModifier>::getInstance();
 	case Data::DataObjectTypes::kImageEffectModifier:
 		return ModifierFactory<ImageEffectModifier, Data::ImageEffectModifier>::getInstance();
+	case Data::DataObjectTypes::kReturnModifier:
+		return ModifierFactory<ReturnModifier, Data::ReturnModifier>::getInstance();
+	case Data::DataObjectTypes::kCursorModifierV1:
+		return ModifierFactory<CursorModifierV1, Data::CursorModifierV1>::getInstance();
 	case Data::DataObjectTypes::kMessengerModifier:
 		return ModifierFactory<MessengerModifier, Data::MessengerModifier>::getInstance();
 	case Data::DataObjectTypes::kSetModifier:
diff --git a/engines/mtropolis/modifiers.cpp b/engines/mtropolis/modifiers.cpp
index 1d9a7b48ada..1a0c1d5b315 100644
--- a/engines/mtropolis/modifiers.cpp
+++ b/engines/mtropolis/modifiers.cpp
@@ -2232,6 +2232,74 @@ const char *ImageEffectModifier::getDefaultName() const {
 	return "Image Effect Modifier";
 }
 
+ReturnModifier::ReturnModifier() {
+}
+
+bool ReturnModifier::load(ModifierLoaderContext &context, const Data::ReturnModifier &data) {
+	if (!loadTypicalHeader(data.modHeader) || !_executeWhen.load(data.executeWhen))
+		return false;
+
+	return true;
+}
+
+bool ReturnModifier::respondsToEvent(const Event &evt) const {
+	return _executeWhen.respondsTo(evt);
+}
+
+VThreadState ReturnModifier::consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) {
+	warning("Return modifier not implemented");
+	return kVThreadReturn;
+}
+
+void ReturnModifier::disable(Runtime *runtime) {
+}
+
+Common::SharedPtr<Modifier> ReturnModifier::shallowClone() const {
+	return Common::SharedPtr<Modifier>(new ReturnModifier(*this));
+}
+
+const char *ReturnModifier::getDefaultName() const {
+	return "Return Modifier";
+}
+
+
+CursorModifierV1::CursorModifierV1() : _cursorIndex(kCursor_Interact) {
+}
+
+bool CursorModifierV1::load(ModifierLoaderContext &context, const Data::CursorModifierV1 &data) {
+	if (!loadTypicalHeader(data.modHeader))
+		return false;
+
+	if (data.hasMacOnlyPart)
+		_cursorIndex = data.macOnlyPart.cursorIndex;
+
+	return true;
+}
+
+bool CursorModifierV1::respondsToEvent(const Event &evt) const {
+	return _applyWhen.respondsTo(evt);
+}
+
+VThreadState CursorModifierV1::consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) {
+	if (_applyWhen.respondsTo(msg->getEvent())) {
+		warning("Cursor modifier V1 should be applied, but is not implemented");
+		return kVThreadReturn;
+	}
+	return kVThreadReturn;
+}
+
+void CursorModifierV1::disable(Runtime *runtime) {
+	warning("Cursor modifier V1 should probably dismiss when disabled?");
+}
+
+Common::SharedPtr<Modifier> CursorModifierV1::shallowClone() const {
+	return Common::SharedPtr<Modifier>(new CursorModifierV1(*this));
+}
+
+const char *CursorModifierV1::getDefaultName() const {
+	return "Cursor Modifier";
+}
+
 bool CompoundVariableModifier::load(ModifierLoaderContext &context, const Data::CompoundVariableModifier &data) {
 	if (data.numChildren > 0) {
 		ChildLoaderContext loaderContext;
diff --git a/engines/mtropolis/modifiers.h b/engines/mtropolis/modifiers.h
index ffe1c98118f..af76be475a9 100644
--- a/engines/mtropolis/modifiers.h
+++ b/engines/mtropolis/modifiers.h
@@ -881,6 +881,69 @@ private:
 	bool _includeBorders;
 };
 
+class ReturnModifier : public Modifier {
+public:
+	ReturnModifier();
+
+	bool load(ModifierLoaderContext &context, const Data::ReturnModifier &data);
+
+	bool respondsToEvent(const Event &evt) const override;
+	VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
+	void disable(Runtime *runtime) override;
+
+#ifdef MTROPOLIS_DEBUG_ENABLE
+	const char *debugGetTypeName() const override { return "Return Modifier"; }
+	SupportStatus debugGetSupportStatus() const override { return kSupportStatusNone; }
+#endif
+
+private:
+	Common::SharedPtr<Modifier> shallowClone() const override;
+	const char *getDefaultName() const override;
+
+	Event _executeWhen;
+};
+
+class CursorModifierV1 : public Modifier {
+public:
+	CursorModifierV1();
+
+	bool load(ModifierLoaderContext &context, const Data::CursorModifierV1 &data);
+
+	bool respondsToEvent(const Event &evt) const override;
+	VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
+	void disable(Runtime *runtime) override;
+
+#ifdef MTROPOLIS_DEBUG_ENABLE
+	const char *debugGetTypeName() const override { return "Cursor Modifier V1"; }
+	SupportStatus debugGetSupportStatus() const override { return kSupportStatusNone; }
+#endif
+
+private:
+	enum {
+		kCursor_Inactive,
+		kCursor_Interact,
+		kCursor_HandGrabBW,
+		kCursor_HandOpenBW,
+		kCursor_HandPointUp,
+		kCursor_HandPointRight,
+		kCursor_HandPointLeft,
+		kCursor_HandPointDown,
+		kCursor_HandGrabColor,
+		kCursor_HandOpenColor,
+		kCursor_Arrow,
+		kCursor_Pencil,
+		kCursor_Smiley,
+		kCursor_Wait,
+		kCursor_Hidden,
+	};
+
+	Common::SharedPtr<Modifier> shallowClone() const override;
+	const char *getDefaultName() const override;
+
+	Event _applyWhen;
+	uint32 _cursorIndex;
+};
+
 // Compound variable modifiers are not true variable modifiers.
 // They aren't treated as values by Miniscript and they aren't
 // treated as unique objects by aliases.  The only way that
diff --git a/engines/mtropolis/module.mk b/engines/mtropolis/module.mk
index 58380f6ce68..1d45e895c6b 100644
--- a/engines/mtropolis/module.mk
+++ b/engines/mtropolis/module.mk
@@ -20,6 +20,8 @@ MODULE_OBJS = \
 	plugin/mti_data.o \
 	plugin/obsidian.o \
 	plugin/obsidian_data.o \
+	plugin/spqr.o \
+	plugin/spqr_data.o \
 	plugin/standard.o \
 	plugin/standard_data.o \
 	render.o \
diff --git a/engines/mtropolis/plugin/mti.cpp b/engines/mtropolis/plugin/mti.cpp
index fd4fef515db..674442c563f 100644
--- a/engines/mtropolis/plugin/mti.cpp
+++ b/engines/mtropolis/plugin/mti.cpp
@@ -30,40 +30,6 @@ namespace MTropolis {
 
 namespace MTI {
 
-PanningModifier::PanningModifier() {
-}
-
-PanningModifier::~PanningModifier() {
-}
-
-bool PanningModifier::load(const PlugInModifierLoaderContext &context, const Data::MTI::PanningModifier &data) {
-	return true;
-}
-
-bool PanningModifier::respondsToEvent(const Event &evt) const {
-	return false;
-}
-
-VThreadState PanningModifier::consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) {
-	return kVThreadReturn;
-}
-
-void PanningModifier::disable(Runtime *runtime) {
-}
-
-#ifdef MTROPOLIS_DEBUG_ENABLE
-void PanningModifier::debugInspect(IDebugInspectionReport *report) const {
-}
-#endif
-
-Common::SharedPtr<Modifier> PanningModifier::shallowClone() const {
-	return Common::SharedPtr<Modifier>(new PanningModifier(*this));
-}
-
-const char *PanningModifier::getDefaultName() const {
-	return "Panning Modifier";	// ???
-}
-
 ShanghaiModifier::ShanghaiModifier() {
 }
 
@@ -146,11 +112,10 @@ const char *PrintModifier::getDefaultName() const {
 }
 
 MTIPlugIn::MTIPlugIn()
-	: _panningModifierFactory(this), _shanghaiModifierFactory(this), _printModifierFactory(this) {
+	: _shanghaiModifierFactory(this), _printModifierFactory(this) {
 }
 
 void MTIPlugIn::registerModifiers(IPlugInModifierRegistrar *registrar) const {
-	registrar->registerPlugInModifier("panning", &_panningModifierFactory);
 	registrar->registerPlugInModifier("Shanghai", &_shanghaiModifierFactory);
 	registrar->registerPlugInModifier("Print", &_printModifierFactory);
 }
diff --git a/engines/mtropolis/plugin/mti.h b/engines/mtropolis/plugin/mti.h
index bfb8f79f45a..f48a65df086 100644
--- a/engines/mtropolis/plugin/mti.h
+++ b/engines/mtropolis/plugin/mti.h
@@ -33,28 +33,6 @@ namespace MTI {
 
 class MTIPlugIn;
 
-class PanningModifier : public Modifier {
-public:
-	PanningModifier();
-	~PanningModifier();
-
-	bool load(const PlugInModifierLoaderContext &context, const Data::MTI::PanningModifier &data);
-
-	bool respondsToEvent(const Event &evt) const override;
-	VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
-
-	void disable(Runtime *runtime) override;
-
-#ifdef MTROPOLIS_DEBUG_ENABLE
-	const char *debugGetTypeName() const override { return "Panning Modifier"; }
-	void debugInspect(IDebugInspectionReport *report) const override;
-#endif
-
-private:
-	Common::SharedPtr<Modifier> shallowClone() const override;
-	const char *getDefaultName() const override;
-};
-
 class ShanghaiModifier : public Modifier {
 public:
 	ShanghaiModifier();
@@ -108,7 +86,6 @@ public:
 	void registerModifiers(IPlugInModifierRegistrar *registrar) const override;
 
 private:
-	PlugInModifierFactory<PanningModifier, Data::MTI::PanningModifier> _panningModifierFactory;
 	PlugInModifierFactory<ShanghaiModifier, Data::MTI::ShanghaiModifier> _shanghaiModifierFactory;
 	PlugInModifierFactory<PrintModifier, Data::MTI::PrintModifier> _printModifierFactory;
 };
diff --git a/engines/mtropolis/plugin/mti_data.cpp b/engines/mtropolis/plugin/mti_data.cpp
index 4d164aeaa31..ddfbef9cf35 100644
--- a/engines/mtropolis/plugin/mti_data.cpp
+++ b/engines/mtropolis/plugin/mti_data.cpp
@@ -27,16 +27,6 @@ namespace Data {
 
 namespace MTI {
 
-DataReadErrorCode PanningModifier::load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) {
-	if (prefix.plugInRevision != 3)
-		return kDataReadErrorUnsupportedRevision;
-
-	if (!unknown1Event.load(reader) || !unknown2Event.load(reader) || !unknown3Int.load(reader) || !unknown4Int.load(reader) || !unknown5Int.load(reader))
-		return kDataReadErrorReadFailed;
-
-	return kDataReadErrorNone;
-}
-
 DataReadErrorCode ShanghaiModifier::load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) {
 	if (prefix.plugInRevision != 0)
 		return kDataReadErrorUnsupportedRevision;
diff --git a/engines/mtropolis/plugin/mti_data.h b/engines/mtropolis/plugin/mti_data.h
index b06cf1c76a7..f1f94188b52 100644
--- a/engines/mtropolis/plugin/mti_data.h
+++ b/engines/mtropolis/plugin/mti_data.h
@@ -31,20 +31,8 @@ namespace Data {
 namespace MTI {
 
 // Known Muppet Treasure Island custom modifiers:
-// panning - ???
 // Shanghai - ???
 
-struct PanningModifier : public PlugInModifierData {
-	PlugInTypeTaggedValue unknown1Event; // Probably "Enable When"
-	PlugInTypeTaggedValue unknown2Event; // Probably "Disable When"
-	PlugInTypeTaggedValue unknown3Int;   // Int
-	PlugInTypeTaggedValue unknown4Int;   // Int
-	PlugInTypeTaggedValue unknown5Int;   // Int
-
-protected:
-	DataReadErrorCode load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) override;
-};
-
 struct ShanghaiModifier : public PlugInModifierData {
 	PlugInTypeTaggedValue unknown1Event;  // Probably "Enable When"
 	PlugInTypeTaggedValue unknown2VarRef; // VarRef (Probably tile set)
diff --git a/engines/mtropolis/plugin/spqr.cpp b/engines/mtropolis/plugin/spqr.cpp
new file mode 100644
index 00000000000..de2f17a6a44
--- /dev/null
+++ b/engines/mtropolis/plugin/spqr.cpp
@@ -0,0 +1,69 @@
+/* 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 "mtropolis/plugin/spqr.h"
+#include "mtropolis/plugins.h"
+
+namespace MTropolis {
+
+namespace SPQR {
+
+FadeModifier::FadeModifier() {
+}
+
+FadeModifier::~FadeModifier() {
+}
+
+bool FadeModifier::load(const PlugInModifierLoaderContext &context, const Data::SPQR::FadeModifier &data) {
+	return true;
+}
+
+
+void FadeModifier::disable(Runtime *runtime) {
+}
+
+Common::SharedPtr<Modifier> FadeModifier::shallowClone() const {
+	return Common::SharedPtr<Modifier>(new FadeModifier(*this));
+}
+
+const char *FadeModifier::getDefaultName() const {
+	return "Fade Modifier"; // ???
+}
+
+SPQRPlugIn::SPQRPlugIn()
+	: _fadeModifierFactory(this) {
+}
+
+void SPQRPlugIn::registerModifiers(IPlugInModifierRegistrar *registrar) const {
+	registrar->registerPlugInModifier("fade", &_fadeModifierFactory);
+}
+
+} // namespace SPQR
+
+namespace PlugIns {
+
+Common::SharedPtr<PlugIn> createSPQR() {
+	return Common::SharedPtr<PlugIn>(new SPQR::SPQRPlugIn());
+}
+
+} // End of namespace PlugIns
+
+} // End of namespace MTropolis
diff --git a/engines/mtropolis/plugin/spqr.h b/engines/mtropolis/plugin/spqr.h
new file mode 100644
index 00000000000..0476cbc880e
--- /dev/null
+++ b/engines/mtropolis/plugin/spqr.h
@@ -0,0 +1,68 @@
+/* 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 MTROPOLIS_PLUGIN_SPQR_H
+#define MTROPOLIS_PLUGIN_SPQR_H
+
+#include "mtropolis/modifier_factory.h"
+#include "mtropolis/modifiers.h"
+#include "mtropolis/plugin/spqr_data.h"
+#include "mtropolis/runtime.h"
+
+namespace MTropolis {
+
+namespace SPQR {
+
+class SPQRPlugIn;
+
+class FadeModifier : public Modifier {
+public:
+	FadeModifier();
+	~FadeModifier();
+
+	bool load(const PlugInModifierLoaderContext &context, const Data::SPQR::FadeModifier &data);
+
+	void disable(Runtime *runtime) override;
+
+#ifdef MTROPOLIS_DEBUG_ENABLE
+	const char *debugGetTypeName() const override { return "Fade Modifier"; }
+#endif
+
+private:
+	Common::SharedPtr<Modifier> shallowClone() const override;
+	const char *getDefaultName() const override;
+};
+
+class SPQRPlugIn : public MTropolis::PlugIn {
+public:
+	SPQRPlugIn();
+
+	void registerModifiers(IPlugInModifierRegistrar *registrar) const override;
+
+private:
+	PlugInModifierFactory<FadeModifier, Data::SPQR::FadeModifier> _fadeModifierFactory;
+};
+
+} // End of namespace SPQR
+
+} // End of namespace MTropolis
+
+#endif
diff --git a/engines/mtropolis/plugin/spqr_data.cpp b/engines/mtropolis/plugin/spqr_data.cpp
new file mode 100644
index 00000000000..675772f0a32
--- /dev/null
+++ b/engines/mtropolis/plugin/spqr_data.cpp
@@ -0,0 +1,44 @@
+/* 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 "mtropolis/plugin/spqr_data.h"
+
+namespace MTropolis {
+
+namespace Data {
+
+namespace SPQR {
+
+DataReadErrorCode FadeModifier::load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) {
+	if (prefix.plugInRevision != 1)
+		return kDataReadErrorUnsupportedRevision;
+
+	if (!unknown1Event.load(reader) || !unknown2Event.load(reader) || !unknown3Int.load(reader) || !unknown4Int.load(reader) || !unknown5Int.load(reader))
+		return kDataReadErrorReadFailed;
+
+	return kDataReadErrorNone;
+}
+
+} // End of namespace SPQR
+
+} // End of namespace Data
+
+} // End of namespace MTropolis
diff --git a/engines/mtropolis/plugin/spqr_data.h b/engines/mtropolis/plugin/spqr_data.h
new file mode 100644
index 00000000000..6b9d6ac901c
--- /dev/null
+++ b/engines/mtropolis/plugin/spqr_data.h
@@ -0,0 +1,53 @@
+/* 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 MTROPOLIS_PLUGIN_SPQR_DATA_H
+#define MTROPOLIS_PLUGIN_SPQR_DATA_H
+
+#include "mtropolis/data.h"
+
+namespace MTropolis {
+
+namespace Data {
+
+namespace SPQR {
+
+// Known SPQR - The Empire's Darkest Hour custom modifiers:
+// fade - ???
+
+struct FadeModifier : public PlugInModifierData {
+	PlugInTypeTaggedValue unknown1Event; // Probably "Enable When"
+	PlugInTypeTaggedValue unknown2Event; // Probably "Disable When"
+	PlugInTypeTaggedValue unknown3Int;   // Int
+	PlugInTypeTaggedValue unknown4Int;   // Int
+	PlugInTypeTaggedValue unknown5Int;   // Int
+
+protected:
+	DataReadErrorCode load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) override;
+};
+
+} // End of namespace SPQR
+
+} // End of namespace Data
+
+} // End of namespace MTropolis
+
+#endif
diff --git a/engines/mtropolis/plugin/standard.cpp b/engines/mtropolis/plugin/standard.cpp
index 235a3a99e92..8c33c92bdec 100644
--- a/engines/mtropolis/plugin/standard.cpp
+++ b/engines/mtropolis/plugin/standard.cpp
@@ -3220,6 +3220,41 @@ const char *SysInfoModifier::getDefaultName() const {
 	return "SysInfo Modifier";
 }
 
+PanningModifier::PanningModifier() {
+}
+
+PanningModifier::~PanningModifier() {
+}
+
+bool PanningModifier::load(const PlugInModifierLoaderContext &context, const Data::Standard::PanningModifier &data) {
+	return true;
+}
+
+bool PanningModifier::respondsToEvent(const Event &evt) const {
+	return false;
+}
+
+VThreadState PanningModifier::consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) {
+	return kVThreadReturn;
+}
+
+void PanningModifier::disable(Runtime *runtime) {
+}
+
+#ifdef MTROPOLIS_DEBUG_ENABLE
+void PanningModifier::debugInspect(IDebugInspectionReport *report) const {
+	Modifier::debugInspect(report);
+}
+#endif
+
+Common::SharedPtr<Modifier> PanningModifier::shallowClone() const {
+	return Common::SharedPtr<Modifier>(new PanningModifier(*this));
+}
+
+const char *PanningModifier::getDefaultName() const {
+	return "Panning Modifier"; // ???
+}
+
 StandardPlugInHacks::StandardPlugInHacks() : allowGarbledListModData(false) {
 }
 
@@ -3230,7 +3265,8 @@ StandardPlugIn::StandardPlugIn(bool useDynamicMidi)
 	, _objRefVarModifierFactory(this)
 	, _midiModifierFactory(this)
 	, _listVarModifierFactory(this)
-	, _sysInfoModifierFactory(this) {
+	, _sysInfoModifierFactory(this)
+	, _panningModifierFactory(this) {
 	_midi.reset(new MultiMidiPlayer(useDynamicMidi));
 }
 
@@ -3245,6 +3281,8 @@ void StandardPlugIn::registerModifiers(IPlugInModifierRegistrar *registrar) cons
 	registrar->registerPlugInModifier("MIDIModf", &_midiModifierFactory);
 	registrar->registerPlugInModifier("ListMod", &_listVarModifierFactory);
 	registrar->registerPlugInModifier("SysInfo", &_sysInfoModifierFactory);
+
+	registrar->registerPlugInModifier("panning", &_panningModifierFactory);
 }
 
 const StandardPlugInHacks &StandardPlugIn::getHacks() const {
diff --git a/engines/mtropolis/plugin/standard.h b/engines/mtropolis/plugin/standard.h
index 3eb8ab9fb74..dd12aa39927 100644
--- a/engines/mtropolis/plugin/standard.h
+++ b/engines/mtropolis/plugin/standard.h
@@ -399,6 +399,28 @@ struct StandardPlugInHacks {
 	bool allowGarbledListModData;
 };
 
+class PanningModifier : public Modifier {
+public:
+	PanningModifier();
+	~PanningModifier();
+
+	bool load(const PlugInModifierLoaderContext &context, const Data::Standard::PanningModifier &data);
+
+	bool respondsToEvent(const Event &evt) const override;
+	VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
+
+	void disable(Runtime *runtime) override;
+
+#ifdef MTROPOLIS_DEBUG_ENABLE
+	const char *debugGetTypeName() const override { return "Panning Modifier"; }
+	void debugInspect(IDebugInspectionReport *report) const override;
+#endif
+
+private:
+	Common::SharedPtr<Modifier> shallowClone() const override;
+	const char *getDefaultName() const override;
+};
+
 class StandardPlugIn : public MTropolis::PlugIn {
 public:
 	explicit StandardPlugIn(bool useDynamicMidi);
@@ -419,6 +441,7 @@ private:
 	PlugInModifierFactory<MidiModifier, Data::Standard::MidiModifier> _midiModifierFactory;
 	PlugInModifierFactory<ListVariableModifier, Data::Standard::ListVariableModifier> _listVarModifierFactory;
 	PlugInModifierFactory<SysInfoModifier, Data::Standard::SysInfoModifier> _sysInfoModifierFactory;
+	PlugInModifierFactory<PanningModifier, Data::Standard::PanningModifier> _panningModifierFactory;
 
 	Common::SharedPtr<MultiMidiPlayer> _midi;
 	StandardPlugInHacks _hacks;
diff --git a/engines/mtropolis/plugin/standard_data.cpp b/engines/mtropolis/plugin/standard_data.cpp
index fdd84651d9f..1cb6038ed0f 100644
--- a/engines/mtropolis/plugin/standard_data.cpp
+++ b/engines/mtropolis/plugin/standard_data.cpp
@@ -212,6 +212,16 @@ DataReadErrorCode ListVariableModifier::load(PlugIn &plugIn, const PlugInModifie
 	return kDataReadErrorNone;
 }
 
+DataReadErrorCode PanningModifier::load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) {
+	if (prefix.plugInRevision != 3)
+		return kDataReadErrorUnsupportedRevision;
+
+	if (!unknown1Event.load(reader) || !unknown2Event.load(reader) || !unknown3Int.load(reader) || !unknown4Int.load(reader) || !unknown5Int.load(reader))
+		return kDataReadErrorReadFailed;
+
+	return kDataReadErrorNone;
+}
+
 DataReadErrorCode SysInfoModifier::load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) {
 	if (prefix.plugInRevision != 0)
 		return kDataReadErrorUnsupportedRevision;
diff --git a/engines/mtropolis/plugin/standard_data.h b/engines/mtropolis/plugin/standard_data.h
index a0756b774de..14620418b8a 100644
--- a/engines/mtropolis/plugin/standard_data.h
+++ b/engines/mtropolis/plugin/standard_data.h
@@ -173,6 +173,17 @@ protected:
 	DataReadErrorCode load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) override;
 };
 
+struct PanningModifier : public PlugInModifierData {
+	PlugInTypeTaggedValue unknown1Event; // Probably "Enable When"
+	PlugInTypeTaggedValue unknown2Event; // Probably "Disable When"
+	PlugInTypeTaggedValue unknown3Int;   // Int
+	PlugInTypeTaggedValue unknown4Int;   // Int
+	PlugInTypeTaggedValue unknown5Int;   // Int
+
+protected:
+	DataReadErrorCode load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) override;
+};
+
 } // End of namespace Standard
 
 } // End of namespace Data
diff --git a/engines/mtropolis/plugins.h b/engines/mtropolis/plugins.h
index d998c7911bb..484cdbf6027 100644
--- a/engines/mtropolis/plugins.h
+++ b/engines/mtropolis/plugins.h
@@ -41,6 +41,7 @@ namespace PlugIns {
 Common::SharedPtr<PlugIn> createStandard();
 Common::SharedPtr<PlugIn> createObsidian(const Common::SharedPtr<Obsidian::WordGameData> &wgData);
 Common::SharedPtr<PlugIn> createMTI();
+Common::SharedPtr<PlugIn> createSPQR();
 
 } // End of namespace PlugIns
 




More information about the Scummvm-git-logs mailing list