commit 36eb4f6fdf23746e0536283c9ad17d06d63f37df
Author: Willem Jan Palenstijn <wjp@usecode.org>
Date:   Mon May 15 21:53:05 2017 +0200

    SCI: Ignore priority and transparency for KQ6 hi-res views
    
    This fixes bug 9786. Thanks to m_kiewitz for verifying with disasm.

diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 91303be5a7..5a17cb8763 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -801,34 +801,7 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
 
 	const byte *bitmapData = bitmap.getUnsafeDataAt((clipRect.top - rect.top) * celWidth + (clipRect.left - rect.left), celWidth * (height - 1) + width);
 
-	if (!_EGAmapping) {
-		for (int y = 0; y < height; y++, bitmapData += celWidth) {
-			for (int x = 0; x < width; x++) {
-				const byte color = bitmapData[x];
-				if (color != clearKey) {
-					const int x2 = clipRectTranslated.left + x;
-					const int y2 = clipRectTranslated.top + y;
-					if (!upscaledHires) {
-						if (priority >= _screen->getPriority(x2, y2)) {
-							byte outputColor = palette->mapping[color];
-							// SCI16 remapping (QFG4 demo)
-							if (g_sci->_gfxRemap16 && g_sci->_gfxRemap16->isRemapped(outputColor))
-								outputColor = g_sci->_gfxRemap16->remapColor(outputColor, _screen->getVisual(x2, y2));
-							_screen->putPixel(x2, y2, drawMask, outputColor, priority, 0);
-						}
-					} else {
-						// UpscaledHires means view is hires and is supposed to
-						// get drawn onto lowres screen.
-						// FIXME(?): we can't read priority directly with the
-						// hires coordinates. May not be needed at all in kq6
-						// FIXME: Handle proper aspect ratio. Some GK1 hires images
-						// are in 640x400 instead of 640x480
-						_screen->putPixelOnDisplay(x2, y2, palette->mapping[color]);
-					}
-				}
-			}
-		}
-	} else {
+	if (_EGAmapping) {
 		const SciSpan<const byte> EGAmapping = _EGAmapping.subspan(EGAmappingNr * SCI_VIEW_EGAMAPPING_SIZE, SCI_VIEW_EGAMAPPING_SIZE);
 		for (int y = 0; y < height; y++, bitmapData += celWidth) {
 			for (int x = 0; x < width; x++) {
@@ -839,6 +812,36 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
 					_screen->putPixel(x2, y2, drawMask, color, priority, 0);
 			}
 		}
+	} else if (upscaledHires) {
+		for (int y = 0; y < height; y++, bitmapData += celWidth) {
+			for (int x = 0; x < width; x++) {
+				const byte color = bitmapData[x];
+				const int x2 = clipRectTranslated.left + x;
+				const int y2 = clipRectTranslated.top + y;
+				// UpscaledHires means view is hires and is supposed to
+				// get drawn onto lowres screen.
+				// FIXME: Handle proper aspect ratio. Some GK1 hires images
+				// are in 640x400 instead of 640x480
+				_screen->putPixelOnDisplay(x2, y2, palette->mapping[color]);
+			}
+		}
+	} else {
+		for (int y = 0; y < height; y++, bitmapData += celWidth) {
+			for (int x = 0; x < width; x++) {
+				const byte color = bitmapData[x];
+				if (color != clearKey) {
+					const int x2 = clipRectTranslated.left + x;
+					const int y2 = clipRectTranslated.top + y;
+					if (priority >= _screen->getPriority(x2, y2)) {
+						byte outputColor = palette->mapping[color];
+						// SCI16 remapping (QFG4 demo)
+						if (g_sci->_gfxRemap16 && g_sci->_gfxRemap16->isRemapped(outputColor))
+							outputColor = g_sci->_gfxRemap16->remapColor(outputColor, _screen->getVisual(x2, y2));
+						_screen->putPixel(x2, y2, drawMask, outputColor, priority, 0);
+					}
+				}
+			}
+		}
 	}
 }
 
