diff options
author | Gregory Montoir | 2009-01-03 22:12:10 +0000 |
---|---|---|
committer | Gregory Montoir | 2009-01-03 22:12:10 +0000 |
commit | 3a4b4831dce092ac04f0756b48c3d73c8638449c (patch) | |
tree | 83400a0f5dda10aa20f921be2bb69b5c1e2063de | |
parent | c43b79091208228e2f9c5feee8c1d04fa0eb25bb (diff) | |
download | scummvm-rg350-3a4b4831dce092ac04f0756b48c3d73c8638449c.tar.gz scummvm-rg350-3a4b4831dce092ac04f0756b48c3d73c8638449c.tar.bz2 scummvm-rg350-3a4b4831dce092ac04f0756b48c3d73c8638449c.zip |
reorganized introduction sequence static data (to simplify code when using compressed audio files)
svn-id: r35710
-rw-r--r-- | engines/tucker/resource.cpp | 1 | ||||
-rw-r--r-- | engines/tucker/sequences.cpp | 138 | ||||
-rw-r--r-- | engines/tucker/staticres.cpp | 592 | ||||
-rw-r--r-- | engines/tucker/tucker.h | 47 |
4 files changed, 369 insertions, 409 deletions
diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index 812078d50f..f0441a8bf6 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -928,6 +928,7 @@ void TuckerEngine::loadSound(Audio::Mixer::SoundType type, int num, int volume, if (tmp) { stream = (compressedSoundFilesTable[_compressedSoundType].makeStream)(tmp, true, 0, 0, 1); } + // FIXME: looping not handled } } } diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index 3ce5a25198..edcb60c312 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -498,10 +498,12 @@ AnimationSequencePlayer::AnimationSequencePlayer(OSystem *system, Audio::Mixer * _newSeq = false; memset(_animationPalette, 0, sizeof(_animationPalette)); memset(_paletteBuffer, 0, sizeof(_paletteBuffer)); - _soundsListSeqData = 0; - _soundsList1 = 0; + _soundSeqDataOffset = 0; + _soundSeqDataCount = 0; + _soundSeqDataIndex = 0; + _soundsList1Offset = 0; _soundsList1Count = 0; - _soundsList2 = 0; + _soundsList2Offset = 0; _soundsList2Count = 0; _musicVolume = 0; _offscreenBuffer = (uint8 *)malloc(kScreenWidth * kScreenHeight); @@ -585,13 +587,23 @@ void AnimationSequencePlayer::syncTime() { } while (_lastFrameTime <= end); } -Audio::AudioStream *AnimationSequencePlayer::loadSoundFileAsStream(const char *name, AnimationSoundType type) { +Audio::AudioStream *AnimationSequencePlayer::loadSoundFileAsStream(int index, AnimationSoundType type) { + const char *name = 0; + switch (type) { + case kAnimationSoundType8BitsRAW: + case kAnimationSoundType16BitsRAW: + name = _musicFileNamesTable[index]; + break; + case kAnimationSoundTypeWAV: + case kAnimationSoundTypeLoopingWAV: + name = _audioFileNamesTable[index]; + break; + } Audio::AudioStream *stream = 0; char fileName[64]; snprintf(fileName, sizeof(fileName), "audio/%s", name); Common::File f; if (f.open(fileName)) { - uint8 *sampleData = 0; int size = 0, rate = 0; uint8 flags = 0; switch (type) { @@ -613,7 +625,7 @@ Audio::AudioStream *AnimationSequencePlayer::loadSoundFileAsStream(const char *n break; } if (size != 0) { - sampleData = (uint8 *)malloc(size); + uint8 *sampleData = (uint8 *)malloc(size); if (sampleData) { f.read(sampleData, size); flags |= Audio::Mixer::FLAG_AUTOFREE; @@ -632,26 +644,29 @@ void AnimationSequencePlayer::loadSounds(int type, int num) { case 0: index = 1; _soundsList1Count = 14; - _soundsList1 = _soundFilesList1; + _soundsList1Offset = 0; _soundsList2Count = 10; - _soundsList2 = _soundFilesList2; - _soundsListSeqData = _soundSeqData2; + _soundsList2Offset = 14; + _soundSeqDataCount = 58; + _soundSeqDataOffset = 0; break; case 1: index = 1; _soundsList1Count = 14; - _soundsList1 = _soundFilesList3; + _soundsList1Offset = 24; _soundsList2Count = 5; - _soundsList2 = _soundFilesList4; - _soundsListSeqData = _soundSeqData3; + _soundsList2Offset = 38; + _soundSeqDataCount = 60; + _soundSeqDataOffset = 58; break; case 2: index = 1; _soundsList1Count = 14; - _soundsList1 = _soundFilesList5; + _soundsList1Offset = 43; _soundsList2Count = 9; - _soundsList2 = _soundFilesList6; - _soundsListSeqData = _soundSeqData4; + _soundsList2Offset = 57; + _soundSeqDataCount = 48; + _soundSeqDataOffset = 118; break; } _musicVolume = 0; @@ -661,32 +676,36 @@ void AnimationSequencePlayer::loadSounds(int type, int num) { case 0: index = 3; _soundsList1Count = 13; - _soundsList1 = _soundFilesList7; + _soundsList1Offset = 66; _soundsList2Count = 0; - _soundsListSeqData = _soundSeqData5; + _soundSeqDataCount = 19; + _soundSeqDataOffset = 166; break; case 1: index = 6; _soundsList1Count = 14; - _soundsList1 = _soundFilesList8; + _soundsList1Offset = 79; _soundsList2Count = 4; - _soundsList2 = _soundFilesList9; - _soundsListSeqData = _soundSeqData6; + _soundsList2Offset = 93; + _soundSeqDataCount = 25; + _soundSeqDataOffset = 185; break; case 2: index = 7; _soundsList1Count = 13; - _soundsList1 = _soundFilesList10; + _soundsList1Offset = 97; _soundsList2Count = 9; - _soundsList2 = _soundFilesList11; - _soundsListSeqData = _soundSeqData7; + _soundsList2Offset = 110; + _soundSeqDataCount = 43; + _soundSeqDataOffset = 210; break; case 3: index = 10; _soundsList1Count = 11; - _soundsList1 = _soundFilesList12; + _soundsList1Offset = 119; _soundsList2Count = 0; - _soundsListSeqData = _soundSeqData8; + _soundSeqDataCount = 11; + _soundSeqDataOffset = 253; break; } _musicVolume = 80; @@ -696,16 +715,18 @@ void AnimationSequencePlayer::loadSounds(int type, int num) { case 0: index = 4; _soundsList1Count = 6; - _soundsList1 = _soundFilesList13; + _soundsList1Offset = 130; _soundsList2Count = 0; - _soundsListSeqData = _soundSeqData9; + _soundSeqDataCount = 12; + _soundSeqDataOffset = 264; break; case 1: index = 9; _soundsList1Count = 10; - _soundsList1 = _soundFilesList14; + _soundsList1Offset = 136; _soundsList2Count = 0; - _soundsListSeqData = _soundSeqData10; + _soundSeqDataCount = 24; + _soundSeqDataOffset = 276; break; } _musicVolume = 80; @@ -714,63 +735,64 @@ void AnimationSequencePlayer::loadSounds(int type, int num) { index = 5; _soundsList1Count = 0; _soundsList2Count = 0; - _soundsListSeqData = _soundSeqData1; + _soundSeqDataCount = 0; _musicVolume = 100; break; case 9: index = 8; _soundsList1Count = 0; _soundsList2Count = 0; - _soundsListSeqData = _soundSeqData1; + _soundSeqDataCount = 0; _musicVolume = 100; break; case 10: index = 0; _soundsList1Count = 4; - _soundsList1 = _soundFilesList15; + _soundsList1Offset = 146; _soundsList2Count = 0; - _soundsListSeqData = _soundSeqData11; + _soundSeqDataCount = 7; + _soundSeqDataOffset = 300; _musicVolume = 100; break; default: index = 0; _soundsList1Count = 0; _soundsList2Count = 0; - _soundsListSeqData = _soundSeqData1; + _soundSeqDataCount = 0; _musicVolume = 100; break; } if (_musicVolume != 0) { Audio::AudioStream *s; - if ((s = loadSoundFileAsStream(_musicFileNamesTable[index], (type == 5) ? kAnimationSoundType16BitsRAW : kAnimationSoundType8BitsRAW)) != 0) { + if ((s = loadSoundFileAsStream(index, (type == 5) ? kAnimationSoundType16BitsRAW : kAnimationSoundType8BitsRAW)) != 0) { _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, s, -1, scaleMixerVolume(_musicVolume)); } } + _soundSeqDataIndex = 0; } void AnimationSequencePlayer::updateSounds() { Audio::AudioStream *s = 0; - int index; - const int *p = _soundsListSeqData; - while (p[0] != -1 && p[0] <= _frameCounter) { - switch (p[2]) { + const SoundSequenceData *p = &_soundSeqData[_soundSeqDataOffset + _soundSeqDataIndex]; + while (_soundSeqDataIndex < _soundSeqDataCount && p->timestamp <= _frameCounter) { + switch (p->opcode) { case 0: - if ((index = p[1]) < _soundsList1Count) { - if ((s = loadSoundFileAsStream(_soundsList1[index], kAnimationSoundTypeWAV)) != 0) { - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_soundsHandle[index], s, -1, scaleMixerVolume(p[3])); + if (p->index < _soundsList1Count) { + if ((s = loadSoundFileAsStream(_soundsList1Offset + p->index, kAnimationSoundTypeWAV)) != 0) { + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_soundsHandle[p->index], s, -1, scaleMixerVolume(p->volume)); } } break; case 1: - if ((index = p[1]) < _soundsList1Count) { - if ((s = loadSoundFileAsStream(_soundsList1[index], kAnimationSoundTypeLoopingWAV)) != 0) { - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_soundsHandle[index], s, -1, scaleMixerVolume(p[3])); + if (p->index < _soundsList1Count) { + if ((s = loadSoundFileAsStream(_soundsList1Offset + p->index, kAnimationSoundTypeLoopingWAV)) != 0) { + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_soundsHandle[p->index], s, -1, scaleMixerVolume(p->volume)); } } break; case 2: - if ((index = p[1]) < _soundsList1Count) { - _mixer->stopHandle(_soundsHandle[index]); + if (p->index < _soundsList1Count) { + _mixer->stopHandle(_soundsHandle[p->index]); } break; case 3: @@ -778,34 +800,32 @@ void AnimationSequencePlayer::updateSounds() { break; case 4: _mixer->stopHandle(_musicHandle); - index = p[1]; - if ((s = loadSoundFileAsStream(_musicFileNamesTable[index], kAnimationSoundType8BitsRAW)) != 0) { - _musicVolume = p[3]; + if ((s = loadSoundFileAsStream(p->index, kAnimationSoundType8BitsRAW)) != 0) { + _musicVolume = p->volume; _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, s, -1, scaleMixerVolume(_musicVolume)); } break; case 5: - if ((index = p[1]) < _soundsList2Count) { - if ((s = loadSoundFileAsStream(_soundsList2[index], kAnimationSoundTypeWAV)) != 0) { - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, s, -1, scaleMixerVolume(p[3])); + if (p->index < _soundsList2Count) { + if ((s = loadSoundFileAsStream(_soundsList2Offset + p->index, kAnimationSoundTypeWAV)) != 0) { + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, s, -1, scaleMixerVolume(p->volume)); } } break; case 6: _mixer->stopHandle(_musicHandle); - index = p[1]; - if ((s = loadSoundFileAsStream(_musicFileNamesTable[index], kAnimationSoundType16BitsRAW)) != 0) { - _musicVolume = p[3]; + if ((s = loadSoundFileAsStream(p->index, kAnimationSoundType16BitsRAW)) != 0) { + _musicVolume = p->volume; _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, s, -1, scaleMixerVolume(_musicVolume)); } break; default: - warning("Unhandled sound opcode %d (%d,%d)", p[2], _frameCounter, p[0]); + warning("Unhandled sound opcode %d (%d,%d)", p->opcode, _frameCounter, p->timestamp); break; } - p += 4; + ++p; + ++_soundSeqDataIndex; } - _soundsListSeqData = p; } void AnimationSequencePlayer::fadeInPalette() { diff --git a/engines/tucker/staticres.cpp b/engines/tucker/staticres.cpp index 1ae0f54759..3efb34c58a 100644 --- a/engines/tucker/staticres.cpp +++ b/engines/tucker/staticres.cpp @@ -229,137 +229,119 @@ const uint8 TuckerEngine::_charWidthCharset2[58] = { 0x13, 0x12, 0x10, 0x11, 0x13, 0x14, 0x14, 0x10, 0x13, 0x10, }; -// timestamp, index, opcode, volume - -const int AnimationSequencePlayer::_soundSeqData1[1] = { - -1, -}; - -const int AnimationSequencePlayer::_soundSeqData2[233] = { - 16, 3, 1, 100, 18, 5, 1, 100, 26, 9, 5, 100, 74, 9, 0, 100, - 118, 10, 0, 100, 139, 9, 0, 100, 140, 10, 2, 100, 144, 5, 2, 100, - 146, 3, 2, 100, 147, 9, 2, 100, 148, 2, 1, 100, 156, 0, 1, 50, - 158, 4, 5, 100, 188, 4, 5, 100, 212, 2, 2, 100, 223, 1, 0, 100, - 230, 1, 2, 100, 234, 1, 0, 100, 251, 1, 0, 100, 265, 11, 6, 80, - 293, 5, 1, 80, 295, 12, 6, 80, 343, 13, 6, 110, 373, 14, 6, 80, - 429, 5, 2, 100, 431, 15, 6, 80, 456, 2, 1, 100, 457, 1, 5, 100, - 463, 0, 5, 100, 482, 2, 2, 100, 483, 8, 1, 100, 494, 8, 5, 100, - 507, 7, 5, 100, 511, 7, 5, 100, 522, 13, 1, 100, 547, 6, 5, 100, - 548, 11, 0, 100, 556, 12, 0, 100, 557, 2, 5, 100, 599, 7, 1, 100, - 639, 7, 2, 100, 641, 12, 0, 100, 642, 7, 5, 100, 718, 14, 2, 100, - 719, 1, 2, 100, 720, 2, 2, 100, 721, 3, 2, 100, 722, 4, 2, 100, - 723, 5, 2, 100, 724, 6, 2, 100, 725, 7, 2, 100, 726, 8, 2, 100, - 727, 9, 2, 100, 728, 10, 2, 100, 729, 11, 2, 100, 730, 12, 2, 100, - 731, 0, 2, 100, 732, 13, 2, 100, -1, -}; - -const int AnimationSequencePlayer::_soundSeqData3[241] = { - 2, 0, 3, 100, 3, 2, 0, 100, 3, 5, 1, 20, 6, 25, 6, 80, - 22, 1, 5, 100, 37, 29, 6, 80, 59, 30, 6, 80, 69, 26, 6, 80, - 124, 27, 6, 80, 163, 28, 6, 80, 197, 31, 6, 80, 224, 32, 6, 80, - 306, 33, 6, 80, 350, 34, 6, 80, 388, 8, 0, 100, 389, 6, 1, 100, - 390, 9, 1, 100, 395, 10, 0, 100, 398, 3, 0, 100, 408, 3, 0, 100, - 413, 4, 0, 100, 418, 3, 0, 100, 426, 6, 2, 100, 427, 9, 2, 100, - 430, 35, 6, 80, 472, 36, 6, 80, 514, 9, 1, 100, 515, 7, 0, 100, - 516, 6, 1, 100, 517, 4, 0, 100, 520, 11, 0, 100, 523, 3, 0, 100, - 531, 7, 2, 100, 532, 9, 2, 100, 533, 6, 2, 100, 534, 3, 0, 100, - 535, 37, 6, 80, 553, 38, 6, 80, 569, 39, 6, 80, 588, 40, 6, 80, - 662, 41, 6, 80, 777, 42, 6, 80, 978, 1, 0, 100, 1008, 12, 0, 100, - 1011, 4, 5, 100, 1022, 52, 6, 80, 1039, 3, 5, 100, 1045, 3, 5, 100, - 1051, 3, 5, 100, 1057, 3, 5, 100, 1063, 3, 5, 100, 1066, 3, 5, 40, - 1074, 43, 6, 80, 1256, 44, 6, 80, 1322, 45, 6, 80, 1373, 46, 6, 80, - 1419, 47, 6, 80, 1792, 13, 0, 100, 1793, 0, 5, 100, 1895, 51, 6, 80, - -1, -}; - -const int AnimationSequencePlayer::_soundSeqData4[193] = { - 2, 0, 3, 100, 4, 3, 1, 40, 5, 7, 1, 20, 7, 3, 5, 100, - 62, 3, 2, 100, 63, 48, 6, 80, 198, 7, 2, 100, 202, 5, 1, 100, - 203, 16, 6, 80, 211, 1, 5, 100, 216, 0, 1, 40, 217, 5, 2, 100, - 218, 6, 1, 100, 224, 2, 5, 100, 229, 17, 6, 80, 273, 6, 2, 100, - 274, 4, 1, 100, 275, 4, 5, 100, 335, 1, 1, 100, 336, 13, 0, 100, - 339, 11, 0, 100, 358, 0, 5, 100, 364, 24, 4, 100, 397, 7, 5, 100, - 399, 6, 5, 100, 433, 5, 5, 100, 451, 13, 0, 100, 459, 1, 2, 100, - 508, 4, 2, 100, 509, 1, 1, 100, 521, 11, 0, 100, 530, 8, 0, 100, - 537, 9, 0, 100, 557, 8, 5, 100, 578, 5, 5, 100, 602, 13, 0, 100, - 609, 1, 2, 100, 626, 12, 0, 100, 628, 10, 0, 100, 670, 6, 5, 100, - 690, 10, 0, 100, 692, 3, 5, 100, 705, 11, 0, 100, 710, 2, 5, 100, - 714, 9, 0, 100, 720, 9, 2, 100, 721, 7, 5, 100, 725, 0, 5, 100, - -1, -}; - -const int AnimationSequencePlayer::_soundSeqData5[77] = { - 3, 8, 0, 100, 43, 11, 0, 100, 68, 5, 1, 100, 100, 5, 2, 100, - 104, 6, 0, 100, 139, 7, 0, 100, 192, 3, 0, 100, 199, 4, 0, 100, - 207, 4, 0, 100, 208, 2, 0, 100, 254, 0, 0, 100, 260, 0, 0, 100, - 266, 0, 0, 100, 272, 0, 0, 100, 276, 0, 0, 100, 282, 1, 0, 100, - 303, 10, 0, 100, 319, 12, 0, 100, 355, 9, 0, 100, -1, -}; - -const int AnimationSequencePlayer::_soundSeqData6[101] = { - 3, 0, 1, 100, 34, 0, 2, 100, 57, 0, 5, 100, 77, 0, 5, 100, - 84, 9, 0, 100, 100, 9, 0, 100, 140, 3, 5, 100, 157, 2, 5, 100, - 158, 1, 0, 100, 204, 1, 5, 100, 220, 2, 1, 100, 235, 7, 0, 100, - 236, 2, 2, 100, 248, 12, 0, 100, 251, 13, 0, 100, 265, 11, 0, 100, - 276, 11, 0, 100, 310, 5, 0, 100, 335, 6, 0, 100, 370, 4, 0, 100, - 373, 8, 0, 100, 378, 8, 0, 100, 434, 10, 0, 100, 453, 3, 0, 100, - 484, 3, 2, 100, -1, -}; - -const int AnimationSequencePlayer::_soundSeqData7[173] = { - 3, 4, 5, 100, 10, 5, 5, 100, 22, 6, 5, 100, 32, 7, 5, 100, - 39, 6, 5, 100, 48, 7, 5, 100, 57, 6, 5, 100, 65, 3, 0, 50, - 102, 4, 0, 50, 151, 2, 5, 50, 205, 3, 5, 100, 218, 0, 5, 100, - 227, 0, 5, 100, 236, 0, 5, 100, 245, 0, 5, 100, 254, 0, 5, 100, - 263, 0, 5, 100, 272, 0, 5, 100, 291, 1, 1, 40, 309, 8, 5, 100, - 360, 8, 5, 100, 384, 2, 1, 60, 398, 10, 0, 100, 440, 2, 2, 100, - 441, 1, 2, 100, 452, 11, 0, 100, 466, 1, 5, 100, 470, 8, 0, 100, - 503, 6, 0, 100, 519, 7, 0, 100, 536, 8, 0, 100, 538, 4, 5, 100, - 549, 5, 5, 100, 558, 4, 5, 100, 568, 5, 5, 100, 578, 4, 5, 100, - 586, 5, 5, 100, 593, 4, 5, 100, 600, 5, 5, 100, 606, 4, 5, 100, - 613, 5, 5, 100, 620, 9, 0, 100, 630, 12, 0, 100, -1, -}; - -const int AnimationSequencePlayer::_soundSeqData8[45] = { - 17, 2, 0, 100, 57, 8, 0, 100, 62, 10, 0, 100, 67, 9, 0, 100, - 74, 3, 1, 100, 87, 3, 2, 100, 85, 0, 0, 100, 138, 5, 0, 100, - 196, 7, 0, 100, 222, 6, 0, 100, 228, 1, 0, 100, -1, -}; - -const int AnimationSequencePlayer::_soundSeqData9[49] = { - 20, 4, 0, 100, 132, 0, 0, 100, 145, 0, 2, 100, 171, 1, 0, 100, - 315, 2, 0, 50, 334, 3, 0, 100, 602, 5, 0, 50, 631, 5, 0, 50, - 660, 5, 0, 50, 767, 5, 0, 50, 795, 5, 0, 50, 824, 5, 0, 50, - -1, -}; - -const int AnimationSequencePlayer::_soundSeqData10[97] = { - 4, 8, 1, 100, 5, 6, 0, 100, 47, 8, 2, 100, 125, 8, 1, 100, - 126, 6, 0, 100, 156, 8, 2, 100, 168, 2, 0, 100, 174, 2, 0, 100, - 180, 2, 0, 100, 186, 2, 0, 100, 192, 2, 0, 100, 267, 2, 0, 100, - 273, 2, 0, 100, 279, 2, 0, 100, 285, 2, 0, 100, 291, 2, 0, 100, - 297, 2, 0, 100, 302, 0, 0, 100, 417, 1, 0, 100, 472, 5, 0, 100, - 600, 5, 0, 100, 623, 3, 0, 100, 643, 9, 0, 100, 781, 4, 0, 80, - -1, -}; - -const int AnimationSequencePlayer::_soundSeqData11[29] = { - 2, 0, 3, 100, 3, 0, 1, 100, 33, 0, 2, 100, 33, 1, 0, 100, - 53, 2, 1, 100, 78, 2, 2, 100, 80, 0, 4, 100, -1, -}; - -const char *AnimationSequencePlayer::_musicFileNamesTable[53] = { - "DemoMenu.raw", - "IntroduB.raw", - "IntroduA.raw", - "DemoRolA.raw", - "DemoChA1.raw", +const SoundSequenceData AnimationSequencePlayer::_soundSeqData[] = { + { 16, 3, 1, 100 }, { 18, 5, 1, 100 }, { 26, 9, 5, 100 }, { 74, 9, 0, 100 }, + { 118, 10, 0, 100 }, { 139, 9, 0, 100 }, { 140, 10, 2, 100 }, { 144, 5, 2, 100 }, + { 146, 3, 2, 100 }, { 147, 9, 2, 100 }, { 148, 2, 1, 100 }, { 156, 0, 1, 50 }, + { 158, 4, 5, 100 }, { 188, 4, 5, 100 }, { 212, 2, 2, 100 }, { 223, 1, 0, 100 }, + { 230, 1, 2, 100 }, { 234, 1, 0, 100 }, { 251, 1, 0, 100 }, { 265, 11, 6, 80 }, + { 293, 5, 1, 80 }, { 295, 12, 6, 80 }, { 343, 13, 6, 110 }, { 373, 14, 6, 80 }, + { 429, 5, 2, 100 }, { 431, 15, 6, 80 }, { 456, 2, 1, 100 }, { 457, 1, 5, 100 }, + { 463, 0, 5, 100 }, { 482, 2, 2, 100 }, { 483, 8, 1, 100 }, { 494, 8, 5, 100 }, + { 507, 7, 5, 100 }, { 511, 7, 5, 100 }, { 522, 13, 1, 100 }, { 547, 6, 5, 100 }, + { 548, 11, 0, 100 }, { 556, 12, 0, 100 }, { 557, 2, 5, 100 }, { 599, 7, 1, 100 }, + { 639, 7, 2, 100 }, { 641, 12, 0, 100 }, { 642, 7, 5, 100 }, { 718, 14, 2, 100 }, + { 719, 1, 2, 100 }, { 720, 2, 2, 100 }, { 721, 3, 2, 100 }, { 722, 4, 2, 100 }, + { 723, 5, 2, 100 }, { 724, 6, 2, 100 }, { 725, 7, 2, 100 }, { 726, 8, 2, 100 }, + { 727, 9, 2, 100 }, { 728, 10, 2, 100 }, { 729, 11, 2, 100 }, { 730, 12, 2, 100 }, + { 731, 0, 2, 100 }, { 732, 13, 2, 100 }, + // count 2,58 + // offset 3,58 + { 2, 0, 3, 100 }, { 3, 2, 0, 100 }, { 3, 5, 1, 20 }, { 6, 25, 6, 80 }, + { 22, 1, 5, 100 }, { 37, 29, 6, 80 }, { 59, 30, 6, 80 }, { 69, 26, 6, 80 }, + { 124, 27, 6, 80 }, { 163, 28, 6, 80 }, { 197, 31, 6, 80 }, { 224, 32, 6, 80 }, + { 306, 33, 6, 80 }, { 350, 34, 6, 80 }, { 388, 8, 0, 100 }, { 389, 6, 1, 100 }, + { 390, 9, 1, 100 }, { 395, 10, 0, 100 }, { 398, 3, 0, 100 }, { 408, 3, 0, 100 }, + { 413, 4, 0, 100 }, { 418, 3, 0, 100 }, { 426, 6, 2, 100 }, { 427, 9, 2, 100 }, + { 430, 35, 6, 80 }, { 472, 36, 6, 80 }, { 514, 9, 1, 100 }, { 515, 7, 0, 100 }, + { 516, 6, 1, 100 }, { 517, 4, 0, 100 }, { 520, 11, 0, 100 }, { 523, 3, 0, 100 }, + { 531, 7, 2, 100 }, { 532, 9, 2, 100 }, { 533, 6, 2, 100 }, { 534, 3, 0, 100 }, + { 535, 37, 6, 80 }, { 553, 38, 6, 80 }, { 569, 39, 6, 80 }, { 588, 40, 6, 80 }, + { 662, 41, 6, 80 }, { 777, 42, 6, 80 }, { 978, 1, 0, 100 }, { 1008, 12, 0, 100 }, + { 1011, 4, 5, 100 }, { 1022, 52, 6, 80 }, { 1039, 3, 5, 100 }, { 1045, 3, 5, 100 }, + { 1051, 3, 5, 100 }, { 1057, 3, 5, 100 }, { 1063, 3, 5, 100 }, { 1066, 3, 5, 40 }, + { 1074, 43, 6, 80 }, { 1256, 44, 6, 80 }, { 1322, 45, 6, 80 }, { 1373, 46, 6, 80 }, + { 1419, 47, 6, 80 }, { 1792, 13, 0, 100 }, { 1793, 0, 5, 100 }, { 1895, 51, 6, 80 }, + // count 3,60 + // offset 4,118 + { 2, 0, 3, 100 }, { 4, 3, 1, 40 }, { 5, 7, 1, 20 }, { 7, 3, 5, 100 }, + { 62, 3, 2, 100 }, { 63, 48, 6, 80 }, { 198, 7, 2, 100 }, { 202, 5, 1, 100 }, + { 203, 16, 6, 80 }, { 211, 1, 5, 100 }, { 216, 0, 1, 40 }, { 217, 5, 2, 100 }, + { 218, 6, 1, 100 }, { 224, 2, 5, 100 }, { 229, 17, 6, 80 }, { 273, 6, 2, 100 }, + { 274, 4, 1, 100 }, { 275, 4, 5, 100 }, { 335, 1, 1, 100 }, { 336, 13, 0, 100 }, + { 339, 11, 0, 100 }, { 358, 0, 5, 100 }, { 364, 24, 4, 100 }, { 397, 7, 5, 100 }, + { 399, 6, 5, 100 }, { 433, 5, 5, 100 }, { 451, 13, 0, 100 }, { 459, 1, 2, 100 }, + { 508, 4, 2, 100 }, { 509, 1, 1, 100 }, { 521, 11, 0, 100 }, { 530, 8, 0, 100 }, + { 537, 9, 0, 100 }, { 557, 8, 5, 100 }, { 578, 5, 5, 100 }, { 602, 13, 0, 100 }, + { 609, 1, 2, 100 }, { 626, 12, 0, 100 }, { 628, 10, 0, 100 }, { 670, 6, 5, 100 }, + { 690, 10, 0, 100 }, { 692, 3, 5, 100 }, { 705, 11, 0, 100 }, { 710, 2, 5, 100 }, + { 714, 9, 0, 100 }, { 720, 9, 2, 100 }, { 721, 7, 5, 100 }, { 725, 0, 5, 100 }, + // count 4,48 + // offset 5,166 + { 3, 8, 0, 100 }, { 43, 11, 0, 100 }, { 68, 5, 1, 100 }, { 100, 5, 2, 100 }, + { 104, 6, 0, 100 }, { 139, 7, 0, 100 }, { 192, 3, 0, 100 }, { 199, 4, 0, 100 }, + { 207, 4, 0, 100 }, { 208, 2, 0, 100 }, { 254, 0, 0, 100 }, { 260, 0, 0, 100 }, + { 266, 0, 0, 100 }, { 272, 0, 0, 100 }, { 276, 0, 0, 100 }, { 282, 1, 0, 100 }, + { 303, 10, 0, 100 }, { 319, 12, 0, 100 }, { 355, 9, 0, 100 }, + // count 5,19 + // offset 6,185 + { 3, 0, 1, 100 }, { 34, 0, 2, 100 }, { 57, 0, 5, 100 }, { 77, 0, 5, 100 }, + { 84, 9, 0, 100 }, { 100, 9, 0, 100 }, { 140, 3, 5, 100 }, { 157, 2, 5, 100 }, + { 158, 1, 0, 100 }, { 204, 1, 5, 100 }, { 220, 2, 1, 100 }, { 235, 7, 0, 100 }, + { 236, 2, 2, 100 }, { 248, 12, 0, 100 }, { 251, 13, 0, 100 }, { 265, 11, 0, 100 }, + { 276, 11, 0, 100 }, { 310, 5, 0, 100 }, { 335, 6, 0, 100 }, { 370, 4, 0, 100 }, + { 373, 8, 0, 100 }, { 378, 8, 0, 100 }, { 434, 10, 0, 100 }, { 453, 3, 0, 100 }, + { 484, 3, 2, 100 }, + // count 6,25 + // offset 7,210 + { 3, 4, 5, 100 }, { 10, 5, 5, 100 }, { 22, 6, 5, 100 }, { 32, 7, 5, 100 }, + { 39, 6, 5, 100 }, { 48, 7, 5, 100 }, { 57, 6, 5, 100 }, { 65, 3, 0, 50 }, + { 102, 4, 0, 50 }, { 151, 2, 5, 50 }, { 205, 3, 5, 100 }, { 218, 0, 5, 100 }, + { 227, 0, 5, 100 }, { 236, 0, 5, 100 }, { 245, 0, 5, 100 }, { 254, 0, 5, 100 }, + { 263, 0, 5, 100 }, { 272, 0, 5, 100 }, { 291, 1, 1, 40 }, { 309, 8, 5, 100 }, + { 360, 8, 5, 100 }, { 384, 2, 1, 60 }, { 398, 10, 0, 100 }, { 440, 2, 2, 100 }, + { 441, 1, 2, 100 }, { 452, 11, 0, 100 }, { 466, 1, 5, 100 }, { 470, 8, 0, 100 }, + { 503, 6, 0, 100 }, { 519, 7, 0, 100 }, { 536, 8, 0, 100 }, { 538, 4, 5, 100 }, + { 549, 5, 5, 100 }, { 558, 4, 5, 100 }, { 568, 5, 5, 100 }, { 578, 4, 5, 100 }, + { 586, 5, 5, 100 }, { 593, 4, 5, 100 }, { 600, 5, 5, 100 }, { 606, 4, 5, 100 }, + { 613, 5, 5, 100 }, { 620, 9, 0, 100 }, { 630, 12, 0, 100 }, + // count 7,43 + // offset 8,253 + { 17, 2, 0, 100 }, { 57, 8, 0, 100 }, { 62, 10, 0, 100 }, { 67, 9, 0, 100 }, + { 74, 3, 1, 100 }, { 87, 3, 2, 100 }, { 85, 0, 0, 100 }, { 138, 5, 0, 100 }, + { 196, 7, 0, 100 }, { 222, 6, 0, 100 }, { 228, 1, 0, 100 }, + // count 8,11 + // offset 9,264 + { 20, 4, 0, 100 }, { 132, 0, 0, 100 }, { 145, 0, 2, 100 }, { 171, 1, 0, 100 }, + { 315, 2, 0, 50 }, { 334, 3, 0, 100 }, { 602, 5, 0, 50 }, { 631, 5, 0, 50 }, + { 660, 5, 0, 50 }, { 767, 5, 0, 50 }, { 795, 5, 0, 50 }, { 824, 5, 0, 50 }, + // count 9,12 + // offset 10,276 + { 4, 8, 1, 100 }, { 5, 6, 0, 100 }, { 47, 8, 2, 100 }, { 125, 8, 1, 100 }, + { 126, 6, 0, 100 }, { 156, 8, 2, 100 }, { 168, 2, 0, 100 }, { 174, 2, 0, 100 }, + { 180, 2, 0, 100 }, { 186, 2, 0, 100 }, { 192, 2, 0, 100 }, { 267, 2, 0, 100 }, + { 273, 2, 0, 100 }, { 279, 2, 0, 100 }, { 285, 2, 0, 100 }, { 291, 2, 0, 100 }, + { 297, 2, 0, 100 }, { 302, 0, 0, 100 }, { 417, 1, 0, 100 }, { 472, 5, 0, 100 }, + { 600, 5, 0, 100 }, { 623, 3, 0, 100 }, { 643, 9, 0, 100 }, { 781, 4, 0, 80 }, + // count 10,24 + // offset 11,300 + { 2, 0, 3, 100 }, { 3, 0, 1, 100 }, { 33, 0, 2, 100 }, { 33, 1, 0, 100 }, + { 53, 2, 1, 100 }, { 78, 2, 2, 100 }, { 80, 0, 4, 100 } + // count 11,7 +}; + +const char *AnimationSequencePlayer::_musicFileNamesTable[] = { + "demomenu.raw", + "introdub.raw", + "introdua.raw", + "demorola.raw", + "democha1.raw", "icrmusic.raw", - "DemoRolC.raw", - "DemoRolC.raw", - "MeriLogo.raw", - "DemoChA2.raw", - "DemoRolC.raw", + "demorolc.raw", + "demorolc.raw", + "merilogo.raw", + "democha2.raw", + "demorolc.raw", "int1.raw", "int2.raw", "int3.raw", @@ -404,195 +386,167 @@ const char *AnimationSequencePlayer::_musicFileNamesTable[53] = { "int42.raw" }; -const char *AnimationSequencePlayer::_soundFilesList1[14] = { - "IntroduA.wav", - "FX35.wav", - "FX47.wav", - "FX50.wav", - "FX51.wav", - "FX52.wav", - "FX54.wav", - "FX58.wav", - "FX59.wav", - "FX53.wav", - "FX55.wav", - "FX68.wav", - "FX57.wav", - "FX36.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList2[10] = { - "FX33.wav", - "FX34.wav", - "FX38.wav", - "FX39.wav", - "FX48.wav", - "FX49.wav", - "FX69.wav", - "FX32.wav", - "FX56.wav", - "FX117.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList3[14] = { - "IntroduA.wav", - "FX37.wav", - "FX49.wav", - "FX72.wav", - "FX73.wav", - "FX74.wav", - "FX75.wav", - "FX76.wav", - "FX77.wav", - "FX78.wav", - "FX79.wav", - "FX80.wav", - "FX81.wav", - "FX83.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList4[5] = { - "FX70.wav", - "FX33.wav", - "RDFX12.wav", - "FX86.wav", - "FX116.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList5[14] = { - "IntroduA.wav", - "FX36.wav", - "FX46.wav", - "FX52.wav", - "FX59.wav", - "FX66.wav", - "FX67.wav", - "FX74.wav", - "RDFX26.wav", - "FX42.wav", - "FX43.wav", - "FX44.wav", - "FX45.wav", - "FX61.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList6[9] = { - "FX40.wav", - "FX60.wav", - "FX62.wav", - "FX71.wav", - "FX63.wav", - "FX64.wav", - "FX68.wav", - "FX69.wav", - "RDFX12.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList7[13] = { - "RDFX1.wav", - "RDFX2.wav", - "RDFX4.wav", - "RDFX5.wav", - "RDFX6.wav", - "RDFX7.wav", - "RDFX10.wav", - "RDFX11.wav", - "RDFX12.wav", - "RDFX19.wav", - "RDFX29.wav", - "RDFX32.wav", - "RDFX35.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList8[14] = { - "RDFX8.wav", - "RDFX9.wav", - "RDFX13.wav", - "RDFX14.wav", - "RDFX33.wav", - "RDFX16.wav", - "RDFX18.wav", - "RDFX20.wav", - "RDFX38.wav", - "FX39.wav", - "RDFX28.wav", - "RDFX25.wav", - "RDFX26.wav", - "RDFX27.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList9[4] = { - "RDFX31.wav", - "RDFX21.wav", - "RDFX15.wav", - "FX34.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList10[13] = { - "FX96.wav", - "FX74.wav", - "FX75.wav", - "FX97.wav", - "FX98.wav", - "FX106.wav", - "FX107.wav", - "FX108.wav", - "FX109.wav", - "FX110.wav", - "FX93.wav", - "FX83.wav", - "FX111.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList11[9] = { - "FX86.wav", - "FX101.wav", - "FX112.wav", - "FX104.wav", - "FX102.wav", - "FX103.wav", - "FX91.wav", - "FX92.wav", - "FX105.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList12[11] = { - "RDFX3.wav", - "RDFX9.wav", - "RDFX17.wav", - "RDFX22.wav", - "RDFX23.wav", - "RDFX24.wav", - "RDFX30.wav", - "RDFX36.wav", - "RDFX1.wav", - "RDFX16.wav", - "RDFX37.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList13[6] = { - "FX82.wav", - "FX80.wav", - "FX89.wav", - "FX90.wav", - "FX83.wav", - "FX84.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList14[10] = { - "RDFX2.wav", - "FX85.wav", - "FX86.wav", - "FX87.wav", - "FX88.wav", - "FX99.wav", - "FX98.wav", - "FX97.wav", - "FX96.wav", - "FX100.wav" -}; - -const char *AnimationSequencePlayer::_soundFilesList15[4] = { +const char *AnimationSequencePlayer::_audioFileNamesTable[] = { + "introdua.wav", + "fx35.wav", + "fx47.wav", + "fx50.wav", + "fx51.wav", + "fx52.wav", + "fx54.wav", + "fx58.wav", + "fx59.wav", + "fx53.wav", + "fx55.wav", + "fx68.wav", + "fx57.wav", + "fx36.wav", + // offset 2,14 + "fx33.wav", + "fx34.wav", + "fx38.wav", + "fx39.wav", + "fx48.wav", + "fx49.wav", + "fx69.wav", + "fx32.wav", + "fx56.wav", + "fx117.wav", + // offset 3,24 + "introdua.wav", + "fx37.wav", + "fx49.wav", + "fx72.wav", + "fx73.wav", + "fx74.wav", + "fx75.wav", + "fx76.wav", + "fx77.wav", + "fx78.wav", + "fx79.wav", + "fx80.wav", + "fx81.wav", + "fx83.wav", + // offset 4,38 + "fx70.wav", + "fx33.wav", + "rdfx12.wav", + "fx86.wav", + "fx116.wav", + // offset 5,43 + "introdua.wav", + "fx36.wav", + "fx46.wav", + "fx52.wav", + "fx59.wav", + "fx66.wav", + "fx67.wav", + "fx74.wav", + "rdfx26.wav", + "fx42.wav", + "fx43.wav", + "fx44.wav", + "fx45.wav", + "fx61.wav", + // offset 6,57 + "fx40.wav", + "fx60.wav", + "fx62.wav", + "fx71.wav", + "fx63.wav", + "fx64.wav", + "fx68.wav", + "fx69.wav", + "rdfx12.wav", + // offset 7,66 + "rdfx1.wav", + "rdfx2.wav", + "rdfx4.wav", + "rdfx5.wav", + "rdfx6.wav", + "rdfx7.wav", + "rdfx10.wav", + "rdfx11.wav", + "rdfx12.wav", + "rdfx19.wav", + "rdfx29.wav", + "rdfx32.wav", + "rdfx35.wav", + // offset 8,79 + "rdfx8.wav", + "rdfx9.wav", + "rdfx13.wav", + "rdfx14.wav", + "rdfx33.wav", + "rdfx16.wav", + "rdfx18.wav", + "rdfx20.wav", + "rdfx38.wav", + "fx39.wav", + "rdfx28.wav", + "rdfx25.wav", + "rdfx26.wav", + "rdfx27.wav", + // offset 9,93 + "rdfx31.wav", + "rdfx21.wav", + "rdfx15.wav", + "fx34.wav", + // offset 10,97 + "fx96.wav", + "fx74.wav", + "fx75.wav", + "fx97.wav", + "fx98.wav", + "fx106.wav", + "fx107.wav", + "fx108.wav", + "fx109.wav", + "fx110.wav", + "fx93.wav", + "fx83.wav", + "fx111.wav", + // offset 11,110 + "fx86.wav", + "fx101.wav", + "fx112.wav", + "fx104.wav", + "fx102.wav", + "fx103.wav", + "fx91.wav", + "fx92.wav", + "fx105.wav", + // offset 12,119 + "rdfx3.wav", + "rdfx9.wav", + "rdfx17.wav", + "rdfx22.wav", + "rdfx23.wav", + "rdfx24.wav", + "rdfx30.wav", + "rdfx36.wav", + "rdfx1.wav", + "rdfx16.wav", + "rdfx37.wav", + // offset 13,130 + "fx82.wav", + "fx80.wav", + "fx89.wav", + "fx90.wav", + "fx83.wav", + "fx84.wav", + // offset 14,136 + "rdfx2.wav", + "fx85.wav", + "fx86.wav", + "fx87.wav", + "fx88.wav", + "fx99.wav", + "fx98.wav", + "fx97.wav", + "fx96.wav", + "fx100.wav", + // offset 15,146 "rdfx22.wav", "fx113.wav", "fx114.wav", diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h index bc8d112d8a..9cbe9c4528 100644 --- a/engines/tucker/tucker.h +++ b/engines/tucker/tucker.h @@ -843,6 +843,13 @@ enum AnimationSoundType { kAnimationSoundTypeLoopingWAV }; +struct SoundSequenceData { + int timestamp; + int index; + int opcode; + int volume; +}; + class AnimationSequencePlayer { public: @@ -859,7 +866,7 @@ private: void syncTime(); void loadSounds(int type, int num); - Audio::AudioStream *loadSoundFileAsStream(const char *name, AnimationSoundType type); + Audio::AudioStream *loadSoundFileAsStream(int index, AnimationSoundType type); void updateSounds(); void fadeInPalette(); void fadeOutPalette(); @@ -889,11 +896,13 @@ private: int _seqNum, _currentSeqNum; ::Graphics::FlicPlayer _flicPlayer[2]; uint8 _animationPalette[256 * 4], _paletteBuffer[256 * 4]; - const int *_soundsListSeqData; - const char **_soundsList1; + int _soundsList1Offset; int _soundsList1Count; - const char **_soundsList2; + int _soundsList2Offset; int _soundsList2Count; + int _soundSeqDataOffset; + int _soundSeqDataCount; + int _soundSeqDataIndex; int _musicVolume; uint8 *_offscreenBuffer; int _updateScreenWidth; @@ -907,33 +916,9 @@ private: Audio::SoundHandle _sfxHandle; Audio::SoundHandle _musicHandle; - static const int _soundSeqData1[1]; - static const int _soundSeqData2[233]; - static const int _soundSeqData3[241]; - static const int _soundSeqData4[193]; - static const int _soundSeqData5[77]; - static const int _soundSeqData6[101]; - static const int _soundSeqData7[173]; - static const int _soundSeqData8[45]; - static const int _soundSeqData9[49]; - static const int _soundSeqData10[97]; - static const int _soundSeqData11[29]; - static const char *_musicFileNamesTable[53]; - static const char *_soundFilesList1[14]; - static const char *_soundFilesList2[10]; - static const char *_soundFilesList3[14]; - static const char *_soundFilesList4[5]; - static const char *_soundFilesList5[14]; - static const char *_soundFilesList6[9]; - static const char *_soundFilesList7[13]; - static const char *_soundFilesList8[14]; - static const char *_soundFilesList9[4]; - static const char *_soundFilesList10[13]; - static const char *_soundFilesList11[9]; - static const char *_soundFilesList12[11]; - static const char *_soundFilesList13[6]; - static const char *_soundFilesList14[10]; - static const char *_soundFilesList15[4]; + static const SoundSequenceData _soundSeqData[]; + static const char *_musicFileNamesTable[]; + static const char *_audioFileNamesTable[]; }; } // namespace Tucker |