aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/director/director.h3
-rw-r--r--engines/director/score.cpp24
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;