aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/tsage/globals.cpp9
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes0.cpp6
-rw-r--r--engines/tsage/sound.cpp26
-rw-r--r--engines/tsage/sound.h8
4 files changed, 27 insertions, 22 deletions
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 6540f4dccc..d195980825 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 d673c33c5a..b5f40817bf 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 f8797fd569..3925e67b5f 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 5d0bc92c1f..beaf916484 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"; }