SHERLOCK: Rework use of music flags

This commit is contained in:
Strangerke 2015-05-22 22:23:40 +02:00
parent 2db07a9d39
commit 1e58f3d925
6 changed files with 26 additions and 27 deletions

View File

@ -668,12 +668,8 @@ void ScalpelEngine::showLBV(const Common::String &filename) {
void ScalpelEngine::startScene() {
if (_scene->_goToScene == OVERHEAD_MAP || _scene->_goToScene == OVERHEAD_MAP2) {
// Show the map
if (_sound->_musicOn) {
if (_sound->loadSong(100)) {
if (_sound->_music)
_sound->startSong();
}
}
if (_sound->_musicOn && _sound->loadSong(100))
_sound->startSong();
_scene->_goToScene = _map->show();
@ -693,10 +689,8 @@ void ScalpelEngine::startScene() {
case RESCUE_ANNA:
case MOOREHEAD_DEATH:
case BRUMWELL_SUICIDE:
if (_sound->_musicOn && _sound->loadSong(_scene->_goToScene)) {
if (_sound->_music)
_sound->startSong();
}
if (_sound->_musicOn && _sound->loadSong(_scene->_goToScene))
_sound->startSong();
switch (_scene->_goToScene) {
case BLACKWOOD_CAPTURE:

View File

@ -446,10 +446,8 @@ bool Scene::loadScene(const Common::String &filename) {
checkInventory();
// Handle starting any music for the scene
if (sound._musicOn && sound.loadSong(_currentScene)) {
if (sound._music)
sound.startSong();
}
if (sound._musicOn && sound.loadSong(_currentScene))
sound.startSong();
// Load walking images if not already loaded
people.loadWalk();

View File

@ -71,7 +71,7 @@ void Settings::drawInteface(bool flag) {
screen.makeButton(Common::Rect(SETUP_POINTS[0][0], SETUP_POINTS[0][1], SETUP_POINTS[0][2], SETUP_POINTS[0][1] + 10),
SETUP_POINTS[0][3] - screen.stringWidth("Exit") / 2, "Exit");
tempStr = Common::String::format("Music %s", SETUP_STRS0[sound._music]);
tempStr = Common::String::format("Music %s", SETUP_STRS0[sound._musicOn]);
screen.makeButton(Common::Rect(SETUP_POINTS[1][0], SETUP_POINTS[1][1], SETUP_POINTS[1][2], SETUP_POINTS[1][1] + 10),
SETUP_POINTS[1][3] - screen.stringWidth(tempStr) / 2, tempStr);
@ -154,7 +154,7 @@ int Settings::drawButtons(const Common::Point &pt, int _key) {
// Print the button text
switch (idx) {
case 1:
tempStr = Common::String::format("Music %s", SETUP_STRS0[sound._music]);
tempStr = Common::String::format("Music %s", SETUP_STRS0[sound._musicOn]);
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
break;
case 2:
@ -255,14 +255,11 @@ void Settings::show(SherlockEngine *vm) {
if ((found == 1 && events._released) || ui._key == 'M') {
// Toggle music
if (sound._music) {
sound.stopSound();
sound._music = false;
}
else {
sound._music = true;
sound._musicOn = !sound._musicOn;
if (!sound._musicOn)
sound.stopMusic();
else
sound.startSong();
}
updateConfig = true;
settings.drawInteface(true);

View File

@ -218,7 +218,7 @@ void SherlockEngine::loadConfig() {
void SherlockEngine::saveConfig() {
ConfMan.setBool("mute", !_sound->_digitized);
ConfMan.setBool("music_mute", !_sound->_music);
ConfMan.setBool("music_mute", !_sound->_musicOn);
ConfMan.setBool("speech_mute", !_sound->_voices);
ConfMan.setInt("font", _screen->fontNumber());

View File

@ -52,7 +52,7 @@ static const uint8 creativeADPCM_AdjustMap[64] = {
Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
_digitized = false;
_music = false;
_musicPlaying = false;
_voices = 0;
_diskSoundPlaying = false;
_soundPlaying = false;
@ -78,7 +78,7 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
void Sound::syncSoundSettings() {
_digitized = !ConfMan.getBool("mute");
_music = !ConfMan.getBool("mute") && !ConfMan.getBool("music_mute");
_musicOn = !ConfMan.getBool("mute") && !ConfMan.getBool("music_mute");
_voices = !ConfMan.getBool("mute") && !ConfMan.getBool("speech_mute") ? 1 : 0;
}
@ -202,6 +202,9 @@ void Sound::stopSound() {
}
void Sound::playMusic(const Common::String &name) {
if (!_musicOn)
return;
// TODO
warning("Sound::playMusic %s", name.c_str());
Common::SeekableReadStream *stream = _vm->_res->load(name, "MUSIC.LIB");
@ -223,6 +226,8 @@ void Sound::playMusic(const Common::String &name) {
void Sound::stopMusic() {
// TODO
warning("TODO: Sound::stopMusic");
_musicPlaying = false;
}
int Sound::loadSong(int songNumber) {
@ -232,8 +237,13 @@ int Sound::loadSong(int songNumber) {
}
void Sound::startSong() {
if (!_musicOn)
return;
// TODO
warning("TODO: Sound::startSong");
_musicPlaying = true;
}
void Sound::freeSong() {

View File

@ -49,7 +49,7 @@ private:
byte decodeSample(byte sample, byte& reference, int16& scale);
public:
bool _digitized;
bool _music;
bool _musicPlaying;
int _voices;
bool _soundOn;
bool _musicOn;