From 5e472b1ba22a26d6cc54b9b07f20ad45cd47a89e Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Mon, 19 Apr 2010 16:36:47 +0000 Subject: SCI: added upscaling for shape cursors in upscaled hires games (will make the cursor "normal" sized in japanese sci01 games) svn-id: r48720 --- engines/sci/graphics/cursor.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp index 13968974f0..bbfa079253 100644 --- a/engines/sci/graphics/cursor.cpp +++ b/engines/sci/graphics/cursor.cpp @@ -92,6 +92,7 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) { int16 maskA, maskB; byte *pOut; byte *rawBitmap = new byte[SCI_CURSOR_SCI0_HEIGHTWIDTH * SCI_CURSOR_SCI0_HEIGHTWIDTH]; + int16 heightWidth; if (resourceId == -1) { // no resourceId given, so we actually hide the cursor @@ -135,7 +136,20 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) { } } - CursorMan.replaceCursor(rawBitmap, SCI_CURSOR_SCI0_HEIGHTWIDTH, SCI_CURSOR_SCI0_HEIGHTWIDTH, hotspot.x, hotspot.y, SCI_CURSOR_SCI0_TRANSPARENCYCOLOR); + heightWidth = SCI_CURSOR_SCI0_HEIGHTWIDTH; + + if (_upscaledHires) { + // Scale cursor by 2x + heightWidth *= 2; + hotspot.x *= 2; + hotspot.y *= 2; + byte *upscaledBitmap = new byte[heightWidth * heightWidth]; + _screen->scale2x(rawBitmap, upscaledBitmap, SCI_CURSOR_SCI0_HEIGHTWIDTH, SCI_CURSOR_SCI0_HEIGHTWIDTH); + delete[] rawBitmap; + rawBitmap = upscaledBitmap; + } + + CursorMan.replaceCursor(rawBitmap, heightWidth, heightWidth, hotspot.x, hotspot.y, SCI_CURSOR_SCI0_TRANSPARENCYCOLOR); kernelShow(); delete[] rawBitmap; @@ -155,6 +169,8 @@ void GfxCursor::kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Co int16 height = celInfo->height; byte clearKey = celInfo->clearKey; Common::Point *cursorHotspot = hotspot; + byte *cursorBitmap; + if (!cursorHotspot) // Compute hotspot from xoffset/yoffset cursorHotspot = new Common::Point((celInfo->width >> 1) - celInfo->displaceX, celInfo->height - celInfo->displaceY - 1); @@ -166,8 +182,6 @@ void GfxCursor::kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Co return; } - byte *cursorBitmap = cursorView->getBitmap(loopNum, celNum); - if (_upscaledHires) { // Scale cursor by 2x width *= 2; @@ -176,6 +190,8 @@ void GfxCursor::kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Co cursorHotspot->y *= 2; cursorBitmap = new byte[width * height]; _screen->scale2x(celInfo->rawBitmap, cursorBitmap, celInfo->width, celInfo->height); + } else { + cursorBitmap = cursorView->getBitmap(loopNum, celNum); } CursorMan.replaceCursor(cursorBitmap, width, height, cursorHotspot->x, cursorHotspot->y, clearKey); -- cgit v1.2.3