[Scummvm-cvs-logs] SF.net SVN: scummvm:[38684] scummvm/trunk/engines/sword1/animation.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sat Feb 21 12:27:04 CET 2009


Revision: 38684
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38684&view=rev
Author:   eriktorbjorn
Date:     2009-02-21 11:27:04 +0000 (Sat, 21 Feb 2009)

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/engines/sword1/animation.cpp

Modified: scummvm/trunk/engines/sword1/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword1/animation.cpp	2009-02-21 11:26:54 UTC (rev 38683)
+++ scummvm/trunk/engines/sword1/animation.cpp	2009-02-21 11:27:04 UTC (rev 38684)
@@ -77,6 +77,7 @@
 
 MoviePlayer::~MoviePlayer(void) {
 	delete _decoder;
+	delete _bgSoundHandle;
 }
 
 /**
@@ -255,21 +256,21 @@
 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();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list