diff options
author | Torbjörn Andersson | 2005-12-21 10:57:48 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2005-12-21 10:57:48 +0000 |
commit | ca03d5a3e4804aa011911349ceb68737092824e5 (patch) | |
tree | da03be212691284d48eb8338203545793749ab34 /sword2 | |
parent | 2facc1411b295b70d65f37bfe23f29d33a2dcff0 (diff) | |
download | scummvm-rg350-ca03d5a3e4804aa011911349ceb68737092824e5.tar.gz scummvm-rg350-ca03d5a3e4804aa011911349ceb68737092824e5.tar.bz2 scummvm-rg350-ca03d5a3e4804aa011911349ceb68737092824e5.zip |
Added debugging messages to track which CD (1 or 2) the game thinks it's
supposed to be reading data from. Maybe this will help track down the
mysterious missing speech problem reported on the forum.
svn-id: r19823
Diffstat (limited to 'sword2')
-rw-r--r-- | sword2/driver/d_sound.cpp | 10 | ||||
-rw-r--r-- | sword2/maketext.cpp | 2 | ||||
-rw-r--r-- | sword2/resman.cpp | 17 | ||||
-rw-r--r-- | sword2/resman.h | 15 | ||||
-rw-r--r-- | sword2/sound.h | 2 |
5 files changed, 27 insertions, 19 deletions
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 22e3bf1453..1dfcd99688 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -43,6 +43,8 @@ namespace Sword2 { static AudioStream *makeCLUStream(Common::File *fp, int size); static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd, uint32 id, uint32 *numSamples) { + debug(3, "Playing %s from CD %d", base, cd); + if (!fh->file.isOpen()) { struct { const char *ext; @@ -453,7 +455,7 @@ int Sound::readBuffer(int16 *buffer, const int numSamples) { for (i = 0; i < MAXMUS; i++) { if (_music[i]) { - if (_music[i]->whichCd() == 1) + if (_music[i]->getCD() == 1) inUse[0] = true; else inUse[1] = true; @@ -532,7 +534,7 @@ int32 Sound::streamCompMusic(uint32 musicId, bool loop) { //Common::StackLock lock(_mutex); _mutex.lock(); - int cd = _vm->_resman->whichCd(); + int cd = _vm->_resman->getCD(); if (loop) _loopingMusicId = musicId; @@ -708,7 +710,7 @@ int32 Sound::amISpeaking() { */ uint32 Sound::preFetchCompSpeech(uint32 speechId, uint16 **buf) { - int cd = _vm->_resman->whichCd(); + int cd = _vm->_resman->getCD(); uint32 numSamples; SoundFileHandle *fh = (cd == 1) ? &_speechFile[0] : &_speechFile[1]; @@ -754,7 +756,7 @@ int32 Sound::playCompSpeech(uint32 speechId, uint8 vol, int8 pan) { if (getSpeechStatus() == RDERR_SPEECHPLAYING) return RDERR_SPEECHPLAYING; - int cd = _vm->_resman->whichCd(); + int cd = _vm->_resman->getCD(); SoundFileHandle *fh = (cd == 1) ? &_speechFile[0] : &_speechFile[1]; AudioStream *input = getAudioStream(fh, "speech", cd, speechId, NULL); diff --git a/sword2/maketext.cpp b/sword2/maketext.cpp index c9c4090a83..9df4605484 100644 --- a/sword2/maketext.cpp +++ b/sword2/maketext.cpp @@ -73,7 +73,7 @@ namespace Sword2 { */ byte *FontRenderer::makeTextSprite(byte *sentence, uint16 maxWidth, uint8 pen, uint32 fontRes, uint8 border) { - debug(3, "makeTextSprite(\"%s\", maxWidth=%u)", sentence, maxWidth); + debug(5, "makeTextSprite(\"%s\", maxWidth=%u)", sentence, maxWidth); _borderPen = border; diff --git a/sword2/resman.cpp b/sword2/resman.cpp index fc2984a722..7d97c3d880 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -53,7 +53,7 @@ ResourceManager::ResourceManager(Sword2Engine *vm) { // Until proven differently, assume we're on CD 1. This is so the start // dialog will be able to play any music at all. - _curCd = 1; + setCD(CD1); // We read in the resource info which tells us the names of the // resource cluster files ultimately, although there might be groups @@ -217,10 +217,9 @@ byte *ResourceManager::openResource(uint32 res, bool dump) { // If we're loading a cluster that's only available from one // of the CDs, remember which one so that we can play the - // correct music. + // correct speech and music. - if ((_resFiles[cluFileNum].cd == CD1) || (_resFiles[cluFileNum].cd == CD2)) - _curCd = _resFiles[cluFileNum].cd; + setCD(_resFiles[cluFileNum].cd); // Actually, as long as the file can be found we don't really // care which CD it's on. But if we can't find it, keep asking @@ -247,6 +246,8 @@ byte *ResourceManager::openResource(uint32 res, bool dump) { file->read(_resList[res].ptr, len); + debug(3, "Loaded resource '%s' from CD %d", fetchName(_resList[res].ptr), getCD()); + if (dump) { char buf[256]; const char *tag; @@ -390,7 +391,7 @@ Common::File *ResourceManager::openCluFile(uint16 fileNum) { if ((_vm->_features & GF_DEMO) || (_resFiles[fileNum].cd & LOCAL_PERM)) error("Could not find '%s'", _resFiles[fileNum].fileName); - getCd(_resFiles[fileNum].cd & 3); + askForCD(_resFiles[fileNum].cd & 3); } return file; } @@ -579,11 +580,7 @@ void ResourceManager::killAllObjects(bool wantInfo) { Debug_Printf("Expelled %d resources\n", nuked); } -int ResourceManager::whichCd() { - return _curCd; -} - -void ResourceManager::getCd(int cd) { +void ResourceManager::askForCD(int cd) { byte *textRes; // Stop any music from playing - so the system no longer needs the diff --git a/sword2/resman.h b/sword2/resman.h index 7fabf907c7..42ebda120d 100644 --- a/sword2/resman.h +++ b/sword2/resman.h @@ -64,7 +64,7 @@ private: Sword2Engine *_vm; - int _curCd; + int _curCD; uint32 _totalResFiles; uint32 _totalClusters; @@ -116,9 +116,18 @@ public: } // Prompts the user for the specified CD. - void getCd(int cd); + void askForCD(int cd); - int whichCd(); + void setCD(int cd) { + if (cd == CD1) + _curCD = 1; + else if (cd == CD2) + _curCD = 2; + } + + int getCD() { + return _curCD; + } void remove(int res); void removeAll(); diff --git a/sword2/sound.h b/sword2/sound.h index 60e31946bd..b954ab1815 100644 --- a/sword2/sound.h +++ b/sword2/sound.h @@ -152,7 +152,7 @@ public: bool isStereo() const { return _decoder->isStereo(); } int getRate() const { return _decoder->getRate(); } - int whichCd() { return _cd; } + int getCD() { return _cd; } void fadeUp(); void fadeDown(); |