From cfcd3fd780254b60abe1eea43f1de18494d65582 Mon Sep 17 00:00:00 2001 From: Keith Kaisershot Date: Sun, 27 Apr 2014 21:12:34 -0400 Subject: PEGASUS: Set volume in more places --- engines/pegasus/menu.cpp | 2 ++ engines/pegasus/neighborhood/caldoria/caldoria.cpp | 2 ++ engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp | 15 +++++++++++++++ engines/pegasus/neighborhood/caldoria/caldoriabomb.h | 3 +++ .../pegasus/neighborhood/caldoria/caldoriamessages.cpp | 6 ++++++ engines/pegasus/neighborhood/caldoria/caldoriamessages.h | 2 ++ engines/pegasus/neighborhood/mars/mars.cpp | 11 +++++++++++ engines/pegasus/neighborhood/neighborhood.cpp | 11 ++++++++++- engines/pegasus/neighborhood/neighborhood.h | 2 ++ engines/pegasus/neighborhood/norad/delta/globegame.cpp | 5 +++++ engines/pegasus/neighborhood/norad/delta/globegame.h | 2 ++ engines/pegasus/neighborhood/norad/delta/noraddelta.cpp | 7 +++++++ engines/pegasus/neighborhood/norad/delta/noraddelta.h | 2 ++ engines/pegasus/pegasus.cpp | 7 +++++++ 14 files changed, 76 insertions(+), 1 deletion(-) (limited to 'engines/pegasus') diff --git a/engines/pegasus/menu.cpp b/engines/pegasus/menu.cpp index e55c006f86..4bbda8fd93 100644 --- a/engines/pegasus/menu.cpp +++ b/engines/pegasus/menu.cpp @@ -227,6 +227,7 @@ MainMenu::MainMenu() : GameMenu(kMainMenuID), _menuBackground(0), _overviewButto _menuLoop.attachFader(&_menuFader); _menuLoop.initFromAIFFFile("Sounds/Main Menu.aiff"); + _menuFader.setMasterVolume(((PegasusEngine *)g_engine)->getAmbienceLevel()); updateDisplay(); } @@ -736,6 +737,7 @@ DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _d _largeSelect.startDisplaying(); } else { _triumphSound.initFromQuickTime("Sounds/Caldoria/Galactic Triumph"); + _triumphSound.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel()); _triumphSound.playSound(); } diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.cpp b/engines/pegasus/neighborhood/caldoria/caldoria.cpp index 709a4fefed..9d2d6723a9 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoria.cpp +++ b/engines/pegasus/neighborhood/caldoria/caldoria.cpp @@ -196,6 +196,8 @@ void Caldoria::start() { if (!pullbackMovie->loadFile("Images/Caldoria/Pullback.movie")) error("Could not load pullback movie"); + pullbackMovie->setVolume(MIN(_vm->getSoundFXLevel(), 0xFF)); + // Draw the first frame so we can fade to it const Graphics::Surface *frame = pullbackMovie->decodeNextFrame(); assert(frame); diff --git a/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp b/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp index abf34d3863..c964e3458b 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp +++ b/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp @@ -1167,6 +1167,18 @@ CaldoriaBomb::~CaldoriaBomb() { delete[] _bombLevel[i]; } +void CaldoriaBomb::setSoundFXLevel(const uint16) { + // The transition sounds between levels are ambience, so overwrite what + // Neighborhood::setSoundFXLevel does and keep using the ambience volume level + if (_timer.isRunning()) + _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel()); +} + +void CaldoriaBomb::setAmbienceLevel(const uint16 level) { + if (_timer.isRunning()) + _owner->_navMovie.setVolume(level); +} + void CaldoriaBomb::openInteraction() { _grid.moveElementTo(kCaldoriaBombGridLeft, kCaldoriaBombGridTop); _grid.setDisplayOrder(kCaldoriaBombGridOrder); @@ -1234,6 +1246,7 @@ void CaldoriaBomb::receiveNotification(Notification *notification, const Notific _timer.start(); _currentLevel = 0; _lastVertex = -1; + _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel()); startBombAmbient("Sounds/Caldoria/BmbLoop1.22K.AIFF"); break; case kCaldoria56BombStage2: @@ -1258,6 +1271,7 @@ void CaldoriaBomb::receiveNotification(Notification *notification, const Notific _grid.hide(); _timer.stop(); _timer.hide(); + _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel()); _owner->loadLoopSound1(""); _owner->playDeathExtra(kCaldoria56BombExplodes, kDeathNuclearExplosion); } @@ -1411,6 +1425,7 @@ void CaldoriaBomb::handleInput(const Input &input, const Hotspot *hotspot) { _timer.stop(); _grid.hide(); _timer.hide(); + _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel()); _owner->startExtraSequence(kCaldoria56BombStage7, kExtraCompletedFlag, kFilterNoInput); break; } diff --git a/engines/pegasus/neighborhood/caldoria/caldoriabomb.h b/engines/pegasus/neighborhood/caldoria/caldoriabomb.h index 5bb39b4122..ba6d1e8998 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoriabomb.h +++ b/engines/pegasus/neighborhood/caldoria/caldoriabomb.h @@ -122,6 +122,9 @@ public: CaldoriaBomb(Neighborhood *, NotificationManager *); virtual ~CaldoriaBomb(); + void setSoundFXLevel(const uint16); + void setAmbienceLevel(const uint16); + long getNumHints(); Common::String getHintMovie(uint); void doSolve(); diff --git a/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp b/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp index a3ce97d438..2ae990d775 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp +++ b/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp @@ -24,6 +24,7 @@ */ #include "pegasus/gamestate.h" +#include "pegasus/pegasus.h" #include "pegasus/neighborhood/neighborhood.h" #include "pegasus/neighborhood/caldoria/caldoria.h" #include "pegasus/neighborhood/caldoria/caldoriamessages.h" @@ -45,6 +46,10 @@ void CaldoriaMessages::openInteraction() { _messageNumber = 1; } +void CaldoriaMessages::setSoundFXLevel(const uint16 fxLevel) { + _messageMovie.setVolume(fxLevel); +} + void CaldoriaMessages::initInteraction() { GameInteraction::_owner->startExtraSequence(kCaBedroomVidPhone, kExtraCompletedFlag, kFilterNoInput); } @@ -101,6 +106,7 @@ void CaldoriaMessages::play1Message(uint messageNumber) { GameState.setCaldoriaSeenMessages(true); } + _messageMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel()); _messageMovie.moveElementTo(kCaldoriaMessageLeft, kCaldoriaMessageTop); _messageMovie.setDisplayOrder(kCaldoriaMessagesOrder); _messageMovie.startDisplaying(); diff --git a/engines/pegasus/neighborhood/caldoria/caldoriamessages.h b/engines/pegasus/neighborhood/caldoria/caldoriamessages.h index 955fe10ce9..b2fc7c3bf9 100644 --- a/engines/pegasus/neighborhood/caldoria/caldoriamessages.h +++ b/engines/pegasus/neighborhood/caldoria/caldoriamessages.h @@ -41,6 +41,8 @@ public: CaldoriaMessages(Neighborhood *, const NotificationID, NotificationManager *); virtual ~CaldoriaMessages() {} + void setSoundFXLevel(const uint16); + protected: void openInteraction(); void initInteraction(); diff --git a/engines/pegasus/neighborhood/mars/mars.cpp b/engines/pegasus/neighborhood/mars/mars.cpp index f7493dbe75..df5a75541c 100644 --- a/engines/pegasus/neighborhood/mars/mars.cpp +++ b/engines/pegasus/neighborhood/mars/mars.cpp @@ -2402,6 +2402,8 @@ void Mars::doCanyonChase() { if (!video->loadFile("Images/Mars/M44ESA.movie")) error("Could not load interface->shuttle transition video"); + video->setVolume(MIN(_vm->getSoundFXLevel(), 0xFF)); + video->start(); while (!_vm->shouldQuit() && !video->endOfVideo()) { @@ -2612,6 +2614,7 @@ void Mars::startUpFromFinishedSpaceChase() { kShuttleJunkTop, false); initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false); + _explosions.setVolume(_vm->getSoundFXLevel()); _explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes); _energyBeam.initShuttleWeapon(); @@ -2650,6 +2653,7 @@ void Mars::startUpFromFinishedSpaceChase() { initOneMovie(&_canyonChaseMovie, "Images/Mars/M98EAS.movie", kShuttleTractorBeamMovieOrder, kShuttleWindowLeft, kShuttleWindowTop, true); + _canyonChaseMovie.setVolume(_vm->getSoundFXLevel()); _canyonChaseMovie.setTime(_canyonChaseMovie.getDuration()); _canyonChaseMovie.redrawMovieWorld(); } @@ -2725,6 +2729,7 @@ void Mars::startUpFromSpaceChase() { kShuttleJunkTop, false); initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false); + _explosions.setVolume(_vm->getSoundFXLevel()); _explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes); _energyBeam.initShuttleWeapon(); @@ -2788,6 +2793,10 @@ void Mars::startUpFromSpaceChase() { void Mars::setSoundFXLevel(const uint16 level) { Neighborhood::setSoundFXLevel(level); + if (GameState.getCurrentRoomAndView() == MakeRoomView(kMars48, kEast) && + !GameState.getMarsAvoidedReactorRobot()) + _loop2Fader.setMasterVolume(level); + if (_canyonChaseMovie.isMovieValid()) _canyonChaseMovie.setVolume(level); @@ -2842,6 +2851,7 @@ void Mars::marsTimerExpired(MarsTimerEvent &event) { initOneMovie(&_junk, "Images/Mars/Junk.movie", kShuttleJunkOrder, kShuttleJunkLeft, kShuttleJunkTop, false); initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false); + _explosions.setVolume(_vm->getSoundFXLevel()); _explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes); _energyBeam.initShuttleWeapon(); @@ -3175,6 +3185,7 @@ void Mars::spaceChaseClick(const Input &input, const HotSpotID id) { // Shameless reuse of a variable :P initOneMovie(&_canyonChaseMovie, "Images/Mars/M98EAS.movie", kShuttleTractorBeamMovieOrder, kShuttleWindowLeft, kShuttleWindowTop, true); + _canyonChaseMovie.setVolume(_vm->getSoundFXLevel()); _canyonChaseMovie.redrawMovieWorld(); playMovieSegment(&_canyonChaseMovie, 0, _canyonChaseMovie.getDuration()); diff --git a/engines/pegasus/neighborhood/neighborhood.cpp b/engines/pegasus/neighborhood/neighborhood.cpp index 320fbdabaa..c9be349694 100644 --- a/engines/pegasus/neighborhood/neighborhood.cpp +++ b/engines/pegasus/neighborhood/neighborhood.cpp @@ -1495,7 +1495,15 @@ void Neighborhood::loadLoopSound2(const Common::String &soundName, uint16 volume if (!_loop2SoundString.empty()) { _soundLoop2.initFromAIFFFile(_loop2SoundString); _soundLoop2.loopSound(); - _loop2Fader.setMasterVolume(_vm->getAmbienceLevel()); + // HACK: Some ambient loops are actually sound effects, like Ares waiting at + // the reactor and Poseidon at the launch console. Detect these and use the + // SFX volume instead of ambience. + if (soundName == "Sounds/Mars/Robot Loop.aiff" || + soundName == "Sounds/Norad/Breathing Typing.22K.AIFF" || + soundName == "Sounds/Norad/N54NAS.32K.AIFF") + _loop2Fader.setMasterVolume(_vm->getSoundFXLevel()); + else + _loop2Fader.setMasterVolume(_vm->getAmbienceLevel()); _loop2Fader.setFaderValue(0); faderMove.makeTwoKnotFaderSpec(fadeScale, 0, 0, fadeIn, volume); _loop2Fader.startFaderSync(faderMove); @@ -1580,6 +1588,7 @@ void Neighborhood::closeCroppedMovie() { void Neighborhood::playCroppedMovieOnce(const Common::String &movieName, CoordType left, CoordType top, const InputBits interruptionFilter) { openCroppedMovie(movieName, left, top); + _croppedMovie.setVolume(_vm->getSoundFXLevel()); _croppedMovie.redrawMovieWorld(); _croppedMovie.start(); diff --git a/engines/pegasus/neighborhood/neighborhood.h b/engines/pegasus/neighborhood/neighborhood.h index 3c1c5eac92..f7f2b038c6 100644 --- a/engines/pegasus/neighborhood/neighborhood.h +++ b/engines/pegasus/neighborhood/neighborhood.h @@ -91,6 +91,7 @@ struct QueueRequest { bool operator==(const QueueRequest &arg1, const QueueRequest &arg2); bool operator!=(const QueueRequest &arg1, const QueueRequest &arg2); +class CaldoriaBomb; class GameInteraction; class Item; class Neighborhood; @@ -109,6 +110,7 @@ protected: typedef Common::Queue NeighborhoodActionQueue; class Neighborhood : public IDObject, public NotificationReceiver, public InputHandler, public Idler { +friend class CaldoriaBomb; friend class StriderCallBack; public: diff --git a/engines/pegasus/neighborhood/norad/delta/globegame.cpp b/engines/pegasus/neighborhood/norad/delta/globegame.cpp index 0b95e9bc2b..5c321a8e8a 100644 --- a/engines/pegasus/neighborhood/norad/delta/globegame.cpp +++ b/engines/pegasus/neighborhood/norad/delta/globegame.cpp @@ -453,8 +453,13 @@ GlobeGame::GlobeGame(Neighborhood *handler) : GameInteraction(kNoradGlobeGameInt _neighborhoodNotification = handler->getNeighborhoodNotification(); } +void GlobeGame::setSoundFXLevel(const uint16 fxLevel) { + _monitorMovie.setVolume(fxLevel); +} + void GlobeGame::openInteraction() { _monitorMovie.initFromMovieFile("Images/Norad Delta/N79 Left Monitor"); + _monitorMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel()); _monitorMovie.moveElementTo(kGlobeMonitorLeft, kGlobeMonitorTop); _monitorMovie.setDisplayOrder(kGlobeMonitorLayer); _monitorMovie.startDisplaying(); diff --git a/engines/pegasus/neighborhood/norad/delta/globegame.h b/engines/pegasus/neighborhood/norad/delta/globegame.h index 73ed48866f..93235a1784 100644 --- a/engines/pegasus/neighborhood/norad/delta/globegame.h +++ b/engines/pegasus/neighborhood/norad/delta/globegame.h @@ -98,6 +98,8 @@ public: GlobeGame(Neighborhood *); virtual ~GlobeGame() {} + void setSoundFXLevel(const uint16); + void handleInput(const Input &, const Hotspot *); void clickInHotspot(const Input &, const Hotspot *); void activateHotspots(); diff --git a/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp b/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp index 1eea2f0156..b6ce700132 100644 --- a/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp +++ b/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp @@ -863,6 +863,13 @@ void NoradDelta::doSolve() { } } +void NoradDelta::setSoundFXLevel(const uint16 level) { + Neighborhood::setSoundFXLevel(level); + + if (GameState.getCurrentRoomAndView() == MakeRoomView(kNorad54North, kNorth)) + _loop2Fader.setMasterVolume(level); +} + Common::String NoradDelta::getSoundSpotsName() { return "Sounds/Norad/Norad Delta Spots"; } diff --git a/engines/pegasus/neighborhood/norad/delta/noraddelta.h b/engines/pegasus/neighborhood/norad/delta/noraddelta.h index 11065f2c9d..2f276a8a7d 100644 --- a/engines/pegasus/neighborhood/norad/delta/noraddelta.h +++ b/engines/pegasus/neighborhood/norad/delta/noraddelta.h @@ -68,6 +68,8 @@ public: bool canSolve(); void doSolve(); + void setSoundFXLevel(const uint16); + void doorOpened(); protected: diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp index a0ec12a7c4..0010180d8d 100644 --- a/engines/pegasus/pegasus.cpp +++ b/engines/pegasus/pegasus.cpp @@ -307,6 +307,7 @@ void PegasusEngine::runIntro() { Video::VideoDecoder *video = new Video::QuickTimeDecoder(); if (video->loadFile(_introDirectory + "/BandaiLogo.movie")) { + video->setVolume(MIN(getAmbienceLevel(), 0xFF)); video->start(); while (!shouldQuit() && !video->endOfVideo() && !skipped) { @@ -338,6 +339,8 @@ void PegasusEngine::runIntro() { if (!video->loadFile(_introDirectory + "/Big Movie.movie")) error("Could not load intro movie"); + video->setVolume(MIN(getAmbienceLevel(), 0xFF)); + video->seek(Audio::Timestamp(0, 10 * 600, 600)); video->start(); @@ -794,6 +797,8 @@ void PegasusEngine::introTimerExpired() { if (!video->loadFile(_introDirectory + "/LilMovie.movie")) error("Failed to load little movie"); + video->setVolume(MIN(getAmbienceLevel(), 0xFF)); + bool saveAllowed = swapSaveAllowed(false); bool openAllowed = swapLoadAllowed(false); @@ -941,6 +946,8 @@ void PegasusEngine::doGameMenuCommand(const GameMenuCommand command) { if (!video->loadFile(_introDirectory + "/Closing.movie")) error("Could not load closing movie"); + video->setVolume(MIN(getSoundFXLevel(), 0xFF)); + uint16 x = (640 - video->getWidth() * 2) / 2; uint16 y = (480 - video->getHeight() * 2) / 2; -- cgit v1.2.3