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

mgerhardy martin.gerhardy at gmail.com
Tue Nov 24 17:05:22 UTC 2020


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

Summary:
6f70d6315f TWINE: fixed loading boolean config values
a566f250e9 TWINE: fixed Sound::stopSamples also stopping music


Commit: 6f70d6315f5511a10d12c6ccce308ef6bdf0f808
    https://github.com/scummvm/scummvm/commit/6f70d6315f5511a10d12c6ccce308ef6bdf0f808
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-24T18:05:07+01:00

Commit Message:
TWINE: fixed loading boolean config values

Changed paths:
    engines/twine/music.cpp
    engines/twine/twine.cpp


diff --git a/engines/twine/music.cpp b/engines/twine/music.cpp
index 5e58b44cb2..63d3798f1b 100644
--- a/engines/twine/music.cpp
+++ b/engines/twine/music.cpp
@@ -130,10 +130,6 @@ bool Music::playTrackMusicCd(int32 track) {
 }
 
 void Music::stopTrackMusicCd() {
-	if (!_engine->cfgfile.UseCD) {
-		return;
-	}
-
 	AudioCDManager *cdrom = g_system->getAudioCDManager();
 	cdrom->stop();
 }
@@ -150,9 +146,11 @@ bool Music::playTrackMusic(int32 track) {
 
 	stopMusic();
 	if (playTrackMusicCd(track)) {
+		debug("Play cd music track %i", track);
 		return true;
 	}
 	if (playMidiMusic(track)) {
+		debug("Play midi music track %i", track);
 		return true;
 	}
 	warning("Failed to play track %i", track);
@@ -197,24 +195,16 @@ bool Music::playMidiMusic(int32 midiIdx, int32 loop) {
 		return false;
 	}
 	_midiPlayer.play(midiPtr, midiSize);
-	debug("Play midi music %i from %s", midiIdx, filename);
 	return true;
 }
 
 void Music::stopMidiMusic() {
-	if (!_engine->cfgfile.Sound) {
-		return;
-	}
-
 	_midiPlayer.stop();
 	free(midiPtr);
 	midiPtr = nullptr;
 }
 
 bool Music::initCdrom() {
-	if (!_engine->cfgfile.Sound) {
-		return false;
-	}
 	AudioCDManager* cdrom = g_system->getAudioCDManager();
 	_engine->cfgfile.UseCD = cdrom->open();
 	return _engine->cfgfile.UseCD;
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 3f553860a2..cd6e316a1a 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -292,6 +292,7 @@ static int getLanguageTypeIndex(const char *languageName) {
 
 #define ConfGetOrDefault(key, defaultVal) (ConfMan.hasKey(key) ? ConfMan.get(key) : Common::String(defaultVal))
 #define ConfGetIntOrDefault(key, defaultVal) (ConfMan.hasKey(key) ? atoi(ConfMan.get(key).c_str()) : (defaultVal))
+#define ConfGetBoolOrDefault(key, defaultVal) (ConfMan.hasKey(key) ? ConfMan.get(key) == "true" || atoi(ConfMan.get(key).c_str()) == 1 : (defaultVal))
 
 void TwinEEngine::initConfigurations() {
 	// TODO: use existing entries for some of the settings - like volume and so on.
@@ -317,20 +318,33 @@ void TwinEEngine::initConfigurations() {
 		}
 	}
 	cfgfile.Version = ConfGetIntOrDefault("version", EUROPE_VERSION);
-	cfgfile.UseCD = ConfGetIntOrDefault("usecd", 0) == 1;
-	cfgfile.Sound = ConfGetIntOrDefault("sound", 1) == 1;
+	cfgfile.UseCD = ConfGetBoolOrDefault("usecd", false);
+	cfgfile.Sound = ConfGetBoolOrDefault("sound", true);
 	cfgfile.Movie = ConfGetIntOrDefault("movie", CONF_MOVIE_FLA);
 	cfgfile.Fps = ConfGetIntOrDefault("fps", DEFAULT_FRAMES_PER_SECOND);
-	cfgfile.Debug = ConfGetIntOrDefault("debug", 0) == 1;
+	cfgfile.Debug = ConfGetBoolOrDefault("debug", false);
 
-	cfgfile.UseAutoSaving = ConfGetIntOrDefault("useautosaving", 0);
-	cfgfile.CrossFade = ConfGetIntOrDefault("crossfade", 0);
-	cfgfile.WallCollision = ConfGetIntOrDefault("wallcollision", 0);
+	cfgfile.UseAutoSaving = ConfGetBoolOrDefault("useautosaving", false);
+	cfgfile.CrossFade = ConfGetBoolOrDefault("crossfade", false);
+	cfgfile.WallCollision = ConfGetBoolOrDefault("wallcollision", false);
 
-	_actor->autoAgressive = ConfGetIntOrDefault("combatauto", 1) == 1;
+	_actor->autoAgressive = ConfGetBoolOrDefault("combatauto", true);
 	cfgfile.ShadowMode = ConfGetIntOrDefault("shadow", 2);
-	cfgfile.SceZoom = ConfGetIntOrDefault("scezoom", 0) == 0;
+	cfgfile.SceZoom = ConfGetBoolOrDefault("scezoom", false);
 	cfgfile.PolygonDetails = ConfGetIntOrDefault("polygondetails", 2);
+
+	debug("UseCD:          %s", (cfgfile.UseCD ? "true" : "false"));
+	debug("Sound:          %s", (cfgfile.Sound ? "true" : "false"));
+	debug("Movie:          %i", cfgfile.Movie);
+	debug("Fps:            %i", cfgfile.Fps);
+	debug("Debug:          %s", (cfgfile.Debug ? "true" : "false"));
+	debug("UseAutoSaving:  %s", (cfgfile.UseAutoSaving ? "true" : "false"));
+	debug("CrossFade:      %s", (cfgfile.CrossFade ? "true" : "false"));
+	debug("WallCollision:  %s", (cfgfile.WallCollision ? "true" : "false"));
+	debug("AutoAgressive:  %s", (_actor->autoAgressive ? "true" : "false"));
+	debug("ShadowMode:     %i", cfgfile.ShadowMode);
+	debug("PolygonDetails: %i", cfgfile.PolygonDetails);
+	debug("SceZoom:        %s", (cfgfile.SceZoom ? "true" : "false"));
 }
 
 void TwinEEngine::initEngine() {


Commit: a566f250e92dbb81fcae57316868bd1767744492
    https://github.com/scummvm/scummvm/commit/a566f250e92dbb81fcae57316868bd1767744492
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-11-24T18:05:07+01:00

Commit Message:
TWINE: fixed Sound::stopSamples also stopping music

Changed paths:
    engines/twine/sound.cpp


diff --git a/engines/twine/sound.cpp b/engines/twine/sound.cpp
index aabe80a54d..ae3402069b 100644
--- a/engines/twine/sound.cpp
+++ b/engines/twine/sound.cpp
@@ -163,7 +163,9 @@ void Sound::stopSamples() {
 		return;
 	}
 
-	_engine->_system->getMixer()->stopAll();
+	for (int i = 0; i < NUM_CHANNELS; i++) {
+		_engine->_system->getMixer()->stopHandle(samplesPlaying[i]);
+	}
 	memset(samplesPlayingActors, -1, sizeof(samplesPlayingActors));
 }
 




More information about the Scummvm-git-logs mailing list