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

elasota noreply at scummvm.org
Sat Jul 2 04:11:02 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:
fa7d5f3d73 MTROPOLIS: Quietly ignore Flush All Media command
ec0867af3a MTROPOLIS: Implement Stop command for sound elements.


Commit: fa7d5f3d73e4bd746c553fb6b2ee73ed3f2e115f
    https://github.com/scummvm/scummvm/commit/fa7d5f3d73e4bd746c553fb6b2ee73ed3f2e115f
Author: elasota (ejlasota at gmail.com)
Date: 2022-07-02T00:09:26-04:00

Commit Message:
MTROPOLIS: Quietly ignore Flush All Media command

Changed paths:
    engines/mtropolis/runtime.cpp


diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index c87ab2c0278..c39adf4f1ef 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -2984,9 +2984,17 @@ VThreadState Structural::consumeCommand(Runtime *runtime, const Common::SharedPt
 		return kVThreadReturn;
 	}
 
-	if (Event::create(EventIDs::kPreloadMedia, 0).respondsTo(msg->getEvent()) || Event::create(EventIDs::kFlushMedia, 0).respondsTo(msg->getEvent()) || Event::create(EventIDs::kPrerollMedia, 0).respondsTo(msg->getEvent())) {
-		// Just ignore these
-		return kVThreadReturn;
+	// Just ignore these
+	const EventIDs::EventID ignoredIDs[] = {
+		EventIDs::kPreloadMedia,
+		EventIDs::kFlushMedia,
+		EventIDs::kFlushAllMedia,
+		EventIDs::kPrerollMedia
+	};
+
+	for (EventIDs::EventID evtID : ignoredIDs) {
+		if (Event::create(evtID, 0).respondsTo(msg->getEvent()))
+			return kVThreadReturn;
 	}
 
 	warning("Command type %i was ignored", msg->getEvent().eventType);


Commit: ec0867af3a8e8379bee1a601332c31741b044106
    https://github.com/scummvm/scummvm/commit/ec0867af3a8e8379bee1a601332c31741b044106
Author: elasota (ejlasota at gmail.com)
Date: 2022-07-02T00:09:59-04:00

Commit Message:
MTROPOLIS: Implement Stop command for sound elements.

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


diff --git a/engines/mtropolis/elements.cpp b/engines/mtropolis/elements.cpp
index e580b811e90..92d35dca30b 100644
--- a/engines/mtropolis/elements.cpp
+++ b/engines/mtropolis/elements.cpp
@@ -2012,6 +2012,12 @@ VThreadState SoundElement::consumeCommand(Runtime *runtime, const Common::Shared
 
 		return kVThreadReturn;
 	}
+	if (Event::create(EventIDs::kStop, 0).respondsTo(msg->getEvent())) {
+		StartPlayingTaskData *startPlayingTaskData = runtime->getVThread().pushTask("SoundElement::stopPlayingTask", this, &SoundElement::stopPlayingTask);
+		startPlayingTaskData->runtime = runtime;
+
+		return kVThreadReturn;
+	}
 
 	return NonVisualElement::consumeCommand(runtime, msg);
 }
@@ -2186,4 +2192,16 @@ VThreadState SoundElement::startPlayingTask(const StartPlayingTaskData &taskData
 	return kVThreadReturn;
 }
 
+VThreadState SoundElement::stopPlayingTask(const StartPlayingTaskData &taskData) {
+	_paused = false;
+	_shouldPlayIfNotPaused = false;
+	_needsReset = true;
+
+	Common::SharedPtr<MessageProperties> msgProps(new MessageProperties(Event::create(EventIDs::kStop, 0), DynamicValue(), getSelfReference()));
+	Common::SharedPtr<MessageDispatch> dispatch(new MessageDispatch(msgProps, this, false, true, false));
+	taskData.runtime->sendMessageOnVThread(dispatch);
+
+	return kVThreadReturn;
+}
+
 } // End of namespace MTropolis
diff --git a/engines/mtropolis/elements.h b/engines/mtropolis/elements.h
index ed8399ff8aa..94ca52902d3 100644
--- a/engines/mtropolis/elements.h
+++ b/engines/mtropolis/elements.h
@@ -352,6 +352,7 @@ private:
 	};
 
 	VThreadState startPlayingTask(const StartPlayingTaskData &taskData);
+	VThreadState stopPlayingTask(const StartPlayingTaskData &taskData);
 
 	void setLoop(bool loop);
 	void setVolume(uint16 volume);




More information about the Scummvm-git-logs mailing list