[Scummvm-git-logs] scummvm master -> 818b0bc6186319c2915594cd23bcb86fb5c40b6d

elasota noreply at scummvm.org
Thu Jul 4 19:56:43 UTC 2024


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

Summary:
e212224d1f MTROPOLIS: Permit var references to reference non-variable modifiers
9d16f99f1b MTROPOLIS: Fix missing linkInternalReferences and visitInternalReferences in SaveAndRestoreModifier
e7fbd26afa MTROPOLIS: Produce a reference to the var instead of the var contents from var ref sources
818b0bc618 MTROPOLIS: Coerce vector sources for Vector Motion Modifier instead of check


Commit: e212224d1fdf460bc45d950cd388211fa4114f33
    https://github.com/scummvm/scummvm/commit/e212224d1fdf460bc45d950cd388211fa4114f33
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2024-07-04T15:56:20-04:00

Commit Message:
MTROPOLIS: Permit var references to reference non-variable modifiers

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


diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index 6d8c0ac821f..5663f9f2594 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -2428,11 +2428,10 @@ void VarReference::linkInternalReferences(ObjectLinkingScope *scope) {
 			warning("VarReference to '%s' failed to resolve a valid object", source.c_str());
 		} else {
 			Common::SharedPtr<RuntimeObject> objShr = obj.lock();
-			if (objShr->isModifier() && static_cast<Modifier *>(objShr.get())->isVariable()) {
+			if (objShr->isModifier())
 				this->resolution = obj.staticCast<Modifier>();
-			} else {
-				error("VarReference referenced a non-variable");
-			}
+			else
+				warning("VarReference to '%s' wasn't a modifier", source.c_str());
 		}
 	}
 }
