diff options
author | Colin Snover | 2017-09-28 13:47:45 -0500 |
---|---|---|
committer | Colin Snover | 2017-09-28 14:58:17 -0500 |
commit | cd6130cdd62aa54e9b4ec4e8b367509224bd3248 (patch) | |
tree | b5cf4cb2b45bcd032d577f9ab5b4857fef1d29cb /engines/sci | |
parent | 1351189575251a7fd6ebd6af62677e501077a9df (diff) | |
download | scummvm-rg350-cd6130cdd62aa54e9b4ec4e8b367509224bd3248.tar.gz scummvm-rg350-cd6130cdd62aa54e9b4ec4e8b367509224bd3248.tar.bz2 scummvm-rg350-cd6130cdd62aa54e9b4ec4e8b367509224bd3248.zip |
SCI32: Add audio volume sync support for RAMA
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/detection_tables.h | 7 | ||||
-rw-r--r-- | engines/sci/engine/features.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/guest_additions.cpp | 35 | ||||
-rw-r--r-- | engines/sci/engine/guest_additions.h | 3 | ||||
-rw-r--r-- | engines/sci/engine/selector.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/selector.h | 2 | ||||
-rw-r--r-- | engines/sci/engine/vm.h | 2 |
7 files changed, 48 insertions, 5 deletions
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h index efe2884a5a..58af0fde71 100644 --- a/engines/sci/detection_tables.h +++ b/engines/sci/detection_tables.h @@ -4022,17 +4022,18 @@ static const struct ADGameDescription SciGameDescriptions[] = { #undef GUIO_QFG4_FLOPPY #undef GUIO_QFG4_CD -#define GUIO_RAMA_DEMO GUIO7(GUIO_NOMIDI, \ +#define GUIO_RAMA_DEMO GUIO8(GUIO_NOSUBTITLES, \ + GUIO_NOMIDI, \ GUIO_NOLAUNCHLOAD, \ GUIO_NOASPECT, \ GUIO_LINKSPEECHTOSFX, \ GUIO_LINKMUSICTOSFX, \ GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \ GAMEOPTION_HQ_VIDEO) -#define GUIO_RAMA GUIO7(GUIO_NOMIDI, \ +#define GUIO_RAMA GUIO7(GUIO_NOSUBTITLES, \ + GUIO_NOMIDI, \ GUIO_NOASPECT, \ GUIO_LINKSPEECHTOSFX, \ - GUIO_LINKMUSICTOSFX, \ GAMEOPTION_ORIGINAL_SAVELOAD, \ GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \ GAMEOPTION_HQ_VIDEO) diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp index c4e23b59aa..f94ab8a6a7 100644 --- a/engines/sci/engine/features.cpp +++ b/engines/sci/engine/features.cpp @@ -577,8 +577,8 @@ bool GameFeatures::audioVolumeSyncUsesGlobals() const { case GID_LSL7: case GID_PHANTASMAGORIA: case GID_PHANTASMAGORIA2: + case GID_RAMA: case GID_TORIN: - // TODO: SCI3 return true; default: return false; diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp index 06cf0c9f66..d4e410261f 100644 --- a/engines/sci/engine/guest_additions.cpp +++ b/engines/sci/engine/guest_additions.cpp @@ -100,7 +100,7 @@ bool GuestAdditions::shouldSyncAudioToScummVM() const { // SCI16 with menu bar return true; } else if (objName == "volumeSlider") { - // SCI16 with icon bar, QFG4, Hoyle5 + // SCI16 with icon bar, QFG4, Hoyle5, RAMA return true; } else if (gameId == GID_MOTHERGOOSE256 && objName == "soundBut") { return true; @@ -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_RAMA && index == kGlobalVarRamaMusicVolume) { + syncRamaVolumeFromScummVM((ConfMan.getInt("music_volume") + 1) * kRamaVolumeMax / Audio::Mixer::kMaxMixerVolume); } if (_features->supportsTextSpeed()) { @@ -1034,6 +1036,13 @@ void GuestAdditions::syncAudioVolumeGlobalsFromScummVM() const { break; } + case GID_RAMA: { + const int16 musicVolume = (ConfMan.getInt("music_volume") + 1) * kRamaVolumeMax / Audio::Mixer::kMaxMixerVolume; + syncRamaVolumeFromScummVM(musicVolume); + syncRamaUI(musicVolume); + break; + } + case GID_LSL7: case GID_TORIN: { const int16 musicVolume = (ConfMan.getInt("music_volume") + 1) * 100 / Audio::Mixer::kMaxMixerVolume; @@ -1143,6 +1152,15 @@ void GuestAdditions::syncPhant2VolumeFromScummVM(const int16 masterVolume) const } } +void GuestAdditions::syncRamaVolumeFromScummVM(const int16 musicVolume) const { + _state->variables[VAR_GLOBAL][kGlobalVarRamaMusicVolume] = make_reg(0, musicVolume); + const reg_t gameId = _state->variables[VAR_GLOBAL][kGlobalVarGame]; + if (!gameId.isNull()) { + reg_t args[] = { make_reg(0, musicVolume) }; + invokeSelector(gameId, SELECTOR(masterVolume), 1, args); + } +} + void GuestAdditions::syncTorinVolumeFromScummVM(const int16 musicVolume, const int16 sfxVolume, const int16 speechVolume) const { _state->variables[VAR_GLOBAL][kGlobalVarTorinMusicVolume] = make_reg(0, musicVolume); _state->variables[VAR_GLOBAL][kGlobalVarTorinSFXVolume] = make_reg(0, sfxVolume); @@ -1204,6 +1222,13 @@ void GuestAdditions::syncAudioVolumeGlobalsToScummVM(const int index, const reg_ } break; + case GID_RAMA: + if (index == kGlobalVarRamaMusicVolume) { + const int16 musicVolume = value.toSint16() * Audio::Mixer::kMaxMixerVolume / kRamaVolumeMax; + ConfMan.setInt("music_volume", musicVolume); + } + break; + case GID_LSL7: case GID_TORIN: if (index == kGlobalVarTorinMusicVolume || @@ -1434,6 +1459,14 @@ void GuestAdditions::syncQFG4UI(const int16 musicVolume) const { } } +void GuestAdditions::syncRamaUI(const int16 musicVolume) const { + const reg_t sliderId = _segMan->findObjectByName("volumeSlider"); + if (!sliderId.isNull() && !readSelector(_segMan, sliderId, SELECTOR(plane)).isNull()) { + reg_t args[] = { make_reg(0, musicVolume) }; + invokeSelector(sliderId, SELECTOR(setCel), 1, args); + } +} + void GuestAdditions::syncShivers1UI(const int16 dacVolume) const { const reg_t sliderId = _segMan->findObjectByName("spVolume"); if (!sliderId.isNull()) { diff --git a/engines/sci/engine/guest_additions.h b/engines/sci/engine/guest_additions.h index a1043a8402..ba6adf344e 100644 --- a/engines/sci/engine/guest_additions.h +++ b/engines/sci/engine/guest_additions.h @@ -43,6 +43,7 @@ enum { // will just use 85 as the maximum volume. kPhant2VolumeMax = 85, + kRamaVolumeMax = 16, kLSL6HiresUIVolumeMax = 13, kLSL6HiresSubtitleFlag = 105 }; @@ -388,6 +389,7 @@ private: void syncGK2VolumeFromScummVM(const int16 musicVolume) const; void syncLSL6HiresVolumeFromScummVM(const int16 musicVolume) const; void syncPhant2VolumeFromScummVM(const int16 masterVolume) const; + void syncRamaVolumeFromScummVM(const int16 musicVolume) const; void syncTorinVolumeFromScummVM(const int16 musicVolume, const int16 sfxVolume, const int16 speechVolume) const; /** @@ -421,6 +423,7 @@ private: void syncPQ4UI(const int16 musicVolume) const; void syncPQSWATUI() const; void syncQFG4UI(const int16 musicVolume) const; + void syncRamaUI(const int16 musicVolume) const; void syncShivers1UI(const int16 dacVolume) const; void syncSQ6UI() const; void syncTorinUI(const int16 musicVolume, const int16 sfxVolume, const int16 speechVolume) const; diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp index 1feb80844c..42c71c4d31 100644 --- a/engines/sci/engine/selector.cpp +++ b/engines/sci/engine/selector.cpp @@ -230,6 +230,8 @@ void Kernel::mapSelectors() { FIND_SELECTOR(fileNumber); FIND_SELECTOR(description); FIND_SELECTOR(dispose); + FIND_SELECTOR(masterVolume); + FIND_SELECTOR(setCel); #endif } diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h index 1603ca94f3..2debd3204d 100644 --- a/engines/sci/engine/selector.h +++ b/engines/sci/engine/selector.h @@ -187,6 +187,8 @@ struct SelectorCache { Selector fileNumber; // for RAMA save/load Selector description; // for RAMA save/load Selector dispose; // for RAMA save/load save from launcher + Selector masterVolume; // for RAMA volume sync + Selector setCel; // for RAMA volume sync #endif }; diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index 83550f8aa6..0da48a4cad 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -139,6 +139,7 @@ enum { enum GlobalVar { kGlobalVarEgo = 0, + kGlobalVarGame = 1, kGlobalVarCurrentRoom = 2, kGlobalVarSpeed = 3, // SCI16 kGlobalVarQuit = 4, @@ -158,6 +159,7 @@ enum GlobalVar { kGlobalVarRamaCatalogFile = 130, kGlobalVarLSL6HiresGameFlags = 137, kGlobalVarGK1NarratorMode = 166, // 0 for text, 1 for speech + kGlobalVarRamaMusicVolume = 176, // 0 to 16 kGlobalVarPhant1MusicVolume = 187, // 0 to 15 kGlobalVarPhant1DACVolume = 188, // 0 to 127 kGlobalVarLSL6HiresMusicVolume = 194, // 0 to 13 |