aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorDmitry Iskrich2016-06-30 20:04:05 +0300
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commit0f58203c021512396d8e3a32ada41f49eb0e1880 (patch)
tree37b1630f696d39d58d10b50bf855ada9efeeb206 /engines
parentd70a76f1d6e5fdb5e7dd0a3c45f7c6acf4f8a94f (diff)
downloadscummvm-rg350-0f58203c021512396d8e3a32ada41f49eb0e1880.tar.gz
scummvm-rg350-0f58203c021512396d8e3a32ada41f49eb0e1880.tar.bz2
scummvm-rg350-0f58203c021512396d8e3a32ada41f49eb0e1880.zip
DIRECTOR: Fix rendering resource, loading shared BMP
Diffstat (limited to 'engines')
-rw-r--r--engines/director/director.cpp14
-rw-r--r--engines/director/director.h2
-rw-r--r--engines/director/score.cpp10
3 files changed, 25 insertions, 1 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 2081ebdc89..c7ae940873 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -58,6 +58,11 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
_currentPalette = 0;
//FIXME
_sharedMMM = "SHARDCST.MMM";
+ _sharedCasts = new Common::HashMap<int, Cast *>();
+ _sharedDIB = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
+ _sharedBMP = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
+ _sharedSTXT = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
+ _sharedSound = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
_movies = new Common::HashMap<Common::String, Score *>();
const Common::FSNode gameDataDir(ConfMan.get("path"));
@@ -423,6 +428,15 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
}
}
+ Common::Array<uint16> bmp = shardcst->getResourceIDList(MKTAG('B','I','T','D'));
+
+ if (bmp.size() != 0) {
+ Common::Array<uint16>::iterator iterator;
+ for (iterator = bmp.begin(); iterator != bmp.end(); ++iterator) {
+ _sharedBMP->setVal(*iterator, shardcst->getResource(MKTAG('B','I','T','D'), *iterator));
+ }
+ }
+
Common::Array<uint16> sound = shardcst->getResourceIDList(MKTAG('S','N','D',' '));
if (stxt.size() != 0) {
diff --git a/engines/director/director.h b/engines/director/director.h
index a3e0ad0dbb..2d0b734002 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -69,6 +69,7 @@ public:
uint16 getPaletteColorCount() const { return _currentPaletteLength; }
void loadSharedCastsFrom(Common::String filename);
Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *getSharedDIB() const { return _sharedDIB; }
+ Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *getSharedBMP() const { return _sharedBMP; }
Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *getSharedSTXT() const { return _sharedSTXT; }
Common::HashMap<int, Cast *> *getSharedCasts() const { return _sharedCasts; }
@@ -98,6 +99,7 @@ private:
Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedDIB;
Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedSTXT;
Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedSound;
+ Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedBMP;
Archive *_mainArchive;
Common::MacResManager *_macBinary;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index c51c6cc159..6b9cdb293a 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1164,6 +1164,10 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
Image::ImageDecoder *img = getImageFrom(_sprites[i]->_castId);
+ if (!img) {
+ continue;
+ }
+
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;
@@ -1224,7 +1228,11 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
return img;
}
- //TODO Shared bitmaps
+ if (_vm->getSharedBMP()->contains(imgId)) {
+ img = new Image::BitmapDecoder();
+ img->loadStream(*_vm->getSharedBMP()->getVal(imgId));
+ return img;
+ }
warning("Image %d not found", spriteId);
return img;