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

elasota noreply at scummvm.org
Sun Nov 13 22:02:13 UTC 2022


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

Summary:
0c70527b03 MTROPOLIS: Add some more attributes for SPQR.
170472b718 MTROPOLIS: Fix multiple ".." object reference paths not resolving correctly.
7da5f964ea MTROPOLIS: Fix shared scene modifiers not setting active shared scene correctly.
875db95d52 MTROPOLIS: Don't use default shared scene if one was ever set explicitly.  Allow propagation of command-type messages se
7aca46a375 MTROPOLIS: Fix string dereference crash.


Commit: 0c70527b03479b035ce9d5f3f93541e90d343fa9
    https://github.com/scummvm/scummvm/commit/0c70527b03479b035ce9d5f3f93541e90d343fa9
Author: elasota (ejlasota at gmail.com)
Date: 2022-11-13T17:01:36-05:00

Commit Message:
MTROPOLIS: Add some more attributes for SPQR.

Changed paths:
    engines/mtropolis/runtime.cpp
    engines/mtropolis/runtime.h


diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index ab8a5acddaa..a79a7d424fc 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -2645,7 +2645,7 @@ void MessageProperties::setValue(const DynamicValue &value) {
 		_value = value;
 }
 
-WorldManagerInterface::WorldManagerInterface() : _gameMode(false) {
+WorldManagerInterface::WorldManagerInterface() : _gameMode(false), _combineRedraws(true), _opInt(0) {
 }
 
 bool WorldManagerInterface::readAttribute(MiniscriptThread *thread, DynamicValue &result, const Common::String &attrib) {
@@ -2663,10 +2663,12 @@ bool WorldManagerInterface::readAttribute(MiniscriptThread *thread, DynamicValue
 
 		result.setInt(bitDepth);
 		return true;
-	}
-	else if (attrib == "gamemode") {
+	} else if (attrib == "gamemode") {
 		result.setBool(_gameMode);
 		return true;
+	} else if (attrib == "combineredraws") {
+		result.setBool(_combineRedraws);
+		return true;
 	}
 
 	return RuntimeObject::readAttribute(thread, result, attrib);
@@ -2676,24 +2678,30 @@ MiniscriptInstructionOutcome WorldManagerInterface::writeRefAttribute(Miniscript
 	if (attrib == "currentscene") {
 		DynamicValueWriteFuncHelper<WorldManagerInterface, &WorldManagerInterface::setCurrentScene, true>::create(this, result);
 		return kMiniscriptInstructionOutcomeContinue;
-	}
-	if (attrib == "refreshcursor") {
+	} else if (attrib == "refreshcursor") {
 		DynamicValueWriteFuncHelper<WorldManagerInterface, &WorldManagerInterface::setRefreshCursor, true>::create(this, result);
 		return kMiniscriptInstructionOutcomeContinue;
-	}
-	if (attrib == "autoresetcursor") {
+	} else if (attrib == "autoresetcursor") {
 		DynamicValueWriteFuncHelper<WorldManagerInterface, &WorldManagerInterface::setAutoResetCursor, true>::create(this, result);
 		return kMiniscriptInstructionOutcomeContinue;
-	}
-	if (attrib == "winsndbuffersize") {
+	} else if (attrib == "winsndbuffersize") {
 		DynamicValueWriteFuncHelper<WorldManagerInterface, &WorldManagerInterface::setWinSndBufferSize, true>::create(this, result);
 		return kMiniscriptInstructionOutcomeContinue;
-	}
-	if (attrib == "gamemode") {
+	} else if (attrib == "gamemode") {
 		DynamicValueWriteBoolHelper::create(&_gameMode, result);
 		return kMiniscriptInstructionOutcomeContinue;
-	}
-	if (attrib == "scenefades") {
+	} else if (attrib == "combineredraws") {
+		DynamicValueWriteBoolHelper::create(&_combineRedraws, result);
+		return kMiniscriptInstructionOutcomeContinue;
+	} else if (attrib == "qtpalettehack") {
+		DynamicValueWriteDiscardHelper::create(result);
+		return kMiniscriptInstructionOutcomeContinue;
+	} else if (attrib == "opint") {
+		// This is used by SPQR before changing scenes in many instances.  It's not clear what it does.
+		// It's usually set to 2 or 4, sometimes 7
+		DynamicValueWriteIntegerHelper<int32>::create(&_opInt, result);
+		return kMiniscriptInstructionOutcomeContinue;
+	} else if (attrib == "scenefades") {
 		// TODO
 		DynamicValueWriteDiscardHelper::create(result);
 		return kMiniscriptInstructionOutcomeContinue;
@@ -6620,7 +6628,7 @@ VThreadState Project::consumeCommand(Runtime *runtime, const Common::SharedPtr<M
 }
 
 MiniscriptInstructionOutcome Project::writeRefAttribute(MiniscriptThread *thread, DynamicValueWriteProxy &result, const Common::String &attrib) {
-	if (attrib == "allowquit") {
+	if (attrib == "allowquit" || attrib == "allowquitkey") {
 		DynamicValueWriteDiscardHelper::create(result);
 		return kMiniscriptInstructionOutcomeContinue;
 	}
diff --git a/engines/mtropolis/runtime.h b/engines/mtropolis/runtime.h
index d3fe79b85c7..9aa416b31c5 100644
--- a/engines/mtropolis/runtime.h
+++ b/engines/mtropolis/runtime.h
@@ -2022,7 +2022,9 @@ private:
 	MiniscriptInstructionOutcome setAutoResetCursor(MiniscriptThread *thread, const DynamicValue &value);
 	MiniscriptInstructionOutcome setWinSndBufferSize(MiniscriptThread *thread, const DynamicValue &value);
 
+	int32 _opInt;
 	bool _gameMode;
+	bool _combineRedraws;
 };
 
 class AssetManagerInterface : public RuntimeObject {


Commit: 170472b7182a775946e5b1a11a50f2bfff2d8680
    https://github.com/scummvm/scummvm/commit/170472b7182a775946e5b1a11a50f2bfff2d8680
Author: elasota (ejlasota at gmail.com)
Date: 2022-11-13T17:01:36-05:00

Commit Message:
MTROPOLIS: Fix multiple ".." object reference paths not resolving correctly.

Changed paths:
    engines/mtropolis/plugin/standard.cpp


diff --git a/engines/mtropolis/plugin/standard.cpp b/engines/mtropolis/plugin/standard.cpp
index 8c33c92bdec..3c2ab192a8c 100644
--- a/engines/mtropolis/plugin/standard.cpp
+++ b/engines/mtropolis/plugin/standard.cpp
@@ -2155,6 +2155,8 @@ void ObjectReferenceVariableModifier::resolveRelativePath(RuntimeObject *obj, co
 			obj = getObjectParent(obj);
 			if (obj == nullptr)
 				return;
+
+			continue;
 		}
 
 		const Common::Array<Common::SharedPtr<Modifier> > *modifierChildren = nullptr;


Commit: 7da5f964eaad19507902b4ec1b8102f138a24151
    https://github.com/scummvm/scummvm/commit/7da5f964eaad19507902b4ec1b8102f138a24151
Author: elasota (ejlasota at gmail.com)
Date: 2022-11-13T17:01:37-05:00

Commit Message:
MTROPOLIS: Fix shared scene modifiers not setting active shared scene correctly.

Changed paths:
    engines/mtropolis/runtime.cpp


diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index a79a7d424fc..51ad25c7510 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -4872,6 +4872,8 @@ void Runtime::executeHighLevelSceneTransition(const HighLevelSceneTransition &tr
 				sharedSceneEntry.scene = targetSharedScene;
 
 				_sceneStack[0] = sharedSceneEntry;
+
+				_activeSharedScene = targetSharedScene;
 			}
 		} break;
 	default:


Commit: 875db95d527ee75cd5f6e99d194b0c8fd5a4b275
    https://github.com/scummvm/scummvm/commit/875db95d527ee75cd5f6e99d194b0c8fd5a4b275
Author: elasota (ejlasota at gmail.com)
Date: 2022-11-13T17:01:38-05:00

Commit Message:
MTROPOLIS: Don't use default shared scene if one was ever set explicitly.  Allow propagation of command-type messages sent to behaviors.  This should fix SPQR palette changes.

Changed paths:
    engines/mtropolis/runtime.cpp
    engines/mtropolis/runtime.h


diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index 51ad25c7510..2f97fd38c6c 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -3042,6 +3042,14 @@ bool Structural::readAttribute(MiniscriptThread *thread, DynamicValue &result, c
 	} else if (attrib == "flushpriority") {
 		result.setInt(_flushPriority);
 		return true;
+	} else if (attrib == "firstchild") {
+		// Despite documentation describing modifiers as children, "firstchild" on a structural element always returns
+		// the first structural child.
+		if (_children.size() == 0)
+			result.clear();
+		else
+			result.setObject(_children[0]->getSelfReference());
+		return true;
 	}
 
 	// Traverse children (modifiers must be first)
@@ -3639,19 +3647,17 @@ MessageDispatch::MessageDispatch(const Common::SharedPtr<MessageProperties> &msg
 
 MessageDispatch::MessageDispatch(const Common::SharedPtr<MessageProperties> &msgProps, Modifier *root, bool cascade, bool relay, bool couldBeCommand)
 	: _cascade(cascade), _relay(relay), _terminated(false), _msg(msgProps), _isCommand(false) {
-	if (couldBeCommand && EventIDs::isCommand(msgProps->getEvent().eventType)) {
-		_isCommand = true;
-		// Can't actually send this so don't even bother.  Modifiers are not allowed to respond to commands.
-	} else {
-		PropagationStack topEntry;
-		topEntry.index = 0;
-		topEntry.propagationStage = PropagationStack::kStageCheckAndSendToModifier;
-		topEntry.ptr.modifier = root;
 
-		_isCommand = (couldBeCommand && EventIDs::isCommand(msgProps->getEvent().eventType));
+	// Apparently if a command message is sent to a modifier, it's handled as a message.
+	// SPQR depends on this to send "Element Select" messages to pick the palette.
+	PropagationStack topEntry;
+	topEntry.index = 0;
+	topEntry.propagationStage = PropagationStack::kStageCheckAndSendToModifier;
+	topEntry.ptr.modifier = root;
 
-		_propagationStack.push_back(topEntry);
-	}
+	_isCommand = false;
+
+	_propagationStack.push_back(topEntry);
 
 	_root = root->getSelfReference();
 }
@@ -4140,7 +4146,7 @@ Runtime::Runtime(OSystem *system, Audio::Mixer *mixer, ISaveUIProvider *saveProv
 	  _cachedMousePosition(Common::Point(0, 0)), _realMousePosition(Common::Point(0, 0)), _trackedMouseOutside(false),
 	  _forceCursorRefreshOnce(true), _autoResetCursor(false), _haveModifierOverrideCursor(false), _sceneGraphChanged(false), _isQuitting(false),
 	  _collisionCheckTime(0), _defaultVolumeState(true), _activeSceneTransitionEffect(nullptr), _sceneTransitionStartTime(0), _sceneTransitionEndTime(0),
-	  _modifierOverrideCursorID(0), _subtitleRenderer(subRenderer) {
+	  _sharedSceneWasSetExplicitly(false), _modifierOverrideCursorID(0), _subtitleRenderer(subRenderer) {
 	_random.reset(new Common::RandomSource("mtropolis"));
 
 	_vthread.reset(new VThread());
@@ -4677,7 +4683,12 @@ void Runtime::executeCompleteTransitionToScene(const Common::SharedPtr<Structura
 	if (_sceneStack.size() == 0)
 		_sceneStack.resize(1);	// Reserve shared scene slot
 
-	Common::SharedPtr<Structural> targetSharedScene = findDefaultSharedSceneForScene(targetScene.get());
+	Common::SharedPtr<Structural> targetSharedScene;
+
+	if (_sharedSceneWasSetExplicitly)
+		targetSharedScene = _activeSharedScene;
+	else
+		targetSharedScene = findDefaultSharedSceneForScene(targetScene.get());
 
 	for (const Common::SharedPtr<SceneTransitionHooks> &hooks : _hacks.sceneTransitionHooks)
 		hooks->onSceneTransitionSetup(this, _activeMainScene, targetScene);
@@ -4796,7 +4807,12 @@ void Runtime::executeHighLevelSceneTransition(const HighLevelSceneTransition &tr
 
 			if (transition.addToDestinationScene) {
 				if (targetScene != _activeMainScene) {
-					Common::SharedPtr<Structural> targetSharedScene = findDefaultSharedSceneForScene(targetScene.get());
+					Common::SharedPtr<Structural> targetSharedScene;
+
+					if (_sharedSceneWasSetExplicitly)
+						targetSharedScene = _activeSharedScene;
+					else
+						targetSharedScene = findDefaultSharedSceneForScene(targetScene.get());
 
 					if (targetScene == targetSharedScene)
 						error("Transitioned into a default shared scene, this is not supported");
@@ -4875,6 +4891,8 @@ void Runtime::executeHighLevelSceneTransition(const HighLevelSceneTransition &tr
 
 				_activeSharedScene = targetSharedScene;
 			}
+
+			_sharedSceneWasSetExplicitly = true;
 		} break;
 	default:
 		error("Unknown high-level scene transition type");
diff --git a/engines/mtropolis/runtime.h b/engines/mtropolis/runtime.h
index 9aa416b31c5..006be8d011b 100644
--- a/engines/mtropolis/runtime.h
+++ b/engines/mtropolis/runtime.h
@@ -1835,6 +1835,7 @@ private:
 	Common::SharedPtr<Graphics::ManagedSurface> _sceneTransitionNewFrame;
 	uint32 _sceneTransitionStartTime;
 	uint32 _sceneTransitionEndTime;
+	bool _sharedSceneWasSetExplicitly;
 
 	Common::WeakPtr<Window> _mainWindow;
 	Common::Array<Common::SharedPtr<Window> > _windows;


Commit: 7aca46a37559516f43533e227d0c39d43e9ff4ec
    https://github.com/scummvm/scummvm/commit/7aca46a37559516f43533e227d0c39d43e9ff4ec
Author: elasota (ejlasota at gmail.com)
Date: 2022-11-13T17:01:39-05:00

Commit Message:
MTROPOLIS: Fix string dereference crash.

Changed paths:
    engines/mtropolis/runtime.cpp


diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index 2f97fd38c6c..024e8740f68 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -1884,7 +1884,7 @@ MiniscriptInstructionOutcome DynamicValueWriteStringHelper::write(MiniscriptThre
 	Common::String &dest = *static_cast<Common::String *>(objectRef);
 	switch (derefValue.getType()) {
 	case DynamicValueTypes::kString:
-		dest = value.getString();
+		dest = derefValue.getString();
 		return kMiniscriptInstructionOutcomeContinue;
 	default:
 		return kMiniscriptInstructionOutcomeFailed;




More information about the Scummvm-git-logs mailing list