mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
BLADERUNNER: Persistent sound settings, speech samples fix
This commit is contained in:
parent
c99fbcd53b
commit
e90f708852
@ -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
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user