diff options
author | Colin Snover | 2017-11-12 10:16:34 -0600 |
---|---|---|
committer | Eugene Sandulenko | 2017-11-18 22:35:12 +0100 |
commit | 72a42927279a8b740cd0bb5a8053def4a465f2dd (patch) | |
tree | 81ad3321e6e6898c19d4d26c1c3ae64bcbc536c4 /engines/fullpipe/modal.cpp | |
parent | 8f1d76d2616489924f472815f91107cd46d479de (diff) | |
download | scummvm-rg350-72a42927279a8b740cd0bb5a8053def4a465f2dd.tar.gz scummvm-rg350-72a42927279a8b740cd0bb5a8053def4a465f2dd.tar.bz2 scummvm-rg350-72a42927279a8b740cd0bb5a8053def4a465f2dd.zip |
FULLPIPE: Improve memory safety and fix leaks in sound code
Diffstat (limited to 'engines/fullpipe/modal.cpp')
-rw-r--r-- | engines/fullpipe/modal.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 3faa035c60..6589ba6991 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1504,11 +1504,11 @@ void ModalMainMenu::updateVolume() { } } -void ModalMainMenu::updateSoundVolume(Sound *snd) { - if (!snd->_objectId) +void ModalMainMenu::updateSoundVolume(Sound &snd) { + if (!snd._objectId) return; - StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(snd->_objectId, -1); + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(snd._objectId, -1); if (!ani) return; @@ -1522,7 +1522,7 @@ void ModalMainMenu::updateSoundVolume(Sound *snd) { if (ani->_oy <= _screct.bottom) { if (ani->_oy >= _screct.top) { - snd->setPanAndVolume(g_fp->_sfxVolume, 0); + snd.setPanAndVolume(g_fp->_sfxVolume, 0); return; } @@ -1534,7 +1534,7 @@ void ModalMainMenu::updateSoundVolume(Sound *snd) { par = 0; if (dx > 800) { - snd->setPanAndVolume(-3500, 0); + snd.setPanAndVolume(-3500, 0); return; } @@ -1545,7 +1545,7 @@ void ModalMainMenu::updateSoundVolume(Sound *snd) { int dx = ani->_ox - _screct.right; if (dx > 800) { - snd->setPanAndVolume(-3500, 0); + snd.setPanAndVolume(-3500, 0); return; } @@ -1557,7 +1557,7 @@ void ModalMainMenu::updateSoundVolume(Sound *snd) { int32 pp = b * a; - snd->setPanAndVolume(pan + pp / 800, par); + snd.setPanAndVolume(pan + pp / 800, par); return; } @@ -1570,9 +1570,9 @@ void ModalMainMenu::updateSoundVolume(Sound *snd) { if (p > g_fp->_sfxVolume) p = g_fp->_sfxVolume; - snd->setPanAndVolume(p, dx * (-3500) / 800); + snd.setPanAndVolume(p, dx * (-3500) / 800); } else { - snd->setPanAndVolume(-3500, 0); + snd.setPanAndVolume(-3500, 0); } } |