[Scummvm-git-logs] scummvm master -> 6b3bbeeebc6f257286d6b4baa16105fec7ca52c3

elasota noreply at scummvm.org
Sat Jul 2 04:37:07 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:
6b3bbeeebc MTROPOLIS: Improve sound Stop command handling accuracy (fix freeze on Obsidian rebel VO)


Commit: 6b3bbeeebc6f257286d6b4baa16105fec7ca52c3
    https://github.com/scummvm/scummvm/commit/6b3bbeeebc6f257286d6b4baa16105fec7ca52c3
Author: elasota (ejlasota at gmail.com)
Date: 2022-07-02T00:36:51-04:00

Commit Message:
MTROPOLIS: Improve sound Stop command handling accuracy (fix freeze on Obsidian rebel VO)

Changed paths:
    engines/mtropolis/elements.cpp


diff --git a/engines/mtropolis/elements.cpp b/engines/mtropolis/elements.cpp
index 92d35dca30b..aab9c98c3ea 100644
--- a/engines/mtropolis/elements.cpp
+++ b/engines/mtropolis/elements.cpp
@@ -2181,25 +2181,36 @@ void SoundElement::setBalance(int16 balance) {
 }
 
 VThreadState SoundElement::startPlayingTask(const StartPlayingTaskData &taskData) {
-	_paused = false;
+	// Pushed in reverse order, actual order is Unpaused -> Played
+	{
+		Common::SharedPtr<MessageProperties> msgProps(new MessageProperties(Event::create(EventIDs::kPlay, 0), DynamicValue(), getSelfReference()));
+		Common::SharedPtr<MessageDispatch> dispatch(new MessageDispatch(msgProps, this, false, true, false));
+		taskData.runtime->sendMessageOnVThread(dispatch);
+	}
+
+	if (_paused) {
+		Common::SharedPtr<MessageProperties> msgProps(new MessageProperties(Event::create(EventIDs::kUnpause, 0), DynamicValue(), getSelfReference()));
+		Common::SharedPtr<MessageDispatch> dispatch(new MessageDispatch(msgProps, this, false, true, false));
+		taskData.runtime->sendMessageOnVThread(dispatch);
+
+		_paused = false;
+	}
+
 	_shouldPlayIfNotPaused = true;
 	_needsReset = true;
 
-	Common::SharedPtr<MessageProperties> msgProps(new MessageProperties(Event::create(EventIDs::kPlay, 0), DynamicValue(), getSelfReference()));
-	Common::SharedPtr<MessageDispatch> dispatch(new MessageDispatch(msgProps, this, false, true, false));
-	taskData.runtime->sendMessageOnVThread(dispatch);
-
 	return kVThreadReturn;
 }
 
 VThreadState SoundElement::stopPlayingTask(const StartPlayingTaskData &taskData) {
-	_paused = false;
-	_shouldPlayIfNotPaused = false;
-	_needsReset = true;
+	if (_shouldPlayIfNotPaused) {
+		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);
 
-	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);
+		_shouldPlayIfNotPaused = false;
+		_needsReset = true;
+	}
 
 	return kVThreadReturn;
 }




More information about the Scummvm-git-logs mailing list