aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r--engines/sci/sfx/soundcmd.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index b3f9609b12..7b4a74ec10 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -918,10 +918,25 @@ void SoundCommandParser::cmdSetSoundPriority(reg_t obj, int16 value) {
#ifdef USE_OLD_MUSIC_FUNCTIONS
script_set_priority(_resMan, _segMan, _state, obj, value);
#else
+ MusicEntry *musicSlot = _music->getSlot(obj);
+ if (!musicSlot) {
+ warning("cmdSetSoundPriority: Slot not found (%04x:%04x)", PRINT_REG(obj));
+ return;
+ }
+
if (value == -1) {
+ // Set priority from the song data
+ Resource *song = _resMan->findResource(ResourceId(kResourceTypeSound, musicSlot->resnum), 0);
+ if (song->data[0] == 0xf0)
+ _music->soundSetPriority(musicSlot, song->data[1]);
+ else
+ warning("cmdSetSoundPriority: Attempt to unset song priority when there is no built-in value");
+
//pSnd->prio=0;field_15B=0
PUT_SEL32V(_segMan, obj, flags, GET_SEL32V(_segMan, obj, flags) & 0xFD);
} else {
+ // Scripted priority
+
//pSnd->field_15B=1;
PUT_SEL32V(_segMan, obj, flags, GET_SEL32V(_segMan, obj, flags) | 2);
//DoSOund(0xF,hobj,w)