[Scummvm-cvs-logs] scummvm master -> 18a3f5c12592aadca684d256170f465a3d53ecd8

Tkachov Tkachov at users.noreply.github.com
Fri Aug 5 09:46:48 CEST 2016


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

Summary:
8fcc919b56 WAGE: Fix cursor
18a3f5c125 WAGE: Fix crash in Brownie's Dream


Commit: 8fcc919b565bb944a3ff87540715fefc8761cf89
    https://github.com/scummvm/scummvm/commit/8fcc919b565bb944a3ff87540715fefc8761cf89
Author: Alexander Tkachev (alexander at tkachov.ru)
Date: 2016-08-05T14:40:53+06:00

Commit Message:
WAGE: Fix cursor

It's now being clipped within window borders.

Changed paths:
    engines/wage/gui.cpp



diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 86c2a9b..212e75b 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -96,16 +96,22 @@ static void cursorTimerHandler(void *refCon) {
 
 	x += gui->_consoleWindow->getInnerDimensions().left;
 	y += gui->_consoleWindow->getInnerDimensions().top;
+	int h = kCursorHeight;
 
-	gui->_screen.vLine(x, y, y + kCursorHeight, gui->_cursorState ? kColorBlack : kColorWhite);
+	if (y + h > gui->_consoleWindow->getInnerDimensions().bottom) {
+		h = gui->_consoleWindow->getInnerDimensions().bottom - y;
+	}
+
+	if (h > 0)
+		gui->_screen.vLine(x, y, y + h, gui->_cursorState ? kColorBlack : kColorWhite);
 
 	if (!gui->_cursorOff)
 		gui->_cursorState = !gui->_cursorState;
 
 	gui->_cursorRect.left = x;
 	gui->_cursorRect.right = MIN<uint16>(x + 1, gui->_screen.w);
-	gui->_cursorRect.top = y;
-	gui->_cursorRect.bottom = MIN<uint16>(y + kCursorHeight, gui->_screen.h);
+	gui->_cursorRect.top = MIN<uint16>(y - 1, gui->_consoleWindow->getInnerDimensions().top);
+	gui->_cursorRect.bottom = MIN<uint16>(MIN<uint16>(y + h, gui->_screen.h), gui->_consoleWindow->getInnerDimensions().bottom);
 
 	gui->_cursorDirty = true;
 }


Commit: 18a3f5c12592aadca684d256170f465a3d53ecd8
    https://github.com/scummvm/scummvm/commit/18a3f5c12592aadca684d256170f465a3d53ecd8
Author: Alexander Tkachev (alexander at tkachov.ru)
Date: 2016-08-05T14:44:31+06:00

Commit Message:
WAGE: Fix crash in Brownie's Dream

I guess it would crash everywhere else as well, if console window would
be placed the same way. The problem is that console window goes off
screen a little in that game, but copyRectToScreen arguments are not
adjusted to stay within screen area.

This commit adds some checks and adjusts these arguments.

Changed paths:
    engines/wage/gui-console.cpp
    engines/wage/gui.cpp



diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index 2b364d3..2476a8c 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -306,7 +306,20 @@ void Gui::drawInput() {
 
 		font->drawString(&_screen, _out[_inputTextLineNum], x, y, _screen.w, kColorBlack);
 
-		g_system->copyRectToScreen(_screen.getBasePtr(x, y), _screen.pitch, x, y, _consoleWindow->getInnerDimensions().width(), font->getFontHeight());
+		int w = _consoleWindow->getInnerDimensions().width();
+		int h = font->getFontHeight();
+		if (x < 0) {
+			w += x;
+			x = 0;
+		}
+		if (y < 0) {
+			h += y;
+			y = 0;
+		}
+		if (x + w > _screen.w) w = _screen.w - x;
+		if (y + h > _screen.h) h = _screen.h - y;
+		if (w != 0 && h != 0)
+			g_system->copyRectToScreen(_screen.getBasePtr(x, y), _screen.pitch, x, y, w, h);
 	}
 
 	_cursorX = font->getStringWidth(_out[_inputTextLineNum]) + kConHPadding;
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 212e75b..cd259e6 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -220,8 +220,19 @@ void Gui::draw() {
 	_wm.draw();
 
 	if (_cursorDirty && _cursorRect.left < _screen.w && _cursorRect.bottom < _screen.h) {
-		g_system->copyRectToScreen(_screen.getBasePtr(_cursorRect.left, _cursorRect.top), _screen.pitch,
-				_cursorRect.left, _cursorRect.top, _cursorRect.width(), _cursorRect.height());
+		int x = _cursorRect.left, y = _cursorRect.top, w = _cursorRect.width(), h = _cursorRect.height();
+		if (x < 0) {
+			w += x;
+			x = 0;
+		}
+		if (y < 0) {
+			h += y;
+			y = 0;
+		}
+		if (x + w > _screen.w) w = _screen.w - x;
+		if (y + h > _screen.h) h = _screen.h - y;
+		if (w != 0 && h != 0)
+			g_system->copyRectToScreen(_screen.getBasePtr(x, y), _screen.pitch, x, y, w, h);
 
 		_cursorDirty = false;
 	}






More information about the Scummvm-git-logs mailing list