diff options
author | sluicebox | 2019-09-28 17:41:01 -0700 |
---|---|---|
committer | sluicebox | 2019-09-28 17:41:01 -0700 |
commit | 188c64349ff1029777b151bf2e2e781844d8d304 (patch) | |
tree | 08d7f0c15b4bebb4a873009e0c06d15145a4c3eb /engines | |
parent | 1736467d20279901a7e7f0e4152a2162e129903c (diff) | |
download | scummvm-rg350-188c64349ff1029777b151bf2e2e781844d8d304.tar.gz scummvm-rg350-188c64349ff1029777b151bf2e2e781844d8d304.tar.bz2 scummvm-rg350-188c64349ff1029777b151bf2e2e781844d8d304.zip |
SCI32: Sync HOYLE5 Bridge volume control
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/guest_additions.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp index 7f5a11cb63..581cbbf4e1 100644 --- a/engines/sci/engine/guest_additions.cpp +++ b/engines/sci/engine/guest_additions.cpp @@ -114,6 +114,9 @@ bool GuestAdditions::shouldSyncAudioToScummVM() const { return true; } else if (gameId == GID_GK2 && objName == "soundSlider") { return true; + } else if (gameId == GID_HOYLE5 && objName == "volumeSliderF") { + // Hoyle5 has a second control panel with a different slider name + return true; } else if (gameId == GID_KQ7 && (objName == "volumeUp" || objName == "volumeDown")) { return true; @@ -1406,17 +1409,22 @@ void GuestAdditions::syncGK2UI() const { } void GuestAdditions::syncHoyle5UI(const int16 musicVolume) const { - const reg_t sliderId = _segMan->findObjectByName("volumeSlider"); - if (!sliderId.isNull()) { - const int16 yPosition = 167 - musicVolume * 145 / 10; - writeSelectorValue(_segMan, sliderId, SELECTOR(y), yPosition); - - // There does not seem to be any good way to learn whether the - // volume slider is visible (and thus eligible for - // kUpdateScreenItem) - const reg_t planeId = readSelector(_segMan, sliderId, SELECTOR(plane)); - if (g_sci->_gfxFrameout->getPlanes().findByObject(planeId) != nullptr) { - g_sci->_gfxFrameout->kernelUpdateScreenItem(sliderId); + // Hoyle5 has two control panels with different slider names + const reg_t sliders[] = { _segMan->findObjectByName("volumeSlider"), + _segMan->findObjectByName("volumeSliderF") }; + for (int i = 0; i < ARRAYSIZE(sliders); ++i) { + const reg_t sliderId = sliders[i]; + if (!sliderId.isNull()) { + const int16 yPosition = 167 - musicVolume * 145 / 10; + writeSelectorValue(_segMan, sliderId, SELECTOR(y), yPosition); + + // There does not seem to be any good way to learn whether the + // volume slider is visible (and thus eligible for + // kUpdateScreenItem) + const reg_t planeId = readSelector(_segMan, sliderId, SELECTOR(plane)); + if (g_sci->_gfxFrameout->getPlanes().findByObject(planeId) != nullptr) { + g_sci->_gfxFrameout->kernelUpdateScreenItem(sliderId); + } } } } |