[Scummvm-git-logs] scummvm master -> c444de0ecaab3757ac6170a283734214166dc696

sev- sev at scummvm.org
Thu Feb 9 19:00:21 CET 2017


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b4ea7e0ce9 DIRECTOR: Lingo: Fix Symbol printing
5fb528743b DIRECTOR: Lingo: Add sanity checks to score-related built-ins
c444de0eca DIRECTOR: Made DirectorEngine::_currentScore private


Commit: b4ea7e0ce99b8cda65d75374fa29805e2d7fcda7
    https://github.com/scummvm/scummvm/commit/b4ea7e0ce99b8cda65d75374fa29805e2d7fcda7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-09T18:43:10+01:00

Commit Message:
DIRECTOR: Lingo: Fix Symbol printing

Changed paths:
    engines/director/lingo/lingo.cpp


diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 0ce1944..79dfc1f 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -387,6 +387,7 @@ Common::String *Datum::toString() {
 		delete s;
 		s = u.s;
 		break;
+	case SYMBOL:
 	case OBJECT:
 		*s = Common::String::format("#%s", u.s->c_str());
 		break;


Commit: 5fb528743b1e98fb769686b5193c4e58cf32143f
    https://github.com/scummvm/scummvm/commit/5fb528743b1e98fb769686b5193c4e58cf32143f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-09T18:45:42+01:00

Commit Message:
DIRECTOR: Lingo: Add sanity checks to score-related built-ins

Changed paths:
    engines/director/lingo/lingo-funcs.cpp


diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 5ae58a9..6260fe9 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -171,6 +171,9 @@ void Lingo::func_mciwait(Common::String &s) {
 void Lingo::func_goto(Datum &frame, Datum &movie) {
 	g_director->_playbackPaused = false;
 
+	if (!_vm->getCurrentScore())
+		return;
+
 	if (movie.type != VOID) {
 		movie.toString();
 
@@ -206,13 +209,15 @@ void Lingo::func_goto(Datum &frame, Datum &movie) {
 		return;
 
 	if (frame.type == STRING) {
-		_vm->_currentScore->setStartToLabel(*frame.u.s);
+		if (_vm->getCurrentScore())
+			_vm->getCurrentScore()->setStartToLabel(*frame.u.s);
 		return;
 	}
 
 	frame.toInt();
 
-	_vm->_currentScore->setCurrentFrame(frame.u.i);
+	if (_vm->getCurrentScore())
+		_vm->getCurrentScore()->setCurrentFrame(frame.u.i);
 }
 
 void Lingo::func_gotoloop() {
@@ -273,6 +278,9 @@ void Lingo::func_beep(int repeats) {
 }
 
 int Lingo::func_marker(int m) 	{
+	if (!_vm->getCurrentScore())
+		return 0;
+
 	int labelNumber = _vm->getCurrentScore()->getCurrentLabelNumber();
 	if (m != 0) {
 		if (m < 0) {


Commit: c444de0ecaab3757ac6170a283734214166dc696
    https://github.com/scummvm/scummvm/commit/c444de0ecaab3757ac6170a283734214166dc696
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-09T18:48:22+01:00

Commit Message:
DIRECTOR: Made DirectorEngine::_currentScore private

Changed paths:
    engines/director/director.h
    engines/director/frame.cpp
    engines/director/lingo/lingo-builtins.cpp
    engines/director/lingo/lingo-funcs.cpp
    engines/director/lingo/lingo-the.cpp


diff --git a/engines/director/director.h b/engines/director/director.h
index 882eb14..001393b 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -98,7 +98,6 @@ public:
 	Common::HashMap<int, Cast *> *getSharedCasts() const { return _sharedCasts; }
 
 	Common::HashMap<Common::String, Score *> *_movies;
-	Score *_currentScore;
 
 	Common::RandomSource _rnd;
 	Graphics::MacWindowManager *_wm;
@@ -142,6 +141,8 @@ private:
 	uint16 _currentPaletteLength;
 	Lingo *_lingo;
 
+	Score *_currentScore;
+
 	Graphics::MacPatterns _director3Patterns;
 	Graphics::MacPatterns _director3QuickDrawPatterns;
 
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 68b1713..f6a16e6 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -560,7 +560,7 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
 					break;
 				}
 			} else {
-				if (!_vm->_currentScore->_casts.contains(_sprites[i]->_castId)) {
+				if (!_vm->getCurrentScore()->_casts.contains(_sprites[i]->_castId)) {
 					if (!_vm->getSharedCasts()->contains(_sprites[i]->_castId)) {
 						warning("Cast id %d not found", _sprites[i]->_castId);
 						continue;
@@ -569,7 +569,7 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
 						cast = _vm->getSharedCasts()->getVal(_sprites[i]->_castId);
 					}
 				} else {
-					cast = _vm->_currentScore->_casts[_sprites[i]->_castId];
+					cast = _vm->getCurrentScore()->_casts[_sprites[i]->_castId];
 				}
 				castType = cast->type;
 			}
@@ -661,7 +661,7 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
 
 void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId, uint16 textId) {
 	uint16 castId = _sprites[spriteId]->_castId;
-	ButtonCast *button = static_cast<ButtonCast *>(_vm->_currentScore->_casts[castId]);
+	ButtonCast *button = static_cast<ButtonCast *>(_vm->getCurrentScore()->_casts[castId]);
 
 	uint32 rectLeft = button->initialRect.left;
 	uint32 rectTop = button->initialRect.top;
@@ -703,14 +703,14 @@ void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId, uin
 Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
 	uint16 imgId = spriteId + 1024;
 
-	if (_vm->getVersion() >= 4 && _vm->_currentScore->_casts[spriteId]->children.size() > 0)
-		imgId = _vm->_currentScore->_casts[spriteId]->children[0].index;
+	if (_vm->getVersion() >= 4 && _vm->getCurrentScore()->_casts[spriteId]->children.size() > 0)
+		imgId = _vm->getCurrentScore()->_casts[spriteId]->children[0].index;
 
 	Image::ImageDecoder *img = NULL;
 
-	if (_vm->_currentScore->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
+	if (_vm->getCurrentScore()->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
 		img = new DIBDecoder();
-		img->loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
+		img->loadStream(*_vm->getCurrentScore()->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
 		return img;
 	}
 
@@ -728,9 +728,9 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
 		pic = _vm->getSharedBMP()->getVal(imgId);
 		pic->seek(0); // TODO: this actually gets re-read every loop... we need to rewind it!
 		bc = static_cast<BitmapCast *>(_vm->getSharedCasts()->getVal(spriteId));
-	} else 	if (_vm->_currentScore->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
-		pic = _vm->_currentScore->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId);
-		bc = static_cast<BitmapCast *>(_vm->_currentScore->_casts[spriteId]);
+	} else 	if (_vm->getCurrentScore()->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
+		pic = _vm->getCurrentScore()->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId);
+		bc = static_cast<BitmapCast *>(_vm->getCurrentScore()->_casts[spriteId]);
 	}
 
 	if (pic != NULL && bc != NULL) {
@@ -741,7 +741,7 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
 				imgId, w, h, bc->flags, bc->someFlaggyThing, bc->unk1, bc->unk2);
 			img = new BITDDecoder(w, h);
 		} else if (_vm->getVersion() < 6) {
-			bc = static_cast<BitmapCast *>(_vm->_currentScore->_casts[spriteId]);
+			bc = static_cast<BitmapCast *>(_vm->getCurrentScore()->_casts[spriteId]);
 			int w = bc->initialRect.width(), h = bc->initialRect.height();
 
 			debugC(2, kDebugImages, "id: %d, w: %d, h: %d, flags: %x, some: %x, unk1: %d, unk2: %d",
@@ -798,8 +798,8 @@ void Frame::inkBasedBlit(Graphics::ManagedSurface &targetSurface, const Graphics
 void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, uint16 castId) {
 	Common::SeekableSubReadStreamEndian *textStream = NULL;
 
-	if (_vm->_currentScore->_movieArchive->hasResource(MKTAG('S', 'T', 'X', 'T'), castId)) {
-		textStream = _vm->_currentScore->_movieArchive->getResource(MKTAG('S', 'T', 'X', 'T'), castId);
+	if (_vm->getCurrentScore()->_movieArchive->hasResource(MKTAG('S', 'T', 'X', 'T'), castId)) {
+		textStream = _vm->getCurrentScore()->_movieArchive->getResource(MKTAG('S', 'T', 'X', 'T'), castId);
 	} else if (_vm->getSharedSTXT() != nullptr) {
 		textStream = _vm->getSharedSTXT()->getVal(spriteId + 1024);
 	}
@@ -812,7 +812,7 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
 		return;
 
 	uint16 castId = _sprites[spriteId]->_castId;
-	TextCast *textCast = static_cast<TextCast *>(_vm->_currentScore->_casts[castId]);
+	TextCast *textCast = static_cast<TextCast *>(_vm->getCurrentScore()->_casts[castId]);
 
 	uint32 unk1 = textStream->readUint32();
 	uint32 strLen = textStream->readUint32();
@@ -906,10 +906,10 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
 	if (_vm->getVersion() >= 4 && textSize != NULL)
 		width = textCast->initialRect.right;
 
-	if (_vm->_currentScore->_fontMap.contains(textCast->fontId)) {
+	if (_vm->getCurrentScore()->_fontMap.contains(textCast->fontId)) {
 		// We need to make sure that the Shared Cast fonts have been loaded in?
 		// might need a mapping table here of our own.
-		// textCast->fontId = _vm->_wm->_fontMan->getFontIdByName(_vm->_currentScore->_fontMap[textCast->fontId]);
+		// textCast->fontId = _vm->_wm->_fontMan->getFontIdByName(_vm->getCurrentScore()->_fontMap[textCast->fontId]);
 	}
 
 	Graphics::MacFont macFont = Graphics::MacFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 03e1a86..f34be6e 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -904,8 +904,8 @@ void Lingo::b_printFrom(int nargs) {
 }
 
 void Lingo::b_quit(int nargs) {
-	if (g_director->_currentScore)
-		g_director->_currentScore->_stopPlay = true;
+	if (g_director->getCurrentScore())
+		g_director->getCurrentScore()->_stopPlay = true;
 
 	g_lingo->pushVoid();
 }
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 6260fe9..a6dc3f0 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -185,7 +185,7 @@ void Lingo::func_goto(Datum &frame, Datum &movie) {
 		}
 
 		_vm->_nextMovie = *movie.u.s;
-		_vm->_currentScore->_stopPlay = true;
+		_vm->getCurrentScore()->_stopPlay = true;
 
 		_vm->_nextMovieFrameS.clear();
 		_vm->_nextMovieFrameI = -1;
@@ -221,24 +221,24 @@ void Lingo::func_goto(Datum &frame, Datum &movie) {
 }
 
 void Lingo::func_gotoloop() {
-	if (!_vm->_currentScore)
+	if (!_vm->getCurrentScore())
 		return;
 
-	_vm->_currentScore->gotoLoop();
+	_vm->getCurrentScore()->gotoLoop();
 }
 
 void Lingo::func_gotonext() {
-	if (!_vm->_currentScore)
+	if (!_vm->getCurrentScore())
 		return;
 
-	_vm->_currentScore->gotoNext();
+	_vm->getCurrentScore()->gotoNext();
 }
 
 void Lingo::func_gotoprevious() {
-	if (!_vm->_currentScore)
+	if (!_vm->getCurrentScore())
 		return;
 
-	_vm->_currentScore->gotoPrevious();
+	_vm->getCurrentScore()->gotoPrevious();
 }
 
 void Lingo::func_cursor(int c) {
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 090a7fe..8a5f837 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -317,20 +317,20 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 
 	d.toInt(); // Enforce Integer
 
-	if (!_vm->_currentScore) {
+	if (!_vm->getCurrentScore()) {
 		warning("The sprite %d field %d setting over non-active score", id, field);
 		return;
 	}
 
-	Sprite *sprite = _vm->_currentScore->getSpriteById(id);
+	Sprite *sprite = _vm->getCurrentScore()->getSpriteById(id);
 
 	if (!sprite)
 		return;
 
 	switch (field) {
 	case kTheCastNum:
-		if (_vm->_currentScore->_casts.contains(d.u.i)) {
-			sprite->_cast = _vm->_currentScore->_casts[d.u.i];
+		if (_vm->getCurrentScore()->_casts.contains(d.u.i)) {
+			sprite->_cast = _vm->getCurrentScore()->_casts[d.u.i];
 			sprite->_castId = d.u.i;
 		}
 		break;
@@ -519,12 +519,12 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
 		return d;
 	}
 
-	if (!_vm->_currentScore) {
+	if (!_vm->getCurrentScore()) {
 		warning("The sprite %d field %d setting over non-active score", id, field);
 		return d;
 	}
 
-	Sprite *sprite = _vm->_currentScore->getSpriteById(id);
+	Sprite *sprite = _vm->getCurrentScore()->getSpriteById(id);
 
 	if (!sprite)
 		return d;
@@ -630,14 +630,14 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
 		return d;
 	}
 
-	if (!_vm->_currentScore) {
+	if (!_vm->getCurrentScore()) {
 		warning("The cast %d field %d setting over non-active score", id, field);
 		return d;
 	}
 
 	Cast *cast;
 	CastInfo *castInfo;
-	if (!_vm->_currentScore->_casts.contains(id)) {
+	if (!_vm->getCurrentScore()->_casts.contains(id)) {
 		if (field == kTheLoaded) {
 			d.type = INT;
 			d.u.i = 0;
@@ -648,8 +648,8 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
 		warning("The cast %d found", id);
 	}
 
-	cast = _vm->_currentScore->_casts[id];
-	castInfo = _vm->_currentScore->_castsInfo[id];
+	cast = _vm->getCurrentScore()->_casts[id];
+	castInfo = _vm->getCurrentScore()->_castsInfo[id];
 
 	d.type = INT;
 
@@ -683,7 +683,7 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
 				return d;
 			}
 
-			ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+			ShapeCast *shape = static_cast<ShapeCast *>(_vm->getCurrentScore()->_casts[id]);
 			d.u.i = shape->bgCol;
 		}
 		break;
@@ -695,7 +695,7 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
 				return d;
 			}
 
-			ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+			ShapeCast *shape = static_cast<ShapeCast *>(_vm->getCurrentScore()->_casts[id]);
 			d.u.i = shape->fgCol;
 		}
 		break;
@@ -721,13 +721,13 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
 		return;
 	}
 
-	if (!_vm->_currentScore) {
+	if (!_vm->getCurrentScore()) {
 		warning("The cast %d field %d setting over non-active score", id, field);
 		return;
 	}
 
-	Cast *cast = _vm->_currentScore->_casts[id];
-	CastInfo *castInfo = _vm->_currentScore->_castsInfo[id];
+	Cast *cast = _vm->getCurrentScore()->_casts[id];
+	CastInfo *castInfo = _vm->getCurrentScore()->_castsInfo[id];
 
 	if (!cast) {
 		warning("The cast %d found", id);
@@ -761,7 +761,7 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
 			if (cast->type != kCastShape) {
 				warning("Field %d of cast %d not found", field, id);
 			}
-			ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+			ShapeCast *shape = static_cast<ShapeCast *>(_vm->getCurrentScore()->_casts[id]);
 			shape->bgCol = d.u.i;
 			shape->modified = 1;
 		}
@@ -772,7 +772,7 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
 				warning("Field %d of cast %d not found", field, id);
 				return;
 			}
-			ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+			ShapeCast *shape = static_cast<ShapeCast *>(_vm->getCurrentScore()->_casts[id]);
 			shape->fgCol = d.u.i;
 			shape->modified = 1;
 		}





More information about the Scummvm-git-logs mailing list