[Scummvm-git-logs] scummvm master -> 2399ca102bcf8cbd58945cf56e10502b3d0fbe74

ysj1173886760 42030331+ysj1173886760 at users.noreply.github.com
Mon Jul 26 08:09:31 UTC 2021


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

Summary:
bd6f680648 GRAPHICS: MACGUI: fix rendering text.
bb739dafc7 DIRECTOR: implement b_rect
6e208c41b8 DIRECTOR: implement b_intersect. amend the implementation of b_rect.
7b66a95ae4 DIRECTOR: implement b_inside.
155cc176d4 DIRECTOR: eliminate the narg check in intersect and inside, amend the minArgs of rect
138658789a DIRECTOR: introduce new initializer for Datum
1f1c56e8ab DIRECTOR: implement get the rect of sprite and cast
2399ca102b DIRECTOR: support converting RECT to string in Datum


Commit: bd6f680648a3ab01856f91ad0b377026c3e2a071
    https://github.com/scummvm/scummvm/commit/bd6f680648a3ab01856f91ad0b377026c3e2a071
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-26T14:31:57+08:00

Commit Message:
GRAPHICS: MACGUI: fix rendering text.
previously, it will blink due to i was using transBlitFrom to blit text to composed surface.
for now, i've fixed the render logic, this should behave correct and more faster than ever.

Changed paths:
    graphics/macgui/mactext.cpp


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 545b0e5be6..d3a06f4045 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -1300,13 +1300,20 @@ bool MacText::draw(bool forceRedraw) {
 		_composeSurface->clear(_bgcolor);
 
 	// TODO: Clear surface fully when background colour changes.
-	_contentIsDirty = false;
 	_cursorDirty = false;
 
 	Common::Point offset(calculateOffset());
 
-	if (!_cursorState)
-		_composeSurface->blitFrom(*_cursorSurface2, *_cursorRect, Common::Point(_cursorX + offset.x, _cursorY + offset.y));
+	// if we are drawing the selection text or we are selecting, then we don't draw the cursor
+	if (!((_inTextSelection || _selectedText.endY != -1) && _active)) {
+		if (!_cursorState)
+			_composeSurface->blitFrom(*_cursorSurface2, *_cursorRect, Common::Point(_cursorX + offset.x, _cursorY + offset.y));
+		else
+			_composeSurface->blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX + offset.x, _cursorY + offset.y));
+	}
+
+	if (!(_contentIsDirty || forceRedraw))
+		return true;
 
 	draw(_composeSurface, 0, _scrollPos, _surface->w, _scrollPos + _surface->h, offset.x, offset.y);
 
@@ -1320,13 +1327,11 @@ bool MacText::draw(bool forceRedraw) {
 		_composeSurface->frameRect(borderRect, 0);
 	}
 
-	// if we are drawing the selection text or we are selecting, then we don't draw the cursor
-	if (_cursorState && !((_inTextSelection || _selectedText.endY != -1) && _active))
-		_composeSurface->blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX + offset.x, _cursorY + offset.y));
-
 	if (_selectedText.endY != -1)
 		drawSelection(offset.x, offset.y);
 
+	_contentIsDirty = false;
+
 	return true;
 }
 


Commit: bb739dafc70b78924e754663c80f67f499537c86
    https://github.com/scummvm/scummvm/commit/bb739dafc70b78924e754663c80f67f499537c86
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-26T15:18:43+08:00

Commit Message:
DIRECTOR: implement b_rect

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


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index fe9d8cc260..f213bea2b0 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -2123,11 +2123,40 @@ void LB::b_point(int nargs) {
 }
 
 void LB::b_rect(int nargs) {
-	g_lingo->printSTUBWithArglist("b_rect", nargs);
+	Datum d(0);
 
-	g_lingo->dropStack(nargs);
+	if (nargs == 4) {
+		Datum bottom(g_lingo->pop().asFloat());
+		Datum right(g_lingo->pop().asFloat());
+		Datum top(g_lingo->pop().asFloat());
+		Datum left(g_lingo->pop().asFloat());
+
+		d.u.farr = new DatumArray;
+		d.u.farr->push_back(left);
+		d.u.farr->push_back(top);
+		d.u.farr->push_back(right);
+		d.u.farr->push_back(bottom);
+		d.type = RECT;
+	} else if (nargs == 2) {
+		Datum p2 = g_lingo->pop();
+		Datum p1 = g_lingo->pop();
+
+		if (p2.type == POINT && p1.type == POINT) {
+			d.u.farr = new DatumArray;
+			d.u.farr->push_back(p1.u.farr[0]);
+			d.u.farr->push_back(p1.u.farr[1]);
+			d.u.farr->push_back(p2.u.farr[0]);
+			d.u.farr->push_back(p2.u.farr[1]);
+			d.type = RECT;
+		} else
+			warning("LB::b_rect: Rect need 2 Point variable as argument");
 
-	g_lingo->push(Datum(0));
+	} else {
+		warning("LB::b_rect: Rect doesn't support %d args", nargs);
+		g_lingo->dropStack(nargs);
+	}
+
+	g_lingo->push(d);
 }
 
 


