aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/features.cpp1
-rw-r--r--engines/sci/engine/guest_additions.cpp67
-rw-r--r--engines/sci/engine/guest_additions.h3
-rw-r--r--engines/sci/engine/vm.h3
4 files changed, 61 insertions, 13 deletions
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index 7172a6fbe3..06fa046228 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -574,6 +574,7 @@ bool GameFeatures::audioVolumeSyncUsesGlobals() const {
switch (g_sci->getGameId()) {
case GID_GK1:
case GID_GK2:
+ case GID_HOYLE5:
case GID_LSL6HIRES:
case GID_LSL7:
case GID_PHANTASMAGORIA:
diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp
index 06d8d9a5d3..6e15a5259e 100644
--- a/engines/sci/engine/guest_additions.cpp
+++ b/engines/sci/engine/guest_additions.cpp
@@ -112,8 +112,7 @@ bool GuestAdditions::shouldSyncAudioToScummVM() const {
} else if ((gameId == GID_GK1 || gameId == GID_SQ6) && (objName == "musicBar" ||
objName == "soundBar")) {
return true;
- } else if (gameId == GID_PQ4 && (objName == "increaseVolume" ||
- objName == "decreaseVolume")) {
+ } else if (gameId == GID_GK2 && objName == "soundSlider") {
return true;
} else if (gameId == GID_KQ7 && (objName == "volumeUp" ||
objName == "volumeDown")) {
@@ -121,14 +120,11 @@ bool GuestAdditions::shouldSyncAudioToScummVM() const {
} else if (gameId == GID_LSL6HIRES && (objName == "hiResMenu" ||
objName == "volumeDial")) {
return true;
- } else if (gameId == GID_MOTHERGOOSEHIRES && objName == "MgButtonBar") {
- return true;
- } else if (gameId == GID_PQSWAT && (objName == "volumeDownButn" ||
- objName == "volumeUpButn")) {
- return true;
- } else if (gameId == GID_SHIVERS && objName == "spVolume") {
+ } else if ((gameId == GID_LSL7 || gameId == GID_TORIN) && (objName == "oMusicScroll" ||
+ objName == "oSFXScroll" ||
+ objName == "oAudioScroll")) {
return true;
- } else if (gameId == GID_GK2 && objName == "soundSlider") {
+ } else if (gameId == GID_MOTHERGOOSEHIRES && objName == "MgButtonBar") {
return true;
} else if (gameId == GID_PHANTASMAGORIA && (objName == "midiVolDown" ||
objName == "midiVolUp" ||
@@ -137,9 +133,13 @@ bool GuestAdditions::shouldSyncAudioToScummVM() const {
return true;
} else if (gameId == GID_PHANTASMAGORIA2 && objName == "foo2") {
return true;
- } else if ((gameId == GID_LSL7 || gameId == GID_TORIN) && (objName == "oMusicScroll" ||
- objName == "oSFXScroll" ||
- objName == "oAudioScroll")) {
+ } else if (gameId == GID_PQ4 && (objName == "increaseVolume" ||
+ objName == "decreaseVolume")) {
+ return true;
+ } else if (gameId == GID_PQSWAT && (objName == "volumeDownButn" ||
+ objName == "volumeUpButn")) {
+ return true;
+ } else if (gameId == GID_SHIVERS && objName == "spVolume") {
return true;
#endif
}
@@ -163,6 +163,8 @@ void GuestAdditions::writeVarHook(const int type, const int index, const reg_t v
syncAudioVolumeGlobalsToScummVM(index, value);
} else if (g_sci->getGameId() == GID_GK1) {
syncGK1StartupVolumeFromScummVM(index, value);
+ } else if (g_sci->getGameId() == GID_HOYLE5 && index == kGlobalVarHoyle5MusicVolume) {
+ syncHoyle5VolumeFromScummVM((ConfMan.getInt("music_volume") + 1) * kHoyle5VolumeMax / Audio::Mixer::kMaxMixerVolume);
} else if (g_sci->getGameId() == GID_RAMA && !g_sci->isDemo() && index == kGlobalVarRamaMusicVolume) {
syncRamaVolumeFromScummVM((ConfMan.getInt("music_volume") + 1) * kRamaVolumeMax / Audio::Mixer::kMaxMixerVolume);
}
@@ -1004,6 +1006,13 @@ void GuestAdditions::syncAudioVolumeGlobalsFromScummVM() const {
break;
}
+ case GID_HOYLE5: {
+ const int16 musicVolume = (ConfMan.getInt("music_volume") + 1) * kHoyle5VolumeMax / Audio::Mixer::kMaxMixerVolume;
+ syncHoyle5VolumeFromScummVM(musicVolume);
+ syncHoyle5UI(musicVolume);
+ break;
+ }
+
case GID_LSL6HIRES: {
const int16 musicVolume = (ConfMan.getInt("music_volume") + 1) * kLSL6HiresUIVolumeMax / Audio::Mixer::kMaxMixerVolume;
syncLSL6HiresVolumeFromScummVM(musicVolume);
@@ -1136,6 +1145,11 @@ void GuestAdditions::syncGK2VolumeFromScummVM(const int16 musicVolume) const {
}
}
+void GuestAdditions::syncHoyle5VolumeFromScummVM(const int16 musicVolume) const {
+ _state->variables[VAR_GLOBAL][kGlobalVarHoyle5MusicVolume] = make_reg(0, musicVolume);
+ g_sci->_soundCmd->setMasterVolume(ConfMan.getBool("mute") ? 0 : (musicVolume * MUSIC_MASTERVOLUME_MAX / kHoyle5VolumeMax));
+}
+
void GuestAdditions::syncLSL6HiresVolumeFromScummVM(const int16 musicVolume) const {
_state->variables[VAR_GLOBAL][kGlobalVarLSL6HiresMusicVolume] = make_reg(0, musicVolume);
g_sci->_soundCmd->setMasterVolume(ConfMan.getBool("mute") ? 0 : (musicVolume * MUSIC_MASTERVOLUME_MAX / kLSL6HiresUIVolumeMax));
@@ -1195,6 +1209,15 @@ void GuestAdditions::syncAudioVolumeGlobalsToScummVM(const int index, const reg_
}
break;
+ case GID_HOYLE5:
+ if (index == kGlobalVarHoyle5MusicVolume) {
+ const int16 masterVolume = value.toSint16() * Audio::Mixer::kMaxMixerVolume / kHoyle5VolumeMax;
+ ConfMan.setInt("music_volume", masterVolume);
+ ConfMan.setInt("sfx_volume", masterVolume);
+ ConfMan.setInt("speech_volume", masterVolume);
+ }
+ break;
+
case GID_LSL6HIRES:
if (index == kGlobalVarLSL6HiresMusicVolume) {
const int16 musicVolume = value.toSint16() * Audio::Mixer::kMaxMixerVolume / kLSL6HiresUIVolumeMax;
@@ -1299,6 +1322,10 @@ void GuestAdditions::syncInGameUI(const int16 musicVolume, const int16 sfxVolume
syncQFG4UI(musicVolume);
break;
+ case GID_HOYLE5:
+ syncHoyle5UI(musicVolume);
+ break;
+
case GID_SHIVERS:
syncShivers1UI(sfxVolume);
break;
@@ -1344,6 +1371,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);
+ }
+ }
+}
+
void GuestAdditions::syncLSL6HiresUI(const int16 musicVolume) const {
const reg_t musicDialId = _segMan->findObjectByName("volumeDial");
if (!musicDialId.isNull()) {
diff --git a/engines/sci/engine/guest_additions.h b/engines/sci/engine/guest_additions.h
index ba6adf344e..b49fe9d283 100644
--- a/engines/sci/engine/guest_additions.h
+++ b/engines/sci/engine/guest_additions.h
@@ -45,6 +45,7 @@ enum {
kRamaVolumeMax = 16,
kLSL6HiresUIVolumeMax = 13,
+ kHoyle5VolumeMax = 8,
kLSL6HiresSubtitleFlag = 105
};
#endif
@@ -387,6 +388,7 @@ private:
void syncGK1VolumeFromScummVM(const int16 musicVolume, const int16 dacVolume) const;
void syncGK2VolumeFromScummVM(const int16 musicVolume) const;
+ void syncHoyle5VolumeFromScummVM(const int16 musicVolume) const;
void syncLSL6HiresVolumeFromScummVM(const int16 musicVolume) const;
void syncPhant2VolumeFromScummVM(const int16 masterVolume) const;
void syncRamaVolumeFromScummVM(const int16 musicVolume) const;
@@ -416,6 +418,7 @@ private:
void syncGK1UI() const;
void syncGK2UI() const;
+ void syncHoyle5UI(const int16 musicVolume) 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;
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 9cb88e3888..19d4dea014 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -176,7 +176,8 @@ enum GlobalVar {
// a master volume that affects both music *and* sound effects
kGlobalVarPhant2MasterVolume = 236, // 0 to 127
kGlobalVarPhant2ControlPanel = 250,
- kGlobalVarShivers1Score = 349
+ kGlobalVarShivers1Score = 349,
+ kGlobalVarHoyle5MusicVolume = 897
};
/** Number of kernel calls in between gcs; should be < 50000 */