[Scummvm-cvs-logs] scummvm master -> fd2c39591f03778be83b44ed3f7ab470f0011644

bluegr md5 at scummvm.org
Sun Mar 13 22:36:49 CET 2011


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:
5a7c2e0df5 SCI: Fixed regression of rev b1055a3c86. Japanese games should work again
d7c8ed0f5d SCI: Cleanup
fd2c39591f SCI: Fixed the flashing icon bar in the Mac version of Castle of Dr. Brain


Commit: 5a7c2e0df54b2987cf60adc536a822fdb23bd58d
    https://github.com/scummvm/scummvm/commit/5a7c2e0df54b2987cf60adc536a822fdb23bd58d
Author: md5 (md5 at scummvm.org)
Date: 2011-03-13T14:34:05-07:00

Commit Message:
SCI: Fixed regression of rev b1055a3c86. Japanese games should work again

Changed paths:
    engines/sci/graphics/text16.cpp



diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp
index d7a9204..6269a58 100644
--- a/engines/sci/graphics/text16.cpp
+++ b/engines/sci/graphics/text16.cpp
@@ -204,21 +204,24 @@ int16 GfxText16::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgF
 			maxChars = curCharCount; // return count up to (but not including) breaking space
 			break;
 		}
-		if (width + _font->getCharWidth(curChar) > maxWidth)
+		// Sometimes this can go off the screen, like for example bug #3040161.
+		// However, we only perform this for non-Japanese games, as these require
+		// special handling, done after this loop.
+		if (width + _font->getCharWidth(curChar) > maxWidth && g_sci->getLanguage() != Common::JA_JPN)
 			break;
 		width += _font->getCharWidth(curChar);
 		curCharCount++;
 	}
