Skip to content

Commit

Permalink
SCI: Ignore priority and transparency for KQ6 hi-res views
Browse files Browse the repository at this point in the history
This fixes bug 9786. Thanks to m_kiewitz for verifying with disasm.
  • Loading branch information
wjp committed May 15, 2017
1 parent 5c31db0 commit 388419c
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions engines/sci/graphics/view.cpp
Expand Up @@ -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++) {
Expand All @@ -839,6 +812,34 @@ void GfxView::draw(const Common::Rect &rect, const Common::Rect &clipRect, const
_screen->putPixel(x2, y2, drawMask, color, priority, 0);
}
}
} else if (upscaledHires) {
// UpscaledHires means view is hires and is supposed to
// get drawn onto lowres screen.
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;
_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);
}
}
}
}
}
}

Expand Down

0 comments on commit 388419c

Please sign in to comment.