[Scummvm-cvs-logs] SF.net SVN: scummvm:[53071] scummvm/trunk/engines/sci/graphics/cursor.cpp
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Fri Oct 8 14:41:04 CEST 2010
Revision: 53071
http://scummvm.svn.sourceforge.net/scummvm/?rev=53071&view=rev
Author: m_kiewitz
Date: 2010-10-08 12:41:03 +0000 (Fri, 08 Oct 2010)
Log Message:
-----------
SCI: fixing mag cursor as far as possible
added TODO for real proper implementation
at least the alignment and content shown is now correct
Modified Paths:
--------------
scummvm/trunk/engines/sci/graphics/cursor.cpp
Modified: scummvm/trunk/engines/sci/graphics/cursor.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/cursor.cpp 2010-10-08 12:31:54 UTC (rev 53070)
+++ scummvm/trunk/engines/sci/graphics/cursor.cpp 2010-10-08 12:41:03 UTC (rev 53071)
@@ -373,18 +373,38 @@
// Pic
const CelInfo *picCelInfo = _zoomPicView->getCelInfo(0, 0);
const byte *rawPicBitmap = _zoomPicView->getBitmap(0, 0);
- // Compute hotspot from xoffset/yoffset
+
+ // Compute hotspot of cursor
Common::Point cursorHotspot = Common::Point((cursorCelInfo->width >> 1) - cursorCelInfo->displaceX, cursorCelInfo->height - cursorCelInfo->displaceY - 1);
- uint16 targetX = CLIP<int>((mousePoint.x - _zoomZone.left) * _zoomMultiplier, 0, picCelInfo->width - cursorCelInfo->width);
- uint16 targetY = CLIP<int>((mousePoint.y - _zoomZone.top) * _zoomMultiplier, 0, picCelInfo->height - cursorCelInfo->height);
+ int16 targetX = ((mousePoint.x - _moveZone.left) * _zoomMultiplier);
+ int16 targetY = ((mousePoint.y - _moveZone.top) * _zoomMultiplier);
+ if (targetX < 0)
+ targetX = 0;
+ if (targetY < 0)
+ targetY = 0;
+ targetX -= cursorHotspot.x;
+ targetY -= cursorHotspot.y;
+
+ // Sierra SCI actually drew only within zoom area, thus removing the need to fill any other pixels with upmost/left
+ // color of the picture cel. This also made the cursor not appear on top of everything. They actually drew the
+ // cursor manually within kAnimate processing and used a hidden cursor for moving.
+ // TODO: we should also do this
+
// Replace the special magnifier color with the associated magnified pixels
for (int x = 0; x < cursorCelInfo->width; x++) {
for (int y = 0; y < cursorCelInfo->height; y++) {
int curPos = cursorCelInfo->width * y + x;
if (cursorBitmap[curPos] == _zoomColor) {
- _cursorSurface[curPos] = rawPicBitmap[picCelInfo->width * (targetY + y) + (targetX + x)];
+ int16 rawY = targetY + y;
+ int16 rawX = targetX + x;
+ if ((rawY >= 0) && (rawY < picCelInfo->height) && (rawX >= 0) && (rawX < picCelInfo->width)) {
+ int rawPos = picCelInfo->width * rawY + rawX;
+ _cursorSurface[curPos] = rawPicBitmap[rawPos];
+ } else {
+ _cursorSurface[curPos] = rawPicBitmap[0]; // use left and upmost pixel color
+ }
}
}
}
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