[Scummvm-git-logs] scummvm master -> 1b11def7bfde6a4b53040fb6da9d66387c091df5

athrxx athrxx at scummvm.org
Sat Jan 18 20:53:11 UTC 2020


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

Summary:
ce6a4ecd16 KYRA: (EOB) - support "No Music" setting
f923ff6b3b KYRA: (EOB2) - fadeout subtitles on skip event
1b11def7bf KYRA: apply AdLib fix 12fd8cd4 to all Kyra games


Commit: ce6a4ecd16c25890c85f2cbb9a2f5e213ace9717
    https://github.com/scummvm/scummvm/commit/ce6a4ecd16c25890c85f2cbb9a2f5e213ace9717
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-18T21:52:31+01:00

Commit Message:
KYRA: (EOB) - support "No Music" setting

(until now it was possible to switch sounds on and off ingame, but not via the launcher music device setting)

Changed paths:
    engines/kyra/engine/eobcommon.cpp
    engines/kyra/engine/kyra_v1.cpp
    engines/kyra/kyra_v1.h
    engines/kyra/sequence/sequences_darkmoon.cpp


diff --git a/engines/kyra/engine/eobcommon.cpp b/engines/kyra/engine/eobcommon.cpp
index b59a13d..d1c7a6b 100644
--- a/engines/kyra/engine/eobcommon.cpp
+++ b/engines/kyra/engine/eobcommon.cpp
@@ -409,16 +409,29 @@ Common::Error EoBCoreEngine::init() {
 	if (!_staticres->init())
 		error("_staticres->init() failed");
 
-	// SoundTowns_Darkmoon requires initialized _staticres
+	// We start the respective sound driver even if "No Music" has
+	// been selected, because we don't have a null driver class (and
+	// don't really need one). We just disable the sound in the settings.
+	MidiDriver::DeviceHandle dev = 0;
 	if (_flags.platform == Common::kPlatformDOS) {
-		//MidiDriverType midiDriver = MidiDriver::detectDevice(MDT_PCSPK | MDT_ADLIB);
-		_sound = new SoundAdLibPC(this, _mixer);
+		dev = MidiDriver::detectDevice(/*MDT_PCSPK | */MDT_ADLIB);
+		//if (MidiDriver::getMusicType(dev) == MT_ADLIB)
+			_sound = new SoundAdLibPC(this, _mixer);
+		//else
+		//	_sound = new SoundPCS(this, _mixer);
 	} else if (_flags.platform == Common::kPlatformFMTowns) {
+		dev = MidiDriver::detectDevice(MDT_TOWNS);
+		// SoundTowns_Darkmoon requires initialized _staticres
 		_sound = new SoundTowns_Darkmoon(this, _mixer);
 	} else if (_flags.platform == Common::kPlatformPC98) {
-		if (_flags.gameID == GI_EOB1)
+		if (_flags.gameID == GI_EOB1) {
+			dev = MidiDriver::detectDevice(MDT_PC98);
 			_sound = new SoundPC98_EoB(this, _mixer);
+		} else {
+			dev = MidiDriver::detectDevice(MDT_PC98 | MDT_MIDI);
+		}
 	} else if (_flags.platform == Common::kPlatformAmiga) {
+		dev = MidiDriver::detectDevice(MDT_AMIGA);
 		_sound = new SoundAmiga_EoB(this, _mixer);
 	}
 
@@ -429,7 +442,8 @@ Common::Error EoBCoreEngine::init() {
 	_sound->loadSfxFile("EFECT.OBJ");
 
 	// Setup volume settings (and read in all ConfigManager settings)
-	syncSoundSettings();
+	_configNullSound = (MidiDriver::getMusicType(dev) == MT_NULL);
+	syncSoundSettings();	
 
 	if (!_screen->init())
 		error("screen()->init() failed");
@@ -640,8 +654,8 @@ void EoBCoreEngine::readSettings() {
 	_configMusic = (_flags.platform == Common::kPlatformPC98) ? (ConfMan.getBool("music_mute") ? 0 : 1) : (_configSounds ? 1 : 0);
 
 	if (_sound) {
-		_sound->enableMusic(_configMusic);
-		_sound->enableSFX(_configSounds);
+		_sound->enableMusic(_configNullSound ? false : _configMusic);
+		_sound->enableSFX(_configNullSound ? false : _configSounds);
 	}
 }
 
@@ -659,8 +673,8 @@ void EoBCoreEngine::writeSettings() {
 		} else if (!_configSounds) {
 			_sound->haltTrack();
 		}
-		_sound->enableMusic(_configMusic);
-		_sound->enableSFX(_configSounds);
+		_sound->enableMusic(_configNullSound ? false : _configMusic);
+		_sound->enableSFX(_configNullSound ? false : _configSounds);
 	}
 
 	ConfMan.flushToDisk();
diff --git a/engines/kyra/engine/kyra_v1.cpp b/engines/kyra/engine/kyra_v1.cpp
index c708756..ec4f07e 100644
--- a/engines/kyra/engine/kyra_v1.cpp
+++ b/engines/kyra/engine/kyra_v1.cpp
@@ -43,6 +43,7 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
 	_debugger = 0;
 
 	_configRenderMode = Common::kRenderDefault;
+	_configNullSound = false;
 
 	if (_flags.platform == Common::kPlatformAmiga)
 		_gameSpeed = 50;
@@ -594,16 +595,16 @@ void KyraEngine_v1::readSettings() {
 	_configSounds = ConfMan.getBool("sfx_mute") ? 0 : 1;
 
 	if (_sound) {
-		_sound->enableMusic(_configMusic);
-		_sound->enableSFX(_configSounds);
+		_sound->enableMusic(_configNullSound ? false : _configMusic);
+		_sound->enableSFX(_configNullSound ? false : _configSounds);
 	}
 
 	bool speechMute = ConfMan.getBool("speech_mute");
 	bool subtitles = ConfMan.getBool("subtitles");
 
-	if (!speechMute && subtitles)
+	if (!_configNullSound && !speechMute && subtitles)
 		_configVoice = 2;   // Voice & Text
-	else if (!speechMute && !subtitles)
+	else if (!_configNullSound && !speechMute && !subtitles)
 		_configVoice = 1;   // Voice only
 	else
 		_configVoice = 0;   // Text only
@@ -637,8 +638,8 @@ void KyraEngine_v1::writeSettings() {
 	if (_sound) {
 		if (!_configMusic)
 			_sound->beginFadeOut();
-		_sound->enableMusic(_configMusic);
-		_sound->enableSFX(_configSounds);
+		_sound->enableMusic(_configNullSound ? false : _configMusic);
+		_sound->enableSFX(_configNullSound ? false : _configSounds);
 	}
 
 	ConfMan.setBool("speech_mute", speechMute);
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index b9e5663..03c77b0 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -303,6 +303,7 @@ protected:
 	int _configMusic;
 	bool _configSounds;
 	uint8 _configVoice;
+	bool _configNullSound;
 
 	Common::RenderMode _configRenderMode;
 
diff --git a/engines/kyra/sequence/sequences_darkmoon.cpp b/engines/kyra/sequence/sequences_darkmoon.cpp
index b924b8f..782c827 100644
--- a/engines/kyra/sequence/sequences_darkmoon.cpp
+++ b/engines/kyra/sequence/sequences_darkmoon.cpp
@@ -1726,7 +1726,7 @@ void DarkmoonSequenceHelper::waitForSongNotifier(int index, bool introUpdateAnim
 
 	int seq = 0;
 
-	while (_vm->sound()->checkTrigger() < index && !(_vm->skipFlag() || _vm->shouldQuit())) {
+	while (_vm->sound()->musicEnabled() && _vm->sound()->checkTrigger() < index && !(_vm->skipFlag() || _vm->shouldQuit())) {
 		if (introUpdateAnim) {
 			animCommand(30 | seq);
 			seq ^= 1;
@@ -1740,7 +1740,7 @@ void DarkmoonSequenceHelper::waitForSongNotifier(int index, bool introUpdateAnim
 }
 
 void DarkmoonSequenceHelper::updateAmigaSound() {
-	if (_vm->gameFlags().platform != Common::kPlatformAmiga)
+	if (_vm->gameFlags().platform != Common::kPlatformAmiga || !_vm->sound()->musicEnabled())
 		return;
 
 	int ct = _vm->sound()->checkTrigger();


Commit: f923ff6b3b8eda693313409b44fa90da3ff0068b
    https://github.com/scummvm/scummvm/commit/f923ff6b3b8eda693313409b44fa90da3ff0068b
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-18T21:52:31+01:00

Commit Message:
KYRA: (EOB2) - fadeout subtitles on skip event

(to avoid slight color glitch in the Amiga version)

Changed paths:
    engines/kyra/sequence/sequences_darkmoon.cpp


diff --git a/engines/kyra/sequence/sequences_darkmoon.cpp b/engines/kyra/sequence/sequences_darkmoon.cpp
index 782c827..a252276 100644
--- a/engines/kyra/sequence/sequences_darkmoon.cpp
+++ b/engines/kyra/sequence/sequences_darkmoon.cpp
@@ -1453,13 +1453,11 @@ void DarkmoonSequenceHelper::printText(int index, int color) {
 }
 
 void DarkmoonSequenceHelper::fadeText() {
-	if (_vm->skipFlag() || _vm->shouldQuit())
-		return;
-
+	int rate = _vm->skipFlag() || _vm->shouldQuit() ? 16 : 8;
 	if (_vm->gameFlags().platform == Common::kPlatformAmiga)
-		_screen->fadeTextColor(_palettes[0], 31, 8);
+		_screen->fadeTextColor(_palettes[0], 31, rate);
 	else if (_vm->_configRenderMode != Common::kRenderEGA)
-		_screen->fadeTextColor(_palettes[0], 255, 8);
+		_screen->fadeTextColor(_palettes[0], 255, rate);
 	
 	memset(_textColor, 0, 3);
 	_screen->clearCurDim();


Commit: 1b11def7bfde6a4b53040fb6da9d66387c091df5
    https://github.com/scummvm/scummvm/commit/1b11def7bfde6a4b53040fb6da9d66387c091df5
Author: athrxx (athrxx at scummvm.org)
Date: 2020-01-18T21:52:32+01:00

Commit Message:
KYRA: apply AdLib fix 12fd8cd4 to all Kyra games

The sound glitch has now been reported to also appear in EOB and LOL-Floppy. I was able to confirm at least LOL-Floppy.

And clipping from silence to max volume while doing a fade out really doesn't make much sense.

Changed paths:
    engines/kyra/sound/drivers/adlib.cpp


diff --git a/engines/kyra/sound/drivers/adlib.cpp b/engines/kyra/sound/drivers/adlib.cpp
index 20a344c..0a1d277 100644
--- a/engines/kyra/sound/drivers/adlib.cpp
+++ b/engines/kyra/sound/drivers/adlib.cpp
@@ -919,7 +919,7 @@ void AdLibDriver::secondaryEffect1(Channel &channel) {
 }
 
 uint8 AdLibDriver::calculateOpLevel1(Channel &channel) {
-	int8 value = channel.opLevel1 & 0x3F;
+	uint8 value = channel.opLevel1 & 0x3F;
 
 	if (channel.twoChan) {
 		value += channel.opExtraLevel1;
@@ -934,31 +934,30 @@ uint8 AdLibDriver::calculateOpLevel1(Channel &channel) {
 		value += level3 ^ 0x3F;
 	}
 
-	// The clipping as signed instead of unsigned causes very ugly noises in LOK when the music
-	// is fading out in certain situations (bug #11303). The bug only comes to surface when the
-	// volume setting is not maxed out to 255.
-	// The original LOK AdLib driver does the same wrong clipping, but this doesn't cause glitches
-	// there. The original driver (and game) does not have volume settings and uses a simpler
-	// total level calculation (simply adding the three opExtraLevels to the opLevel).
-	// The original HOF/LOL sound drivers do the same clipping, too. That's were we got that code.
-	// I assume that the issue has been fixed in the fadeout tracks there.
-	// I limit this to LOK for now, since the issue hasn't been reported from any other KYRA games.
-	if (_version == 3) {
-		if (value < 0)
-			debugC(3, kDebugLevelSound, "AdLibDriver::calculateOpLevel1(): WORKAROUND - total level clipping uint/int bug encountered");
-		value = (int8)CLIP<uint8>(value, 0, 0x3F);
-	} else
-		value = CLIP<int8>(value, 0, 0x3F);
+	// The clipping as signed instead of unsigned caused very ugly noises in LOK when the music
+	// was fading out in certain situations (bug #11303). The bug seems to come to surface only
+	// when the volume is not set to the maximum.
+	// I have confirmed that the noise bug also appears in LOL floppy (Westwood logo sound). It has
+	// been reported to be present in EOB 1 (intro music), but I haven't been able to confirm it.
+	// The original AdLib drivers all do the same wrong clipping. At least in the original EOB and
+	// LOK games this wouldn't cause issues, since the original drivers (and games) do not have
+	// volume settings and use a simpler calculation of the total level (just adding the three
+	// opExtraLevels to the opLevel).
+	// The later (HOF/LOL) original drivers do the same wrong clipping, too. But original LOL floppy
+	// doesn't have volume settings either. And with max volume the logo sound is okay... 
+	if (value & 0x80)
+		debugC(3, kDebugLevelSound, "AdLibDriver::calculateOpLevel1(): WORKAROUND - total level clipping uint/int bug encountered");
+	value = CLIP<uint8>(value, 0, 0x3F);
 
 	if (!channel.volumeModifier)
 		value = 0x3F;
 
 	// Preserve the scaling level bits from opLevel1
-	return checkValue(value) | (channel.opLevel1 & 0xC0);
+	return value | (channel.opLevel1 & 0xC0);
 }
 
 uint8 AdLibDriver::calculateOpLevel2(Channel &channel) {
-	int8 value = channel.opLevel2 & 0x3F;
+	uint8 value = channel.opLevel2 & 0x3F;
 
 	value += channel.opExtraLevel1;
 	value += channel.opExtraLevel2;
@@ -972,18 +971,15 @@ uint8 AdLibDriver::calculateOpLevel2(Channel &channel) {
 	value += level3 ^ 0x3F;
 
 	// See comment in calculateOpLevel1()
-	if (_version == 3) {
-		if (value < 0)
-			debugC(3, kDebugLevelSound, "AdLibDriver::calculateOpLevel1(): WORKAROUND - total level clipping uint/int bug encountered");
-		value = (int8)CLIP<uint8>(value, 0, 0x3F);
-	} else
-		value = CLIP<int8>(value, 0, 0x3F);
+	if (value & 0x80)
+		debugC(3, kDebugLevelSound, "AdLibDriver::calculateOpLevel2(): WORKAROUND - total level clipping uint/int bug encountered");
+	value = CLIP<uint8>(value, 0, 0x3F);
 
 	if (!channel.volumeModifier)
 		value = 0x3F;
 
 	// Preserve the scaling level bits from opLevel2
-	return checkValue(value) | (channel.opLevel2 & 0xC0);
+	return value | (channel.opLevel2 & 0xC0);
 }
 
 // parser opcodes




More information about the Scummvm-git-logs mailing list