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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Oct 25 21:46:15 CET 2009


Revision: 45377
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45377&view=rev
Author:   m_kiewitz
Date:     2009-10-25 20:46:14 +0000 (Sun, 25 Oct 2009)

Log Message:
-----------
SCI/newgui: SciGuiView is now able to detect "straight" EGA mappings and will then ignore the mapping. This will result in undithering working for those views. All EGA-mapping views in qfg2 seem to be special fx related so they dont need undithering at all

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-25 20:12:12 UTC (rev 45376)
+++ scummvm/trunk/engines/sci/gui/gui_view.cpp	2009-10-25 20:46:14 UTC (rev 45377)
@@ -52,6 +52,10 @@
 	_resMan->unlockResource(_resource);
 }
 
+static const byte EGAmappingStraight[SCI_VIEW_EGAMAPPING_SIZE] = {
+	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+};
+
 void SciGuiView::initData(GuiResourceId resourceId) {
 	_resource = _resMan->findResource(ResourceId(kResourceTypeView, resourceId), true);
 	if (!_resource) {
@@ -67,7 +71,7 @@
 	uint16 palOffset = 0;
 	uint16 headerSize = 0;
 	uint16 loopSize = 0, celSize = 0;
-	int loopNo, celNo;
+	int loopNo, celNo, EGAmapNr;
 	byte seekEntry;
 	bool IsEGA = false;
 
@@ -97,8 +101,19 @@
 				_embeddedPal = true;
 			} else {
 				// Only use the EGA-mapping, when being SCI1
-				if (getSciVersion() >= SCI_VERSION_1_EGA)
+				if (getSciVersion() >= SCI_VERSION_1_EGA) {
 					_EGAmapping = &_resourceData[palOffset];
+					for (EGAmapNr = 0; EGAmapNr < SCI_VIEW_EGAMAPPING_COUNT; EGAmapNr++) {
+						if (memcmp(_EGAmapping, EGAmappingStraight, SCI_VIEW_EGAMAPPING_SIZE)!=0)
+							break;
+						_EGAmapping += SCI_VIEW_EGAMAPPING_SIZE;
+					}
+					// If all mappings are "straight", then we actually ignore the mapping
+					if (EGAmapNr == SCI_VIEW_EGAMAPPING_COUNT)
+						_EGAmapping = NULL;
+					else
+						_EGAmapping = &_resourceData[palOffset];
+				}
 			}
 		}
 
@@ -373,7 +388,7 @@
 	// Makes no sense to process bitmaps that are 3 pixels wide or less
 	if (width <= 3) return;
 
-	// TODO: Implement ability to undither bitmaps when EGAmappings are set (qfg2)
+	// If EGA mapping is used for this view, dont do undithering as well
 	if (_EGAmapping)
 		return;
 
@@ -466,7 +481,7 @@
 			}
 		}
 	} else {
-		byte *EGAmapping = _EGAmapping + (EGAmappingNr * 16);
+		byte *EGAmapping = _EGAmapping + (EGAmappingNr * SCI_VIEW_EGAMAPPING_SIZE);
 		for (y = clipRectTranslated.top; y < clipRectTranslated.top + height; y++, bitmap += celWidth) {
 			for (x = 0; x < width; x++) {
 				color = EGAmapping[bitmap[x]];

Modified: scummvm/trunk/engines/sci/gui/gui_view.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_view.h	2009-10-25 20:12:12 UTC (rev 45376)
+++ scummvm/trunk/engines/sci/gui/gui_view.h	2009-10-25 20:46:14 UTC (rev 45377)
@@ -45,6 +45,9 @@
 	sciViewCelInfo *cel;
 };
 
+#define SCI_VIEW_EGAMAPPING_SIZE 16
+#define SCI_VIEW_EGAMAPPING_COUNT 8
+
 class SciGuiView {
 public:
 	SciGuiView(ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette, GuiResourceId resourceId);


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