diff options
author | Johannes Schickel | 2012-09-21 03:01:39 +0200 |
---|---|---|
committer | Johannes Schickel | 2012-09-21 03:01:39 +0200 |
commit | fad5041a3206da1649702874b563986d65a3626a (patch) | |
tree | d7d06a9053bebdc47a2ebae559d24f32b831e92b /engines/toltecs | |
parent | 1aa12ddb967832e196ae694d34a4ba49802cab2c (diff) | |
download | scummvm-rg350-fad5041a3206da1649702874b563986d65a3626a.tar.gz scummvm-rg350-fad5041a3206da1649702874b563986d65a3626a.tar.bz2 scummvm-rg350-fad5041a3206da1649702874b563986d65a3626a.zip |
TOLTECS: Replace ceil with integer maths.
This removes an unnecessary use of floating point maths.
Diffstat (limited to 'engines/toltecs')
-rw-r--r-- | engines/toltecs/menu.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp index d7ba254d9b..dfdad74839 100644 --- a/engines/toltecs/menu.cpp +++ b/engines/toltecs/menu.cpp @@ -582,19 +582,20 @@ void MenuSystem::changeVolumeBar(ItemID itemID, int delta) { switch (itemID) { case kItemIdVoices: _vm->_cfgVoicesVolume = CLIP(_vm->_cfgVoicesVolume + delta, 0, 20); - newVolume = ceil((double)_vm->_cfgVoicesVolume * Audio::Mixer::kMaxChannelVolume / 20); + // Always round volume up instead of down. + newVolume = (_vm->_cfgVoicesVolume * Audio::Mixer::kMaxChannelVolume + 19) / 20; _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, newVolume); ConfMan.setInt("speech_volume", newVolume); break; case kItemIdMusic: _vm->_cfgMusicVolume = CLIP(_vm->_cfgMusicVolume + delta, 0, 20); - newVolume = ceil((double)_vm->_cfgMusicVolume * Audio::Mixer::kMaxChannelVolume / 20); + newVolume = (_vm->_cfgMusicVolume * Audio::Mixer::kMaxChannelVolume + 19) / 20; _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, newVolume); ConfMan.setInt("music_volume", newVolume); break; case kItemIdSoundFX: _vm->_cfgSoundFXVolume = CLIP(_vm->_cfgSoundFXVolume + delta, 0, 20); - newVolume = ceil((double)_vm->_cfgSoundFXVolume * Audio::Mixer::kMaxChannelVolume / 20); + newVolume = (_vm->_cfgSoundFXVolume * Audio::Mixer::kMaxChannelVolume + 19) / 20; _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, newVolume); ConfMan.setInt("sfx_volume", newVolume); break; |