Implemented cmdUpdateCues() in the new sound code and fixed a crash when loading music with a resource number of zero

svn-id: r46435
This commit is contained in:
Filippos Karapetis 2009-12-20 16:35:37 +00:00
parent c1eaafcac7
commit c1e90ce3cc
2 changed files with 27 additions and 27 deletions

View file

@ -1809,7 +1809,7 @@ bool ResourceManager::hasSci1Voc900() {
} }
SoundResource::SoundResource(uint32 resNumber, ResourceManager *resMan) : _resMan(resMan) { 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) if (!res)
return; return;

View file

@ -604,6 +604,9 @@ void SoundCommandParser::cmdUpdateHandle(reg_t obj, int16 value) {
} }
void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
if (!obj.segment)
return;
#ifdef USE_OLD_MUSIC_FUNCTIONS #ifdef USE_OLD_MUSIC_FUNCTIONS
int signal = 0; int signal = 0;
int min = 0; int min = 0;
@ -674,35 +677,32 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
PUT_SEL32V(_segMan, obj, frame, frame); PUT_SEL32V(_segMan, obj, frame, frame);
} }
#else #else
// TODO
#endif
#if 0 int slot = _music->findListSlot(obj);
if (hobj == 0) if (slot < 0) {
warning("cmdUpdateCues: Slot not found");
return; return;
Object obj(hobj); }
HEAPHANDLE hnode = obj.getProperty(44); // nodePtr
if (hnode) { if (!GET_SEL32(_segMan, obj, nodePtr).isNull()) {
MusicEntry *pSnd = (MusicEntry *)heap2Ptr(hnode); int16 signal = GET_SEL32V(_segMan, obj, signal);
switch (pSnd->signal) { int16 dataInc = GET_SEL32V(_segMan, obj, dataInc);
case 0:
if (pSnd->dataInc != obj.getProperty(92)) { // dataInc switch (signal) {
obj.setProperty(92, pSnd->dataInc); // dataInc case 0:
obj.setProperty(17, pSnd->dataInc + 127); // signal PUT_SEL32V(_segMan, obj, signal, dataInc + 127);
} break;
break; case 0xFFFF:
case 0xFFFF: cmdStopHandle(obj, value);
StopSnd(hobj); break;
break; default:
default: break;
obj.setProperty(17, pSnd->signal); // signal
} }
//D13E
pSnd->signal = 0; uint16 ticker = _music->_playList[slot]->ticker;
obj.setProperty(94, pSnd->ticker / 3600); // .min PUT_SEL32V(_segMan, obj, min, ticker / 3600);
obj.setProperty(95, pSnd->ticker % 3600 / 60); // .sec PUT_SEL32V(_segMan, obj, sec, ticker % 3600 / 60);
obj.setProperty(96, pSnd->ticker); // .frame PUT_SEL32V(_segMan, obj, frame, ticker);
obj.setProperty(97, pSnd->volume); // volume
} }
#endif #endif
} }