[Scummvm-git-logs] scummvm master -> 655a9774c0e67574d7ae5d7aeb0cd66869a8f45a

AndywinXp noreply at scummvm.org
Mon Jan 2 19:21:51 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
655a9774c0 SCUMM: LOOM (CD/Steam): Implement CD Audio music/speech reloading


Commit: 655a9774c0e67574d7ae5d7aeb0cd66869a8f45a
    https://github.com/scummvm/scummvm/commit/655a9774c0e67574d7ae5d7aeb0cd66869a8f45a
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-01-02T20:21:46+01:00

Commit Message:
SCUMM: LOOM (CD/Steam): Implement CD Audio music/speech reloading

We were already saving the relevant info for doing that, we simply never used it :-)

Changed paths:
    engines/scumm/saveload.cpp


diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index f9f887416f3..d1faf051879 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -1882,12 +1882,23 @@ void ScummEngine::saveLoadWithSerializer(Common::Serializer &s) {
 		if (s.isSaving())
 			info = _system->getAudioCDManager()->getStatus();
 		syncWithSerializer(s, info);
-		// If we are loading, and the music being loaded was supposed to loop
-		// forever, then resume playing it. This helps a lot when the audio CD
-		// is used to provide ambient music (see bug #1150).
-		// FM-Towns versions handle this in Player_Towns_v1::restoreAfterLoad().
-		if (s.isLoading() && info.playing && info.numLoops < 0 && _game.platform != Common::kPlatformFMTowns)
-			_sound->playCDTrackInternal(info.track, info.numLoops, info.start, info.duration);
+
+		if (s.isLoading() && info.playing) {
+			if (info.numLoops < 0 && _game.platform != Common::kPlatformFMTowns) {
+				// If we are loading, and the music being loaded was supposed to loop
+				// forever, then resume playing it. This helps a lot when the audio CD
+				// is used to provide ambient music (see bug #1150).
+				// FM-Towns versions handle this in Player_Towns_v1::restoreAfterLoad().
+				_sound->playCDTrackInternal(info.track, info.numLoops, info.start, info.duration);
+			} else if (_game.id == GID_LOOM && info.start != 0 && info.duration != 0) {
+				// Reload audio for LOOM CD/Steam. We move the offset forward by a little bit
+				// to restore the correct sync.
+				int startOffset = (int)(VAR(VAR_MUSIC_TIMER) * 1.25);
+
+				_sound->_cdMusicTimer = VAR(VAR_MUSIC_TIMER);
+				_sound->playCDTrackInternal(info.track, info.numLoops, info.start + startOffset, info.duration - VAR(VAR_MUSIC_TIMER));
+			}
+		}
 	}
 
 




More information about the Scummvm-git-logs mailing list