From 6d4900ad06821c69334735b48f8451e32030bcad Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 5 Sep 2008 13:02:03 +0000 Subject: Hopefully fixed the chaos with the SAGA volume values. This also fixes the broken volume introduced with the introduction of the RTL code in the engine svn-id: r34349 --- engines/saga/interface.cpp | 21 ++++++++++++--------- engines/saga/music.cpp | 6 +++--- engines/saga/rscfile.cpp | 2 +- engines/saga/sfuncs.cpp | 6 +++--- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp index 2112f5ee98..abf8094533 100644 --- a/engines/saga/interface.cpp +++ b/engines/saga/interface.cpp @@ -1646,13 +1646,15 @@ void Interface::setOption(PanelButton *panelButton) { } break; case kTextMusic: - _vm->_musicVolume = (_vm->_musicVolume + 1) % 11; - _vm->_music->setVolume(_vm->_musicVolume == 10 ? -1 : _vm->_musicVolume * 25, 1); - ConfMan.setInt("music_volume", _vm->_musicVolume * 25); + _vm->_musicVolume = _vm->_musicVolume + 25; + if (_vm->_musicVolume > 255) _vm->_musicVolume = 0; + _vm->_music->setVolume(_vm->_musicVolume, 1); + ConfMan.setInt("music_volume", _vm->_musicVolume); break; case kTextSound: - _vm->_soundVolume = (_vm->_soundVolume + 1) % 11; - ConfMan.setInt("sfx_volume", _vm->_soundVolume * 25); + _vm->_soundVolume = _vm->_soundVolume + 25; + if (_vm->_soundVolume > 255) _vm->_soundVolume = 0; + ConfMan.setInt("sound_volume", _vm->_soundVolume); _vm->_sound->setVolume(); break; case kTextVoices: @@ -1672,8 +1674,9 @@ void Interface::setOption(PanelButton *panelButton) { _vm->_voicesEnabled = false; } - _vm->_speechVolume = (_vm->_speechVolume + 1) % 11; - ConfMan.setInt("speech_volume", _vm->_speechVolume * 25); + _vm->_speechVolume = _vm->_speechVolume + 25; + if (_vm->_speechVolume > 255) _vm->_speechVolume = 0; + ConfMan.setInt("speech_volume", _vm->_speechVolume); _vm->_sound->setVolume(); ConfMan.setBool("subtitles", _vm->_subtitlesEnabled); @@ -2275,13 +2278,13 @@ void Interface::drawPanelButtonText(Surface *ds, InterfacePanel *panel, PanelBut break; case kTextMusic: if (_vm->_musicVolume) - textId = kText10Percent + _vm->_musicVolume - 1; + textId = kText10Percent + _vm->_musicVolume / 25 - 1; else textId = kTextOff; break; case kTextSound: if (_vm->_soundVolume) - textId = kText10Percent + _vm->_soundVolume - 1; + textId = kText10Percent + _vm->_soundVolume / 25 - 1; else textId = kTextOff; break; diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 9b0efad0d5..5bf0c0ec03 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -404,7 +404,7 @@ void Music::musicVolumeGauge() { } void Music::setVolume(int volume, int time) { - _targetVolume = volume * 2; // ScummVM has different volume scale + _targetVolume = volume; _currentVolumePercent = 0; if (volume == -1) // Set Full volume @@ -585,7 +585,7 @@ void Music::play(uint32 resourceId, MusicFlags flags) { parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1); _player->_parser = parser; - setVolume(_vm->_musicVolume == 10 ? 255 : _vm->_musicVolume * 25); + setVolume(_vm->_musicVolume); if (flags & MUSIC_LOOP) _player->setLoop(true); @@ -603,7 +603,7 @@ void Music::pause(void) { } void Music::resume(void) { - _player->setVolume(_vm->_musicVolume == 10 ? 255 : _vm->_musicVolume * 25); + _player->setVolume(_vm->_musicVolume); _player->setPlaying(true); } diff --git a/engines/saga/rscfile.cpp b/engines/saga/rscfile.cpp index e150caeca5..9bf882153c 100644 --- a/engines/saga/rscfile.cpp +++ b/engines/saga/rscfile.cpp @@ -805,7 +805,7 @@ void Resource::loadGlobalResources(int chapter, int actorsEntrance) { free(resourcePointer); } else { // The IHNM demo has a fixed music track and doesn't load a song table - _vm->_music->setVolume(_vm->_musicVolume == 10 ? -1 : _vm->_musicVolume * 25, 1); + _vm->_music->setVolume(_vm->_musicVolume, 1); _vm->_music->play(3, MUSIC_LOOP); free(resourcePointer); } diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp index e1e1074e1d..e19fd5ae02 100644 --- a/engines/saga/sfuncs.cpp +++ b/engines/saga/sfuncs.cpp @@ -1465,7 +1465,7 @@ void Script::sfPlayMusic(SCRIPTFUNC_PARAMS) { int16 param = thread->pop() + 9; if (param >= 9 && param <= 34) { - _vm->_music->setVolume(_vm->_musicVolume == 10 ? -1 : _vm->_musicVolume * 25, 1); + _vm->_music->setVolume(_vm->_musicVolume, 1); _vm->_music->play(param); } else { _vm->_music->stop(); @@ -1482,7 +1482,7 @@ void Script::sfPlayMusic(SCRIPTFUNC_PARAMS) { if (param1 >= _vm->_music->_songTableLen) { warning("sfPlayMusic: Wrong song number (%d > %d)", param1, _vm->_music->_songTableLen - 1); } else { - _vm->_music->setVolume(_vm->_musicVolume == 10 ? -1 : _vm->_musicVolume * 25, 1); + _vm->_music->setVolume(_vm->_musicVolume, 1); _vm->_music->play(_vm->_music->_songTable[param1], param2 ? MUSIC_LOOP : MUSIC_NORMAL); if (!_vm->_scene->haveChapterPointsChanged()) { _vm->_scene->setCurrentMusicTrack(param1); @@ -1928,7 +1928,7 @@ void Script::sfQueueMusic(SCRIPTFUNC_PARAMS) { if (param1 >= _vm->_music->_songTableLen) { warning("sfQueueMusic: Wrong song number (%d > %d)", param1, _vm->_music->_songTableLen - 1); } else { - _vm->_music->setVolume(_vm->_musicVolume == 10 ? -1 : _vm->_musicVolume * 25, 1); + _vm->_music->setVolume(_vm->_musicVolume, 1); event.type = kEvTOneshot; event.code = kMusicEvent; event.param = _vm->_music->_songTable[param1]; -- cgit v1.2.3