From d5fb1170d7d3e9cbe2029d494f6a438745f6490c Mon Sep 17 00:00:00 2001 From: David Fioramonti Date: Sat, 9 Sep 2017 08:40:33 -0700 Subject: TITANIC: Prevent locking/unlocking sounds in photoview In scummvm and the original engine if you try to unlock/lock stars in photoview/skyview then the stars will not unlock/lock, but the sounds associated with unlocking and locking were playing. Giving a false impression that the locking/unlocking was happening. The sounds no longer play when in photoview. --- engines/titanic/game/nav_helmet.cpp | 29 +++++++++++++++++++++------ engines/titanic/star_control/star_control.cpp | 12 +++++++++++ engines/titanic/star_control/star_control.h | 5 +++++ 3 files changed, 40 insertions(+), 6 deletions(-) (limited to 'engines/titanic') diff --git a/engines/titanic/game/nav_helmet.cpp b/engines/titanic/game/nav_helmet.cpp index 498f52b0cb..f4ea6e4a11 100644 --- a/engines/titanic/game/nav_helmet.cpp +++ b/engines/titanic/game/nav_helmet.cpp @@ -22,6 +22,7 @@ #include "titanic/game/nav_helmet.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/star_control/star_control.h" namespace Titanic { @@ -113,12 +114,28 @@ bool CNavHelmet::PETPhotoOnOffMsg(CPETPhotoOnOffMsg *msg) { bool CNavHelmet::PETStarFieldLockMsg(CPETStarFieldLockMsg *msg) { if (_helmetOn) { - if (msg->_value) { - playSound("a#6.wav"); - starFn(LOCK_STAR); - } else { - playSound("a#5.wav"); - starFn(UNLOCK_STAR); + CPetControl *pet = getPetControl(); + CStarControl *starControl = 0; + bool isStarFieldMode=false; + + if (pet) + starControl = pet->getStarControl(); + + if (starControl) + isStarFieldMode = starControl->isStarFieldMode(); + + if (isStarFieldMode) { + // locking and unlocking only in starfield + // It already does this without the conditional + // but now it will also not play the sounds in + // photoview + if (msg->_value) { + playSound("a#6.wav"); + starFn(LOCK_STAR); + } else { + playSound("a#5.wav"); + starFn(UNLOCK_STAR); + } } } diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index cc414305eb..8464262b31 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -145,6 +145,18 @@ void CStarControl::newFrame() { } } +bool CStarControl::isStarFieldMode() { + if (!_petControl) + _petControl = getPetControl(); + + if (_petControl) { + + if (_starField.getMode() == MODE_STARFIELD) + return true; + } + return false; +} + void CStarControl::doAction(StarControlAction action) { if (!_enabled) return; diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index e4072d7d62..7efd3869c1 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -69,6 +69,11 @@ public: */ virtual void draw(CScreenManager *screenManager); + /** + * _starField is currently showing the starfield + */ + bool isStarFieldMode(); + /** * Does an action in the star control */ -- cgit v1.2.3