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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Oct 24 21:29:07 CEST 2009


Revision: 45362
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45362&view=rev
Author:   m_kiewitz
Date:     2009-10-24 19:29:06 +0000 (Sat, 24 Oct 2009)

Log Message:
-----------
SCI/newgui: support for EGA mapping in SCI1 games, fixes qfg2 character selection

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gui/gui_view.cpp
    scummvm/trunk/engines/sci/gui/gui_view.h

Modified: scummvm/trunk/engines/sci/gui/gui_view.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_view.cpp	2009-10-24 18:52:57 UTC (rev 45361)
+++ scummvm/trunk/engines/sci/gui/gui_view.cpp	2009-10-24 19:29:06 UTC (rev 45362)
@@ -71,8 +71,9 @@
 	byte seekEntry;
 	bool IsEGA = false;
 
+	_loopCount = 0;
 	_embeddedPal = false;
-	_loopCount = 0;
+	_EGAmapping = NULL;
 
 	switch (_resMan->getViewType()) {
 	case kViewEga: // View-format SCI0 (and Amiga 16 colors)
@@ -87,11 +88,17 @@
 		palOffset = READ_LE_UINT16(_resourceData + 6);
 
 		if (palOffset && palOffset != 0x100) {
-			// Some games also have an offset set. It seems that it points to a 16-byte mapping table
-			//  cels also work by not using it, so we dont.
+			// Some SCI0/SCI01 games also have an offset set. It seems that it points to a 16-byte mapping table
+			//  but on those games using that mapping will actually screw things up.
+			// On the other side: vga sci1 games have this pointing to a VGA palette
+			//  and ega sci1 games have this pointing to a 8x16 byte mapping table that needs to get applied then
 			if (!IsEGA) {
 				_palette->createFromData(&_resourceData[palOffset], &_viewPalette);
 				_embeddedPal = true;
+			} else {
+				// Only use the EGA-mapping, when being SCI1
+				if (getSciVersion() >= SCI_VERSION_1_EGA)
+					_EGAmapping = &_resourceData[palOffset];
 			}
 		}
 
@@ -425,7 +432,7 @@
 	}
 }
 
-void SciGuiView::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 paletteNo) {
+void SciGuiView::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 EGAmappingNr) {
 	GuiPalette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette;
 	sciViewCelInfo *celInfo = getCelInfo(loopNo, celNo);
 	byte *bitmap = getBitmap(loopNo, celNo);
@@ -446,12 +453,23 @@
 
 	bitmap += (clipRect.top - rect.top) * celWidth + (clipRect.left - rect.left);
 
-	for (y = clipRectTranslated.top; y < clipRectTranslated.top + height; y++, bitmap += celWidth) {
-		for (x = 0; x < width; x++) {
-			color = bitmap[x];
-			if (color != clearKey && priority >= _screen->getPriority(clipRectTranslated.left + x, y))
-				_screen->putPixel(clipRectTranslated.left + x, y, drawMask, palette->mapping[color], priority, 0);
+	if (!_EGAmapping) {
+		for (y = clipRectTranslated.top; y < clipRectTranslated.top + height; y++, bitmap += celWidth) {
+			for (x = 0; x < width; x++) {
+				color = bitmap[x];
+				if (color != clearKey && priority >= _screen->getPriority(clipRectTranslated.left + x, y))
+					_screen->putPixel(clipRectTranslated.left + x, y, drawMask, palette->mapping[color], priority, 0);
+			}
 		}
+	} else {
+		byte *EGAmapping = _EGAmapping + (EGAmappingNr * 16);
+		for (y = clipRectTranslated.top; y < clipRectTranslated.top + height; y++, bitmap += celWidth) {
+			for (x = 0; x < width; x++) {
+				color = EGAmapping[bitmap[x]];
+				if (color != clearKey && priority >= _screen->getPriority(clipRectTranslated.left + x, y))
+					_screen->putPixel(clipRectTranslated.left + x, y, drawMask, color, priority, 0);
+			}
+		}
 	}
 }
 

Modified: scummvm/trunk/engines/sci/gui/gui_view.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_view.h	2009-10-24 18:52:57 UTC (rev 45361)
+++ scummvm/trunk/engines/sci/gui/gui_view.h	2009-10-24 19:29:06 UTC (rev 45362)
@@ -57,7 +57,7 @@
 	sciViewLoopInfo *getLoopInfo(GuiViewLoopNo loopNo);
 	void getCelRect(GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect);
 	byte *getBitmap(GuiViewLoopNo loopNo, GuiViewCelNo celNo);
-	void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 paletteNo);
+	void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, GuiViewLoopNo loopNo, GuiViewCelNo celNo, byte priority, uint16 EGAmappingNr);
 	uint16 getLoopCount() const { return _loopCount; }
 	uint16 getCelCount(GuiViewLoopNo loopNo) { return _loop[loopNo].celCount; }
 	GuiPalette *getPalette();
@@ -79,6 +79,8 @@
 	sciViewLoopInfo *_loop;
 	bool _embeddedPal;
 	GuiPalette _viewPalette;
+
+	byte *_EGAmapping;
 };
 
 } // 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