[Scummvm-git-logs] scummvm master -> 435c996a25b9186d04f78f9423e96b893fbbaf3e
sev-
noreply at scummvm.org
Fri Feb 24 14:54:49 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
435c996a25 DIRECTOR: Support external bitmaps
Commit: 435c996a25b9186d04f78f9423e96b893fbbaf3e
https://github.com/scummvm/scummvm/commit/435c996a25b9186d04f78f9423e96b893fbbaf3e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-24T15:54:36+01:00
Commit Message:
DIRECTOR: Support external bitmaps
Patch courtesy of eientei
Changed paths:
engines/director/cast.cpp
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index b305fef730a..f74d6e6ace2 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -27,6 +27,7 @@
#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/macwindowmanager.h"
#include "image/bmp.h"
+#include "image/pict.h"
#include "director/director.h"
#include "director/cast.h"
@@ -669,6 +670,29 @@ void Cast::loadBitmapData(int key, BitmapCastMember *bitmapCast) {
else if (sharedCast && sharedCast->getArchive()->hasResource(tag, imgId))
pic = sharedCast->getArchive()->getResource(tag, imgId);
}
+
+ if (pic == nullptr || pic->size() == 0) {
+ // image file is linked, load from the filesystem
+ Common::File file;
+
+ Common::String filename = _castsInfo[key]->fileName;
+ Common::String directory = _castsInfo[key]->directory;
+
+ Common::String imageFilename = directory + g_director->_dirSeparator + filename;
+ Common::Path path = Common::Path(pathMakeRelative(imageFilename), g_director->_dirSeparator);
+
+ file.open(path);
+ Image::PICTDecoder *pict = new Image::PICTDecoder();
+ pict->loadStream(file);
+ file.close();
+ bitmapCast->_img = pict;
+
+ const Graphics::Surface *surf = pict->getSurface();
+ bitmapCast->_size = surf->pitch * surf->h + pict->getPaletteColorCount() * 3;
+
+ delete pic;
+ return;
+ }
} else {
if (_loadedCast->contains(imgId)) {
bitmapCast->_tag = tag = ((BitmapCastMember *)_loadedCast->getVal(imgId))->_tag;
More information about the Scummvm-git-logs
mailing list