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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Mon Oct 5 23:39:01 CEST 2009


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

Log Message:
-----------
SCI/newgui: changed the way dithering works on ega games, also default value change for kDrawStatus

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kmenu.cpp
    scummvm/trunk/engines/sci/gui/gui.cpp
    scummvm/trunk/engines/sci/gui/gui_gfx.cpp
    scummvm/trunk/engines/sci/gui/gui_picture.cpp
    scummvm/trunk/engines/sci/gui/gui_screen.cpp
    scummvm/trunk/engines/sci/gui/gui_screen.h
    scummvm/trunk/engines/sci/gui/gui_view.cpp

Modified: scummvm/trunk/engines/sci/engine/kmenu.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-10-05 20:46:19 UTC (rev 44678)
+++ scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-10-05 21:38:51 UTC (rev 44679)
@@ -69,7 +69,7 @@
 	reg_t textReference = argv[0];
 	Common::String text;
 	int16 colorPen = (argc > 1) ? argv[1].toSint16() : 0; // old code was: s->status_bar_foreground;
-	int16 colorBack = (argc > 2) ? argv[2].toSint16() : 255; // s->status_bar_background;
+	int16 colorBack = (argc > 2) ? argv[2].toSint16() : s->resMan->isVGA() ? 255 : 15; // s->status_bar_background;
 
 	if (!textReference.isNull()) {
 		// Sometimes this is called without giving text, if thats the case dont process it
@@ -80,7 +80,6 @@
 	return s->r_acc;
 }
 
-
 reg_t kDrawMenuBar(EngineState *s, int argc, reg_t *argv) {
 	if (argv[0].toSint16())
 		sciw_set_menubar(s, s->titlebar_port, s->_menubar, -1);

Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-05 20:46:19 UTC (rev 44678)
+++ scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-05 21:38:51 UTC (rev 44679)
@@ -107,11 +107,6 @@
 reg_t SciGui::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) {
 	GuiWindow *wnd = NULL;
 
-	if (!_s->resMan->isVGA()) {
-		colorPen |= (colorPen << 4);
-		colorBack |= (colorBack << 4);
-	}
-
 	if (restoreRect.top != 0 && restoreRect.left != 0 && restoreRect.height() != 0 && restoreRect.width() != 0)
 		wnd = _windowMgr->NewWindow(dims, &restoreRect, title, style, priority, false);
 	else
@@ -197,8 +192,6 @@
 			break;
 		}
 	}
-	if (!_s->resMan->isVGA())
-		bgcolor |= (bgcolor << 4);
 
 	// now drawing the text
 	_gfx->TextSize(rect, text, -1, width);
@@ -241,11 +234,6 @@
 void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) {
 	GuiPort *oldPort = _gfx->SetPort(_gfx->_menuPort);
 
-	if (!_s->resMan->isVGA()) {
-		colorPen |= colorPen << 4;
-		colorBack |= colorBack << 4;
-	}
-
 	_gfx->FillRect(_gfx->_menuRect, 1, colorBack);
 	_gfx->PenColor(colorPen);
 	_gfx->MoveTo(0, 1);
@@ -323,15 +311,11 @@
 }
 
 void SciGui::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) {
-	if (!_s->resMan->isVGA())
-		color |= (color << 4);
 	_gfx->FillRect(rect, colorMask, color, priority, control);
 	_screen->copyToScreen();
 }
 
 void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
-	if (!_s->resMan->isVGA())
-		color |= (color << 4);
 	_gfx->Draw_Line(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);
 	_screen->copyToScreen();
 }

