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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Jan 23 12:00:24 CET 2010


Revision: 47462
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47462&view=rev
Author:   m_kiewitz
Date:     2010-01-23 11:00:24 +0000 (Sat, 23 Jan 2010)

Log Message:
-----------
SCI: separate fix function for kDrawControl rects

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

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-01-23 03:09:29 UTC (rev 47461)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-01-23 11:00:24 UTC (rev 47462)
@@ -185,14 +185,6 @@
 }
 
 Common::Rect kGraphCreateRect(int16 x, int16 y, int16 x1, int16 y1) {
-	// TODO: find out what to do when just one coordinate is wrong - if we should fix it the same way as in jones
-	//        needs some serious work
-	if ((x > x1) && (y > y1)) {
-		// We get this in jones when challenging jones -> upper left is right, lower right is 0, 0
-		//  If we "fix this" we will draw a box that isnt supposed to be there and also draw the button to the wrong
-		//  space
-		return Common::Rect(x, y, x, y);
-	}
 	if (x > x1) SWAP(x, x1);
 	if (y > y1) SWAP(y, y1);
 	return Common::Rect(x, y, x1, y1);
@@ -700,6 +692,14 @@
 	return s->r_acc;
 }
 
+// Original top-left must stay on kControl rects, we adjust accordingly because sierra sci actually wont draw rects that
+//  are upside down (example: jones, when challenging jones - one button is a duplicate and also has lower-right which is 0, 0)
+Common::Rect kControlCreateRect(int16 x, int16 y, int16 x1, int16 y1) {
+	if (x > x1) x1 = x;
+	if (y > y1) y1 = y;
+	return Common::Rect(x, y, x1, y1);
+}
+
 void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
 	int16 type = GET_SEL32V(s->_segMan, controlObject, type);
 	int16 style = GET_SEL32V(s->_segMan, controlObject, state);
@@ -721,7 +721,7 @@
 	const char **listEntries = NULL;
 	bool isAlias = false;
 
-	rect = kGraphCreateRect(x, y, GET_SEL32V(s->_segMan, controlObject, nsRight), GET_SEL32V(s->_segMan, controlObject, nsBottom));
+	rect = kControlCreateRect(x, y, GET_SEL32V(s->_segMan, controlObject, nsRight), GET_SEL32V(s->_segMan, controlObject, nsBottom));
 
 	if (!textReference.isNull())
 		text = s->_segMan->getString(textReference);


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