aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2015-05-22 22:23:40 +0200
committerStrangerke2015-05-22 22:23:40 +0200
commit1e58f3d9258ee6c98e48b3f246b922c786d1b14c (patch)
treea3c14885e5147ef049afd268de336e1cde3f1c15 /engines
parent2db07a9d39cc9557d292908d84d3fc146635fd75 (diff)
downloadscummvm-rg350-1e58f3d9258ee6c98e48b3f246b922c786d1b14c.tar.gz
scummvm-rg350-1e58f3d9258ee6c98e48b3f246b922c786d1b14c.tar.bz2
scummvm-rg350-1e58f3d9258ee6c98e48b3f246b922c786d1b14c.zip
SHERLOCK: Rework use of music flags
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/scalpel/scalpel.cpp14
-rw-r--r--engines/sherlock/scene.cpp6
-rw-r--r--engines/sherlock/settings.cpp15
-rw-r--r--engines/sherlock/sherlock.cpp2
-rw-r--r--engines/sherlock/sound.cpp14
-rw-r--r--engines/sherlock/sound.h2
6 files changed, 26 insertions, 27 deletions
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index 7875f22c47..8354b22c2a 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -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:
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 5ae7e25258..39ec16ca7e 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -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();
diff --git a/engines/sherlock/settings.cpp b/engines/sherlock/settings.cpp
index bf5294f08b..e61f7a2246 100644
--- a/engines/sherlock/settings.cpp
+++ b/engines/sherlock/settings.cpp
@@ -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);
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index d4644d4d9d..db1083d195 100644
--- a/engines/sherlock/sherlock.cpp
+++ b/engines/sherlock/sherlock.cpp
@@ -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());
diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp
index 4f27481f5b..1441b4c4aa 100644
--- a/engines/sherlock/sound.cpp
+++ b/engines/sherlock/sound.cpp
@@ -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() {
diff --git a/engines/sherlock/sound.h b/engines/sherlock/sound.h
index 689e615a36..e0e56bc13c 100644
--- a/engines/sherlock/sound.h
+++ b/engines/sherlock/sound.h
@@ -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;