diff --git a/engines/mtropolis/runtime.h b/engines/mtropolis/runtime.h
index b2a5c267950..97f9022a5e3 100644
--- a/engines/mtropolis/runtime.h
+++ b/engines/mtropolis/runtime.h
@@ -408,7 +408,7 @@ struct VarReference {
 
 	uint32 guid;
 	Common::String source;
-	Common::WeakPtr<Modifier> resolution;
+	Common::WeakPtr<Modifier> resolution;	// NOTE: This may not be a variable
 
 	inline bool operator==(const VarReference &other) const {
 		return guid == other.guid && source == other.source;


Commit: 9d16f99f1bd7aed6ad418779e2855edd7675f91d
    https://github.com/scummvm/scummvm/commit/9d16f99f1bd7aed6ad418779e2855edd7675f91d
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2024-07-04T15:56:20-04:00

Commit Message:
MTROPOLIS: Fix missing linkInternalReferences and visitInternalReferences in SaveAndRestoreModifier

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


diff --git a/engines/mtropolis/modifiers.cpp b/engines/mtropolis/modifiers.cpp
index ea030f4832e..763fef911d1 100644
--- a/engines/mtropolis/modifiers.cpp
+++ b/engines/mtropolis/modifiers.cpp
@@ -451,6 +451,18 @@ VThreadState SaveAndRestoreModifier::consumeMessage(Runtime *runtime, const Comm
 	return kVThreadError;
 }
 
+void SaveAndRestoreModifier::linkInternalReferences(ObjectLinkingScope *scope) {
+	Modifier::linkInternalReferences(scope);
+
+	_saveOrRestoreValue.linkInternalReferences(scope);
+}
+
+void SaveAndRestoreModifier::visitInternalReferences(IStructuralReferenceVisitor *visitor) {
+	Modifier::visitInternalReferences(visitor);
+
+	_saveOrRestoreValue.visitInternalReferences(visitor);
+}
+
 Common::SharedPtr<Modifier> SaveAndRestoreModifier::shallowClone() const {
 	return Common::SharedPtr<Modifier>(new SaveAndRestoreModifier(*this));
 }
diff --git a/engines/mtropolis/modifiers.h b/engines/mtropolis/modifiers.h
index 7742d4ddfae..1545c6a2ca3 100644
--- a/engines/mtropolis/modifiers.h
+++ b/engines/mtropolis/modifiers.h
@@ -194,6 +194,10 @@ public:
 	SupportStatus debugGetSupportStatus() const override { return kSupportStatusDone; }
 #endif
 
+protected:
+	void linkInternalReferences(ObjectLinkingScope *scope) override;
+	void visitInternalReferences(IStructuralReferenceVisitor *visitor) override;
+
 private:
 	Common::SharedPtr<Modifier> shallowClone() const override;
 	const char *getDefaultName() const override;


Commit: e7fbd26afa8b6a5b260864f597996eedca62ecc5
    https://github.com/scummvm/scummvm/commit/e7fbd26afa8b6a5b260864f597996eedca62ecc5
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2024-07-04T15:56:20-04:00

Commit Message:
MTROPOLIS: Produce a reference to the var instead of the var contents from var ref sources

Changed paths:
    engines/mtropolis/runtime.cpp


diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index 5663f9f2594..437a5fd5696 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -1881,15 +1881,9 @@ DynamicValue DynamicValueSource::produceValue(const DynamicValue &incomingData)
 	case DynamicValueSourceTypes::kIncomingData:
 		return incomingData;
 	case DynamicValueSourceTypes::kVariableReference: {
-			Common::SharedPtr<Modifier> resolution = _valueUnion._varReference.resolution.lock();
-			if (resolution && resolution->isVariable()) {
-				DynamicValue result;
-				static_cast<VariableModifier *>(resolution.get())->varGetValue(result);
-				return result;
-			} else {
-				warning("Dynamic value source wasn't a variable");
-				return DynamicValue();
-			}
+			DynamicValue result;
+			result.setObject(_valueUnion._varReference.resolution);
+			return result;
 		} break;
 	default:
 		warning("Dynamic value couldn't be resolved");


Commit: 818b0bc6186319c2915594cd23bcb86fb5c40b6d
    https://github.com/scummvm/scummvm/commit/818b0bc6186319c2915594cd23bcb86fb5c40b6d
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2024-07-04T15:56:20-04:00

Commit Message:
MTROPOLIS: Coerce vector sources for Vector Motion Modifier instead of check

This is necessary since they are now correctly receiving the var reference instead of a raw vector value

Changed paths:
    engines/mtropolis/modifiers.cpp


diff --git a/engines/mtropolis/modifiers.cpp b/engines/mtropolis/modifiers.cpp
index 763fef911d1..055839b80eb 100644
--- a/engines/mtropolis/modifiers.cpp
+++ b/engines/mtropolis/modifiers.cpp
@@ -1417,7 +1417,7 @@ VThreadState VectorMotionModifier::consumeMessage(Runtime *runtime, const Common
 	if (_enableWhen.respondsTo(msg->getEvent())) {
 		DynamicValue vec = _vec.produceValue(msg->getValue());
 
-		if (vec.getType() != DynamicValueTypes::kVector) {
+		if (!vec.convertToType(DynamicValueTypes::kVector, vec)) {
 #ifdef MTROPOLIS_DEBUG_ENABLE
 			if (Debugger *debugger = runtime->debugGetDebugger())
 				debugger->notify(kDebugSeverityError, "Vector value was not actually a vector");
@@ -1459,7 +1459,7 @@ void VectorMotionModifier::trigger(Runtime *runtime) {
 	if (_vec.getSourceType() == DynamicValueSourceTypes::kVariableReference) {
 		DynamicValue vec = _vec.produceValue(DynamicValue());
 
-		if (vec.getType() == DynamicValueTypes::kVector)
+		if (vec.convertToType(DynamicValueTypes::kVector, vec))
 			_resolvedVector = vec.getVector();
 	}
 




More information about the Scummvm-git-logs mailing list