diff options
author | Paweł Kołodziejski | 2008-01-15 12:51:26 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2008-01-15 12:51:26 +0000 |
commit | 4b9d2e937050dc0af3907e28af2fcbb40ecde9aa (patch) | |
tree | 1adf58bdb9cd10695928b2ce6b44de3fe845a098 /engines/scumm | |
parent | 86714835f1603ade5d54af0e503e0b70bf2aee33 (diff) | |
download | scummvm-rg350-4b9d2e937050dc0af3907e28af2fcbb40ecde9aa.tar.gz scummvm-rg350-4b9d2e937050dc0af3907e28af2fcbb40ecde9aa.tar.bz2 scummvm-rg350-4b9d2e937050dc0af3907e28af2fcbb40ecde9aa.zip |
implement loading markers "exit". dumped version 3 for compressed bun files, compress tools are not ready
svn-id: r30494
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_sndmgr.cpp | 38 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_sndmgr.h | 11 |
2 files changed, 43 insertions, 6 deletions
diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index a92f1e0cb2..c01c948225 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -58,19 +58,23 @@ ImuseDigiSndMgr::~ImuseDigiSndMgr() { delete _cacheBundleDir; } -void ImuseDigiSndMgr::countElements(byte *ptr, int &numRegions, int &numJumps, int &numSyncs) { +void ImuseDigiSndMgr::countElements(byte *ptr, int &numRegions, int &numJumps, int &numSyncs, int &numMarkers) { uint32 tag; int32 size = 0; do { tag = READ_BE_UINT32(ptr); ptr += 4; switch (tag) { - case MKID_BE('TEXT'): case MKID_BE('STOP'): case MKID_BE('FRMT'): case MKID_BE('DATA'): size = READ_BE_UINT32(ptr); ptr += size + 4; break; + case MKID_BE('TEXT'): + if (!scumm_stricmp((const char *)(ptr + 8), "exit")) + numMarkers++; + size = READ_BE_UINT32(ptr); ptr += size + 4; + break; case MKID_BE('REGN'): numRegions++; size = READ_BE_UINT32(ptr); ptr += size + 4; @@ -96,8 +100,8 @@ void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::File *file, SoundDesc *sound, uint32 tag = file->readUint32BE(); assert(tag == MKID_BE('RMAP')); int32 version = file->readUint32BE(); - if (version != 2) { - error("ImuseDigiSndMgr::prepareSoundFromRMAP: Wrong version number, expected 2, but it's: %d.", version); + if (version != 3) { + error("ImuseDigiSndMgr::prepareSoundFromRMAP: Wrong version number, expected 3, but it's: %d.", version); } sound->bits = file->readUint32BE(); sound->freq = file->readUint32BE(); @@ -105,12 +109,16 @@ void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::File *file, SoundDesc *sound, sound->numRegions = file->readUint32BE(); sound->numJumps = file->readUint32BE(); sound->numSyncs = file->readUint32BE(); + sound->numMarkers = file->readUint32BE(); sound->region = new Region[sound->numRegions]; assert(sound->region); sound->jump = new Jump[sound->numJumps]; assert(sound->jump); sound->sync = new Sync[sound->numSyncs]; assert(sound->sync); + sound->marker = new Marker[sound->numMarkers]; + assert(sound->marker); + for (l = 0; l < sound->numRegions; l++) { sound->region[l].offset = file->readUint32BE(); sound->region[l].length = file->readUint32BE(); @@ -126,6 +134,12 @@ void ImuseDigiSndMgr::prepareSoundFromRMAP(Common::File *file, SoundDesc *sound, sound->sync[l].ptr = (byte *)malloc(sound->sync[l].size); file->read(sound->sync[l].ptr, sound->sync[l].size); } + for (l = 0; l < sound->numMarkers; l++) { + sound->marker[l].pos = file->readUint32BE(); + sound->marker[l].length = file->readUint32BE(); + sound->marker[l].ptr = new char[sound->marker[l].length]; + file->read(sound->marker[l].ptr, sound->marker[l].length); + } } void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { @@ -207,17 +221,21 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { int curIndexRegion = 0; int curIndexJump = 0; int curIndexSync = 0; + int curIndexMarker = 0; sound->numRegions = 0; sound->numJumps = 0; sound->numSyncs = 0; - countElements(ptr, sound->numRegions, sound->numJumps, sound->numSyncs); + sound->numMarkers = 0; + countElements(ptr, sound->numRegions, sound->numJumps, sound->numSyncs, sound->numMarkers); sound->region = new Region[sound->numRegions]; assert(sound->region); sound->jump = new Jump[sound->numJumps]; assert(sound->jump); sound->sync = new Sync[sound->numSyncs]; assert(sound->sync); + sound->marker = new Marker[sound->numMarkers]; + assert(sound->marker); do { tag = READ_BE_UINT32(ptr); ptr += 4; @@ -229,6 +247,15 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, SoundDesc *sound) { sound->channels = READ_BE_UINT32(ptr); ptr += 4; break; case MKID_BE('TEXT'): + if (!scumm_stricmp((const char *)(ptr + 8), "exit")) { + sound->marker[curIndexRegion].pos = READ_BE_UINT32(ptr + 4); + sound->marker[curIndexRegion].length = strlen((const char *)(ptr + 8)) + 1; + sound->marker[curIndexRegion].ptr = new char[sound->marker[curIndexRegion].length]; + strcpy(sound->marker[curIndexRegion].ptr, (const char *)(ptr + 8)); + curIndexMarker++; + } + size = READ_BE_UINT32(ptr); ptr += size + 4; + break; case MKID_BE('STOP'): size = READ_BE_UINT32(ptr); ptr += size + 4; break; @@ -451,6 +478,7 @@ void ImuseDigiSndMgr::closeSound(SoundDesc *soundDesc) { delete[] soundDesc->region; delete[] soundDesc->jump; delete[] soundDesc->sync; + delete[] soundDesc->marker; memset(soundDesc, 0, sizeof(SoundDesc)); } diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.h b/engines/scumm/imuse_digi/dimuse_sndmgr.h index dec0865689..87d59095c2 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.h +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.h @@ -65,6 +65,12 @@ private: byte *ptr; // pointer to sync }; + struct Marker { + int32 pos; // position Markaer in sound data + int32 length; // length of marker string + char *ptr; // pointer to string + }; + public: struct SoundDesc { @@ -81,6 +87,9 @@ public: int numSyncs; // number of Syncs Sync *sync; + int numMarkers; // number of Markers + Marker *marker; + bool endFlag; bool inUse; byte *allData; @@ -113,7 +122,7 @@ private: bool openMusicBundle(SoundDesc *sound, int &disk); bool openVoiceBundle(SoundDesc *sound, int &disk); - void countElements(byte *ptr, int &numRegions, int &numJumps, int &numSyncs); + void countElements(byte *ptr, int &numRegions, int &numJumps, int &numSyncs, int &numMarkers); public: |