SHERLOCK: Rework use of music flags
This commit is contained in:
parent
2db07a9d39
commit
1e58f3d925
6 changed files with 26 additions and 27 deletions
|
@ -668,12 +668,8 @@ void ScalpelEngine::showLBV(const Common::String &filename) {
|
||||||
void ScalpelEngine::startScene() {
|
void ScalpelEngine::startScene() {
|
||||||
if (_scene->_goToScene == OVERHEAD_MAP || _scene->_goToScene == OVERHEAD_MAP2) {
|
if (_scene->_goToScene == OVERHEAD_MAP || _scene->_goToScene == OVERHEAD_MAP2) {
|
||||||
// Show the map
|
// Show the map
|
||||||
if (_sound->_musicOn) {
|
if (_sound->_musicOn && _sound->loadSong(100))
|
||||||
if (_sound->loadSong(100)) {
|
_sound->startSong();
|
||||||
if (_sound->_music)
|
|
||||||
_sound->startSong();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_scene->_goToScene = _map->show();
|
_scene->_goToScene = _map->show();
|
||||||
|
|
||||||
|
@ -693,10 +689,8 @@ void ScalpelEngine::startScene() {
|
||||||
case RESCUE_ANNA:
|
case RESCUE_ANNA:
|
||||||
case MOOREHEAD_DEATH:
|
case MOOREHEAD_DEATH:
|
||||||
case BRUMWELL_SUICIDE:
|
case BRUMWELL_SUICIDE:
|
||||||
if (_sound->_musicOn && _sound->loadSong(_scene->_goToScene)) {
|
if (_sound->_musicOn && _sound->loadSong(_scene->_goToScene))
|
||||||
if (_sound->_music)
|
_sound->startSong();
|
||||||
_sound->startSong();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (_scene->_goToScene) {
|
switch (_scene->_goToScene) {
|
||||||
case BLACKWOOD_CAPTURE:
|
case BLACKWOOD_CAPTURE:
|
||||||
|
|
|
@ -446,10 +446,8 @@ bool Scene::loadScene(const Common::String &filename) {
|
||||||
checkInventory();
|
checkInventory();
|
||||||
|
|
||||||
// Handle starting any music for the scene
|
// Handle starting any music for the scene
|
||||||
if (sound._musicOn && sound.loadSong(_currentScene)) {
|
if (sound._musicOn && sound.loadSong(_currentScene))
|
||||||
if (sound._music)
|
sound.startSong();
|
||||||
sound.startSong();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load walking images if not already loaded
|
// Load walking images if not already loaded
|
||||||
people.loadWalk();
|
people.loadWalk();
|
||||||
|
|
|
@ -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),
|
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");
|
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),
|
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);
|
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
|
// Print the button text
|
||||||
switch (idx) {
|
switch (idx) {
|
||||||
case 1:
|
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);
|
screen.buttonPrint(Common::Point(SETUP_POINTS[idx][3], SETUP_POINTS[idx][1]), color, true, tempStr);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -255,14 +255,11 @@ void Settings::show(SherlockEngine *vm) {
|
||||||
|
|
||||||
if ((found == 1 && events._released) || ui._key == 'M') {
|
if ((found == 1 && events._released) || ui._key == 'M') {
|
||||||
// Toggle music
|
// Toggle music
|
||||||
if (sound._music) {
|
sound._musicOn = !sound._musicOn;
|
||||||
sound.stopSound();
|
if (!sound._musicOn)
|
||||||
sound._music = false;
|
sound.stopMusic();
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
sound._music = true;
|
|
||||||
sound.startSong();
|
sound.startSong();
|
||||||
}
|
|
||||||
|
|
||||||
updateConfig = true;
|
updateConfig = true;
|
||||||
settings.drawInteface(true);
|
settings.drawInteface(true);
|
||||||
|
|
|
@ -218,7 +218,7 @@ void SherlockEngine::loadConfig() {
|
||||||
|
|
||||||
void SherlockEngine::saveConfig() {
|
void SherlockEngine::saveConfig() {
|
||||||
ConfMan.setBool("mute", !_sound->_digitized);
|
ConfMan.setBool("mute", !_sound->_digitized);
|
||||||
ConfMan.setBool("music_mute", !_sound->_music);
|
ConfMan.setBool("music_mute", !_sound->_musicOn);
|
||||||
ConfMan.setBool("speech_mute", !_sound->_voices);
|
ConfMan.setBool("speech_mute", !_sound->_voices);
|
||||||
|
|
||||||
ConfMan.setInt("font", _screen->fontNumber());
|
ConfMan.setInt("font", _screen->fontNumber());
|
||||||
|
|
|
@ -52,7 +52,7 @@ static const uint8 creativeADPCM_AdjustMap[64] = {
|
||||||
|
|
||||||
Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
|
Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
|
||||||
_digitized = false;
|
_digitized = false;
|
||||||
_music = false;
|
_musicPlaying = false;
|
||||||
_voices = 0;
|
_voices = 0;
|
||||||
_diskSoundPlaying = false;
|
_diskSoundPlaying = false;
|
||||||
_soundPlaying = false;
|
_soundPlaying = false;
|
||||||
|
@ -78,7 +78,7 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
|
||||||
|
|
||||||
void Sound::syncSoundSettings() {
|
void Sound::syncSoundSettings() {
|
||||||
_digitized = !ConfMan.getBool("mute");
|
_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;
|
_voices = !ConfMan.getBool("mute") && !ConfMan.getBool("speech_mute") ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,6 +202,9 @@ void Sound::stopSound() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::playMusic(const Common::String &name) {
|
void Sound::playMusic(const Common::String &name) {
|
||||||
|
if (!_musicOn)
|
||||||
|
return;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
warning("Sound::playMusic %s", name.c_str());
|
warning("Sound::playMusic %s", name.c_str());
|
||||||
Common::SeekableReadStream *stream = _vm->_res->load(name, "MUSIC.LIB");
|
Common::SeekableReadStream *stream = _vm->_res->load(name, "MUSIC.LIB");
|
||||||
|
@ -223,6 +226,8 @@ void Sound::playMusic(const Common::String &name) {
|
||||||
void Sound::stopMusic() {
|
void Sound::stopMusic() {
|
||||||
// TODO
|
// TODO
|
||||||
warning("TODO: Sound::stopMusic");
|
warning("TODO: Sound::stopMusic");
|
||||||
|
|
||||||
|
_musicPlaying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Sound::loadSong(int songNumber) {
|
int Sound::loadSong(int songNumber) {
|
||||||
|
@ -232,8 +237,13 @@ int Sound::loadSong(int songNumber) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::startSong() {
|
void Sound::startSong() {
|
||||||
|
if (!_musicOn)
|
||||||
|
return;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
warning("TODO: Sound::startSong");
|
warning("TODO: Sound::startSong");
|
||||||
|
|
||||||
|
_musicPlaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::freeSong() {
|
void Sound::freeSong() {
|
||||||
|
|
|
@ -49,7 +49,7 @@ private:
|
||||||
byte decodeSample(byte sample, byte& reference, int16& scale);
|
byte decodeSample(byte sample, byte& reference, int16& scale);
|
||||||
public:
|
public:
|
||||||
bool _digitized;
|
bool _digitized;
|
||||||
bool _music;
|
bool _musicPlaying;
|
||||||
int _voices;
|
int _voices;
|
||||||
bool _soundOn;
|
bool _soundOn;
|
||||||
bool _musicOn;
|
bool _musicOn;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue