[Scummvm-cvs-logs] SF.net SVN: scummvm:[44984] scummvm/trunk/engines/sci/engine/kgraphics.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Mon Oct 12 14:38:58 CEST 2009


Revision: 44984
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44984&view=rev
Author:   m_kiewitz
Date:     2009-10-12 12:38:58 +0000 (Mon, 12 Oct 2009)

Log Message:
-----------
SCI: kGraph now fixes up coordinates before constructing a rect (invalid rects are given to us by castle of dr. brain right at the 2nd screen when entering left door)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kgraphics.cpp

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-12 12:15:27 UTC (rev 44983)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-12 12:38:58 UTC (rev 44984)
@@ -585,8 +585,14 @@
 	return make_reg(0, s->_gui->picNotValid(newPicNotValid));
 }
 
+void kGraphCreateRect(int16 x, int16 y, int16 x1, int16 y1, Common::Rect *destRect) {
+	if (x > x1) SWAP(x, x1);
+	if (y > y1) SWAP(y, y1);
+	*destRect = Common::Rect(x, y, x1, y1);
+}
+
 reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
-	int x = 0, y = 0, x1 = 0, y1 = 0;
+	int16 x = 0, y = 0, x1 = 0, y1 = 0;
 	uint16 flags;
 	int16 priority, control, color, colorMask;
 	Common::Rect rect;
@@ -620,7 +626,7 @@
 		break;
 
 	case K_GRAPH_SAVE_BOX:
-		rect = Common::Rect(x, y, x1, y1);
+		kGraphCreateRect(x, y, x1, y1, &rect);
 		flags = (argc > 5) ? argv[5].toUint16() : 0;
 		return s->_gui->graphSaveBox(rect, flags);
 		break;
@@ -630,12 +636,12 @@
 		break;
 
 	case K_GRAPH_FILL_BOX_BACKGROUND:
-		rect = Common::Rect(x, y, x1, y1);
+		kGraphCreateRect(x, y, x1, y1, &rect);
 		s->_gui->graphFillBoxBackground(rect);
 		break;
 
 	case K_GRAPH_FILL_BOX_FOREGROUND:
-		rect = Common::Rect(x, y, x1, y1);
+		kGraphCreateRect(x, y, x1, y1, &rect);
 		s->_gui->graphFillBoxForeground(rect);
 		break;
 
@@ -650,14 +656,14 @@
 		break;
 
 	case K_GRAPH_UPDATE_BOX: {
-		rect = Common::Rect(x, y, x1, y1);
+		kGraphCreateRect(x, y, x1, y1, &rect);
 		s->_gui->graphUpdateBox(rect);
 		break;
 	}
 	break;
 
 	case K_GRAPH_REDRAW_BOX: {
-		rect = Common::Rect(x, y, x1, y1);
+		kGraphCreateRect(x, y, x1, y1, &rect);
 		s->_gui->graphRedrawBox(rect);
 		break;
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list