aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2009-02-21 11:27:04 +0000
committerTorbjörn Andersson2009-02-21 11:27:04 +0000
commitab11da060221e05a0f0d4ee12a9ad3becd372606 (patch)
tree9cd95a430a831e6d5492f8ad9de0d55ddc29b295
parentbaa7c7b997d68d434f78a917725368234871bdfc (diff)
downloadscummvm-rg350-ab11da060221e05a0f0d4ee12a9ad3becd372606.tar.gz
scummvm-rg350-ab11da060221e05a0f0d4ee12a9ad3becd372606.tar.bz2
scummvm-rg350-ab11da060221e05a0f0d4ee12a9ad3becd372606.zip
Allocate the background sound handle dynamically. Otherwise, it seems to me as if
it should be invalid as soon as the makeMoviePlayer() function ends. While that never caused any noticeable problems for me in Broken Sword 1, it broke things in amusing ways when I tried to rewrite the Broken Sword 2 cutscene player along the same lines. svn-id: r38684
-rw-r--r--engines/sword1/animation.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index 81d7839a29..4c7607b9c2 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -77,6 +77,7 @@ MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSys
MoviePlayer::~MoviePlayer(void) {
delete _decoder;
+ delete _bgSoundHandle;
}
/**
@@ -255,21 +256,21 @@ int32 DXAPlayerWithSound::getAudioLag() {
MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system) {
char filename[20];
char buf[60];
- Audio::SoundHandle bgSoundHandle;
+ Audio::SoundHandle *bgSoundHandle = new Audio::SoundHandle;
snprintf(filename, sizeof(filename), "%s.smk", sequenceList[id]);
if (Common::File::exists(filename)) {
Graphics::SMKPlayer *smkDecoder = new Graphics::SMKPlayer(snd);
- return new MoviePlayer(vm, textMan, snd, system, &bgSoundHandle, smkDecoder, kVideoDecoderSMK);
+ return new MoviePlayer(vm, textMan, snd, system, bgSoundHandle, smkDecoder, kVideoDecoderSMK);
}
snprintf(filename, sizeof(filename), "%s.dxa", sequenceList[id]);
if (Common::File::exists(filename)) {
#ifdef USE_ZLIB
- DXAPlayerWithSound *dxaDecoder = new DXAPlayerWithSound(snd, &bgSoundHandle);
- return new MoviePlayer(vm, textMan, snd, system, &bgSoundHandle, dxaDecoder, kVideoDecoderDXA);
+ DXAPlayerWithSound *dxaDecoder = new DXAPlayerWithSound(snd, bgSoundHandle);
+ return new MoviePlayer(vm, textMan, snd, system, bgSoundHandle, dxaDecoder, kVideoDecoderDXA);
#else
GUI::MessageDialog dialog("DXA cutscenes found but ScummVM has been built without zlib support", "OK");
dialog.runModal();