diff options
author | Paul Gilbert | 2015-05-18 19:53:49 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-05-18 19:53:49 -0400 |
commit | 19d93325b1ccda2d02d708cbef20a49786f38d2b (patch) | |
tree | 45cef98afdff7e557d28fc6ede9811cdca0bf7c3 /engines | |
parent | b760c7d360d206d39391875e26271098c63acdd3 (diff) | |
download | scummvm-rg350-19d93325b1ccda2d02d708cbef20a49786f38d2b.tar.gz scummvm-rg350-19d93325b1ccda2d02d708cbef20a49786f38d2b.tar.bz2 scummvm-rg350-19d93325b1ccda2d02d708cbef20a49786f38d2b.zip |
SHERLOCK: Move the override filename fields into the Animation class
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/animation.cpp | 10 | ||||
-rw-r--r-- | engines/sherlock/animation.h | 3 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel.cpp | 32 | ||||
-rw-r--r-- | engines/sherlock/sherlock.h | 2 | ||||
-rw-r--r-- | engines/sherlock/sound.cpp | 6 | ||||
-rw-r--r-- | engines/sherlock/sound.h | 2 |
6 files changed, 29 insertions, 26 deletions
diff --git a/engines/sherlock/animation.cpp b/engines/sherlock/animation.cpp index 3c283636ca..8b891125cc 100644 --- a/engines/sherlock/animation.cpp +++ b/engines/sherlock/animation.cpp @@ -49,8 +49,8 @@ bool Animation::play(const Common::String &filename, int minDelay, int fade, // Load the animation Common::SeekableReadStream *stream; - if (!_vm->_titleOverride.empty()) - stream = _vm->_res->load(vdxName, _vm->_titleOverride); + if (!_gfxLibraryFilename.empty()) + stream = _vm->_res->load(vdxName, _gfxLibraryFilename); else if (_vm->_useEpilogue2) stream = _vm->_res->load(vdxName, "epilog2.lib"); else @@ -105,12 +105,12 @@ bool Animation::play(const Common::String &filename, int minDelay, int fade, if (frameNumber++ == *soundFrames) { ++soundNumber; ++soundFrames; - Common::String fname = _vm->_soundOverride.empty() ? + Common::String fname = _soundLibraryFilename.empty() ? Common::String::format("%s%01d", filename.c_str(), soundNumber) : Common::String::format("%s%02d", filename.c_str(), soundNumber); if (sound._voices) - sound.playSound(fname, WAIT_RETURN_IMMEDIATELY); + sound.playSound(fname, WAIT_RETURN_IMMEDIATELY, 100, _soundLibraryFilename.c_str()); } events.wait(speed * 3); @@ -184,7 +184,7 @@ void Animation::setTitleFrames(const int *frames, int count, int maxFrames) { const int *Animation::checkForSoundFrames(const Common::String &filename) { const int *frames = &NO_FRAMES; - if (_vm->_soundOverride.empty()) { + if (_soundLibraryFilename.empty()) { for (uint idx = 0; idx < _prologueNames.size(); ++idx) { if (filename.equalsIgnoreCase(_prologueNames[idx])) { frames = &_prologueFrames[idx][0]; diff --git a/engines/sherlock/animation.h b/engines/sherlock/animation.h index cd22a5c30a..2c47686efd 100644 --- a/engines/sherlock/animation.h +++ b/engines/sherlock/animation.h @@ -45,6 +45,9 @@ private: const int *checkForSoundFrames(const Common::String &filename); public: + Common::String _soundLibraryFilename; + Common::String _gfxLibraryFilename; +public: Animation(SherlockEngine *vm); void setPrologueNames(const char *const *names, int count); diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index 0d62336283..fa55ca6013 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -302,8 +302,8 @@ bool ScalpelEngine::showCityCutscene() { byte palette[PALETTE_SIZE]; _sound->playMusic("prolog1.mus"); - _titleOverride = "title.lib"; - _soundOverride = "title.snd"; + _animation->_gfxLibraryFilename = "title.lib"; + _animation->_soundLibraryFilename = "title.snd"; bool finished = _animation->play("26open1", 1, 255, true, 2); if (finished) { @@ -365,8 +365,8 @@ bool ScalpelEngine::showCityCutscene() { } } - _titleOverride = ""; - _soundOverride = ""; + _animation->_gfxLibraryFilename = ""; + _animation->_soundLibraryFilename = ""; return finished; } @@ -377,8 +377,8 @@ bool ScalpelEngine::showAlleyCutscene() { byte palette[PALETTE_SIZE]; _sound->playMusic("prolog2.mus"); - _titleOverride = "TITLE.LIB"; - _soundOverride = "TITLE.SND"; + _animation->_gfxLibraryFilename = "TITLE.LIB"; + _animation->_soundLibraryFilename = "TITLE.SND"; bool finished = _animation->play("27PRO1", 1, 3, true, 2); if (finished) @@ -405,8 +405,8 @@ bool ScalpelEngine::showAlleyCutscene() { finished = _events->delay(1000); } - _titleOverride = ""; - _soundOverride = ""; + _animation->_gfxLibraryFilename = ""; + _animation->_soundLibraryFilename = ""; return finished; } @@ -414,8 +414,8 @@ bool ScalpelEngine::showAlleyCutscene() { * Show the Baker Street outside cutscene */ bool ScalpelEngine::showStreetCutscene() { - _titleOverride = "TITLE.LIB"; - _soundOverride = "TITLE.SND"; + _animation->_gfxLibraryFilename = "TITLE.LIB"; + _animation->_soundLibraryFilename = "TITLE.SND"; _sound->playMusic("PROLOG3.MUS"); @@ -424,8 +424,8 @@ bool ScalpelEngine::showStreetCutscene() { if (finished) finished = _animation->play("14NOTE", 1, 0, false, 2); - _titleOverride = ""; - _soundOverride = ""; + _animation->_gfxLibraryFilename = ""; + _animation->_soundLibraryFilename = ""; return finished; } @@ -469,8 +469,8 @@ bool ScalpelEngine::scrollCredits() { */ bool ScalpelEngine::showOfficeCutscene() { _sound->playMusic("PROLOG4.MUS"); - _titleOverride = "TITLE2.LIB"; - _soundOverride = "TITLE.SND"; + _animation->_gfxLibraryFilename = "TITLE2.LIB"; + _animation->_soundLibraryFilename = "TITLE.SND"; bool finished = _animation->play("COFF1", 1, 3, true, 3); if (finished) @@ -505,8 +505,8 @@ bool ScalpelEngine::showOfficeCutscene() { if (finished) _screen->fadeToBlack(3); - _titleOverride = ""; - _soundOverride = ""; + _animation->_gfxLibraryFilename = ""; + _animation->_soundLibraryFilename = ""; return finished; } diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h index 571bd4dc61..830a255f5f 100644 --- a/engines/sherlock/sherlock.h +++ b/engines/sherlock/sherlock.h @@ -99,8 +99,6 @@ public: UserInterface *_ui; Common::RandomSource _randomSource; Common::Array<bool> _flags; - Common::String _soundOverride; - Common::String _titleOverride; bool _useEpilogue2; int _loadGameSlot; bool _canLoadSave; diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp index bcc6c96e4f..9693ccbd94 100644 --- a/engines/sherlock/sound.cpp +++ b/engines/sherlock/sound.cpp @@ -110,14 +110,16 @@ byte Sound::decodeSample(byte sample, byte &reference, int16 &scale) { return reference; } -bool Sound::playSound(const Common::String &name, WaitType waitType, int priority) { +bool Sound::playSound(const Common::String &name, WaitType waitType, int priority, const char *libraryFilename) { + Resources &res = *_vm->_res; stopSound(); Common::String filename = name; if (!filename.contains('.')) filename += ".SND"; - Common::SeekableReadStream *stream = _vm->_res->load(filename); + Common::String libFilename(libraryFilename); + Common::SeekableReadStream *stream = libFilename.empty() ? res.load(filename) : res.load(filename, libFilename); if (!stream) error("Unable to find sound file '%s'", filename.c_str()); diff --git a/engines/sherlock/sound.h b/engines/sherlock/sound.h index 62d4aa24c4..bff50d7a07 100644 --- a/engines/sherlock/sound.h +++ b/engines/sherlock/sound.h @@ -63,7 +63,7 @@ public: void syncSoundSettings(); void loadSound(const Common::String &name, int priority); - bool playSound(const Common::String &name, WaitType waitType, int priority = 100); + bool playSound(const Common::String &name, WaitType waitType, int priority = 100, const char *libraryFilename = nullptr); void playLoadedSound(int bufNum, WaitType waitType); void freeLoadedSounds(); void stopSound(); |