Skip to content

Commit

Permalink
DIRECTOR: Fix rendering resource, loading shared BMP
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Iskrich authored and sev- committed Aug 3, 2016
1 parent d70a76f commit 0f58203
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
14 changes: 14 additions & 0 deletions engines/director/director.cpp
Expand Up @@ -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"));
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions engines/director/director.h
Expand Up @@ -69,6 +69,7 @@ class DirectorEngine : public ::Engine {
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; }

Expand Down Expand Up @@ -98,6 +99,7 @@ class DirectorEngine : public ::Engine {
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;
Expand Down
10 changes: 9 additions & 1 deletion engines/director/score.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0f58203

Please sign in to comment.