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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Apr 25 22:48:59 CEST 2010


Revision: 48799
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48799&view=rev
Author:   m_kiewitz
Date:     2010-04-25 20:48:59 +0000 (Sun, 25 Apr 2010)

Log Message:
-----------
SCI: green buttons for sci0early implemented

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

Modified: scummvm/trunk/engines/sci/graphics/controls.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/controls.cpp	2010-04-25 19:49:10 UTC (rev 48798)
+++ scummvm/trunk/engines/sci/graphics/controls.cpp	2010-04-25 20:48:59 UTC (rev 48799)
@@ -251,7 +251,15 @@
 }
 
 void GfxControls::kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite) {
+	int16 sci0EarlyPen, sci0EarlyBack;
 	if (!hilite) {
+		if (getSciVersion() == SCI_VERSION_0_EARLY) {
+			// SCI0early actually used hardcoded green/black buttons instead of using the port colors
+			sci0EarlyPen = _ports->_curPort->penClr;
+			sci0EarlyBack = _ports->_curPort->backClr;
+			_ports->penColor(0);
+			_ports->backColor(2);
+		}
 		rect.grow(1);
 		_paint16->eraseRect(rect);
 		_paint16->frameRect(rect);
@@ -266,8 +274,16 @@
 			rect.grow(1);
 			_paint16->bitsShow(rect);
 		}
+		if (getSciVersion() == SCI_VERSION_0_EARLY) {
+			_ports->penColor(sci0EarlyPen);
+			_ports->backColor(sci0EarlyBack);
+		}
 	} else {
-		_paint16->invertRect(rect);
+		// SCI0early used xor to invert button rectangles resulting in pink/white buttons
+		if (getSciVersion() == SCI_VERSION_0_EARLY)
+			_paint16->invertRectViaXOR(rect);
+		else
+			_paint16->invertRect(rect);
 		_paint16->bitsShow(rect);
 	}
 }

Modified: scummvm/trunk/engines/sci/graphics/paint16.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-04-25 19:49:10 UTC (rev 48798)
+++ scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-04-25 20:48:59 UTC (rev 48799)
@@ -182,6 +182,25 @@
 	_ports->_curPort->penMode = oldpenmode;
 }
 
+// used in SCI0early exclusively
+void GfxPaint16::invertRectViaXOR(const Common::Rect &rect) {
+	Common::Rect r = rect;
+	int16 x, y;
+	byte curVisual;
+
+	r.clip(_ports->_curPort->rect);
+	if (r.isEmpty()) // nothing to invert
+		return;
+
+	_ports->offsetRect(r);
+	for (y = r.top; y < r.bottom; y++) {
+		for (x = r.left; x < r.right; x++) {
+			curVisual = _screen->getVisual(x, y);
+			_screen->putPixel(x, y, SCI_SCREEN_MASK_VISUAL, curVisual ^ 0x0f, 0, 0);
+		}
+	}
+}
+
 void GfxPaint16::eraseRect(const Common::Rect &rect) {
 	fillRect(rect, SCI_SCREEN_MASK_VISUAL, _ports->_curPort->backClr);
 }

Modified: scummvm/trunk/engines/sci/graphics/paint16.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.h	2010-04-25 19:49:10 UTC (rev 48798)
+++ scummvm/trunk/engines/sci/graphics/paint16.h	2010-04-25 20:48:59 UTC (rev 48799)
@@ -60,6 +60,7 @@
 
 	void clearScreen(byte color = 255);
 	void invertRect(const Common::Rect &rect);
+	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);


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