[Scummvm-cvs-logs] SF.net SVN: scummvm:[51994] scummvm/trunk/engines/sci

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Wed Aug 11 20:19:59 CEST 2010


Revision: 51994
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51994&view=rev
Author:   m_kiewitz
Date:     2010-08-11 18:19:58 +0000 (Wed, 11 Aug 2010)

Log Message:
-----------
SCI: fixing kGraphFillBoxAny implementation

working now like in sierra sci, when using priority/control - fixes pepper adventures in time - no failure screen - bug #3040185
cleanup of GfxPaint16::fillRect

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

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-08-11 17:33:36 UTC (rev 51993)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-08-11 18:19:58 UTC (rev 51994)
@@ -300,8 +300,8 @@
 	Common::Rect rect = getGraphRect(argv);
 	int16 colorMask = argv[4].toUint16();
 	int16 color = argv[5].toSint16();
-	int16 priority = (argc > 6) ? argv[6].toSint16() : -1;
-	int16 control = (argc > 7) ? argv[7].toSint16() : -1;
+	int16 priority = argv[6].toSint16(); // yes, we may read from stack sometimes here
+	int16 control = argv[7].toSint16(); // sierra did the same
 
 	g_sci->_gfxPaint16->kernelGraphFillBox(rect, colorMask, color, priority, control);
 	return s->r_acc;

Modified: scummvm/trunk/engines/sci/graphics/paint16.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-08-11 17:33:36 UTC (rev 51993)
+++ scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-08-11 18:19:58 UTC (rev 51994)
@@ -221,7 +221,7 @@
 	fillRect(rect, GFX_SCREEN_MASK_VISUAL, _ports->_curPort->penClr);
 }
 
-void GfxPaint16::fillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen, byte clrBack, byte bControl) {
+void GfxPaint16::fillRect(const Common::Rect &rect, int16 drawFlags, byte color, byte priority, byte control) {
 	Common::Rect r = rect;
 	r.clip(_ports->_curPort->rect);
 	if (r.isEmpty()) // nothing to fill
@@ -238,17 +238,17 @@
 			for (y = r.top; y < r.bottom; y++) {
 				for (x = r.left; x < r.right; x++) {
 					curVisual = _screen->getVisual(x, y);
-					if (curVisual == clrPen) {
-						_screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, clrBack, 0, 0);
-					} else if (curVisual == clrBack) {
-						_screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, clrPen, 0, 0);
+					if (curVisual == color) {
+						_screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, priority, 0, 0);
+					} else if (curVisual == priority) {
+						_screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, color, 0, 0);
 					}
 				}
 			}
-		} else { // just fill rect with ClrPen
+		} else { // just fill rect with color
 			for (y = r.top; y < r.bottom; y++) {
 				for (x = r.left; x < r.right; x++) {
-					_screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, clrPen, 0, 0);
+					_screen->putPixel(x, y, GFX_SCREEN_MASK_VISUAL, color, 0, 0);
 				}
 			}
 		}
@@ -258,10 +258,14 @@
 		return;
 	drawFlags &= GFX_SCREEN_MASK_PRIORITY|GFX_SCREEN_MASK_CONTROL;
 
+	// we need to isolate the bits, sierra sci saved priority and control inside one byte, we don't
+	priority &= 0x0f;
+	control &= 0x0f;
+
 	if (oldPenMode != 2) {
 		for (y = r.top; y < r.bottom; y++) {
 			for (x = r.left; x < r.right; x++) {
-				_screen->putPixel(x, y, drawFlags, 0, clrBack, bControl);
+				_screen->putPixel(x, y, drawFlags, 0, priority, control);
 			}
 		}
 	} else {

Modified: scummvm/trunk/engines/sci/graphics/paint16.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.h	2010-08-11 17:33:36 UTC (rev 51993)
+++ scummvm/trunk/engines/sci/graphics/paint16.h	2010-08-11 18:19:58 UTC (rev 51994)
@@ -62,7 +62,7 @@
 	void invertRectViaXOR(const Common::Rect &rect);
 	void eraseRect(const Common::Rect &rect);
 	void paintRect(const Common::Rect &rect);
-	void fillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen, byte clrBack = 0, byte bControl = 0);
+	void fillRect(const Common::Rect &rect, int16 drawFlags, byte color, byte priority = 0, byte control = 0);
 	void frameRect(const Common::Rect &rect);
 
 	void bitsShow(const Common::Rect &r);


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