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
This commit is contained in:
parent
baa7c7b997
commit
ab11da0602
1 changed files with 5 additions and 4 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue