[Scummvm-git-logs] scummvm master -> 4eca244685220f2358613ce0f78a805814de408d

elasota noreply at scummvm.org
Sun Sep 11 19:33:56 UTC 2022


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

Summary:
ca882b5d57 MTROPOLIS: Fix some things required to boot MTI
4eca244685 MTROPOLIS: Add more loaders for MTI data


Commit: ca882b5d577d711340eb13d92fd81fbee6209d48
    https://github.com/scummvm/scummvm/commit/ca882b5d577d711340eb13d92fd81fbee6209d48
Author: elasota (ejlasota at gmail.com)
Date: 2022-09-11T14:52:42-04:00

Commit Message:
MTROPOLIS: Fix some things required to boot MTI

Changed paths:
    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/plugin/standard.cpp
    engines/mtropolis/plugin/standard_data.cpp
    engines/mtropolis/plugin/standard_data.h


diff --git a/engines/mtropolis/boot.cpp b/engines/mtropolis/boot.cpp
index bfa1f77dda1..f663cc9a8bb 100644
--- a/engines/mtropolis/boot.cpp
+++ b/engines/mtropolis/boot.cpp
@@ -1102,7 +1102,7 @@ Common::SharedPtr<ProjectDescription> bootProject(const MTropolisGameDescription
 
 			Boot::FileIdentification ident;
 			ident.fileName = fileName;
-			ident.category = Boot::MTFT_AUTO;
+			ident.category = fileDesc->fileType;
 			ident.macType.value = 0;
 			ident.macCreator.value = 0;
 			winFiles.push_back(ident);
diff --git a/engines/mtropolis/data.cpp b/engines/mtropolis/data.cpp
index 869ab9d99b8..10be8b89305 100644
--- a/engines/mtropolis/data.cpp
+++ b/engines/mtropolis/data.cpp
@@ -1442,6 +1442,22 @@ DataReadErrorCode ElementTransitionModifier::load(DataReader &reader) {
 	return kDataReadErrorNone;
 }
 
+SharedSceneModifier::SharedSceneModifier()
+	: executeWhen(Event::createDefault()), unknown1{0, 0, 0, 0}, sectionGUID(0), subsectionGUID(0), sceneGUID(0) {
+}
+
+DataReadErrorCode SharedSceneModifier::load(DataReader &reader) {
+	if (_revision != 1000)
+		return kDataReadErrorUnsupportedRevision;
+
+	if (!modHeader.load(reader) || !executeWhen.load(reader)
+		|| !reader.readBytes(unknown1) || !reader.readU32(sectionGUID)
+		|| !reader.readU32(subsectionGUID) || !reader.readU32(sceneGUID))
+		return kDataReadErrorReadFailed;
+
+	return kDataReadErrorNone;
+}
+
 IfMessengerModifier::IfMessengerModifier()
 	: messageFlags(0), send(Event::createDefault()), when(Event::createDefault()), unknown6(0), destination(0),
 	  unknown7{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, unknown9{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, withSourceLength(0), withStringLength(0) {
@@ -2289,6 +2305,9 @@ DataReadErrorCode loadDataObject(const PlugInModifierRegistry &registry, DataRea
 	case DataObjectTypes::kElementTransitionModifier:
 		dataObject = new ElementTransitionModifier();
 		break;
+	case DataObjectTypes::kSharedSceneModifier:
+		dataObject = new SharedSceneModifier();
+		break;
 	case DataObjectTypes::kIfMessengerModifier:
 		dataObject = new IfMessengerModifier();
 		break;
diff --git a/engines/mtropolis/data.h b/engines/mtropolis/data.h
index e2ebc4848b9..38854d773b2 100644
--- a/engines/mtropolis/data.h
+++ b/engines/mtropolis/data.h
@@ -110,7 +110,7 @@ enum DataObjectType {
 	kVectorMotionModifier					= 0x226,
 	kSceneTransitionModifier				= 0x26c,
 	kElementTransitionModifier				= 0x276,
-	kSharedSceneModifier					= 0x29a,	// NYI
+	kSharedSceneModifier					= 0x29a,
 	kIfMessengerModifier					= 0x2bc,
 	kBehaviorModifier						= 0x2c6,
 	kMessengerModifier						= 0x2da,
@@ -1238,6 +1238,21 @@ protected:
 	DataReadErrorCode load(DataReader &reader) override;
 };
 
+struct SharedSceneModifier : public DataObject {
+	SharedSceneModifier();
+
+	TypicalModifierHeader modHeader;
+
+	Event executeWhen;
+	uint8_t unknown1[4];
+	uint32 sectionGUID;
+	uint32 subsectionGUID;
+	uint32 sceneGUID;
+
+protected:
+	DataReadErrorCode load(DataReader &reader) override;
+};
+
 struct IfMessengerModifier : public DataObject {
 	IfMessengerModifier();
 
diff --git a/engines/mtropolis/modifier_factory.cpp b/engines/mtropolis/modifier_factory.cpp
index 6f4d7a94e24..0a4db6720c8 100644
--- a/engines/mtropolis/modifier_factory.cpp
+++ b/engines/mtropolis/modifier_factory.cpp
@@ -91,6 +91,8 @@ SIModifierFactory *getModifierFactoryForDataObjectType(const Data::DataObjectTyp
 		return ModifierFactory<SceneTransitionModifier, Data::SceneTransitionModifier>::getInstance();
 	case Data::DataObjectTypes::kElementTransitionModifier:
 		return ModifierFactory<ElementTransitionModifier, Data::ElementTransitionModifier>::getInstance();
+	case Data::DataObjectTypes::kSharedSceneModifier:
+		return ModifierFactory<SharedSceneModifier, Data::SharedSceneModifier>::getInstance();
 	case Data::DataObjectTypes::kIfMessengerModifier:
 		return ModifierFactory<IfMessengerModifier, Data::IfMessengerModifier>::getInstance();
 	case Data::DataObjectTypes::kTimerMessengerModifier:
diff --git a/engines/mtropolis/modifiers.cpp b/engines/mtropolis/modifiers.cpp
index 096b5b74d2a..85910cf9faf 100644
--- a/engines/mtropolis/modifiers.cpp
+++ b/engines/mtropolis/modifiers.cpp
@@ -1190,6 +1190,46 @@ void ElementTransitionModifier::setTransitionProgress(uint32 step, uint32 maxSte
 	}
 }
 
+
+SharedSceneModifier::SharedSceneModifier() : _targetSectionGUID(0), _targetSubsectionGUID(0), _targetSceneGUID(0) {
+}
+
+SharedSceneModifier::~SharedSceneModifier() {
+}
+
+bool SharedSceneModifier::load(ModifierLoaderContext &context, const Data::SharedSceneModifier &data) {
+	if (!loadTypicalHeader(data.modHeader))
+		return false;
+
+	if (!_executeWhen.load(data.executeWhen))
+		return false;
+
+	_targetSectionGUID = data.sectionGUID;
+	_targetSubsectionGUID = data.subsectionGUID;
+	_targetSceneGUID = data.sceneGUID;
+
+	return true;
+}
+
+bool SharedSceneModifier::respondsToEvent(const Event &evt) const {
+	return _executeWhen.respondsTo(evt);
+}
+
+VThreadState SharedSceneModifier::consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) {
+	return kVThreadReturn;
+}
+
+void SharedSceneModifier::disable(Runtime *runtime) {
+}
+
+Common::SharedPtr<Modifier> SharedSceneModifier::shallowClone() const {
+	return Common::SharedPtr<Modifier>(new SharedSceneModifier(*this));
+}
+
+const char *SharedSceneModifier::getDefaultName() const {
+	return "Shared Scene Modifier";
+}
+
 bool IfMessengerModifier::load(ModifierLoaderContext &context, const Data::IfMessengerModifier &data) {
 	if (!loadTypicalHeader(data.modHeader))
 		return false;
diff --git a/engines/mtropolis/modifiers.h b/engines/mtropolis/modifiers.h
index 2a78972ad72..404f0e72b68 100644
--- a/engines/mtropolis/modifiers.h
+++ b/engines/mtropolis/modifiers.h
@@ -465,6 +465,33 @@ private:
 	Common::SharedPtr<ScheduledEvent> _scheduledEvent;
 };
 
+class SharedSceneModifier : public Modifier {
+public:
+	SharedSceneModifier();
+	~SharedSceneModifier();
+
+	bool load(ModifierLoaderContext &context, const Data::SharedSceneModifier &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 "Shared Scene Modifier"; }
+	SupportStatus debugGetSupportStatus() const override { return kSupportStatusNone; }
+#endif
+
+private:
+	Common::SharedPtr<Modifier> shallowClone() const override;
+	const char *getDefaultName() const override;
+
+	Event _executeWhen;
+
+	uint32 _targetSectionGUID;
+	uint32 _targetSubsectionGUID;
+	uint32 _targetSceneGUID;
+};
+
 class IfMessengerModifier : public Modifier {
 public:
 	bool load(ModifierLoaderContext &context, const Data::IfMessengerModifier &data);
diff --git a/engines/mtropolis/plugin/standard.cpp b/engines/mtropolis/plugin/standard.cpp
index 8a57a6dbf59..3a439976d6d 100644
--- a/engines/mtropolis/plugin/standard.cpp
+++ b/engines/mtropolis/plugin/standard.cpp
@@ -1588,9 +1588,21 @@ void CursorModifier::disable(Runtime *runtime) {
 }
 
 bool CursorModifier::load(const PlugInModifierLoaderContext &context, const Data::Standard::CursorModifier &data) {
-	if (!_applyWhen.load(data.applyWhen) || !_removeWhen.load(data.removeWhen))
+	if (data.applyWhen.type != Data::PlugInTypeTaggedValue::kEvent || data.cursorIDAsLabel.type != Data::PlugInTypeTaggedValue::kLabel)
 		return false;
-	_cursorID = data.cursorID;
+
+	if (!_applyWhen.load(data.applyWhen.value.asEvent))
+		return false;
+
+	if (data.haveRemoveWhen) {
+		if (!_removeWhen.load(data.removeWhen.value.asEvent))
+			return false;
+	}
+
+	if (data.cursorIDAsLabel.type != Data::PlugInTypeTaggedValue::kLabel)
+		return false;
+
+	_cursorID = data.cursorIDAsLabel.value.asLabel.labelID;
 
 	return true;
 }
diff --git a/engines/mtropolis/plugin/standard_data.cpp b/engines/mtropolis/plugin/standard_data.cpp
index 751aacd8f4a..fdd84651d9f 100644
--- a/engines/mtropolis/plugin/standard_data.cpp
+++ b/engines/mtropolis/plugin/standard_data.cpp
@@ -28,17 +28,26 @@ namespace Data {
 
 namespace Standard {
 
-CursorModifier::CursorModifier()
-	: unknown1(0), applyWhen(Event::createDefault()), unknown2(0), removeWhen(Event::createDefault()),
-	  unknown3(0), unknown4{0, 0, 0, 0}, cursorID(0) {
+CursorModifier::CursorModifier() : haveRemoveWhen(false) {
 }
 
 DataReadErrorCode CursorModifier::load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) {
-	if (prefix.plugInRevision != 1)
+	if (prefix.plugInRevision != 0 && prefix.plugInRevision != 1)
 		return kDataReadErrorUnsupportedRevision;
 
-	if (!reader.readU16(unknown1) || !applyWhen.load(reader) || !reader.readU16(unknown2)
-		|| !removeWhen.load(reader) || !reader.readU16(unknown3) || !reader.readU32(cursorID) || !reader.readBytes(unknown4))
+	if (!applyWhen.load(reader))
+		return kDataReadErrorReadFailed;
+
+	if (prefix.plugInRevision >= 1) {
+		if (!removeWhen.load(reader))
+			return kDataReadErrorReadFailed;
+		haveRemoveWhen = true;
+	} else {
+		removeWhen.type = PlugInTypeTaggedValue::kNull;
+		haveRemoveWhen = false;
+	}
+
+	if (!cursorIDAsLabel.load(reader))
 		return kDataReadErrorReadFailed;
 
 	return kDataReadErrorNone;
diff --git a/engines/mtropolis/plugin/standard_data.h b/engines/mtropolis/plugin/standard_data.h
index ca72b07dcfb..a0756b774de 100644
--- a/engines/mtropolis/plugin/standard_data.h
+++ b/engines/mtropolis/plugin/standard_data.h
@@ -33,13 +33,11 @@ namespace Standard {
 struct CursorModifier : public PlugInModifierData {
 	CursorModifier();
 
-	uint16 unknown1;
-	Event applyWhen;
-	uint16 unknown2;
-	Event removeWhen;
-	uint16 unknown3;
-	uint32 cursorID;
-	uint8 unknown4[4];
+	bool haveRemoveWhen;
+
+	PlugInTypeTaggedValue applyWhen;
+	PlugInTypeTaggedValue removeWhen;
+	PlugInTypeTaggedValue cursorIDAsLabel;
 
 protected:
 	DataReadErrorCode load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) override;


Commit: 4eca244685220f2358613ce0f78a805814de408d
    https://github.com/scummvm/scummvm/commit/4eca244685220f2358613ce0f78a805814de408d
Author: elasota (ejlasota at gmail.com)
Date: 2022-09-11T14:52:43-04:00

Commit Message:
MTROPOLIS: Add more loaders for MTI data

Changed paths:
  A engines/mtropolis/plugin/mti.cpp
  A engines/mtropolis/plugin/mti.h
  A engines/mtropolis/plugin/mti_data.cpp
  A engines/mtropolis/plugin/mti_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/plugins.h
    engines/mtropolis/runtime.cpp


diff --git a/engines/mtropolis/boot.cpp b/engines/mtropolis/boot.cpp
index f663cc9a8bb..74380a9dd35 100644
--- a/engines/mtropolis/boot.cpp
+++ b/engines/mtropolis/boot.cpp
@@ -33,6 +33,7 @@
 #include "mtropolis/runtime.h"
 #include "mtropolis/subtitles.h"
 
+#include "mtropolis/plugin/mti.h"
 #include "mtropolis/plugin/obsidian.h"
 #include "mtropolis/plugin/standard.h"
 #include "mtropolis/plugins.h"
@@ -376,6 +377,25 @@ Common::SharedPtr<Obsidian::WordGameData> ObsidianGameDataHandler::loadWinWordGa
 	return wgData;
 }
 
+class MTIGameDataHandler : public GameDataHandler {
+public:
+	MTIGameDataHandler(const Game &game, const MTropolisGameDescription &gameDesc);
+
+	void addPlugIns(ProjectDescription &projectDesc, const Common::Array<FileIdentification> &files) override;
+};
+
+MTIGameDataHandler::MTIGameDataHandler(const Game &game, const MTropolisGameDescription &gameDesc) : GameDataHandler(game, gameDesc) {
+}
+
+void MTIGameDataHandler::addPlugIns(ProjectDescription &projectDesc, const Common::Array<FileIdentification> &files) {
+	Common::SharedPtr<MTropolis::PlugIn> mtiPlugIn(new MTI::MTIPlugIn());
+	projectDesc.addPlugIn(mtiPlugIn);
+
+	Common::SharedPtr<MTropolis::PlugIn> standardPlugIn = PlugIns::createStandard();
+	static_cast<Standard::StandardPlugIn *>(standardPlugIn.get())->getHacks().allowGarbledListModData = true;
+	projectDesc.addPlugIn(standardPlugIn);
+}
+
 static bool getMacTypesForMacBinary(const char *fileName, uint32 &outType, uint32 &outCreator) {
 	Common::SharedPtr<Common::SeekableReadStream> stream(SearchMan.createReadStreamForMember(fileName));
 
@@ -862,7 +882,7 @@ const Game games[] = {
 		mtiRetailWinFiles,
 		mtiRetailWinDirectories,
 		nullptr,
-		GameDataHandlerFactory<GameDataHandler>::create
+		GameDataHandlerFactory<MTIGameDataHandler>::create
 	},
 	// Muppet Treasure Island - Demo - Windows
 	{
@@ -870,7 +890,7 @@ const Game games[] = {
 		mtiDemoWinFiles,
 		nullptr,
 		nullptr,
-		GameDataHandlerFactory<GameDataHandler>::create
+		GameDataHandlerFactory<MTIGameDataHandler>::create
 	},
 };
 
diff --git a/engines/mtropolis/data.cpp b/engines/mtropolis/data.cpp
index 10be8b89305..95d1b92732f 100644
--- a/engines/mtropolis/data.cpp
+++ b/engines/mtropolis/data.cpp
@@ -1170,6 +1170,20 @@ DataReadErrorCode MiniscriptModifier::load(DataReader &reader) {
 	return kDataReadErrorNone;
 }
 
+ColorTableModifier::ColorTableModifier() : applyWhen(Event::createDefault()), unknown1(0), unknown2{0, 0, 0, 0}, assetID(0) {
+}
+
+DataReadErrorCode ColorTableModifier::load(DataReader &reader) {
+	if (_revision != 1001)
+		return kDataReadErrorUnsupportedRevision;
+
+	if (!modHeader.load(reader) || !applyWhen.load(reader) || !reader.readU32(unknown1)
+		|| !reader.readBytes(unknown2) || !reader.readU32(assetID))
+		return kDataReadErrorReadFailed;
+
+	return kDataReadErrorNone;
+}
+
 SaveAndRestoreModifier::SaveAndRestoreModifier()
 	: unknown1{0, 0, 0, 0}, saveWhen(Event::createDefault()), restoreWhen(Event::createDefault()),
 	  unknown5{0, 0, 0, 0, 0, 0, 0, 0}, lengthOfFilePath(0), lengthOfFileName(0), lengthOfVariableName(0), lengthOfVariableString(0) {
@@ -2272,6 +2286,9 @@ DataReadErrorCode loadDataObject(const PlugInModifierRegistry &registry, DataRea
 	case DataObjectTypes::kMiniscriptModifier:
 		dataObject = new MiniscriptModifier();
 		break;
+	case DataObjectTypes::kColorTableModifier:
+		dataObject = new ColorTableModifier();
+		break;
 	case DataObjectTypes::kSaveAndRestoreModifier:
 		dataObject = new SaveAndRestoreModifier();
 		break;
diff --git a/engines/mtropolis/data.h b/engines/mtropolis/data.h
index 38854d773b2..18174e54dfd 100644
--- a/engines/mtropolis/data.h
+++ b/engines/mtropolis/data.h
@@ -125,7 +125,7 @@ enum DataObjectType {
 	kMiniscriptModifier						= 0x3c0,
 	kCursorModifierV1						= 0x3ca,	// NYI - Obsolete version
 	kGradientModifier						= 0x4b0,	// NYI
-	kColorTableModifier						= 0x4c4,	// NYI
+	kColorTableModifier						= 0x4c4,
 	kSaveAndRestoreModifier					= 0x4d8,
 
 	kCompoundVariableModifier				= 0x2c7,
@@ -936,6 +936,18 @@ protected:
 	DataReadErrorCode load(DataReader &reader) override;
 };
 
+struct ColorTableModifier : public DataObject {
+	ColorTableModifier();
+
+	TypicalModifierHeader modHeader;
+	Event applyWhen;
+	uint32 unknown1;
+	uint8 unknown2[4];
+	uint32 assetID;
+
+protected:
+	DataReadErrorCode load(DataReader &reader) override;
+};
 
 struct SaveAndRestoreModifier : public DataObject {
 	SaveAndRestoreModifier();
diff --git a/engines/mtropolis/modifier_factory.cpp b/engines/mtropolis/modifier_factory.cpp
index 0a4db6720c8..44d99e1ce2e 100644
--- a/engines/mtropolis/modifier_factory.cpp
+++ b/engines/mtropolis/modifier_factory.cpp
@@ -73,6 +73,8 @@ SIModifierFactory *getModifierFactoryForDataObjectType(const Data::DataObjectTyp
 		return ModifierFactory<BehaviorModifier, Data::BehaviorModifier>::getInstance();
 	case Data::DataObjectTypes::kMiniscriptModifier:
 		return ModifierFactory<MiniscriptModifier, Data::MiniscriptModifier>::getInstance();
+	case Data::DataObjectTypes::kColorTableModifier:
+		return ModifierFactory<ColorTableModifier, Data::ColorTableModifier>::getInstance();
 	case Data::DataObjectTypes::kSaveAndRestoreModifier:
 		return ModifierFactory<SaveAndRestoreModifier, Data::SaveAndRestoreModifier>::getInstance();
 	case Data::DataObjectTypes::kAliasModifier:
diff --git a/engines/mtropolis/modifiers.cpp b/engines/mtropolis/modifiers.cpp
index 85910cf9faf..b67678a1f8f 100644
--- a/engines/mtropolis/modifiers.cpp
+++ b/engines/mtropolis/modifiers.cpp
@@ -255,6 +255,37 @@ void MiniscriptModifier::visitInternalReferences(IStructuralReferenceVisitor *vi
 	_references->visitInternalReferences(visitor);
 }
 
+ColorTableModifier::ColorTableModifier() : _assetID(0xffffffff) {
+}
+
+bool ColorTableModifier::load(ModifierLoaderContext &context, const Data::ColorTableModifier &data) {
+	if (!loadTypicalHeader(data.modHeader))
+		return false;
+
+	if (!_applyWhen.load(data.applyWhen))
+		return false;
+
+	_assetID = data.assetID;
+
+	return true;
+}
+
+bool ColorTableModifier::respondsToEvent(const Event &evt) const {
+	return _applyWhen.respondsTo(evt);
+}
+
+VThreadState ColorTableModifier::consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) {
+	return kVThreadReturn;
+}
+
+Common::SharedPtr<Modifier> ColorTableModifier::shallowClone() const {
+	return Common::SharedPtr<Modifier>(new ColorTableModifier(*this));
+}
+
+const char *ColorTableModifier::getDefaultName() const {
+	return "Color Table Modifier";
+}
+
 bool SaveAndRestoreModifier::load(ModifierLoaderContext &context, const Data::SaveAndRestoreModifier &data) {
 	if (!loadTypicalHeader(data.modHeader))
 		return false;
diff --git a/engines/mtropolis/modifiers.h b/engines/mtropolis/modifiers.h
index 404f0e72b68..8ee4b7cf95e 100644
--- a/engines/mtropolis/modifiers.h
+++ b/engines/mtropolis/modifiers.h
@@ -125,6 +125,31 @@ private:
 	Common::SharedPtr<MiniscriptReferences> _references;
 };
 
+class ColorTableModifier : public Modifier {
+public:
+	ColorTableModifier();
+
+	bool load(ModifierLoaderContext &context, const Data::ColorTableModifier &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 "Color Table Modifier"; }
+	SupportStatus debugGetSupportStatus() const override { return kSupportStatusNone; }
+#endif
+
+private:
+	Common::SharedPtr<Modifier> shallowClone() const override;
+	const char *getDefaultName() const override;
+
+	Event _applyWhen;
+
+	uint32 _assetID;
+};
+
 class SaveAndRestoreModifier : public Modifier {
 public:
 	bool load(ModifierLoaderContext &context, const Data::SaveAndRestoreModifier &data);
diff --git a/engines/mtropolis/module.mk b/engines/mtropolis/module.mk
index 523ceed12d2..58380f6ce68 100644
--- a/engines/mtropolis/module.mk
+++ b/engines/mtropolis/module.mk
@@ -16,6 +16,8 @@ MODULE_OBJS = \
 	modifiers.o \
 	modifier_factory.o \
 	mtropolis.o \
+	plugin/mti.o \
+	plugin/mti_data.o \
 	plugin/obsidian.o \
 	plugin/obsidian_data.o \
 	plugin/standard.o \
diff --git a/engines/mtropolis/plugin/mti.cpp b/engines/mtropolis/plugin/mti.cpp
new file mode 100644
index 00000000000..3b4c9e4a393
--- /dev/null
+++ b/engines/mtropolis/plugin/mti.cpp
@@ -0,0 +1,121 @@
+/* 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/managed_surface.h"
+
+#include "mtropolis/plugin/mti.h"
+#include "mtropolis/plugins.h"
+
+#include "mtropolis/miniscript.h"
+
+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() {
+}
+
+ShanghaiModifier::~ShanghaiModifier() {
+}
+
+bool ShanghaiModifier::respondsToEvent(const Event &evt) const {
+	return false;
+}
+
+VThreadState ShanghaiModifier::consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) {
+	return kVThreadReturn;
+}
+
+void ShanghaiModifier::disable(Runtime *runtime) {
+}
+
+bool ShanghaiModifier::load(const PlugInModifierLoaderContext &context, const Data::MTI::ShanghaiModifier &data) {
+	return true;
+}
+
+#ifdef MTROPOLIS_DEBUG_ENABLE
+void ShanghaiModifier::debugInspect(IDebugInspectionReport *report) const {
+}
+#endif
+
+Common::SharedPtr<Modifier> ShanghaiModifier::shallowClone() const {
+	return Common::SharedPtr<Modifier>(new ShanghaiModifier(*this));
+}
+
+const char *ShanghaiModifier::getDefaultName() const {
+	return "Shanghai Modifier";	// ???
+}
+
+MTIPlugIn::MTIPlugIn()
+	: _panningModifierFactory(this), _shanghaiModifierFactory(this) {
+}
+
+void MTIPlugIn::registerModifiers(IPlugInModifierRegistrar *registrar) const {
+	registrar->registerPlugInModifier("panning", &_panningModifierFactory);
+	registrar->registerPlugInModifier("Shanghai", &_shanghaiModifierFactory);
+}
+
+
+} // namespace MTI
+
+namespace PlugIns {
+
+Common::SharedPtr<PlugIn> createMTI() {
+	return Common::SharedPtr<PlugIn>(new MTI::MTIPlugIn());
+}
+
+} // End of namespace PlugIns
+
+} // End of namespace MTropolis
diff --git a/engines/mtropolis/plugin/mti.h b/engines/mtropolis/plugin/mti.h
new file mode 100644
index 00000000000..907a807fef7
--- /dev/null
+++ b/engines/mtropolis/plugin/mti.h
@@ -0,0 +1,95 @@
+/* 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_MTI_H
+#define MTROPOLIS_PLUGIN_MTI_H
+
+#include "mtropolis/modifier_factory.h"
+#include "mtropolis/modifiers.h"
+#include "mtropolis/plugin/mti_data.h"
+#include "mtropolis/runtime.h"
+
+namespace MTropolis {
+
+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();
+	~ShanghaiModifier();
+
+	bool respondsToEvent(const Event &evt) const override;
+	VThreadState consumeMessage(Runtime *runtime, const Common::SharedPtr<MessageProperties> &msg) override;
+	void disable(Runtime *runtime) override;
+
+	bool load(const PlugInModifierLoaderContext &context, const Data::MTI::ShanghaiModifier &data);
+
+#ifdef MTROPOLIS_DEBUG_ENABLE
+	const char *debugGetTypeName() const override { return "Shanghai Modifier"; }
+	void debugInspect(IDebugInspectionReport *report) const override;
+#endif
+
+private:
+	Common::SharedPtr<Modifier> shallowClone() const override;
+	const char *getDefaultName() const override;
+};
+
+
+class MTIPlugIn : public MTropolis::PlugIn {
+public:
+	MTIPlugIn();
+
+	void registerModifiers(IPlugInModifierRegistrar *registrar) const override;
+
+private:
+	PlugInModifierFactory<PanningModifier, Data::MTI::PanningModifier> _panningModifierFactory;
+	PlugInModifierFactory<ShanghaiModifier, Data::MTI::ShanghaiModifier> _shanghaiModifierFactory;
+};
+
+} // End of namespace MTI
+
+} // End of namespace MTropolis
+
+#endif
diff --git a/engines/mtropolis/plugin/mti_data.cpp b/engines/mtropolis/plugin/mti_data.cpp
new file mode 100644
index 00000000000..06cf82039de
--- /dev/null
+++ b/engines/mtropolis/plugin/mti_data.cpp
@@ -0,0 +1,55 @@
+/* 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/mti_data.h"
+
+namespace MTropolis {
+
+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;
+
+	if (!unknown1Event.load(reader) || !unknown2VarRef.load(reader))
+		return kDataReadErrorReadFailed;
+
+	return kDataReadErrorNone;
+}
+
+
+} // End of namespace MTI
+
+} // End of namespace Data
+
+} // End of namespace MTropolis
diff --git a/engines/mtropolis/plugin/mti_data.h b/engines/mtropolis/plugin/mti_data.h
new file mode 100644
index 00000000000..8d3ef59b986
--- /dev/null
+++ b/engines/mtropolis/plugin/mti_data.h
@@ -0,0 +1,62 @@
+/* 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_MTI_DATA_H
+#define MTROPOLIS_PLUGIN_MTI_DATA_H
+
+#include "mtropolis/data.h"
+
+namespace MTropolis {
+
+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)
+
+protected:
+	DataReadErrorCode load(PlugIn &plugIn, const PlugInModifier &prefix, DataReader &reader) override;
+};
+
+} // End of namespace MTI
+
+} // End of namespace Data
+
+} // End of namespace MTropolis
+
+#endif
diff --git a/engines/mtropolis/plugins.h b/engines/mtropolis/plugins.h
index 107d05e74c7..d998c7911bb 100644
--- a/engines/mtropolis/plugins.h
+++ b/engines/mtropolis/plugins.h
@@ -40,6 +40,7 @@ namespace PlugIns {
 
 Common::SharedPtr<PlugIn> createStandard();
 Common::SharedPtr<PlugIn> createObsidian(const Common::SharedPtr<Obsidian::WordGameData> &wgData);
+Common::SharedPtr<PlugIn> createMTI();
 
 } // End of namespace PlugIns
 
diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index 37ea9f3affd..7537a92a32e 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -6645,6 +6645,10 @@ void Project::loadBootStream(size_t streamIndex, const Hacks &hacks) {
 
 	size_t numObjectsLoaded = 0;
 	while (stream.pos() != streamDesc.size) {
+		uint64 streamPos = stream.pos();
+
+		debug(3, "Loading boot object from %x (abs %x)", static_cast<int>(streamPos), static_cast<int>(streamDesc.pos + streamPos));
+
 		Common::SharedPtr<Data::DataObject> dataObject;
 		Data::loadDataObject(plugInDataLoaderRegistry, reader, dataObject);
 




More information about the Scummvm-git-logs mailing list