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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Mon Jan 25 21:44:13 CET 2010


Revision: 47560
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47560&view=rev
Author:   m_kiewitz
Date:     2010-01-25 20:44:13 +0000 (Mon, 25 Jan 2010)

Log Message:
-----------
SCI: removed EGA mapping for amiga games, cause changing K_GRAPH_GET_COLORS_NR to support amiga also fixes it - also fixes other odd issues like the ones in kq5 and castle of dr. brain/sq1 (thx. to waltervn for finding this out)

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

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-01-25 19:13:25 UTC (rev 47559)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-01-25 20:44:13 UTC (rev 47560)
@@ -223,7 +223,9 @@
 
 	switch (argv[0].toSint16()) {
 	case K_GRAPH_GET_COLORS_NR:
-		return make_reg(0, !s->resMan->isVGA() ? 0x10 : 0x100);
+		if (s->resMan->isAmiga32color())
+			return make_reg(0, 32);
+		return make_reg(0, !s->resMan->isVGA() ? 16 : 256);
 		break;
 
 	case K_GRAPH_DRAW_LINE:

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-01-25 19:13:25 UTC (rev 47559)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-01-25 20:44:13 UTC (rev 47560)
@@ -176,11 +176,6 @@
 reg_t SciGui::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) {
 	Window *wnd = NULL;
 
-	if (_s->resMan->isAmiga32color()) {
-		colorPen = _palette->mapAmigaColor(colorPen);
-		colorBack = _palette->mapAmigaColor(colorBack);
-	}
-
 	if (restoreRect.top != 0 && restoreRect.left != 0 && restoreRect.height() != 0 && restoreRect.width() != 0)
 		wnd = _windowMgr->NewWindow(dims, &restoreRect, title, style, priority, false);
 	else
@@ -237,15 +232,11 @@
 			break;
 		case SCI_DISPLAY_SETPENCOLOR:
 			colorPen = argv[0].toUint16();
-			if (_s->resMan->isAmiga32color())
-				colorPen = _palette->mapAmigaColor(colorPen);
 			_gfx->PenColor(colorPen);
 			argc--; argv++;
 			break;
 		case SCI_DISPLAY_SETBACKGROUNDCOLOR:
 			colorBack = argv[0].toUint16();
-			if (_s->resMan->isAmiga32color())
-				colorBack = _palette->mapAmigaColor(colorBack);
 			argc--; argv++;
 			break;
 		case SCI_DISPLAY_SETGREYEDOUTPUT:
@@ -324,11 +315,6 @@
 void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) {
 	Port *oldPort = _gfx->SetPort(_gfx->_menuPort);
 
-	if (_s->resMan->isAmiga32color()) {
-		colorPen = _palette->mapAmigaColor(colorPen);
-		colorBack = _palette->mapAmigaColor(colorBack);
-	}
-
 	_gfx->FillRect(_gfx->_menuBarRect, 1, colorBack);
 	_gfx->PenColor(colorPen);
 	_gfx->MoveTo(0, 1);
@@ -506,23 +492,17 @@
 }
 
 void SciGui::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) {
-	if (_s->resMan->isAmiga32color())
-		color = _palette->mapAmigaColor(color);
 	_gfx->FillRect(rect, colorMask, color, priority, control);
 }
 
 void SciGui::graphFrameBox(Common::Rect rect, int16 color) {
 	int16 oldColor = _gfx->GetPort()->penClr;
-	if (_s->resMan->isAmiga32color())
-		color = _palette->mapAmigaColor(color);
 	_gfx->PenColor(color);
 	_gfx->FrameRect(rect);
 	_gfx->PenColor(oldColor);
 }
 
 void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
-	if (_s->resMan->isAmiga32color())
-		color = _palette->mapAmigaColor(color);
 	_gfx->OffsetLine(startPoint, endPoint);
 	_screen->drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);
 }

Modified: scummvm/trunk/engines/sci/graphics/palette.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/palette.cpp	2010-01-25 19:13:25 UTC (rev 47559)
+++ scummvm/trunk/engines/sci/graphics/palette.cpp	2010-01-25 20:44:13 UTC (rev 47560)
@@ -53,8 +53,6 @@
 	_sysPalette.colors[255].g = 255;
 	_sysPalette.colors[255].b = 255;
 
-	memset(&_amigaEGAtable, 0, sizeof(_amigaEGAtable));
-
 	if (autoSetPalette) {
 		if (_resMan->getViewType() == kViewEga)
 			setEGA();
@@ -153,24 +151,11 @@
 		file.close();
 		// Directly set the palette, because setOnScreen() wont do a thing for amiga
 		_screen->setPalette(&_sysPalette);
-
-		// Create EGA to amiga table
-		for (curColor = 1; curColor < 16; curColor++) {
-			_amigaEGAtable[curColor] = matchColor(&_sysPalette, EGApalette[curColor][0], EGApalette[curColor][1], EGApalette[curColor][2]);
-		}
 		return true;
 	}
 	return false;
 }
 
-// On amiga the scripts send us an EGA color, we need to match it to the active amiga palette
-int16 SciPalette::mapAmigaColor(int16 color) {
-	// TODO: not sure what pq3 means by using color 31
-	if (color > 15)
-		return color;
-	return _amigaEGAtable[color];
-}
-
 // Called from picture class, some amiga sci1 games set half of the palette
 void SciPalette::modifyAmigaPalette(byte *data) {
 	int16 curColor, curPos = 0;
@@ -183,7 +168,6 @@
 		_sysPalette.colors[curColor].b = (byte2 & 0x0F) * 0x11;
 	}
 	_screen->setPalette(&_sysPalette);
-	// TODO: when games do this it seems the EGAmapping isnt used anymore, at least the colors are wrong in any case
 }
 
 void SciPalette::setEGA() {

Modified: scummvm/trunk/engines/sci/graphics/palette.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/palette.h	2010-01-25 19:13:25 UTC (rev 47559)
+++ scummvm/trunk/engines/sci/graphics/palette.h	2010-01-25 20:44:13 UTC (rev 47560)
@@ -38,7 +38,6 @@
 
 	void createFromData(byte *data, Palette *paletteOut);
 	bool setAmiga();
-	int16 mapAmigaColor(int16 color);
 	void modifyAmigaPalette(byte *data);
 	void setEGA();
 	bool setFromResource(GuiResourceId resourceId, uint16 flag);
@@ -61,8 +60,6 @@
 	ResourceManager *_resMan;
 
 	Common::Array<PalSchedule> _schedules;
-
-	byte _amigaEGAtable[16];
 };
 
 } // End of namespace Sci


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