aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorColin Snover2017-07-24 12:24:48 -0500
committerColin Snover2017-07-24 19:36:38 -0500
commit97f7308da3216c3e2c9a520573be2fc75639465f (patch)
tree1995495460c7bf734151bb3c2bcea400bbd14abb /engines/sci/engine
parent5ab010e15f19fd94720b4199f3ab1c86e74842ad (diff)
downloadscummvm-rg350-97f7308da3216c3e2c9a520573be2fc75639465f.tar.gz
scummvm-rg350-97f7308da3216c3e2c9a520573be2fc75639465f.tar.bz2
scummvm-rg350-97f7308da3216c3e2c9a520573be2fc75639465f.zip
SCI32: Add music volume UI sync for MGDX
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/guest_additions.cpp21
-rw-r--r--engines/sci/engine/guest_additions.h1
-rw-r--r--engines/sci/engine/selector.cpp1
-rw-r--r--engines/sci/engine/selector.h1
4 files changed, 24 insertions, 0 deletions
diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp
index 2cfed136aa..0f4818d544 100644
--- a/engines/sci/engine/guest_additions.cpp
+++ b/engines/sci/engine/guest_additions.cpp
@@ -1023,6 +1023,10 @@ void GuestAdditions::syncInGameUI(const int16 musicVolume, const int16 sfxVolume
}
switch (g_sci->getGameId()) {
+ case GID_MOTHERGOOSEHIRES:
+ syncMGDXUI(musicVolume);
+ break;
+
case GID_PQ4:
syncPQ4UI(musicVolume);
break;
@@ -1125,6 +1129,23 @@ void GuestAdditions::syncPhant1UI(const int16 oldMusicVolume, const int16 musicV
}
}
+void GuestAdditions::syncMGDXUI(const int16 musicVolume) const {
+ const reg_t sliderId = _segMan->findObjectByName("icon1");
+ if (!sliderId.isNull()) {
+ const int16 celNo = 7 - (musicVolume * 8 / (MUSIC_MASTERVOLUME_MAX + 1));
+ writeSelectorValue(_segMan, sliderId, SELECTOR(mainCel), celNo);
+ writeSelectorValue(_segMan, sliderId, SELECTOR(cel), celNo);
+
+ // 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);
+ }
+ }
+}
+
void GuestAdditions::syncPQ4UI(const int16 musicVolume) const {
const SegmentId segment = _segMan->getScriptSegment(9, SCRIPT_GET_DONT_LOAD);
if (segment != 0 && _segMan->getScript(segment)->getLocalsCount() > 2) {
diff --git a/engines/sci/engine/guest_additions.h b/engines/sci/engine/guest_additions.h
index c920fa74f5..79f498a04e 100644
--- a/engines/sci/engine/guest_additions.h
+++ b/engines/sci/engine/guest_additions.h
@@ -348,6 +348,7 @@ private:
void syncGK1UI() const;
void syncGK2UI() const;
void syncLSL6HiresUI(const int16 musicVolume) const;
+ void syncMGDXUI(const int16 musicVolume) const;
void syncPhant1UI(const int16 oldMusicVolume, const int16 musicVolume, reg_t &musicGlobal, const int16 oldDacVolume, const int16 dacVolume, reg_t &dacGlobal) const;
void syncPQ4UI(const int16 musicVolume) const;
void syncPQSWATUI() const;
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index 9c6921b181..77405578ed 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -218,6 +218,7 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(setSize);
FIND_SELECTOR(displayValue);
FIND_SELECTOR2(new_, "new");
+ FIND_SELECTOR(mainCel);
#endif
}
diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h
index d97a8832c0..b2232625f2 100644
--- a/engines/sci/engine/selector.h
+++ b/engines/sci/engine/selector.h
@@ -175,6 +175,7 @@ struct SelectorCache {
Selector setSize; // for PQ4 volume sync
Selector displayValue; // for PQ:SWAT volume sync
Selector new_; // for Torin/LSL7 save/load patching
+ Selector mainCel; // for MGDX volume sync
#endif
};