Modified: scummvm/trunk/engines/sci/gui/gui_gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_gfx.cpp	2009-10-05 20:46:19 UTC (rev 44678)
+++ scummvm/trunk/engines/sci/gui/gui_gfx.cpp	2009-10-05 21:38:51 UTC (rev 44679)
@@ -383,10 +383,7 @@
 }
 
 void SciGuiGfx::PenColor(int16 color) {
-	if (!_s->resMan->isVGA())
-		_curPort->penClr = color;
-	else
-		_curPort->penClr = color | (color << 4);
+	_curPort->penClr = color;
 }
 
 void SciGuiGfx::PenMode(int16 mode) {
@@ -1183,15 +1180,8 @@
 	byte t_con = _screen->getControl(p.x, p.y);
 	int16 w, e, a_set, b_set;
 	// if in 1st point priority,control or color is already set to target, clear the flag
-	if (!_s->resMan->isVGA()) {
-		// EGA 16 colors
-		if (flag & 1 && ((t_col == (color & 0x0F)) || (t_col == (color >> 4))))
-			flag ^= 1;
-	} else {
-		// VGA 256 colors
-		if (flag & 1 && t_col == color)
-			flag ^= 1;
-	}
+	if (flag & 1 && t_col == color)
+		flag ^= 1;
 	if (flag & 2 && t_pri == prio)
 		flag ^= 2;
 	if (flag & 4 && t_con == control)

Modified: scummvm/trunk/engines/sci/gui/gui_picture.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-10-05 20:46:19 UTC (rev 44678)
+++ scummvm/trunk/engines/sci/gui/gui_picture.cpp	2009-10-05 21:38:51 UTC (rev 44679)
@@ -501,6 +501,10 @@
 			break;
 		case PIC_OP_TERMINATE:
 			_priority = pic_priority;
+			// Dithering EGA pictures
+			if (isEGA) {
+				_screen->dither();
+			}
 			return;
 		default:
 			error("Unsupported pic-operation %X", pic_op);

Modified: scummvm/trunk/engines/sci/gui/gui_screen.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-05 20:46:19 UTC (rev 44678)
+++ scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-05 21:38:51 UTC (rev 44679)
@@ -90,10 +90,6 @@
 	int offset = _baseTable[y] + x;
 
 	if (drawMask & SCI_SCREEN_MASK_VISUAL) {
-		if (!_s->resMan->isVGA()) {
-			// EGA output (16 colors, dithered)
-			color = ((x^y) & 1) ? color >> 4 : color & 0x0F;
-		}
 		*(_visualScreen + offset) = color;
 		_displayScreen[_baseDisplayTable[y] + x] = color;
 	}
@@ -198,4 +194,20 @@
 	}
 }
 
+// Currently not really done, its supposed to be possible to only dither _visualScreen
+void SciGuiScreen::dither() {
+	int y, x;
+	byte color;
+	byte *screenPtr = _visualScreen;
+	byte *displayPtr = _displayScreen;
+
+	for (y = 0; y < _height; y++) {
+		for (x = 0; x < _width; x++) {
+			color = *screenPtr;
+			color = ((x^y) & 1) ? color >> 4 : color & 0x0F;
+			*screenPtr++ = color; *displayPtr++ = color;
+		}
+	}
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/gui/gui_screen.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.h	2009-10-05 20:46:19 UTC (rev 44678)
+++ scummvm/trunk/engines/sci/gui/gui_screen.h	2009-10-05 21:38:51 UTC (rev 44679)
@@ -59,6 +59,8 @@
 	void saveBits(Common::Rect rect, byte mask, byte *memoryPtr);
 	void restoreBits(byte *memoryPtr);
 
+	void dither();
+
 	GuiPalette _sysPalette;
 
 	uint16 _width;

Modified: scummvm/trunk/engines/sci/gui/gui_view.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_view.cpp	2009-10-05 20:46:19 UTC (rev 44678)
+++ scummvm/trunk/engines/sci/gui/gui_view.cpp	2009-10-05 21:38:51 UTC (rev 44679)
@@ -111,12 +111,11 @@
 				cel->height = READ_LE_UINT16(celData + 2);
 				cel->displaceX = celData[4];
 				cel->displaceY = celData[5];
+				cel->clearKey = celData[6];
 				if (IsEGA) {
-					cel->clearKey = celData[6] | celData[6] << 4;
 					cel->offsetEGA = celOffset + 7;
 					cel->offsetRLE = 0;
 				} else {
-					cel->clearKey = celData[6];
 					cel->offsetEGA = 0;
 					cel->offsetRLE = celOffset + 8;
 				}
@@ -245,7 +244,7 @@
 			byte = *literalPtr++;
 			runLength = byte >> 4;
 			byte = _EGAMapping[byte & 0x0F];
-			memset(outPtr + pixelNo, byte | byte << 4, MIN<uint16>(runLength, pixelCount - pixelNo));
+			memset(outPtr + pixelNo, byte, MIN<uint16>(runLength, pixelCount - pixelNo));
 			pixelNo += runLength;
 		}
 		return;


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