diff options
author | Filippos Karapetis | 2009-12-20 16:35:37 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-12-20 16:35:37 +0000 |
commit | c1e90ce3cc0e2b0993585691072b5427f6134d7b (patch) | |
tree | ce8d36b833abe3770d24f8707a192b7f9a4c2093 | |
parent | c1eaafcac766b894c8272a73df3c8ac6bc78e908 (diff) | |
download | scummvm-rg350-c1e90ce3cc0e2b0993585691072b5427f6134d7b.tar.gz scummvm-rg350-c1e90ce3cc0e2b0993585691072b5427f6134d7b.tar.bz2 scummvm-rg350-c1e90ce3cc0e2b0993585691072b5427f6134d7b.zip |
Implemented cmdUpdateCues() in the new sound code and fixed a crash when loading music with a resource number of zero
svn-id: r46435
-rw-r--r-- | engines/sci/resource.cpp | 2 | ||||
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 52 |
2 files changed, 27 insertions, 27 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 989ff02f2b..0dbb35d2eb 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -1809,7 +1809,7 @@ bool ResourceManager::hasSci1Voc900() { } SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan) : _resMan(resMan) { - Resource *res = resNumber ? _resMan->findResource(ResourceId(kResourceTypeSound, resNumber), true) : NULL; + Resource *res = _resMan->findResource(ResourceId(kResourceTypeSound, resNumber), true); if (!res) return; diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index 9949896835..5d04c3bcb8 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -604,6 +604,9 @@ void SoundCommandParser::cmdUpdateHandle(reg_t obj, int16 value) { } void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { + if (!obj.segment) + return; + #ifdef USE_OLD_MUSIC_FUNCTIONS int signal = 0; int min = 0; @@ -674,35 +677,32 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { PUT_SEL32V(_segMan, obj, frame, frame); } #else - // TODO -#endif -#if 0 - if (hobj == 0) + int slot = _music->findListSlot(obj); + if (slot < 0) { + warning("cmdUpdateCues: Slot not found"); return; - Object obj(hobj); - HEAPHANDLE hnode = obj.getProperty(44); // nodePtr - if (hnode) { - MusicEntry *pSnd = (MusicEntry *)heap2Ptr(hnode); - switch (pSnd->signal) { - case 0: - if (pSnd->dataInc != obj.getProperty(92)) { // dataInc - obj.setProperty(92, pSnd->dataInc); // dataInc - obj.setProperty(17, pSnd->dataInc + 127); // signal - } - break; - case 0xFFFF: - StopSnd(hobj); - break; - default: - obj.setProperty(17, pSnd->signal); // signal + } + + if (!GET_SEL32(_segMan, obj, nodePtr).isNull()) { + int16 signal = GET_SEL32V(_segMan, obj, signal); + int16 dataInc = GET_SEL32V(_segMan, obj, dataInc); + + switch (signal) { + case 0: + PUT_SEL32V(_segMan, obj, signal, dataInc + 127); + break; + case 0xFFFF: + cmdStopHandle(obj, value); + break; + default: + break; } - //D13E - pSnd->signal = 0; - obj.setProperty(94, pSnd->ticker / 3600); // .min - obj.setProperty(95, pSnd->ticker % 3600 / 60); // .sec - obj.setProperty(96, pSnd->ticker); // .frame - obj.setProperty(97, pSnd->volume); // volume + + uint16 ticker = _music->_playList[slot]->ticker; + PUT_SEL32V(_segMan, obj, min, ticker / 3600); + PUT_SEL32V(_segMan, obj, sec, ticker % 3600 / 60); + PUT_SEL32V(_segMan, obj, frame, ticker); } #endif } |