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

sev- sev at scummvm.org
Tue Aug 29 09:33:21 CEST 2017


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

Summary:
d0082982d5 WAGE: Make sound blocking
58fb345b3e WAGE: Since the sounds are blocking, made the sound handle global
b5c552b3bb WAGE: Quit gracefully when requested


Commit: d0082982d52a98674cafca08a0822375c37a3d83
    https://github.com/scummvm/scummvm/commit/d0082982d52a98674cafca08a0822375c37a3d83
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-29T09:33:44+02:00

Commit Message:
WAGE: Make sound blocking

Changed paths:
    engines/wage/sound.cpp


diff --git a/engines/wage/sound.cpp b/engines/wage/sound.cpp
index fd6adae..3649069 100644
--- a/engines/wage/sound.cpp
+++ b/engines/wage/sound.cpp
@@ -49,6 +49,7 @@
 #include "audio/mixer.h"
 #include "audio/decoders/raw.h"
 #include "common/stream.h"
+#include "common/system.h"
 
 #include "wage/wage.h"
 #include "wage/entities.h"
@@ -93,6 +94,24 @@ void WageEngine::playSound(Common::String soundName) {
 
 	_mixer->playStream(Audio::Mixer::kPlainSoundType, &s->_handle, stream,
 		-1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+
+	while (_mixer->isSoundHandleActive(s->_handle) && !_shouldQuit) {
+		Common::Event event;
+
+		_eventMan->pollEvent(event);
+
+		switch (event.type) {
+		case Common::EVENT_QUIT:
+			if (saveDialog())
+				_shouldQuit = true;
+			break;
+		default:
+			break;
+		}
+
+		_system->updateScreen();
+		_system->delayMillis(10);
+	}
 }
 
 void WageEngine::updateSoundTimerForScene(Scene *scene, bool firstTime) {


Commit: 58fb345b3e56feb6f05bee0385e115f47bc00b81
    https://github.com/scummvm/scummvm/commit/58fb345b3e56feb6f05bee0385e115f47bc00b81
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-29T09:33:44+02:00

Commit Message:
WAGE: Since the sounds are blocking, made the sound handle global

Changed paths:
    engines/wage/sound.cpp
    engines/wage/sound.h
    engines/wage/wage.h


diff --git a/engines/wage/sound.cpp b/engines/wage/sound.cpp
index 3649069..9f5ed34 100644
--- a/engines/wage/sound.cpp
+++ b/engines/wage/sound.cpp
@@ -92,10 +92,10 @@ void WageEngine::playSound(Common::String soundName) {
 
 	Audio::AudioStream *stream = Audio::makeRawStream(s->_data, s->_size, 11000, Audio::FLAG_UNSIGNED);
 
-	_mixer->playStream(Audio::Mixer::kPlainSoundType, &s->_handle, stream,
+	_mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, stream,
 		-1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
 
-	while (_mixer->isSoundHandleActive(s->_handle) && !_shouldQuit) {
+	while (_mixer->isSoundHandleActive(_soundHandle) && !_shouldQuit) {
 		Common::Event event;
 
 		_eventMan->pollEvent(event);
diff --git a/engines/wage/sound.h b/engines/wage/sound.h
index 101b5a0..ada5a3c 100644
--- a/engines/wage/sound.h
+++ b/engines/wage/sound.h
@@ -48,8 +48,6 @@
 #ifndef WAGE_SOUND_H
 #define WAGE_SOUND_H
 
-#include "audio/mixer.h"
-
 namespace Wage {
 
 class Sound {
@@ -60,8 +58,6 @@ public:
 	Common::String _name;
 	uint _size;
 	byte *_data;
-
-	Audio::SoundHandle _handle;
 };
 
 } // End of namespace Wage
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 4c93399..d2c97ad 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -49,6 +49,7 @@
 #define WAGE_WAGE_H
 
 #include "engines/engine.h"
+#include "audio/mixer.h"
 #include "common/debug.h"
 #include "common/endian.h"
 #include "common/rect.h"
@@ -234,6 +235,8 @@ private:
 	Common::MacResManager *_resManager;
 
 	bool _shouldQuit;
+
+	Audio::SoundHandle _soundHandle;
 };
 
 // Example console class


Commit: b5c552b3bb7f6cd18c493dc23b678135c86a12e7
    https://github.com/scummvm/scummvm/commit/b5c552b3bb7f6cd18c493dc23b678135c86a12e7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-08-29T09:33:44+02:00

Commit Message:
WAGE: Quit gracefully when requested

Changed paths:
    engines/wage/script.cpp
    engines/wage/wage.cpp
    engines/wage/wage.h


diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index 3405c8b..bff75d0 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -165,7 +165,7 @@ bool Script::execute(World *world, int loopCount, Common::String *inputText, Des
 	}
 
 	_data->seek(12);
-	while (_data->pos() < _data->size()) {
+	while (_data->pos() < _data->size() && !_engine->_shouldQuit) {
 		printLine(_data->pos());
 
 		byte command = _data->readByte();
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 7f9fb07..ce47e3e 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -123,6 +123,8 @@ Common::Error WageEngine::run() {
 	if (!_world->loadWorld(_resManager))
 		return Common::kNoGameDataFoundError;
 
+	_shouldQuit = false;
+
 	_gui = new Gui(this);
 
 	_temporarilyHidden = true;
@@ -140,8 +142,6 @@ Common::Error WageEngine::run() {
 	processTurn(&input, NULL);
 	_temporarilyHidden = false;
 
-	_shouldQuit = false;
-
 	while (!_shouldQuit) {
 		_debugger->onFrame();
 
@@ -445,6 +445,10 @@ void WageEngine::processTurnInternal(Common::String *textInput, Designed *clickI
 		regen();
 		Common::String input("look");
 		processTurnInternal(&input, NULL);
+
+		if (_shouldQuit)
+			return;
+
 		redrawScene();
 		_temporarilyHidden = false;
 	} else if (_loopCount == 1) {
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index d2c97ad..51a6951 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -192,6 +192,8 @@ public:
 	bool _isGameOver;
 	bool _commandWasQuick;
 
+	bool _shouldQuit;
+
 	Common::String _inputText;
 
 	void playSound(Common::String soundName);
@@ -234,8 +236,6 @@ private:
 
 	Common::MacResManager *_resManager;
 
-	bool _shouldQuit;
-
 	Audio::SoundHandle _soundHandle;
 };
 





More information about the Scummvm-git-logs mailing list