From 58f0d4e632793ac9e38f5c0596626eba1173748d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 3 Jan 2008 14:42:49 +0000 Subject: Committed slightly modified patch #1862758 "KYRA: audio data assignment patch". svn-id: r30198 --- engines/kyra/kyra.h | 7 +++ engines/kyra/kyra_v1.cpp | 7 ++- engines/kyra/kyra_v1.h | 7 +-- engines/kyra/kyra_v2.cpp | 85 ++++++++++++++++++--------------- engines/kyra/kyra_v2.h | 15 ++++-- engines/kyra/saveload_v1.cpp | 2 +- engines/kyra/sequences_v2.cpp | 15 ++---- engines/kyra/sound.cpp | 6 +-- engines/kyra/sound.h | 38 +++------------ engines/kyra/sound_adlib.cpp | 4 +- engines/kyra/sound_towns.cpp | 102 ++++++++------------------------------- engines/kyra/staticres.cpp | 108 ++++++++++++++++++++++++++++++++++++++++-- 12 files changed, 213 insertions(+), 183 deletions(-) (limited to 'engines') diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h index 5bfb1696a8..e502a886e7 100644 --- a/engines/kyra/kyra.h +++ b/engines/kyra/kyra.h @@ -56,6 +56,13 @@ enum { GI_KYRA3 = 2 }; +struct AudioDataStruct { + const char * const *_fileList; + const uint _fileListLen; + const void * const _cdaTracks; + const uint _cdaNumTracks; +}; + // TODO: this is just the start of makeing the debug output of the kyra engine a bit more useable // in the future we maybe merge some flags and/or create new ones enum kDebugLevels { diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index db0f374f16..ec3ed0b440 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -180,10 +180,9 @@ int KyraEngine_v1::init() { initStaticResource(); - if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) - _sound->setSoundFileList(_soundFilesTowns, _soundFilesTownsCount); - else - _sound->setSoundFileList(_soundFiles, _soundFilesCount); + const AudioDataStruct *const sndList = (_flags.platform == Common::kPlatformFMTowns || + _flags.platform == Common::kPlatformPC98) ? _soundData_TOWNS : _soundData_PC; + _sound->setSoundList(sndList); _trackMap = _dosTrackMap; _trackMapSize = _dosTrackMapSize; diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index f4ff4a4daf..57a1492924 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -764,10 +764,11 @@ protected: const uint8 * const*_specialPalettes; static const char *_soundFiles[]; - static const int _soundFilesCount; static const char *_soundFilesTowns[]; - static const int _soundFilesTownsCount; - + static const int32 _cdaTrackTable[]; + static const AudioDataStruct _soundData_PC[]; + static const AudioDataStruct _soundData_TOWNS[]; + static const int8 _charXPosTable[]; static const int8 _charYPosTable[]; diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 608e954307..b009e4d53e 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -139,12 +139,21 @@ int KyraEngine_v2::init() { _sequenceStrings = (const char * const *) _sequenceStrings_TOWNS_EN; _sequenceStringsSize = _sequenceStringsSize_TOWNS_EN; _sequences = (const Sequence*) _sequences_TOWNS; - } else { + _soundData = (const AudioDataStruct *) _soundData_TOWNS; + } else if (_flags.isTalkie) { _sequenceSoundList = (const char * const *) _sequenceSoundList_PC; _sequenceSoundListSize = _sequenceSoundListSize_PC; _sequenceStrings = (const char * const *) _sequenceStrings_PC_EN; _sequenceStringsSize = _sequenceStringsSize_PC_EN; _sequences = (const Sequence*) _sequences_PC; + _soundData = (const AudioDataStruct *) _soundData_PC; + } else { + _sequenceSoundList = (const char * const *) _sequenceSoundList_PCFLOPPY; + _sequenceSoundListSize = _sequenceSoundListSize_PCFLOPPY; + _sequenceStrings = (const char * const *) _sequenceStrings_PC_EN; + _sequenceStringsSize = _sequenceStringsSize_PC_EN; + _sequences = (const Sequence*) _sequences_PC; + _soundData = (const AudioDataStruct *) _soundData_PC; } for (int i = 0; i < 33; i++) @@ -170,45 +179,58 @@ int KyraEngine_v2::go() { if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) seq_showStarcraftLogo(); - seq_playSequences(kSequenceVirgin, kSequenceZanfaun); - //seq_playSequences(kSequenceFunters, kSequenceFrash); + if (_flags.platform == Common::kPlatformPC && _flags.isDemo) { + _res->loadPakFile("VOC.PAK"); + _menuChoice = 2; + } else { + seq_playSequences(kSequenceVirgin, kSequenceZanfaun); + //seq_playSequences(kSequenceFunters, kSequenceFrash); - if (_menuChoice == 1) { - // load just the pak files needed for ingame _res->unloadAllPakFiles(); - if (_flags.platform == Common::kPlatformPC && (_flags.isTalkie || _flags.isDemo)) { - _res->loadFileList("FILEDATA.FDT"); - } else if (_flags.platform == Common::kPlatformPC) { - //TODO: - //What files are needed for floppy version? - } else if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) { - char tmpfilename[13]; - static const char * pakfiles [] = { "KYRA.DAT", "AUDIO.PAK", "CAULDRON.PAK", - "MISC_CPS.PAK", "MISC_EMC.PAK", "OTHER.PAK", "VOC.PAK", "WSCORE.PAK" }; - for (int i = 0; i < 8; i++) - _res->loadPakFile(pakfiles[i]); - for (int i = 1; i < 10; i++) { - sprintf(tmpfilename, "COST%d_SH.PAK", i); - _res->loadPakFile(tmpfilename); - } - for (int i = 1; i < 6; i++) { - sprintf(tmpfilename, "HOFCH_%d.PAK", i); - _res->loadPakFile(tmpfilename); + + if (_menuChoice != 4) { + // load just the pak files needed for ingame + if (_flags.platform == Common::kPlatformPC && _flags.isTalkie) { + _res->loadFileList("FILEDATA.FDT"); + _res->loadPakFile("KYRA.DAT"); + } else if (_flags.platform == Common::kPlatformPC) { + // TODO + + } else if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) { + char tmpfilename[13]; + static const char * pakfiles [] = { "KYRA.DAT", "AUDIO.PAK", "CAULDRON.PAK", + "MISC_CPS.PAK", "MISC_EMC.PAK", "OTHER.PAK", "VOC.PAK", "WSCORE.PAK" }; + for (int i = 0; i < 8; i++) + _res->loadPakFile(pakfiles[i]); + for (int i = 1; i < 10; i++) { + sprintf(tmpfilename, "COST%d_SH.PAK", i); + _res->loadPakFile(tmpfilename); + } + for (int i = 1; i < 6; i++) { + sprintf(tmpfilename, "HOFCH_%d.PAK", i); + _res->loadPakFile(tmpfilename); + } } } + } + if (_menuChoice == 1) { startup(); runLoop(); cleanup(); } else if (_menuChoice == 3) { - // Load Game + // TODO: Load Game + + } else if (_menuChoice == 2) { + // TODO: Run Demo + } return 0; } void KyraEngine_v2::startup() { - snd_assignMusicData(kMusicIngame); + _sound->setSoundList(&_soundData[kMusicIngame]); // The track map is exactly the same // for FM-TOWNS and DOS _trackMap = _dosTrackMap; @@ -1567,19 +1589,6 @@ void KyraEngine_v2::snd_loadSoundFile(int id) { _sound->loadSoundFile(file); } -void KyraEngine_v2::snd_assignMusicData(kMusicDataID id) { - if (_flags.platform == Common::kPlatformPC) { - if (id == kMusicIntro) - _sound->setSoundFileList(_dosSoundFileListIntro, 1); - else if (id == kMusicFinale) - _sound->setSoundFileList(_dosSoundFileListFinale, 1); - else - _sound->setSoundFileList(_dosSoundFileList, _dosSoundFileListSize); - } else { - _sound->assignData(id); - } -} - void KyraEngine_v2::playVoice(int high, int low) { int vocFile = high * 10000 + low * 10; snd_playVoiceFile(vocFile); diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index fa11952087..9bc44d1cde 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -250,10 +250,18 @@ protected: static const char *_dosSoundFileListIntro[]; static const char *_dosSoundFileListFinale[]; - static const char *_dosSoundFileList[]; - static const int _dosSoundFileListSize; + static const char *_dosSoundFileList[]; + static const char *_fmtSoundFileListIntro[]; + static const char *_fmtSoundFileListFinale[]; + static const char *_fmtSoundFileList[]; + static const uint8 _cdaTrackTableIntro[]; + static const uint8 _cdaTrackTableIngame[]; + static const uint8 _cdaTrackTableFinale[]; + static const AudioDataStruct _soundData_PC[]; + static const AudioDataStruct _soundData_TOWNS[]; static const int8 _dosTrackMap[]; static const int _dosTrackMapSize; + const AudioDataStruct * _soundData; protected: // game initialization @@ -630,7 +638,6 @@ protected: virtual void snd_playVoiceFile(int id); void snd_loadSoundFile(int id); - void snd_assignMusicData(kMusicDataID id); void playVoice(int high, int low); @@ -843,6 +850,8 @@ protected: static const char *_sequenceSoundList_PC[]; static const int _sequenceSoundListSize_PC; + static const char *_sequenceSoundList_PCFLOPPY[]; + static const int _sequenceSoundListSize_PCFLOPPY; static const char *_sequenceSoundList_TOWNS[]; static const int _sequenceSoundListSize_TOWNS; static const char *_sequenceStrings_TOWNS_EN[]; diff --git a/engines/kyra/saveload_v1.cpp b/engines/kyra/saveload_v1.cpp index 21a4f724d1..549afc46e0 100644 --- a/engines/kyra/saveload_v1.cpp +++ b/engines/kyra/saveload_v1.cpp @@ -202,7 +202,7 @@ void KyraEngine_v1::loadGame(const char *fileName) { // In the first version when this entry was introduced, // it wasn't made sure that _curSfxFile was initialized // so if it's out of bounds we just set it to 0. - if (_curSfxFile >= _soundFilesTownsCount || _curSfxFile < 0) + if (_curSfxFile >= (int)_soundData_TOWNS->_fileListLen || _curSfxFile < 0) _curSfxFile = 0; if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) diff --git a/engines/kyra/sequences_v2.cpp b/engines/kyra/sequences_v2.cpp index b2f6685199..df6d55366d 100644 --- a/engines/kyra/sequences_v2.cpp +++ b/engines/kyra/sequences_v2.cpp @@ -46,15 +46,8 @@ void KyraEngine_v2::seq_playSequences(int startSeq, int endSeq) { assert(startSeq >= 0 && endSeq < kSequenceArraySize && startSeq <= endSeq); - if (_flags.isDemo) { - static const char *soundFileList[] = { - "K2_DEMO", - "LOLSYSEX" - }; - _sound->setSoundFileList(soundFileList, 2); - } else { - snd_assignMusicData((startSeq > kSequenceZanfaun) ? kMusicFinale : kMusicIntro); - } + // TODO: verfiy this is also correct for the demo + _sound->setSoundList(&_soundData[(startSeq > kSequenceZanfaun) ? kMusicFinale : kMusicIntro]); _sound->loadSoundFile(0); _screen->_charWidth = -2; @@ -1528,7 +1521,7 @@ void KyraEngine_v2::seq_finaleActorScreen() { _screen->loadBitmap("finale.cps", 3, 3, _screen->_currentPalette); _screen->setFont(Screen::FID_GOLDFONT_FNT); - snd_assignMusicData(kMusicIngame); + _sound->setSoundList(&_soundData[kMusicIngame]); _sound->loadSoundFile(3); _sound->playTrack(3); @@ -1537,7 +1530,7 @@ void KyraEngine_v2::seq_finaleActorScreen() { //XXX - snd_assignMusicData(kMusicFinale); + _sound->setSoundList(&_soundData[kMusicFinale]); _sound->loadSoundFile(0); } diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp index 71ae8a446d..5571e4631a 100644 --- a/engines/kyra/sound.cpp +++ b/engines/kyra/sound.cpp @@ -40,7 +40,7 @@ namespace Kyra { Sound::Sound(KyraEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer), _currentVocFile(0), _vocHandle(), _compressHandle(), - _musicEnabled(1), _sfxEnabled(true), _soundFileList(0), _soundFileListSize(0) { + _musicEnabled(1), _sfxEnabled(true), _soundDataList(0) { } Sound::~Sound() { @@ -259,7 +259,7 @@ void SoundMidiPC::metaEvent(byte type, byte *data, uint16 length) { void SoundMidiPC::loadSoundFile(uint file) { char filename[25]; - sprintf(filename, "%s.%s", soundFilename(file), _useC55 ? "C55" : "XMI"); + sprintf(filename, "%s.%s", fileListEntry(file), _useC55 ? "C55" : "XMI"); uint32 size; uint8 *data = (_vm->resource())->fileData(filename, &size); @@ -296,7 +296,7 @@ void SoundMidiPC::playMusic(uint8 *data, uint32 size) { void SoundMidiPC::loadSoundEffectFile(uint file) { char filename[25]; - sprintf(filename, "%s.%s", soundFilename(file), _useC55 ? "C55" : "XMI"); + sprintf(filename, "%s.%s", fileListEntry(file), _useC55 ? "C55" : "XMI"); uint32 size; uint8 *data = (_vm->resource())->fileData(filename, &size); diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index d221f37ece..fb0abc5678 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -105,23 +105,8 @@ public: * when playing a track and/or sound effect. * * @param list soundfile list - * @param s number of soundfiles */ - virtual void setSoundFileList(const char * const *list, uint s) { _soundFileList = list; _soundFileListSize = s; } - - /** - * Selects preset bundles of music files - * and cd audio tracks the output device will use - * when playing a track and/or sound effect. - * - * TODO: this is just needed for Kyrandia 2 FM-Towns version, - * and is similar to what setSoundFileList is used for, so we - * should think of a better solution than this. - * @see setSoundFileList - * - * @param id kMusicIntro, kMusicIngame or kMusicFinale - */ - virtual void assignData(kMusicDataID id) { _currentTheme = id; } + virtual void setSoundList(const AudioDataStruct *list) { _soundDataList = list; } /** * Load a specifc sound file for use of @@ -191,7 +176,10 @@ public: void voiceStop(); protected: - const char *soundFilename(uint file) { return (file < _soundFileListSize) ? _soundFileList[file] : ""; } + const char *fileListEntry(uint file) const { return (file < _soundDataList->_fileListLen) ? _soundDataList->_fileList[file] : ""; } + const void *cdaData() const { return _soundDataList->_cdaTracks; } + const uint32 cdaTrackNum() const { return _soundDataList->_cdaNumTracks; } + int _musicEnabled; bool _sfxEnabled; @@ -201,9 +189,7 @@ protected: Audio::Mixer *_mixer; private: - const char * const *_soundFileList; - uint _soundFileListSize; - + const AudioDataStruct *_soundDataList; Audio::AudioStream *_currentVocFile; Audio::SoundHandle _vocHandle; Common::File _compressHandle; @@ -444,16 +430,6 @@ private: //SoundTowns_v2_TwnDriver * _driver; uint8 * _twnTrackData; - - static const uint8 _cdaTrackTableK2Intro[]; - static const uint8 _cdaTrackTableK2Ingame[]; - static const uint8 _cdaTrackTableK2Finale[]; - - static const struct Kyra2AudioThemes { - const uint8 * cdaTable; - const uint8 cdaTableSize; - const char * twnFilename; - } _themes[]; }; class MixedSoundDriver : public Sound { @@ -467,7 +443,7 @@ public: void setVolume(int volume) { _music->setVolume(volume); _sfx->setVolume(volume); } int getVolume() { return _music->getVolume(); } - void setSoundFileList(const char * const*list, uint s) { _music->setSoundFileList(list, s); _sfx->setSoundFileList(list, s); } + void setSoundList(const AudioDataStruct * const list) { _music->setSoundList(list); _sfx->setSoundList(list); } void loadSoundFile(uint file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); } void playTrack(uint8 track) { _music->playTrack(track); } diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index 42b227b76a..2f90017ccb 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -2267,7 +2267,7 @@ void SoundAdlibPC::playTrack(uint8 track) { // sync for each loop. To avoid that, we declare that all four // of the song channels have to jump "in sync". - if (track == 4 && scumm_stricmp(soundFilename(_soundFileLoaded), "KYRA1B") == 0) + if (track == 4 && scumm_stricmp(fileListEntry(_soundFileLoaded), "KYRA1B") == 0) _driver->setSyncJumpMask(0x000F); else _driver->setSyncJumpMask(0); @@ -2351,7 +2351,7 @@ void SoundAdlibPC::loadSoundFile(uint file) { uint8 *file_data = 0; uint32 file_size = 0; char filename[25]; - sprintf(filename, "%s.ADL", soundFilename(file)); + sprintf(filename, "%s.ADL", fileListEntry(file)); file_data = _vm->resource()->fileData(filename, &file_size); if (!file_data) { diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index 6a5bb17c37..7315672130 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -1118,46 +1118,16 @@ void SoundTowns::process() { AudioCD.updateCD(); } -namespace { - -struct CDTrackTable { - uint32 fileOffset; - bool loop; - int track; -}; - -} // end of anonymous namespace - void SoundTowns::playTrack(uint8 track) { if (track < 2) return; track -= 2; - static const CDTrackTable tTable[] = { - { 0x04000, 1, 0 }, { 0x05480, 1, 6 }, { 0x05E70, 0, 1 }, - { 0x06D90, 1, 3 }, { 0x072C0, 0, -1 }, { 0x075F0, 1, -1 }, - { 0x07880, 1, -1 }, { 0x089C0, 0, -1 }, { 0x09080, 0, -1 }, - { 0x091D0, 1, 4 }, { 0x0A880, 1, 5 }, { 0x0AF50, 0, -1 }, - { 0x0B1A0, 1, -1 }, { 0x0B870, 0, -1 }, { 0x0BCF0, 1, -1 }, - { 0x0C5D0, 1, 7 }, { 0x0D3E0, 1, 8 }, { 0x0e7b0, 1, 2 }, - { 0x0edc0, 0, -1 }, { 0x0eef0, 1, 9 }, { 0x10540, 1, 10 }, - { 0x10d80, 0, -1 }, { 0x10E30, 0, -1 }, { 0x10FC0, 0, -1 }, - { 0x11310, 1, -1 }, { 0x11A20, 1, -1 }, { 0x12380, 0, -1 }, - { 0x12540, 1, -1 }, { 0x12730, 1, -1 }, { 0x12A90, 1, 11 }, - { 0x134D0, 0, -1 }, { 0x00000, 0, -1 }, { 0x13770, 0, -1 }, - { 0x00000, 0, -1 }, { 0x00000, 0, -1 }, { 0x00000, 0, -1 }, - { 0x00000, 0, -1 }, { 0x14710, 1, 12 }, { 0x15DF0, 1, 13 }, - { 0x16030, 1, 14 }, { 0x17030, 0, -1 }, { 0x17650, 0, -1 }, - { 0x134D0, 0, -1 }, { 0x178E0, 1, -1 }, { 0x18200, 0, -1 }, - { 0x18320, 0, -1 }, { 0x184A0, 0, -1 }, { 0x18BB0, 0, -1 }, - { 0x19040, 0, 19 }, { 0x19B50, 0, 20 }, { 0x17650, 0, -1 }, - { 0x1A730, 1, 21 }, { 0x00000, 0, -1 }, { 0x12380, 0, -1 }, - { 0x1B810, 0, -1 }, { 0x1BA50, 0, 15 }, { 0x1C190, 0, 16 }, - { 0x1CA50, 0, 17 }, { 0x1D100, 0, 18 } - }; + const int32 * const tTable = (const int32 * const) cdaData(); + int tTableIndex = 3 * track; - int trackNum = tTable[track].track; - bool loop = tTable[track].loop; + int trackNum = tTable[tTableIndex + 2]; + int32 loop = tTable[tTableIndex + 1]; if (track == _lastTrack && _musicEnabled) return; @@ -1168,7 +1138,7 @@ void SoundTowns::playTrack(uint8 track) { AudioCD.play(trackNum+1, loop ? -1 : 1, 0, 0); AudioCD.updateCD(); } else if (_musicEnabled) { - playEuphonyTrack(tTable[track].fileOffset, loop); + playEuphonyTrack((uint32) tTable[tTableIndex], loop); } _lastTrack = track; @@ -1195,7 +1165,7 @@ void SoundTowns::loadSoundFile(uint file) { return; _sfxFileIndex = file; delete [] _sfxFileData; - _sfxFileData = _vm->resource()->fileData(soundFilename(file), 0); + _sfxFileData = _vm->resource()->fileData(fileListEntry(file), 0); } void SoundTowns::playSoundEffect(uint8 track) { @@ -1230,22 +1200,13 @@ void SoundTowns::playSoundEffect(uint8 track) { if (offset == -1) return; - struct SfxHeader { - uint32 id; - uint32 inBufferSize; - uint32 unused1; - uint32 outBufferSize; - uint32 unused2; - uint32 unused3; - uint32 rate; - uint32 rootNoteOffs; - } *sfxHeader = (SfxHeader*)(fileBody + offset); - - uint32 sfxHeaderID = TO_LE_32(sfxHeader->id); - uint32 sfxHeaderInBufferSize = TO_LE_32(sfxHeader->inBufferSize); - uint32 sfxHeaderOutBufferSize = TO_LE_32(sfxHeader->outBufferSize); - uint32 sfxRootNoteOffs = TO_LE_32(sfxHeader->rootNoteOffs); - uint32 sfxRate = TO_LE_32(sfxHeader->rate); + uint32 * sfxHeader = (uint32*)(fileBody + offset); + + uint32 sfxHeaderID = READ_LE_UINT32(sfxHeader); + uint32 sfxHeaderInBufferSize = READ_LE_UINT32(&sfxHeader[1]); + uint32 sfxHeaderOutBufferSize = READ_LE_UINT32(&sfxHeader[3]); + uint32 sfxRootNoteOffs = READ_LE_UINT32(&sfxHeader[7]); + uint32 sfxRate = READ_LE_UINT32(&sfxHeader[6]); uint32 playbackBufferSize = (sfxHeaderID == 1) ? sfxHeaderInBufferSize : sfxHeaderOutBufferSize; @@ -1452,10 +1413,12 @@ void SoundTowns_v2::playTrack(uint8 track) { if (track == _lastTrack && _musicEnabled) return; + const uint8 * const cdaTracks = (const uint8 * const) cdaData(); + int trackNum = -1; - for (int i = 0; i < _themes[_currentTheme].cdaTableSize; i++) { - if (track == _themes[_currentTheme].cdaTable[i * 2]) { - trackNum = _themes[_currentTheme].cdaTable[i * 2 + 1] - 1; + for (uint32 i = 0; i < cdaTrackNum(); i++) { + if (track == cdaTracks[i * 2]) { + trackNum = cdaTracks[i * 2 + 1] - 1; break; } } @@ -1470,7 +1433,7 @@ void SoundTowns_v2::playTrack(uint8 track) { AudioCD.updateCD(); } else if (_musicEnabled) { char musicfile[13]; - sprintf(musicfile, "%s%d.twn", _themes[_currentTheme].twnFilename, track); + sprintf(musicfile, "%s%d.twn", fileListEntry(0), track); if (_twnTrackData) delete [] _twnTrackData; _twnTrackData = _vm->resource()->fileData(musicfile, 0); @@ -1547,33 +1510,6 @@ void SoundTowns_v2::beginFadeOut() { haltTrack(); } -const uint8 SoundTowns_v2::_cdaTrackTableK2Intro[] = { - 0x03, 0x01, 0x04, 0x02, 0x05, 0x03, 0x06, 0x04, 0x07, 0x05, 0x08, 0x06 -}; - -const uint8 SoundTowns_v2::_cdaTrackTableK2Ingame[] = { - 0x02, 0x07, 0x03, 0x08, 0x04, 0x09, 0x07, 0x0A, 0x0C, 0x0B, 0x0D, 0x0C, 0x0E, 0x0D, 0x0F, 0x0E, - 0x10, 0x0F, 0x12, 0x10, 0x13, 0x11, 0x15, 0x12, 0x17, 0x13, 0x18, 0x14, 0x19, 0x15, 0x1A, 0x16, - 0x1B, 0x17, 0x1C, 0x18, 0x1D, 0x19, 0x1E, 0x1A, 0x1F, 0x1B, 0x21, 0x1C, 0x22, 0x1D, 0x23, 0x1E, - 0x24, 0x1F, 0x25, 0x20, 0x26, 0x21, 0x27, 0x22, 0x28, 0x23, 0x29, 0x24, 0x2A, 0x25, 0x2B, 0x26, - 0x2C, 0x27, 0x2D, 0x28, 0x2E, 0x29, 0x2F, 0x2A, 0x30, 0x2B, 0x31, 0x2C, 0x32, 0x2D, 0x33, 0x2E, - 0x34, 0x2F, 0x35, 0x30, 0x36, 0x31, 0x37, 0x32, 0x38, 0x33, 0x39, 0x34, 0x3A, 0x35, 0x3B, 0x36, - 0x3C, 0x37, 0x3D, 0x38, 0x3E, 0x39, 0x3F, 0x3A, 0x40, 0x3B, 0x41, 0x3C, 0x42, 0x3D, 0x43, 0x3E, - 0x44, 0x3F, 0x45, 0x40, 0x46, 0x41, 0x47, 0x42, 0x48, 0x43, 0x49, 0x44, 0x4A, 0x45, 0x4B, 0x46, - 0x4C, 0x47, 0x4D, 0x48, 0x4E, 0x49, 0x4F, 0x4A, 0x50, 0x4B, 0x51, 0x4C, 0x52, 0x4D, 0x53, 0x4E, - 0x54, 0x4F, 0x55, 0x50, 0x56, 0x51, 0x57, 0x52 -}; - -const uint8 SoundTowns_v2::_cdaTrackTableK2Finale[] = { - 0x03, 0x53, 0x04, 0x54 -}; - -const SoundTowns_v2::Kyra2AudioThemes SoundTowns_v2::_themes[] = { - { _cdaTrackTableK2Intro, ARRAYSIZE(_cdaTrackTableK2Intro) >> 1, "intro" }, - { _cdaTrackTableK2Ingame, ARRAYSIZE(_cdaTrackTableK2Ingame) >> 1, "k2" }, - { _cdaTrackTableK2Finale, ARRAYSIZE(_cdaTrackTableK2Finale) >> 1, "finale" } -}; - } // end of namespace Kyra #undef EUPHONY_FADEOUT_TICKS diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 0df0f536a1..b64f2f2b8e 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -917,8 +917,6 @@ const char *KyraEngine_v1::_soundFiles[] = { "INTRO" }; -const int KyraEngine_v1::_soundFilesCount = ARRAYSIZE(KyraEngine_v1::_soundFiles); - const char *KyraEngine_v1::_soundFilesTowns[] = { "TW_INTRO.SFX", "TW_SCEN1.SFX", @@ -928,8 +926,38 @@ const char *KyraEngine_v1::_soundFilesTowns[] = { "TW_SCEN5.SFX" }; -const int KyraEngine_v1::_soundFilesTownsCount = ARRAYSIZE(KyraEngine_v1::_soundFilesTowns); +const int32 KyraEngine_v1::_cdaTrackTable[] = { + 0x04000, 1, 0, 0x05480, 1, 6, 0x05E70, 0, 1, + 0x06D90, 1, 3, 0x072C0, 0, -1, 0x075F0, 1, -1, + 0x07880, 1, -1, 0x089C0, 0, -1, 0x09080, 0, -1, + 0x091D0, 1, 4, 0x0A880, 1, 5, 0x0AF50, 0, -1, + 0x0B1A0, 1, -1, 0x0B870, 0, -1, 0x0BCF0, 1, -1, + 0x0C5D0, 1, 7, 0x0D3E0, 1, 8, 0x0e7b0, 1, 2, + 0x0edc0, 0, -1, 0x0eef0, 1, 9, 0x10540, 1, 10, + 0x10d80, 0, -1, 0x10E30, 0, -1, 0x10FC0, 0, -1, + 0x11310, 1, -1, 0x11A20, 1, -1, 0x12380, 0, -1, + 0x12540, 1, -1, 0x12730, 1, -1, 0x12A90, 1, 11, + 0x134D0, 0, -1, 0x00000, 0, -1, 0x13770, 0, -1, + 0x00000, 0, -1, 0x00000, 0, -1, 0x00000, 0, -1, + 0x00000, 0, -1, 0x14710, 1, 12, 0x15DF0, 1, 13, + 0x16030, 1, 14, 0x17030, 0, -1, 0x17650, 0, -1, + 0x134D0, 0, -1, 0x178E0, 1, -1, 0x18200, 0, -1, + 0x18320, 0, -1, 0x184A0, 0, -1, 0x18BB0, 0, -1, + 0x19040, 0, 19, 0x19B50, 0, 20, 0x17650, 0, -1, + 0x1A730, 1, 21, 0x00000, 0, -1, 0x12380, 0, -1, + 0x1B810, 0, -1, 0x1BA50, 0, 15, 0x1C190, 0, 16, + 0x1CA50, 0, 17, 0x1D100, 0, 18 +}; +const AudioDataStruct KyraEngine_v1::_soundData_PC[] = { + { _soundFiles, ARRAYSIZE(_soundFiles), 0, 0 }, + { 0, 0, 0, 0} +}; + +const AudioDataStruct KyraEngine_v1::_soundData_TOWNS[] = { + { _soundFilesTowns, ARRAYSIZE(_soundFilesTowns), _cdaTrackTable, ARRAYSIZE(_cdaTrackTable) }, + { 0, 0, 0, 0} +}; const int8 KyraEngine_v1::_charXPosTable[] = { 0, 4, 4, 4, 0, -4, -4, -4 }; @@ -1427,6 +1455,42 @@ const char *KyraEngine_v2::_sequenceSoundList_PC[] = { "theend" }; +const char *KyraEngine_v2::_sequenceSoundList_PCFLOPPY[] = { + "intro1", + "intro2", + "intro3", + "intro4", + "intro5", + "intro6", + "intro7", + "intro8", + "intro9", + "intro10", + "intro11", + "intro12", + "glow", + + "asong", + "crowcaw", + "eyerub2", + "pluck3", + "rodnreel", + "frog1", + "scavmov2", + "lambmom3", + "lambkid1", + "thunder2", + "thunder3", + "wind6", + "h2odrop2", + "gasleak", + "polgulp1", + "hndslap1", + "burp1", + "scream1", + "theend" +}; + const char *KyraEngine_v2::_sequenceSoundList_TOWNS[] = { "intro1.pcm", "intro2.pcm", @@ -1464,6 +1528,7 @@ const char *KyraEngine_v2::_sequenceSoundList_TOWNS[] = { }; const int KyraEngine_v2::_sequenceSoundListSize_PC = ARRAYSIZE(KyraEngine_v2::_sequenceSoundList_PC); +const int KyraEngine_v2::_sequenceSoundListSize_PCFLOPPY = ARRAYSIZE(KyraEngine_v2::_sequenceSoundList_PCFLOPPY); const int KyraEngine_v2::_sequenceSoundListSize_TOWNS = ARRAYSIZE(KyraEngine_v2::_sequenceSoundList_TOWNS); const uint8 KyraEngine_v2::_seqTextColorPresets[] = { 0x01, 0x01, 0x00, 0x3f, 0x3f, 0x3f }; @@ -1542,7 +1607,42 @@ const char *KyraEngine_v2::_dosSoundFileList[] = { "K2TEST15" }; -const int KyraEngine_v2::_dosSoundFileListSize = ARRAYSIZE(KyraEngine_v2::_dosSoundFileList); +const char *KyraEngine_v2::_fmtSoundFileListIntro[] = { "intro" }; +const char *KyraEngine_v2::_fmtSoundFileListFinale[] = { "finale" }; +const char *KyraEngine_v2::_fmtSoundFileList[] = { "k2" }; + +const uint8 KyraEngine_v2::_cdaTrackTableIntro[] = { + 0x03, 0x01, 0x04, 0x02, 0x05, 0x03, 0x06, 0x04, 0x07, 0x05, 0x08, 0x06 +}; + +const uint8 KyraEngine_v2::_cdaTrackTableIngame[] = { + 0x02, 0x07, 0x03, 0x08, 0x04, 0x09, 0x07, 0x0A, 0x0C, 0x0B, 0x0D, 0x0C, 0x0E, 0x0D, 0x0F, 0x0E, + 0x10, 0x0F, 0x12, 0x10, 0x13, 0x11, 0x15, 0x12, 0x17, 0x13, 0x18, 0x14, 0x19, 0x15, 0x1A, 0x16, + 0x1B, 0x17, 0x1C, 0x18, 0x1D, 0x19, 0x1E, 0x1A, 0x1F, 0x1B, 0x21, 0x1C, 0x22, 0x1D, 0x23, 0x1E, + 0x24, 0x1F, 0x25, 0x20, 0x26, 0x21, 0x27, 0x22, 0x28, 0x23, 0x29, 0x24, 0x2A, 0x25, 0x2B, 0x26, + 0x2C, 0x27, 0x2D, 0x28, 0x2E, 0x29, 0x2F, 0x2A, 0x30, 0x2B, 0x31, 0x2C, 0x32, 0x2D, 0x33, 0x2E, + 0x34, 0x2F, 0x35, 0x30, 0x36, 0x31, 0x37, 0x32, 0x38, 0x33, 0x39, 0x34, 0x3A, 0x35, 0x3B, 0x36, + 0x3C, 0x37, 0x3D, 0x38, 0x3E, 0x39, 0x3F, 0x3A, 0x40, 0x3B, 0x41, 0x3C, 0x42, 0x3D, 0x43, 0x3E, + 0x44, 0x3F, 0x45, 0x40, 0x46, 0x41, 0x47, 0x42, 0x48, 0x43, 0x49, 0x44, 0x4A, 0x45, 0x4B, 0x46, + 0x4C, 0x47, 0x4D, 0x48, 0x4E, 0x49, 0x4F, 0x4A, 0x50, 0x4B, 0x51, 0x4C, 0x52, 0x4D, 0x53, 0x4E, + 0x54, 0x4F, 0x55, 0x50, 0x56, 0x51, 0x57, 0x52 +}; + +const uint8 KyraEngine_v2::_cdaTrackTableFinale[] = { + 0x03, 0x53, 0x04, 0x54 +}; + +const AudioDataStruct KyraEngine_v2::_soundData_PC[] = { + { _dosSoundFileListIntro, ARRAYSIZE(_dosSoundFileListIntro), 0, 0 }, + { _dosSoundFileList, ARRAYSIZE(_dosSoundFileList), 0, 0}, + { _dosSoundFileListFinale, ARRAYSIZE(_dosSoundFileListFinale), 0, 0 } +}; + +const AudioDataStruct KyraEngine_v2::_soundData_TOWNS[] = { + { _fmtSoundFileListIntro, ARRAYSIZE(_fmtSoundFileListIntro), _cdaTrackTableIntro, ARRAYSIZE(_cdaTrackTableIntro) >> 1 }, + { _fmtSoundFileList, ARRAYSIZE(_fmtSoundFileList),_cdaTrackTableIngame, ARRAYSIZE(_cdaTrackTableIngame) >> 1 }, + { _fmtSoundFileListFinale, ARRAYSIZE(_fmtSoundFileListFinale),_cdaTrackTableFinale, ARRAYSIZE(_cdaTrackTableFinale) >> 1 } +}; const int KyraEngine_v2::_itemStringMapSize = ARRAYSIZE(KyraEngine_v2::_itemStringMap); -- cgit v1.2.3