[Scummvm-cvs-logs] scummvm master -> 9dd2898321b2615f6715314dfe50079421b1c20d

dreammaster dreammaster at scummvm.org
Sun Nov 10 21:30:58 CET 2013


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:
9dd2898321 TSAGE: Fix for sound end actions not firing, and cleanup of related fields


Commit: 9dd2898321b2615f6715314dfe50079421b1c20d
    https://github.com/scummvm/scummvm/commit/9dd2898321b2615f6715314dfe50079421b1c20d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-11-10T12:30:24-08:00

Commit Message:
TSAGE: Fix for sound end actions not firing, and cleanup of related fields

Changed paths:
    engines/tsage/globals.cpp
    engines/tsage/ringworld2/ringworld2_scenes0.cpp
    engines/tsage/sound.cpp
    engines/tsage/sound.h



diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 6540f4d..d195980 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -414,6 +414,15 @@ Ringworld2Globals::Ringworld2Globals() {
 	_scannerDialog = new ScannerDialog();
 	_speechSubtitles = SPEECH_TEXT;
 
+	// Register the inner sound objects for each of the global ASoundExt fields.
+	// Normally the ASound constructor would do this, but because they're fields
+	// of the globals, the g_globals reference isn't ready for them to use
+	_sounds.push_back(&_sound1);
+	_sounds.push_back(&_sound2);
+	_sounds.push_back(&_sound3);
+	_sounds.push_back(&_sound4);
+
+	// Initialise fields
 	_stripModifier = 0;
 	_flubMazeArea = 1;
 	_flubMazeEntryDirection = 0;
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
index d673c33..b5f4081 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
@@ -1810,14 +1810,10 @@ void Scene180::signal() {
 		_shipDisplay.setAction(NULL);
 		_shipDisplay.remove();
 
-		// TODO: Figure out why end action on sounds aren't firing. For now, I'm
-		// simply setting up a scene delay to ensure the signal() method gets
-		// called again after a brief delay
 		_backSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0);
 		R2_GLOBALS._screenSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0);
-		setSceneDelay(10);
 		R2_GLOBALS._sound2.fadeOut2(NULL);
-		R2_GLOBALS._sound1.fadeOut2(NULL /* this */);
+		R2_GLOBALS._sound1.fadeOut2(this);
 		break;
 
 	case 39:
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index f8797fd..3925e67 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -1736,7 +1736,7 @@ uint32 Sound::getTimeIndex() const {
 }
 
 int Sound::getCueValue() const {
-	return _cueValue;
+	return _cueValue == 0xff ? -1 : _cueValue;
 }
 
 void Sound::setCueValue(int cueValue) {
@@ -2438,23 +2438,23 @@ void ASound::dispatch() {
 		_cueValue = cueValue;
 		_sound.setCueValue(-1);
 
-		if (_action)
-			_action->signal();
+		if (_endAction)
+			_endAction->signal();
 	}
 
 	if (_cueValue != -1) {
 		if (!_sound.isPrimed()) {
 			_cueValue = -1;
-			if (_action) {
-				_action->signal();
-				_action = NULL;
+			if (_endAction) {
+				_endAction->signal();
+				_endAction = NULL;
 			}
 		}
 	}
 }
 
-void ASound::play(int soundNum, EventHandler *action, int volume) {
-	_action = action;
+void ASound::play(int soundNum, EventHandler *endAction, int volume) {
+	_endAction = endAction;
 	_cueValue = 0;
 
 	setVol(volume);
@@ -2477,9 +2477,9 @@ void ASound::unPrime() {
 	_action = NULL;
 }
 
-void ASound::fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag, EventHandler *action) {
-	if (action)
-		_action = action;
+void ASound::fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag, EventHandler *endAction) {
+	if (endAction)
+		_endAction = endAction;
 
 	_sound.fade(fadeDest, fadeSteps, fadeTicks, stopAfterFadeFlag);
 }
@@ -2506,8 +2506,8 @@ void ASoundExt::signal() {
 	}
 }
 
-void ASoundExt::fadeOut2(EventHandler *action) {
-	fade(0, 10, 10, true, action);
+void ASoundExt::fadeOut2(EventHandler *endAction) {
+	fade(0, 10, 10, true, endAction);
 }
 
 void ASoundExt::changeSound(int soundNum) {
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index 5d0bc92..beaf916 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -366,7 +366,7 @@ public:
 class ASound: public EventHandler {
 public:
 	Sound _sound;
-	EventHandler *_action;
+	EventHandler *_endAction;
 	int _cueValue;
 
 	ASound();
@@ -374,7 +374,7 @@ public:
 	virtual void synchronize(Serializer &s);
 	virtual void dispatch();
 
-	void play(int soundNum, EventHandler *action = NULL, int volume = 127);
+	void play(int soundNum, EventHandler *endAction = NULL, int volume = 127);
 	void stop();
 	void prime(int soundNum, Action *action = NULL);
 	void unPrime();
@@ -386,7 +386,7 @@ public:
 	bool isMuted() const { return _sound.isMuted(); }
 	void pause(bool flag) { _sound.pause(flag); }
 	void mute(bool flag) { _sound.mute(flag); }
-	void fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag, EventHandler *action);
+	void fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag, EventHandler *endAction);
 	void fadeIn() { fade(127, 5, 10, false, NULL); }
 	void fadeOut(Action *action) { fade(0, 5, 10, true, action); }
 	void setTimeIndex(uint32 timeIndex) { _sound.setTimeIndex(timeIndex); }
@@ -407,7 +407,7 @@ public:
 	int _soundNum;
 
 	ASoundExt();
-	void fadeOut2(EventHandler *action);
+	void fadeOut2(EventHandler *endAction);
 	void changeSound(int soundNum);
 
 	virtual Common::String getClassName() { return "ASoundExt"; }






More information about the Scummvm-git-logs mailing list