+
+	// Text without spaces, probably Kanji/Japanese
 	if (maxChars == 0) {
-		// Text w/o space, supposingly kanji
 		maxChars = curCharCount;
 
 		uint16 nextChar;
 
 		// We remove the last char only, if maxWidth was actually equal width
 		// before adding the last char. Otherwise we won't get the same cutting
-		// as in sierra pc98 sci. Note: changing the while() instead will NOT
-		// WORK. it would break all sorts of regular sci games.
+		// as in sierra pc98 sci.
 		if (maxWidth == (width - _font->getCharWidth(curChar))) {
 			maxChars--;
 			if (curChar > 0xFF)


Commit: d7c8ed0f5d783bbfccbb6e627689064b1149e2fd
    https://github.com/scummvm/scummvm/commit/d7c8ed0f5d783bbfccbb6e627689064b1149e2fd
Author: md5 (md5 at scummvm.org)
Date: 2011-03-13T14:34:06-07:00

Commit Message:
SCI: Cleanup

Changed paths:
    engines/sci/engine/kgraphics.cpp



diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index fd052bf..c7a2a26 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1078,10 +1078,8 @@ reg_t kNewWindow(EngineState *s, int argc, reg_t *argv) {
 	int colorPen = adjustGraphColor((argc > 7 + argextra) ? argv[7 + argextra].toSint16() : 0);
 	int colorBack = adjustGraphColor((argc > 8 + argextra) ? argv[8 + argextra].toSint16() : 255);
 
-	//	const char *title = argv[4 + argextra].segment ? kernel_dereference_char_pointer(s, argv[4 + argextra], 0) : NULL;
-	if (argc>=13) {
+	if (argc >= 13)
 		rect2 = Common::Rect (argv[5].toSint16(), argv[4].toSint16(), argv[7].toSint16(), argv[6].toSint16());
-	}
 
 	Common::String title;
 	if (argv[4 + argextra].segment) {


Commit: fd2c39591f03778be83b44ed3f7ab470f0011644
    https://github.com/scummvm/scummvm/commit/fd2c39591f03778be83b44ed3f7ab470f0011644
Author: md5 (md5 at scummvm.org)
Date: 2011-03-13T14:34:08-07:00

Commit Message:
SCI: Fixed the flashing icon bar in the Mac version of Castle of Dr. Brain

Thanks to waltervn for his work and help on this

Changed paths:
    engines/sci/graphics/menu.cpp
    engines/sci/graphics/ports.cpp



diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp
index b0d1203..50ba77e 100644
--- a/engines/sci/graphics/menu.cpp
+++ b/engines/sci/graphics/menu.cpp
@@ -911,6 +911,13 @@ void GfxMenu::kernelDrawStatus(const char *text, int16 colorPen, int16 colorBack
 	_ports->moveTo(0, 1);
 	_text16->DrawStatus(text);
 	_paint16->bitsShow(_ports->_menuBarRect);
+	// Also draw the line under the status bar. Normally, this is never drawn,
+	// but we need it to be drawn because Dr. Brain 1 Mac draws over it when
+	// it displays the icon bar. SSCI used negative rectangles to erase the
+	// area after drawing the icon bar, but this is a much cleaner way of
+	// achieving the same effect.
+	_paint16->fillRect(_ports->_menuLine, 1, 0);
+	_paint16->bitsShow(_ports->_menuLine);
 	_ports->setPort(oldPort);
 }
 
diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp
index c89f46b..9ac8d10 100644
--- a/engines/sci/graphics/ports.cpp
+++ b/engines/sci/graphics/ports.cpp
@@ -361,25 +361,50 @@ Window *GfxPorts::addWindow(const Common::Rect &dims, const Common::Rect *restor
 	}
 
 	pwnd->dims = r;
-	const Common::Rect *wmprect = &_wmgrPort->rect;
+
+	// Clip window, if needed
+	Common::Rect wmprect = _wmgrPort->rect;
+	// Handle a special case for Dr. Brain 1 Mac. When hovering the mouse cursor
+	// over the status line on top, the game scripts try to draw the game's icon
+	// bar above the current port, by specifying a negative window top, so that
+	// the end result will be drawn 10 pixels above the current port. This is a
+	// hack by Sierra, and is only limited to user style windows. Normally, we
+	// should not clip, same as what Sierra does. However, this will result in
+	// having invalid rectangles with negative coordinates. For this reason, we
+	// adjust the containing rectangle instead.
+	if (pwnd->dims.top < 0 && g_sci->getPlatform() == Common::kPlatformMacintosh &&
+		(style & SCI_WINDOWMGR_STYLE_USER) && _wmgrPort->top + pwnd->dims.top >= 0) {
+		// Offset the final rect top by the requested pixels
+		wmprect.top += pwnd->dims.top;
+	}
+
 	int16 oldtop = pwnd->dims.top;
 	int16 oldleft = pwnd->dims.left;
-	if (wmprect->top > pwnd->dims.top)
-		pwnd->dims.moveTo(pwnd->dims.left, wmprect->top);
 
-	if (wmprect->bottom < pwnd->dims.bottom)
-		pwnd->dims.moveTo(pwnd->dims.left, wmprect->bottom - pwnd->dims.bottom + pwnd->dims.top);
+	if (wmprect.top > pwnd->dims.top)
+		pwnd->dims.moveTo(pwnd->dims.left, wmprect.top);
+
+	if (wmprect.bottom < pwnd->dims.bottom)
+		pwnd->dims.moveTo(pwnd->dims.left, wmprect.bottom - pwnd->dims.bottom + pwnd->dims.top);
 
-	if (wmprect->right < pwnd->dims.right)
-		pwnd->dims.moveTo(wmprect->right + pwnd->dims.left - pwnd->dims.right, pwnd->dims.top);
+	if (wmprect.right < pwnd->dims.right)
+		pwnd->dims.moveTo(wmprect.right + pwnd->dims.left - pwnd->dims.right, pwnd->dims.top);
 
-	if (wmprect->left > pwnd->dims.left)
-		pwnd->dims.moveTo(wmprect->left, pwnd->dims.top);
+	if (wmprect.left > pwnd->dims.left)
+		pwnd->dims.moveTo(wmprect.left, pwnd->dims.top);
 
 	pwnd->rect.moveTo(pwnd->rect.left + pwnd->dims.left - oldleft, pwnd->rect.top + pwnd->dims.top - oldtop);
+
 	if (restoreRect == 0)
 		pwnd->restoreRect = pwnd->dims;
 
+	if (pwnd->restoreRect.top < 0 && g_sci->getPlatform() == Common::kPlatformMacintosh &&
+		(style & SCI_WINDOWMGR_STYLE_USER) && _wmgrPort->top + pwnd->restoreRect.top >= 0) {
+		// Special case for Dr. Brain 1 Mac (check above), applied to the
+		// restore rectangle.
+		pwnd->restoreRect.moveTo(pwnd->restoreRect.left, wmprect.top);
+	}
+
 	if (draw)
 		drawWindow(pwnd);
 	setPort((Port *)pwnd);






More information about the Scummvm-git-logs mailing list