diff options
author | Dmitry Iskrich | 2016-06-28 18:03:21 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 0b9e3607a01f4c3b2820b2017240adf073669820 (patch) | |
tree | d09e3dd193313d75c812a77962ffa87c6d60080c | |
parent | aac6c9695a5007b5027df8686b257d9a923a2099 (diff) | |
download | scummvm-rg350-0b9e3607a01f4c3b2820b2017240adf073669820.tar.gz scummvm-rg350-0b9e3607a01f4c3b2820b2017240adf073669820.tar.bz2 scummvm-rg350-0b9e3607a01f4c3b2820b2017240adf073669820.zip |
DIRECTOR: Using shared casts for rendering
-rw-r--r-- | engines/director/director.h | 3 | ||||
-rw-r--r-- | engines/director/score.cpp | 24 |
2 files changed, 23 insertions, 4 deletions
diff --git a/engines/director/director.h b/engines/director/director.h index 566bb2ee9a..0e76cd9ea8 100644 --- a/engines/director/director.h +++ b/engines/director/director.h @@ -67,6 +67,9 @@ public: const byte *getPalette() const { return _currentPalette; } uint16 getPaletteColorCount() const { return _currentPaletteLength; } void loadSharedCastsFrom(Common::String filename); + Common::HashMap<int, Common::SeekableReadStream *> getSharedDIB() const { return _sharedDIB; } + Common::HashMap<int, Common::SeekableReadStream *> getSharedSTXT() const { return _sharedSTXT; } + Common::HashMap<int, Cast *> getSharedCasts() const { return _sharedCasts; } Common::HashMap<Common::String, Score *> *_movies; Score *_currentScore; diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 285577d478..0a4aed49b6 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -1118,7 +1118,18 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) { if ((_sprites[i]->_trails == 0 && renderTrail) || (_sprites[i]->_trails == 1 && !renderTrail)) continue; - Cast *cast = _vm->_currentScore->_casts[_sprites[i]->_castId]; + Cast *cast; + if (!_vm->_currentScore->_casts.contains(_sprites[i]->_castId)) { + if (!_vm->getSharedCasts().contains(_sprites[i]->_castId)) { + warning("Cast id %d not found", _sprites[i]->_castId); + continue; + } else { + cast = _vm->getSharedCasts().getVal(_sprites[i]->_castId); + } + } else { + cast = _vm->_currentScore->_casts[_sprites[i]->_castId]; + } + if (cast->type == kCastText) { renderText(surface, i); continue; @@ -1128,11 +1139,16 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) { uint32 imgId = 1024 + _sprites[i]->_castId; if (!_vm->_currentScore->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) { - continue; + if (!_vm->getSharedDIB().contains(imgId)) { + warning("DIB id %d not found", imgId); + continue; + } else { + img.loadStream(*_vm->getSharedDIB().getVal(imgId)); + } + } else { + img.loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId)); } - img.loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId)); - uint32 regX = static_cast<BitmapCast *>(_sprites[i]->_cast)->regX; uint32 regY = static_cast<BitmapCast *>(_sprites[i]->_cast)->regY; uint32 rectLeft = static_cast<BitmapCast *>(_sprites[i]->_cast)->initialRect.left; |