[Scummvm-git-logs] scummvm master -> 0f4d18958eb6e02413461cd1f5479859ba6f1b82

sev- sev at scummvm.org
Mon Feb 24 18:08:34 UTC 2020


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:
0f4d18958e DIRECTOR: Further work on simplification of shared cast handling


Commit: 0f4d18958eb6e02413461cd1f5479859ba6f1b82
    https://github.com/scummvm/scummvm/commit/0f4d18958eb6e02413461cd1f5479859ba6f1b82
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-02-24T18:09:56+01:00

Commit Message:
DIRECTOR: Further work on simplification of shared cast handling

Changed paths:
    engines/director/resource.cpp
    engines/director/score.cpp


diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 658e5d7..04944a7 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -405,7 +405,6 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
 		}
 	}
 
-	_sharedScore->loadSpriteImages(true);
 	_lingo->_archiveIndex = 0;
 }
 
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 581ea60..2b08bb2 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -296,6 +296,8 @@ void Score::copyCastStxts() {
 void Score::loadSpriteImages(bool isSharedCast) {
 	debugC(1, kDebugLoading, "****** Preloading sprite images");
 
+	Score *sharedScore = _vm->getSharedScore();
+
 	for (Common::HashMap<int, Cast *>::iterator c = _loadedCast->begin(); c != _loadedCast->end(); ++c) {
 		if (!c->_value)
 			continue;
@@ -315,20 +317,27 @@ void Score::loadSpriteImages(bool isSharedCast) {
 		Image::ImageDecoder *img = NULL;
 		Common::SeekableReadStream *pic = NULL;
 
+		if (_loadedCast->contains(imgId)) {
+			pic = sharedScore->getArchive()->getResource(tag, imgId);
+		} else if (sharedScore->_loadedCast && sharedScore->_loadedCast->contains(imgId)) {
+			bitmapCast->_tag = tag = ((BitmapCast *)sharedScore->_loadedCast->getVal(imgId))->_tag;
+			pic = sharedScore->getArchive()->getResource(tag, imgId);
+		}
+
+		if (pic == NULL) {
+			warning("Score::loadSpriteImages(): Image %d not found", imgId);
+			continue;
+		}
+
 		switch (tag) {
 		case MKTAG('D', 'I', 'B', ' '):
-			if (_movieArchive->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
-				debugC(2, kDebugLoading, "****** Loading 'DIB ' id: %d", imgId);
-				img = new DIBDecoder();
-				img->loadStream(*_movieArchive->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
-				bitmapCast->_surface = img->getSurface();
-			}
+			debugC(2, kDebugLoading, "****** Loading 'DIB ' id: %d", imgId);
+			img = new DIBDecoder();
+			img->loadStream(*pic);
+			bitmapCast->_surface = img->getSurface();
 			break;
 		case MKTAG('B', 'I', 'T', 'D'):
-			if (_movieArchive->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
-				debugC(2, kDebugLoading, "****** Loading 'BITD' id: %d", imgId);
-				pic = _movieArchive->getResource(MKTAG('B', 'I', 'T', 'D'), imgId);
-			}
+			debugC(2, kDebugLoading, "****** Loading 'BITD' id: %d", imgId);
 			break;
 		default:
 			warning("Score::loadSpriteImages(): Unknown Bitmap Cast Tag: [%d] %s", tag, tag2str(tag));
@@ -339,7 +348,7 @@ void Score::loadSpriteImages(bool isSharedCast) {
 		debugC(4, kDebugImages, "Score::loadSpriteImages(): id: %d, w: %d, h: %d, flags: %x, bytes: %x, bpp: %d clut: %x",
 			imgId, w, h, bitmapCast->_flags, bitmapCast->_bytes, bitmapCast->_bitsPerPixel, bitmapCast->_clut);
 
-		if (pic != NULL && bitmapCast != NULL && w > 0 && h > 0) {
+		if (bitmapCast != NULL && w > 0 && h > 0) {
 			if (_vm->getVersion() < 6) {
 				img = new BITDDecoder(w, h, bitmapCast->_bitsPerPixel, bitmapCast->_pitch);
 			} else {




More information about the Scummvm-git-logs mailing list