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

npjg nathanael.gentrydb8 at gmail.com
Tue Jul 14 18:58:44 UTC 2020


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

Summary:
3733f3f02a DIRECTOR: Skip over empty channels
64e507a885 DIRECTOR: Run updateStage more directly
1292328639 DIRECTOR: Call updateCast for not-dirty sprites
86ab75f134 DIRECTOR: Call WM draw only when stage is updated
b9ee31ad2a DIRECTOR: Improve setTheSprite dirty rect handling


Commit: 3733f3f02a3db429be7eb461bada61b70dc65c8a
    https://github.com/scummvm/scummvm/commit/3733f3f02a3db429be7eb461bada61b70dc65c8a
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-14T14:58:17-04:00

Commit Message:
DIRECTOR: Skip over empty channels

Changed paths:
    engines/director/channel.cpp
    engines/director/channel.h
    engines/director/score.cpp


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index 878001792b..4d90ca46c1 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -133,6 +133,10 @@ bool Channel::isStretched() {
 		(_sprite->_width != _width || _sprite->_height != _height);
 }
 
+bool Channel::isEmpty() {
+	return (_sprite->_spriteType == kInactiveSprite);
+}
+
 Common::Rect Channel::getBbox(bool unstretched) {
 
 	Common::Rect result(unstretched ? _sprite->_width : _width,
diff --git a/engines/director/channel.h b/engines/director/channel.h
index 1202407a1f..efa94b0539 100644
--- a/engines/director/channel.h
+++ b/engines/director/channel.h
@@ -42,6 +42,7 @@ public:
 
 	bool isStretched();
 	bool isDirty(Sprite *nextSprite = nullptr);
+	bool isEmpty();
 
 	void setWidth(int w);
 	void setHeight(int h);
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 6d600280d8..3652f9190f 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -467,9 +467,10 @@ bool Score::checkSpriteIntersection(uint16 spriteId, Common::Point pos) {
 Common::List<Channel *> Score::getSpriteIntersections(const Common::Rect &r) {
 	Common::List<Channel *>intersections;
 
-	for (uint i = 0; i < _channels.size(); i++)
-		if (!r.findIntersectingRect(_channels[i]->getBbox()).isEmpty())
+	for (uint i = 0; i < _channels.size(); i++) {
+		if (!_channels[i]->isEmpty() && !r.findIntersectingRect(_channels[i]->getBbox()).isEmpty())
 			intersections.push_back(_channels[i]);
+	}
 
 	return intersections;
 }


Commit: 64e507a885de50f890348096c93ec04146d2038e
    https://github.com/scummvm/scummvm/commit/64e507a885de50f890348096c93ec04146d2038e
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-14T14:58:17-04:00

Commit Message:
DIRECTOR: Run updateStage more directly

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


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 0c319a180e..209cf0a125 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1911,7 +1911,6 @@ void LB::b_updateStage(int nargs) {
 	}
 
 	Movie *movie = g_director->getCurrentMovie();
-
 	if (!movie) {
 		warning("b_updateStage: no movie");
 
@@ -1919,8 +1918,7 @@ void LB::b_updateStage(int nargs) {
 	}
 
 	Score *score = movie->getScore();
-
-	score->renderFrame(score->getCurrentFrame(), kRenderUpdateStageOnly);
+	movie->getCurrentStage()->render();
 	g_director->draw();
 	g_director->processEvents(true);
 
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index fe094c969e..3ebe32038d 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -1316,6 +1316,12 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 	default:
 		warning("Lingo::setTheSprite(): Unprocessed setting field \"%s\" of sprite", field2str(field));
 	}
+
+	if (channel->_dirty) {
+		Movie *movie = g_director->getCurrentMovie();
+		if (movie)
+			movie->getCurrentStage()->addDirtyRect(channel->getBbox());
+	}
 }
 
 Datum Lingo::getTheCast(Datum &id1, int field) {


Commit: 12923286395d1bf408ae07b6b57b2df8757c32cf
    https://github.com/scummvm/scummvm/commit/12923286395d1bf408ae07b6b57b2df8757c32cf
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-14T14:58:17-04:00

Commit Message:
DIRECTOR: Call updateCast for not-dirty sprites

This restores text interactivity in Warlock.

Changed paths:
    engines/director/score.cpp


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 3652f9190f..c3c48f543a 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -417,6 +417,7 @@ void Score::renderSprites(uint16 frameId, RenderMode mode) {
 			_stage->addDirtyRect(channel->getBbox());
 		} else if (!channel->_sprite->_puppet) {
 			// Updating scripts, etc. does not require a full re-render
+			channel->_sprite->updateCast();
 			channel->_sprite->_scriptId = nextSprite->_scriptId;
 		}
 	}


Commit: 86ab75f134a7b6ae6f65965639c2d682eee0ac67
    https://github.com/scummvm/scummvm/commit/86ab75f134a7b6ae6f65965639c2d682eee0ac67
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-14T14:58:17-04:00

Commit Message:
DIRECTOR: Call WM draw only when stage is updated

Changed paths:
    engines/director/lingo/lingo-builtins.cpp
    engines/director/stage.cpp


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 209cf0a125..03a08c0baf 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1918,8 +1918,9 @@ void LB::b_updateStage(int nargs) {
 	}
 
 	Score *score = movie->getScore();
-	movie->getCurrentStage()->render();
-	g_director->draw();
+	if (movie->getCurrentStage()->render())
+		g_director->draw();
+
 	g_director->processEvents(true);
 
 	if (debugChannelSet(-1, kDebugFewFramesOnly)) {
diff --git a/engines/director/stage.cpp b/engines/director/stage.cpp
index fa0ef62b16..068095144e 100644
--- a/engines/director/stage.cpp
+++ b/engines/director/stage.cpp
@@ -81,20 +81,20 @@ bool Stage::render(bool forceRedraw, Graphics::ManagedSurface *blitTo) {
 	if (!_currentMovie)
 		return false;
 
-	if (!blitTo)
-		blitTo = &_surface;
-
 	if (forceRedraw) {
 		blitTo->clear(_stageColor);
 		_dirtyRects.clear();
 		_dirtyRects.push_back(Common::Rect(_surface.w, _surface.h));
 	} else {
 		if (_dirtyRects.size() == 0)
-			return true;
+			return false;
 
 		mergeDirtyRects();
 	}
 
+	if (!blitTo)
+		blitTo = &_surface;
+
 	for (Common::List<Common::Rect>::iterator i = _dirtyRects.begin(); i != _dirtyRects.end(); i++) {
 		const Common::Rect &r = *i;
 		blitTo->fillRect(r, _stageColor);


Commit: b9ee31ad2a4c1efdba8d42f5cbc17dbbdc741188
    https://github.com/scummvm/scummvm/commit/b9ee31ad2a4c1efdba8d42f5cbc17dbbdc741188
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-07-14T14:58:17-04:00

Commit Message:
DIRECTOR: Improve setTheSprite dirty rect handling

Don't reset on an unchanged castId, either.

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


diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 3ebe32038d..e7febe6895 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -1185,7 +1185,11 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 	channel->_dirty = true;
 	switch (field) {
 	case kTheBackColor:
-		sprite->_backColor = d.asInt();
+		if (d.asInt() != sprite->_backColor) {
+			sprite->_backColor = d.asInt();
+		} else {
+			channel->_dirty = false;
+		}
 		break;
 	case kTheBlend:
 		sprite->_blend = d.asInt();
@@ -1197,6 +1201,8 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 			sprite->setCast(d.asInt());
 			channel->_width = sprite->_width;
 			channel->_height = sprite->_height;
+		} else {
+			channel->_dirty = false;
 		}
 		break;
 	case kTheConstraint:
@@ -1217,11 +1223,19 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 		sprite->_cast ? sprite->_cast->setEditable(d.asInt()) : false;
 		break;
 	case kTheForeColor:
-		sprite->_foreColor = d.asInt();
+		if (d.asInt() != sprite->_foreColor) {
+			sprite->_foreColor = d.asInt();
+		} else {
+			channel->_dirty = false;
+		}
 		break;
 	case kTheHeight:
-		g_director->getCurrentStage()->addDirtyRect(channel->getBbox());
-		channel->setHeight(d.asInt());
+		if (d.asInt() != channel->_height) {
+			g_director->getCurrentStage()->addDirtyRect(channel->getBbox());
+			channel->setHeight(d.asInt());
+		} else {
+			channel->_dirty = false;
+		}
 		break;
 	case kTheImmediate:
 		sprite->_immediate = d.asInt();
@@ -1243,7 +1257,8 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 		}
 
 		if (d.asInt() != channel->_currentPoint.x) {
-			channel->addDelta(Common::Point(d.asInt() - channel->_currentPoint.x, 0));
+			g_director->getCurrentMovie()->getCurrentStage()->addDirtyRect(channel->getBbox());
+			channel->_currentPoint.x = d.asInt();
 		} else {
 			channel->_dirty = false;
 		}
@@ -1256,7 +1271,8 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 		}
 
 		if (d.asInt() != channel->_currentPoint.y) {
-			channel->addDelta(Common::Point(0, d.asInt() - channel->_currentPoint.y));
+			g_director->getCurrentMovie()->getCurrentStage()->addDirtyRect(channel->getBbox());
+			channel->_currentPoint.y = d.asInt();
 		} else {
 			channel->_dirty = false;
 		}
@@ -1310,18 +1326,19 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 		sprite->_volume = d.asInt();
 		break;
 	case kTheWidth:
-		g_director->getCurrentStage()->addDirtyRect(channel->getBbox());
-		channel->setWidth(d.asInt());
+		if (d.asInt() != channel->_width) {
+			g_director->getCurrentStage()->addDirtyRect(channel->getBbox());
+			channel->setWidth(d.asInt());
+		} else {
+			channel->_dirty = false;
+		}
 		break;
 	default:
 		warning("Lingo::setTheSprite(): Unprocessed setting field \"%s\" of sprite", field2str(field));
 	}
 
-	if (channel->_dirty) {
-		Movie *movie = g_director->getCurrentMovie();
-		if (movie)
-			movie->getCurrentStage()->addDirtyRect(channel->getBbox());
-	}
+	if (channel->_dirty && g_director->getCurrentMovie())
+		g_director->getCurrentMovie()->getCurrentStage()->addDirtyRect(channel->getBbox());
 }
 
 Datum Lingo::getTheCast(Datum &id1, int field) {




More information about the Scummvm-git-logs mailing list