diff options
author | Colin Snover | 2017-01-02 16:59:06 -0600 |
---|---|---|
committer | Colin Snover | 2017-01-02 17:02:31 -0600 |
commit | a91b432cdbd97b1fde73dae2b67bd2b6b4ef6257 (patch) | |
tree | d9f0ca2ea6b7c2c52250fdfb9e53c100f940d4f1 /engines/sci/graphics | |
parent | 3be2025a5e5b029fc5e4a26a221ac8383efb587f (diff) | |
download | scummvm-rg350-a91b432cdbd97b1fde73dae2b67bd2b6b4ef6257.tar.gz scummvm-rg350-a91b432cdbd97b1fde73dae2b67bd2b6b4ef6257.tar.bz2 scummvm-rg350-a91b432cdbd97b1fde73dae2b67bd2b6b4ef6257.zip |
SCI32: Load VMDs from resource bundles
GK2 includes some VMDs in the RESSCI.00n volume bundles for the
chase scene at the end of Chapter 6.
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r-- | engines/sci/graphics/video32.cpp | 29 | ||||
-rw-r--r-- | engines/sci/graphics/video32.h | 7 |
2 files changed, 32 insertions, 4 deletions
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp index c3aafb62bf..4af1e76ed9 100644 --- a/engines/sci/graphics/video32.cpp +++ b/engines/sci/graphics/video32.cpp @@ -39,6 +39,7 @@ #include "sci/graphics/palette32.h" // for GfxPalette32 #include "sci/graphics/plane32.h" // for Plane, PlanePictureCodes::kP... #include "sci/graphics/screen_item32.h" // for ScaleInfo, ScreenItem, Scale... +#include "sci/resource.h" // for ResourceManager, ResourceId,... #include "sci/sci.h" // for SciEngine, g_sci, getSciVersion #include "sci/sound/audio32.h" // for Audio32 #include "sci/video/seq_decoder.h" // for SEQDecoder @@ -492,6 +493,7 @@ VMDPlayer::VMDPlayer(SegManager *segMan, EventManager *eventMan) : _isOpen(false), _isInitialized(false), + _bundledVmd(nullptr), _yieldFrame(0), _yieldInterval(0), _lastYieldedFrameNo(0), @@ -536,15 +538,29 @@ VMDPlayer::IOStatus VMDPlayer::open(const Common::String &fileName, const OpenFl g_sci->_audio32->stop(kAllChannels); } - if (_decoder->loadFile(fileName)) { + Resource *bundledVmd = g_sci->getResMan()->findResource(ResourceId(kResourceTypeVMD, fileName.asUint64()), true); + + if (bundledVmd != nullptr) { + Common::SeekableReadStream *stream = bundledVmd->makeStream(); + if (_decoder->loadStream(stream)) { + _bundledVmd = bundledVmd; + _isOpen = true; + } else { + delete stream; + g_sci->getResMan()->unlockResource(bundledVmd); + } + } else if (_decoder->loadFile(fileName)) { + _isOpen = true; + } + + if (_isOpen) { if (flags & kOpenFlagMute) { _decoder->setVolume(0); } - _isOpen = true; return kIOSuccess; - } else { - return kIOError; } + + return kIOError; } void VMDPlayer::init(const int16 x, const int16 y, const PlayFlags flags, const int16 boostPercent, const int16 boostStartColor, const int16 boostEndColor) { @@ -571,6 +587,11 @@ VMDPlayer::IOStatus VMDPlayer::close() { _isInitialized = false; _ignorePalettes = false; + if (_bundledVmd) { + g_sci->getResMan()->unlockResource(_bundledVmd); + _bundledVmd = nullptr; + } + _segMan->freeBitmap(_screenItem->_celInfo.bitmap); if (!_planeIsOwned && _screenItem != nullptr) { diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h index 69acdf2fce..5ed8fd954a 100644 --- a/engines/sci/graphics/video32.h +++ b/engines/sci/graphics/video32.h @@ -321,6 +321,13 @@ private: bool _isInitialized; /** + * The Resource object for VMDs that are read out + * of a resource bundle instead of being streamed + * from the filesystem. + */ + Resource *_bundledVmd; + + /** * For VMDs played with the `kEventFlagToFrame` flag, * the target frame for yielding back to the SCI VM. */ |