diff options
author | Travis Howell | 2003-08-20 15:19:23 +0000 |
---|---|---|
committer | Travis Howell | 2003-08-20 15:19:23 +0000 |
commit | f16aec61f0253f6677b91f1d99941f9c24c171c5 (patch) | |
tree | cf8e9dc5e72ba12563337a9d4da765244a9c77cb /scumm | |
parent | be0d723e7f421a11b718d0526caf38be96ac7870 (diff) | |
download | scummvm-rg350-f16aec61f0253f6677b91f1d99941f9c24c171c5.tar.gz scummvm-rg350-f16aec61f0253f6677b91f1d99941f9c24c171c5.tar.bz2 scummvm-rg350-f16aec61f0253f6677b91f1d99941f9c24c171c5.zip |
Fix speedy music regression in monkeyega/vga/pass.
Add unique tag to sfx when converting AD resources, to solve sfx cutting off music issue in monkeyega/vga.
svn-id: r9801
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/resource.cpp | 62 | ||||
-rw-r--r-- | scumm/sound.cpp | 11 |
2 files changed, 46 insertions, 27 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 2d8720c72a..a138248be5 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -1027,19 +1027,6 @@ int Scumm::convertADResource(int type, int idx, byte * src_ptr, int size) { total_size += 24; // Up to 24 additional bytes are needed for the jump sysex ptr = createResource(type, idx, total_size); - memcpy(ptr, "ADL ", 4); ptr += 4; - uint32 dw = READ_BE_UINT32(&total_size); - memcpy(ptr, &dw, 4); ptr += 4; - memcpy(ptr, "MDhd", 4); ptr += 4; - ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 8; - ptr += 4; - memset(ptr, 0, 8), ptr += 8; - memcpy(ptr, "MThd", 4); ptr += 4; - ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 6; - ptr += 4; - ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 1; // MIDI format 0 with 1 track - ptr += 4; - // We will ignore the PPQN in the original resource, because // it's invalid anyway. We use a constant PPQN of 480. // For Indy it is actually 240. @@ -1048,18 +1035,31 @@ int Scumm::convertADResource(int type, int idx, byte * src_ptr, int size) { } else { ppqn = 480; } - *ptr++ = ppqn >> 8; - *ptr++ = ppqn & 0xFF; - - memcpy(ptr, "MTrk", 4); ptr += 4; - dw = READ_BE_UINT32(&total_size); - memcpy(ptr, &dw, 4); ptr += 4; src_ptr += 2; size -= 2; if (*src_ptr == 0x80) { // 0x80: is music; otherwise not. + memcpy(ptr, "ADL ", 4); ptr += 4; + uint32 dw = READ_BE_UINT32(&total_size); + memcpy(ptr, &dw, 4); ptr += 4; + memcpy(ptr, "MDhd", 4); ptr += 4; + ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 8; + ptr += 4; + memset(ptr, 0, 8), ptr += 8; + memcpy(ptr, "MThd", 4); ptr += 4; + ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 6; + ptr += 4; + ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 1; // MIDI format 0 with 1 track + ptr += 4; + + *ptr++ = ppqn >> 8; + *ptr++ = ppqn & 0xFF; + + memcpy(ptr, "MTrk", 4); ptr += 4; + dw = READ_BE_UINT32(&total_size); + memcpy(ptr, &dw, 4); ptr += 4; // The "speed" of the song ticks = *(src_ptr + 1); @@ -1090,8 +1090,10 @@ int Scumm::convertADResource(int type, int idx, byte * src_ptr, int size) { // dw = 1000000 * 256 / 473 * ppqn / 2 / ticks; // But this seems closer to original??? dw = 73000000 / ticks; - } else { + } else if (_gameId == GID_LOOM) { dw = 1000000 * ppqn / 4 / 2 / ticks; + } else { + dw = (500000 * 256) / ticks; } debug(4, " ticks = %d, speed = %ld", ticks, dw); @@ -1217,6 +1219,26 @@ int Scumm::convertADResource(int type, int idx, byte * src_ptr, int size) { /* This is a sfx resource. First parse it quickly to find the parallel * tracks. */ + memcpy(ptr, "ASFX", 4); ptr += 4; + uint32 dw = READ_BE_UINT32(&total_size); + memcpy(ptr, &dw, 4); ptr += 4; + memcpy(ptr, "MDhd", 4); ptr += 4; + ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 8; + ptr += 4; + memset(ptr, 0, 8), ptr += 8; + memcpy(ptr, "MThd", 4); ptr += 4; + ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 6; + ptr += 4; + ptr[0] = 0; ptr[1] = 0; ptr[2] = 0; ptr[3] = 1; // MIDI format 0 with 1 track + ptr += 4; + + *ptr++ = ppqn >> 8; + *ptr++ = ppqn & 0xFF; + + memcpy(ptr, "MTrk", 4); ptr += 4; + dw = READ_BE_UINT32(&total_size); + memcpy(ptr, &dw, 4); ptr += 4; + byte current_instr[3][14]; int current_note[3]; int track_time[3]; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 86667d784b..0c6a7bc7c7 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -457,15 +457,12 @@ void Sound::playSound(int soundID) { if (_scumm->_features & GF_AMIGA) return; - // FIXME: This evil hack works around the fact that in some - // places in MonkeyVGA, the music is never explicitly stopped. + // Works around the fact that in some places in MonkeyEGA/VGA, + // the music is never explicitly stopped. // Rather it seems that starting a new music is supposed to // automatically stop the old song. - // This hack relays on the fact that we currently don't support SFX - // in these games, only music. Once we add SFX support, we'll have to - // revise it / replace it by a proper fix. - if (ptr) { - if (READ_BE_UINT16(ptr) == 'RO' || READ_UINT32(ptr) == MKID('ADL ')) + if (_scumm->_imuse && ptr) { + if (READ_UINT32(ptr) != MKID('ASFX')) _scumm->_imuse->stop_all_sounds(); } } |