aboutsummaryrefslogtreecommitdiff
path: root/sword2
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-03-27 12:07:07 +0000
committerTorbjörn Andersson2004-03-27 12:07:07 +0000
commit9b9ebb3a91af2056bf30875caeca5d784e26e618 (patch)
treecc903971179989f2cc2568084168cdd353f501d8 /sword2
parent56ae88d5c778001768093ac14eb84065cab6511a (diff)
downloadscummvm-rg350-9b9ebb3a91af2056bf30875caeca5d784e26e618.tar.gz
scummvm-rg350-9b9ebb3a91af2056bf30875caeca5d784e26e618.tar.bz2
scummvm-rg350-9b9ebb3a91af2056bf30875caeca5d784e26e618.zip
Make sure looping music is restarted after loading a savegame, regardless
of how the savegame is loaded. (ScummVM adds two alternative methods: the -x command-line parameter, and the restart/restore dialog at the beginning of the game, which is only shown when there are savegames available.) svn-id: r13386
Diffstat (limited to 'sword2')
-rw-r--r--sword2/mouse.cpp11
-rw-r--r--sword2/save_rest.cpp11
-rw-r--r--sword2/sword2.cpp5
3 files changed, 18 insertions, 9 deletions
diff --git a/sword2/mouse.cpp b/sword2/mouse.cpp
index 65f7b43b0e..883d24d3a1 100644
--- a/sword2/mouse.cpp
+++ b/sword2/mouse.cpp
@@ -246,20 +246,15 @@ void Sword2Engine::systemMenuMouse(void) {
_sound->unpauseFx();
// If there was looping music before coming into the control panels
- // then restart it! NB. This will also start music required when a game
- // has been restored
+ // then restart it! NB. If a game has been restored the music will be
+ // restarted twice, but this shouldn't cause any harm.
if (_loopingMusicId) {
pars[0] = _loopingMusicId;
pars[1] = FX_LOOP;
_logic->fnPlayMusic(pars);
-
- // cross-fades into the required music: either a restored game
- // tune, or music playing prior to entering control panels
- } else {
- // stop the control panel music
+ } else
_logic->fnStopMusic(NULL);
- }
}
void Sword2Engine::dragMouse(void) {
diff --git a/sword2/save_rest.cpp b/sword2/save_rest.cpp
index 264416abe2..d14e1da50b 100644
--- a/sword2/save_rest.cpp
+++ b/sword2/save_rest.cpp
@@ -404,6 +404,17 @@ uint32 Sword2Engine::restoreFromBuffer(Memory *buffer, uint32 size) {
_loopingMusicId = _saveGameHeader.music_id;
+ // Restart any looping music. Originally this was - and still is - done
+ // in systemMenuMouse(), but with ScummVM we have other ways of
+ // restoring savegames so it's easier to put it here as well.
+
+ if (_loopingMusicId) {
+ pars[0] = _loopingMusicId;
+ pars[1] = FX_LOOP;
+ _logic->fnPlayMusic(pars);
+ } else
+ _logic->fnStopMusic(NULL);
+
// Write to walkthrough file (zebug0.txt)
debug(5, "RESTORED GAME \"%s\"", _saveGameHeader.description);
diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp
index cf8af3a606..f977cc7043 100644
--- a/sword2/sword2.cpp
+++ b/sword2/sword2.cpp
@@ -320,7 +320,10 @@ void Sword2Engine::go() {
setMouse(NORMAL_MOUSE_ID);
_logic->fnPlayMusic(pars);
result = _gui->startControl();
- _logic->fnStopMusic(NULL);
+
+ // If the game is started from the beginning, the cutscene
+ // player will kill the music for us. Otherwise, the restore
+ // will either have killed the music, or done a crossfade.
if (_quit)
return;