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

antoniou79 antoniou at cti.gr
Wed Apr 10 18:15:14 CEST 2019


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:
c99fbcd53b BLADERUNNER: Fix compilation when enabling some macros
e90f708852 BLADERUNNER: Persistent sound settings, speech samples fix


Commit: c99fbcd53b10261fb193f056ba544df81bb401e3
    https://github.com/scummvm/scummvm/commit/c99fbcd53b10261fb193f056ba544df81bb401e3
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-04-10T19:00:14+03:00

Commit Message:
BLADERUNNER: Fix compilation when enabling some macros

Compilation was broken for BLADERUNNER_ORIGINAL_SETTINGS(1) and BLADERUNNER_ORIGINAL_BUGS(1)

Changed paths:
    engines/bladerunner/game_constants.h
    engines/bladerunner/script/scene/ps11.cpp
    engines/bladerunner/ui/kia_section_settings.h


diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h
index 5f60739..9da269b 100644
--- a/engines/bladerunner/game_constants.h
+++ b/engines/bladerunner/game_constants.h
@@ -2193,9 +2193,10 @@ enum GoalZuben {
 enum GoalOfficerLeary {
 	kGoalOfficerLearyDefault = 0,
 	kGoalOfficerLearyRC01WalkToCrowd = 1,
-	kGoalOfficerLearyRC01CrowdInterrogation = 2,
 #if BLADERUNNER_ORIGINAL_BUGS
+	kGoalOfficerLearyRC01CrowdInterrogation = 2
 #else
+	kGoalOfficerLearyRC01CrowdInterrogation = 2,
 	kGoalOfficerLearyRC01ResumeWalkToCrowd = 4
 #endif // BLADERUNNER_ORIGINAL_BUGS
 };
diff --git a/engines/bladerunner/script/scene/ps11.cpp b/engines/bladerunner/script/scene/ps11.cpp
index 97b4615..03c3b09 100644
--- a/engines/bladerunner/script/scene/ps11.cpp
+++ b/engines/bladerunner/script/scene/ps11.cpp
@@ -268,7 +268,7 @@ static const int *getPoliceMazePS11TrackData14() {  // Enemy (kItemPS11Target6)
 		kPMTIRotate,          644, 80,
 		kPMTIWait,            0,
 #if BLADERUNNER_ORIGINAL_BUGS
-1		kPMTIRotate,          388, 80,              // orientation is wrong here
+		kPMTIRotate,          388, 80,              // orientation is wrong here
 #else
 		kPMTIRotate,          260, 80,              // corrected orientation - face towards McCoy
 #endif // BLADERUNNER_ORIGINAL_BUGS
diff --git a/engines/bladerunner/ui/kia_section_settings.h b/engines/bladerunner/ui/kia_section_settings.h
index 5252ad7..ffb408e 100644
--- a/engines/bladerunner/ui/kia_section_settings.h
+++ b/engines/bladerunner/ui/kia_section_settings.h
@@ -23,6 +23,7 @@
 #ifndef BLADERUNNER_KIA_SECTION_SETTINGS_H
 #define BLADERUNNER_KIA_SECTION_SETTINGS_H
 
+#include "bladerunner/bladerunner.h" // for BLADERUNNER_ORIGINAL_SETTINGS macro
 #include "bladerunner/ui/kia_section_base.h"
 
 #include "common/config-manager.h"


Commit: e90f70885248626c96d7643e1c9ad27d6f5f4b78
    https://github.com/scummvm/scummvm/commit/e90f70885248626c96d7643e1c9ad27d6f5f4b78
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-04-10T19:00:14+03:00

Commit Message:
BLADERUNNER: Persistent sound settings, speech samples fix

Changed paths:
    engines/bladerunner/audio_speech.cpp
    engines/bladerunner/bladerunner.cpp
    engines/bladerunner/bladerunner.h
    engines/bladerunner/ui/kia_section_settings.cpp


diff --git a/engines/bladerunner/audio_speech.cpp b/engines/bladerunner/audio_speech.cpp
index 2370a7b..8d2f18d 100644
--- a/engines/bladerunner/audio_speech.cpp
+++ b/engines/bladerunner/audio_speech.cpp
@@ -32,7 +32,9 @@
 
 namespace BladeRunner {
 
-const int AudioSpeech::kSpeechSamples[] = { 65, 355, 490, 465, 480, 485, 505, 760, 7655, 7770, 7740, 8170, 2705, 7200, 6460, 5560, 4870, 4555, 3880, 3525, 3595, 3250, 3070 };
+// Note: Speech samples here should be from A.TLK file
+const int kSpeechSamplesNumber = 23;
+const int AudioSpeech::kSpeechSamples[kSpeechSamplesNumber] = { 65, 355, 490, 465, 480, 485, 505, 760, 7655, 7770, 7740, 8170, 2705, 7200, 6460, 5560, 4870, 4555, 3880, 3525, 3595, 3250, 3070 };
 
 void AudioSpeech::ended() {
 	//Common::StackLock lock(_mutex);
@@ -138,7 +140,14 @@ int AudioSpeech::getVolume() const {
 }
 
 void AudioSpeech::playSample() {
-	_vm->_playerActor->speechPlay(kSpeechSamples[_vm->_rnd.getRandomNumber(22)], true);
+#if BLADERUNNER_ORIGINAL_BUGS
+	_vm->_playerActor->speechPlay(kSpeechSamples[_vm->_rnd.getRandomNumber(kSpeechSamplesNumber-1)], true);
+#else
+	if (_vm->openArchive("A.TLK")) {
+		// load sample speech even when in initial KIA screen (upon launch - but before loading a game)
+		_vm->_playerActor->speechPlay(kSpeechSamples[_vm->_rnd.getRandomNumber(kSpeechSamplesNumber-1)], true);
+	}
+#endif // BLADERUNNER_ORIGINAL_BUGS
 }
 
 } // End of namespace BladeRunner
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 64b42e0..2bf358d 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -108,6 +108,7 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des
 	_actorSpeakStopIsRequested = false;
 
 	_subtitlesEnabled = false;
+
 	_sitcomMode       = false;
 	_shortyMode       = false;
 
@@ -431,8 +432,14 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
 
 	// Assign default values to the ScummVM configuration manager, in case settings are missing
 	ConfMan.registerDefault("subtitles", "true");
+	ConfMan.registerDefault("sfx_volume", 192);
+	ConfMan.registerDefault("music_volume", 192);
+	ConfMan.registerDefault("speech_volume", 192);
+	ConfMan.registerDefault("mute", "false");
+	ConfMan.registerDefault("speech_mute", "false");
+
 	// get value from the ScummVM configuration manager
-	_subtitlesEnabled = ConfMan.getBool("subtitles");
+	syncSoundSettings();
 
 	_sitcomMode = ConfMan.getBool("sitcom");
 	_shortyMode = ConfMan.getBool("shorty");
@@ -1769,6 +1776,27 @@ void BladeRunnerEngine::syncSoundSettings() {
 	Engine::syncSoundSettings();
 
 	_subtitlesEnabled = ConfMan.getBool("subtitles");
+
+	_mixer->setVolumeForSoundType(_mixer->kMusicSoundType, ConfMan.getInt("music_volume"));
+	_mixer->setVolumeForSoundType(_mixer->kSFXSoundType, ConfMan.getInt("sfx_volume"));
+	_mixer->setVolumeForSoundType(_mixer->kSpeechSoundType, ConfMan.getInt("speech_volume"));
+
+	// debug("syncSoundSettings: Volumes synced as Music: %d, Sfx: %d, Speech: %d", ConfMan.getInt("music_volume"), ConfMan.getInt("sfx_volume"), ConfMan.getInt("speech_volume"));
+
+	if (ConfMan.hasKey("mute")) {
+		_mixer->muteSoundType(_mixer->kMusicSoundType, ConfMan.getBool("mute"));
+		_mixer->muteSoundType(_mixer->kSFXSoundType, ConfMan.getBool("mute"));
+		_mixer->muteSoundType(_mixer->kSpeechSoundType, ConfMan.getBool("mute"));
+	}
+
+	if (ConfMan.hasKey("speech_mute")) {
+		// if true it means show only subtitles
+		// "subtitles" key will already be set appropriately by Engine::syncSoundSettings();
+		// but we need to mute the speech
+		_mixer->muteSoundType(_mixer->kSpeechSoundType, ConfMan.getBool("speech_mute"));
+	}
+	// write-back to ini file for persistence
+	ConfMan.flushToDisk(); // TODO Or maybe call this only when game is shut down?
 }
 
 bool BladeRunnerEngine::isSubtitlesEnabled() {
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index ef5140d..c3e53eb 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -200,7 +200,7 @@ public:
 	bool _sceneIsLoading;
 	bool _vqaIsPlaying;
 	bool _vqaStopIsRequested;
-	bool _subtitlesEnabled; // tracks the state of whether subtitles are enabled or disabled from ScummVM GUI option or KIA checkbox (the states are synched)
+	bool _subtitlesEnabled;  // tracks the state of whether subtitles are enabled or disabled from ScummVM GUI option or KIA checkbox (the states are synched)
 	bool _sitcomMode;
 	bool _shortyMode;
 
diff --git a/engines/bladerunner/ui/kia_section_settings.cpp b/engines/bladerunner/ui/kia_section_settings.cpp
index 288e0b4..24c24ac 100644
--- a/engines/bladerunner/ui/kia_section_settings.cpp
+++ b/engines/bladerunner/ui/kia_section_settings.cpp
@@ -289,17 +289,17 @@ void KIASectionSettings::sliderCallback(void *callbackData, void *source) {
 	}
 #else
 	if (source == self->_musicVolume) {
-		self->_vm->_mixer->setVolumeForSoundType(self->_vm->_mixer->kMusicSoundType, self->_musicVolume->_value);
-		self->_vm->_music->playSample();
 		ConfMan.setInt("music_volume", self->_musicVolume->_value);
+		self->_vm->syncSoundSettings();
+		self->_vm->_music->playSample();
 	} else if (source == self->_soundEffectVolume) {
-		self->_vm->_mixer->setVolumeForSoundType(self->_vm->_mixer->kSFXSoundType, self->_soundEffectVolume->_value);
-		self->_vm->_audioPlayer->playSample();
 		ConfMan.setInt("sfx_volume", self->_soundEffectVolume->_value);
+		self->_vm->syncSoundSettings();
+		self->_vm->_audioPlayer->playSample();
 	} else if (source == self->_speechVolume) {
-		self->_vm->_mixer->setVolumeForSoundType(self->_vm->_mixer->kSpeechSoundType, self->_speechVolume->_value);
-		self->_vm->_audioSpeech->playSample();
 		ConfMan.setInt("speech_volume", self->_speechVolume->_value);
+		self->_vm->syncSoundSettings();
+		self->_vm->_audioSpeech->playSample();
 	}
 #endif
 }





More information about the Scummvm-git-logs mailing list