[Scummvm-git-logs] scummvm master -> ea3de9e8ed5f5b11670341fc2cf3c67e97863d87

athrxx noreply at scummvm.org
Fri Apr 26 21:28:51 UTC 2024


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:
ea3de9e8ed SCUMM: (IMS) - fix regression


Commit: ea3de9e8ed5f5b11670341fc2cf3c67e97863d87
    https://github.com/scummvm/scummvm/commit/ea3de9e8ed5f5b11670341fc2cf3c67e97863d87
Author: athrxx (athrxx at scummvm.org)
Date: 2024-04-26T23:28:39+02:00

Commit Message:
SCUMM: (IMS) - fix regression

Player::isFadingOut() was broken by recent fader code changes.
The function does not exist in original drivers, but is needed to
work around MI2 bug no. 385 (original interpreter bug).

Changed paths:
    engines/scumm/imuse/imuse.cpp
    engines/scumm/imuse/imuse_player.cpp


diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp
index 6b23bc05f2d..e6b20234106 100644
--- a/engines/scumm/imuse/imuse.cpp
+++ b/engines/scumm/imuse/imuse.cpp
@@ -705,6 +705,18 @@ int IMuseInternal::stopAllSounds_internal() {
 }
 
 int IMuseInternal::getSoundStatus_internal(int sound, bool ignoreFadeouts) const {
+	if (_game_id != GID_MONKEY2) {
+		// The whole fadeout checking / ignoring is not present in any of the original
+		// drivers, but necessary as a WORKAROUND for a bug in Monkey Island 2 that also
+		// happens with the original interpreter (bug no. 385: "No music if room
+		// transition is too fast"). The bug is caused by sloppy scripting, but probably
+		// wouldn't ever be seen on machines of that era, when the loading time for a
+		// room change would take longer than the fadeout time.
+		// Since the code is objectively wrong and the workaround is not known to be
+		// needed elsewhere, we restrict it to Monkey Island 2.
+		ignoreFadeouts = false;
+	}
+
 	const Player *player = _players;
 	for (int i = ARRAYSIZE(_players); i; i--, player++) {
 		if (player->isActive() && (!ignoreFadeouts || !player->isFadingOut())) {
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index 134e5f7e3c3..4aa32035d2e 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -135,10 +135,11 @@ int Player::getMusicTimer() const {
 }
 
 bool Player::isFadingOut() const {
-	int i;
-	for (i = 0; i < ARRAYSIZE(_parameterFaders); ++i) {
-		if (_parameterFaders[i].param == ParameterFader::pfVolume && (_parameterFaders[i].incr || _parameterFaders[i].ifrac))
-			return true;
+	for (int i = 0; i < ARRAYSIZE(_parameterFaders); ++i) {
+		const ParameterFader &p = _parameterFaders[i];
+		if (p.param == ParameterFader::pfVolume &&
+			_volume + p.cntdwn * p.incr + ((p.irem + p.cntdwn * p.ifrac) / p.ttime) * p.dir == 0)
+				return true;
 	}
 	return false;
 }




More information about the Scummvm-git-logs mailing list