Commit: 6e208c41b8501a05ec2d6ccd91fd61ecec493581
    https://github.com/scummvm/scummvm/commit/6e208c41b8501a05ec2d6ccd91fd61ecec493581
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-26T15:35:28+08:00

Commit Message:
DIRECTOR: implement b_intersect. amend the implementation of b_rect.

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


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index f213bea2b0..e37612f1c5 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -2126,10 +2126,10 @@ void LB::b_rect(int nargs) {
 	Datum d(0);
 
 	if (nargs == 4) {
-		Datum bottom(g_lingo->pop().asFloat());
-		Datum right(g_lingo->pop().asFloat());
-		Datum top(g_lingo->pop().asFloat());
-		Datum left(g_lingo->pop().asFloat());
+		Datum bottom(g_lingo->pop().asInt());
+		Datum right(g_lingo->pop().asInt());
+		Datum top(g_lingo->pop().asInt());
+		Datum left(g_lingo->pop().asInt());
 
 		d.u.farr = new DatumArray;
 		d.u.farr->push_back(left);
@@ -2143,10 +2143,10 @@ void LB::b_rect(int nargs) {
 
 		if (p2.type == POINT && p1.type == POINT) {
 			d.u.farr = new DatumArray;
-			d.u.farr->push_back(p1.u.farr[0]);
-			d.u.farr->push_back(p1.u.farr[1]);
-			d.u.farr->push_back(p2.u.farr[0]);
-			d.u.farr->push_back(p2.u.farr[1]);
+			d.u.farr->push_back(p1.u.farr->operator[](0));
+			d.u.farr->push_back(p1.u.farr->operator[](1));
+			d.u.farr->push_back(p2.u.farr->operator[](0));
+			d.u.farr->push_back(p2.u.farr->operator[](1));
 			d.type = RECT;
 		} else
 			warning("LB::b_rect: Rect need 2 Point variable as argument");
@@ -2161,11 +2161,21 @@ void LB::b_rect(int nargs) {
 
 
 void LB::b_intersect(int nargs) {
-	g_lingo->printSTUBWithArglist("b_intersect", nargs);
+	Datum d(0);
+	if (nargs == 2) {
+		Datum r2 = g_lingo->pop();
+		Datum r1 = g_lingo->pop();
+		Common::Rect rect1(r1.u.farr->operator[](0).asInt(), r1.u.farr->operator[](1).asInt(), r1.u.farr->operator[](2).asInt(), r1.u.farr->operator[](3).asInt());
+		Common::Rect rect2(r2.u.farr->operator[](0).asInt(), r2.u.farr->operator[](1).asInt(), r2.u.farr->operator[](2).asInt(), r2.u.farr->operator[](3).asInt());
 
-	g_lingo->dropStack(nargs);
+		d.type = INT;
+		d.u.i = rect1.intersects(rect2);
+	} else {
+		warning("LB::b_intersect: intersect got %d args, expecting 2", nargs);
+		g_lingo->dropStack(nargs);
+	}
 
-	g_lingo->push(Datum(0));
+	g_lingo->push(d);
 }
 
 void LB::b_inside(int nargs) {


Commit: 7b66a95ae40680da085880f86313970100f39346
    https://github.com/scummvm/scummvm/commit/7b66a95ae40680da085880f86313970100f39346
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-26T15:38:00+08:00

Commit Message:
DIRECTOR: implement b_inside.

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


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index e37612f1c5..83766e0637 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -2179,11 +2179,21 @@ void LB::b_intersect(int nargs) {
 }
 
 void LB::b_inside(int nargs) {
-	g_lingo->printSTUBWithArglist("b_inside", nargs);
+	Datum d(0);
+	if (nargs == 2) {
+		Datum r2 = g_lingo->pop();
+		Datum p1 = g_lingo->pop();
+		Common::Rect rect2(r2.u.farr->operator[](0).asInt(), r2.u.farr->operator[](1).asInt(), r2.u.farr->operator[](2).asInt(), r2.u.farr->operator[](3).asInt());
+		Common::Point point1(p1.u.farr->operator[](0).asInt(), p1.u.farr->operator[](1).asInt());
 
-	g_lingo->dropStack(nargs);
+		d.type = INT;
+		d.u.i = rect2.contains(point1);
+	} else {
+		warning("LB::b_inside: inside got %d args, expecting 2", nargs);
+		g_lingo->dropStack(nargs);
+	}
 
-	g_lingo->push(Datum(0));
+	g_lingo->push(d);
 }
 
 void LB::b_map(int nargs) {


Commit: 155cc176d4799c7504a5aac90502db3472facd2d
    https://github.com/scummvm/scummvm/commit/155cc176d4799c7504a5aac90502db3472facd2d
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-26T15:41:30+08:00

Commit Message:
DIRECTOR: eliminate the narg check in intersect and inside, amend the minArgs of rect

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


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 83766e0637..bc4e7bfda0 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -194,7 +194,7 @@ static BuiltinProto builtins[] = {
 	{ "inside",			LB::b_inside,		2, 2, 400, FBLTIN },	//			D4 f
 	{ "intersect",		LB::b_intersect,	2, 2, 400, FBLTIN },	//			D4 f
 	{ "map",			LB::b_map,			3, 3, 400, FBLTIN },	//			D4 f
-	{ "rect",			LB::b_rect,			4, 4, 400, FBLTIN },	//			D4 f
+	{ "rect",			LB::b_rect,			2, 4, 400, FBLTIN },	//			D4 f
 	{ "union",			LB::b_union,		2, 2, 400, FBLTIN },	//			D4 f
 	// Sound
 	{ "beep",	 		LB::b_beep,			0, 1, 200, CBLTIN },	// D2
@@ -2161,37 +2161,27 @@ void LB::b_rect(int nargs) {
 
 
 void LB::b_intersect(int nargs) {
-	Datum d(0);
-	if (nargs == 2) {
-		Datum r2 = g_lingo->pop();
-		Datum r1 = g_lingo->pop();
-		Common::Rect rect1(r1.u.farr->operator[](0).asInt(), r1.u.farr->operator[](1).asInt(), r1.u.farr->operator[](2).asInt(), r1.u.farr->operator[](3).asInt());
-		Common::Rect rect2(r2.u.farr->operator[](0).asInt(), r2.u.farr->operator[](1).asInt(), r2.u.farr->operator[](2).asInt(), r2.u.farr->operator[](3).asInt());
+	Datum d;
+	Datum r2 = g_lingo->pop();
+	Datum r1 = g_lingo->pop();
+	Common::Rect rect1(r1.u.farr->operator[](0).asInt(), r1.u.farr->operator[](1).asInt(), r1.u.farr->operator[](2).asInt(), r1.u.farr->operator[](3).asInt());
+	Common::Rect rect2(r2.u.farr->operator[](0).asInt(), r2.u.farr->operator[](1).asInt(), r2.u.farr->operator[](2).asInt(), r2.u.farr->operator[](3).asInt());
 
-		d.type = INT;
-		d.u.i = rect1.intersects(rect2);
-	} else {
-		warning("LB::b_intersect: intersect got %d args, expecting 2", nargs);
-		g_lingo->dropStack(nargs);
-	}
+	d.type = INT;
+	d.u.i = rect1.intersects(rect2);
 
 	g_lingo->push(d);
 }
 
 void LB::b_inside(int nargs) {
-	Datum d(0);
-	if (nargs == 2) {
-		Datum r2 = g_lingo->pop();
-		Datum p1 = g_lingo->pop();
-		Common::Rect rect2(r2.u.farr->operator[](0).asInt(), r2.u.farr->operator[](1).asInt(), r2.u.farr->operator[](2).asInt(), r2.u.farr->operator[](3).asInt());
-		Common::Point point1(p1.u.farr->operator[](0).asInt(), p1.u.farr->operator[](1).asInt());
+	Datum d;
+	Datum r2 = g_lingo->pop();
+	Datum p1 = g_lingo->pop();
+	Common::Rect rect2(r2.u.farr->operator[](0).asInt(), r2.u.farr->operator[](1).asInt(), r2.u.farr->operator[](2).asInt(), r2.u.farr->operator[](3).asInt());
+	Common::Point point1(p1.u.farr->operator[](0).asInt(), p1.u.farr->operator[](1).asInt());
 
-		d.type = INT;
-		d.u.i = rect2.contains(point1);
-	} else {
-		warning("LB::b_inside: inside got %d args, expecting 2", nargs);
-		g_lingo->dropStack(nargs);
-	}
+	d.type = INT;
+	d.u.i = rect2.contains(point1);
 
 	g_lingo->push(d);
 }


Commit: 138658789a57df5316b95a2f136bf1dc8ab3f324
    https://github.com/scummvm/scummvm/commit/138658789a57df5316b95a2f136bf1dc8ab3f324
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-26T16:04:13+08:00

Commit Message:
DIRECTOR: introduce new initializer for Datum

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


diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 9d21a0839f..58ac95f7f0 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -633,6 +633,15 @@ Datum::Datum(const CastMemberID &val) {
 	*refCount = 1;
 }
 
+Datum::Datum(const Common::Rect &rect) {
+	type = RECT;
+	u.farr = new DatumArray;
+	u.farr->push_back(Datum(rect.left));
+	u.farr->push_back(Datum(rect.top));
+	u.farr->push_back(Datum(rect.right));
+	u.farr->push_back(Datum(rect.bottom));
+}
+
 void Datum::reset() {
 	if (!refCount)
 		return;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index c1248ffc68..670b9005c4 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -26,6 +26,7 @@
 #include "common/hash-ptr.h"
 #include "common/hash-str.h"
 #include "common/str-array.h"
+#include "common/rect.h"
 
 #include "director/types.h"
 
@@ -132,6 +133,7 @@ struct Datum {	/* interpreter stack type */
 	Datum(const Common::String &val);
 	Datum(AbstractObject *val);
 	Datum(const CastMemberID &val);
+	Datum(const Common::Rect &rect);
 	void reset();
 
 	~Datum() {


Commit: 1f1c56e8ab012f67b84994dc352343d1cfbe37ab
    https://github.com/scummvm/scummvm/commit/1f1c56e8ab012f67b84994dc352343d1cfbe37ab
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-26T16:04:35+08:00

Commit Message:
DIRECTOR: implement get the rect of sprite and cast

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


diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index 2534eac740..222b1d6e0a 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -609,7 +609,8 @@ Datum CastMember::getField(int field) {
 		d = _castId;
 		break;
 	case kTheRect:
-		warning("STUB: CastMember::getField(): Unprocessed getting field \"%s\" of cast %d", g_lingo->field2str(field), _castId);
+		// not sure get the initial rect would be fine to castmember
+		d = Datum(_cast->getCastMember(_castId)->_initialRect);
 		break;
 	case kThePurgePriority:
 		d = _purgePriority;
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 58a3150dca..7961d7e5af 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -1214,7 +1214,13 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
 		d.u.i = sprite->_puppet;
 		break;
 	case kTheRect:
-		warning("STUB: Lingo::getTheSprite(): Unprocessed getting field \"%s\" of sprite", field2str(field));
+		// let compiler to optimize this
+		d.type = RECT;
+		d.u.farr = new DatumArray;
+		d.u.farr->push_back(channel->getBbox().left);
+		d.u.farr->push_back(channel->getBbox().top);
+		d.u.farr->push_back(channel->getBbox().right);
+		d.u.farr->push_back(channel->getBbox().bottom);
 		break;
 	case kTheRight:
 		d.u.i = channel->getBbox().right;


Commit: 2399ca102bcf8cbd58945cf56e10502b3d0fbe74
    https://github.com/scummvm/scummvm/commit/2399ca102bcf8cbd58945cf56e10502b3d0fbe74
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-07-26T16:08:05+08:00

Commit Message:
DIRECTOR: support converting RECT to string in Datum

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


diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 58ac95f7f0..649920429d 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -879,6 +879,16 @@ Common::String Datum::asString(bool printonly) const {
 
 		s += "]";
 		break;
+	case RECT:
+		s = "rect(";
+		for (uint i = 0; i < u.farr->size(); i++) {
+			if (i > 0)
+				s += ", ";
+			s += Common::String::format("%d", u.farr->operator[](i).asInt());
+		}
+
+		s += ")";
+		break;
 	default:
 		warning("Incorrect operation asString() for type: %s", type2str());
 	}




More information about the Scummvm-git-logs mailing list