aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/livingbooks.cpp29
-rw-r--r--engines/mohawk/livingbooks.h1
2 files changed, 17 insertions, 13 deletions
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 356ad94fa6..6a820f52bb 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -562,22 +562,25 @@ bool MohawkEngine_LivingBooks::playSound(LBItem *source, uint16 resourceId) {
if (_lastSoundId && !_sound->isPlaying(_lastSoundId))
_lastSoundId = 0;
- if (!_soundLockOwner) {
- if (_lastSoundId && _lastSoundOwner != source->getId())
- if (source->getSoundPriority() >= _lastSoundPriority)
+ if (!source->isAmbient() || !_sound->isPlaying()) {
+ if (!_soundLockOwner) {
+ if (_lastSoundId && _lastSoundOwner != source->getId())
+ if (source->getSoundPriority() >= _lastSoundPriority)
+ return false;
+ } else {
+ if (_soundLockOwner != source->getId() && source->getSoundPriority() >= _maxSoundPriority)
return false;
- } else {
- if (_soundLockOwner != source->getId() && source->getSoundPriority() >= _maxSoundPriority)
- return false;
- }
+ }
- if (_lastSoundId)
- _sound->stopSound(_lastSoundId);
+ if (_lastSoundId)
+ _sound->stopSound(_lastSoundId);
+
+ _lastSoundOwner = source->getId();
+ _lastSoundPriority = source->getSoundPriority();
+ }
- _sound->playSound(resourceId);
_lastSoundId = resourceId;
- _lastSoundOwner = source->getId();
- _lastSoundPriority = source->getSoundPriority();
+ _sound->playSound(resourceId);
return true;
}
@@ -588,7 +591,7 @@ void MohawkEngine_LivingBooks::lockSound(LBItem *owner, bool lock) {
return;
}
- if (_soundLockOwner)
+ if (_soundLockOwner || (owner->isAmbient() && _sound->isPlaying()))
return;
if (_lastSoundId && !_sound->isPlaying(_lastSoundId))
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 74bf520451..3db71eb66f 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -366,6 +366,7 @@ public:
uint16 getId() { return _itemId; }
uint16 getSoundPriority() { return _soundMode; }
+ bool isAmbient() { return _isAmbient; }
protected:
MohawkEngine_LivingBooks *_vm;