aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/cursor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/graphics/cursor.cpp')
-rw-r--r--engines/sci/graphics/cursor.cpp53
1 files changed, 47 insertions, 6 deletions
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index 50da48aaf3..52a5961070 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -59,10 +59,16 @@ GfxCursor::GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *sc
_zoomColor = 0;
_zoomMultiplier = 0;
_cursorSurface = 0;
+
if (g_sci && g_sci->getGameId() == GID_KQ6 && g_sci->getPlatform() == Common::kPlatformWindows)
_useOriginalKQ6WinCursors = ConfMan.getBool("windows_cursors");
else
_useOriginalKQ6WinCursors = false;
+
+ if (g_sci && g_sci->getGameId() == GID_SQ4 && getSciVersion() == SCI_VERSION_1_1)
+ _useSilverSQ4CDCursors = ConfMan.getBool("silver_cursors");
+ else
+ _useSilverSQ4CDCursors = false;
}
GfxCursor::~GfxCursor() {
@@ -125,18 +131,28 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) {
error("cursor resource %d has invalid size", resourceId);
resourceData = resource->data;
- // hotspot is specified for SCI1 cursors
- hotspot.x = READ_LE_UINT16(resourceData);
- hotspot.y = READ_LE_UINT16(resourceData + 2);
- // bit 0 of resourceData[3] is set on <SCI1 games, which means center hotspot
- if ((hotspot.x == 0) && (hotspot.y == 256))
- hotspot.x = hotspot.y = SCI_CURSOR_SCI0_HEIGHTWIDTH / 2;
+
+ if (getSciVersion() <= SCI_VERSION_0_LATE) {
+ // SCI0 cursors contain hotspot flags, not actual hotspot coordinates.
+ // If bit 0 of resourceData[3] is set, the hotspot should be centered,
+ // otherwise it's in the top left of the mouse cursor.
+ hotspot.x = hotspot.y = resourceData[3] ? SCI_CURSOR_SCI0_HEIGHTWIDTH / 2 : 0;
+ } else {
+ // Cursors in newer SCI versions contain actual hotspot coordinates.
+ hotspot.x = READ_LE_UINT16(resourceData);
+ hotspot.y = READ_LE_UINT16(resourceData + 2);
+ }
// Now find out what colors we are supposed to use
colorMapping[0] = 0; // Black is hardcoded
colorMapping[1] = _screen->getColorWhite(); // White is also hardcoded
colorMapping[2] = SCI_CURSOR_SCI0_TRANSPARENCYCOLOR;
colorMapping[3] = _palette->matchColor(170, 170, 170); // Grey
+ // Special case for the magnifier cursor in LB1 (bug #3487092).
+ // No other SCI0 game has a cursor resource of 1, so this is handled
+ // specifically for LB1.
+ if (g_sci->getGameId() == GID_LAURABOW && resourceId == 1)
+ colorMapping[3] = _screen->getColorWhite();
// Seek to actual data
resourceData += 4;
@@ -165,6 +181,11 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) {
rawBitmap = upscaledBitmap;
}
+ if (hotspot.x >= heightWidth || hotspot.y >= heightWidth) {
+ error("cursor %d's hotspot (%d, %d) is out of range of the cursor's dimensions (%dx%d)",
+ resourceId, hotspot.x, hotspot.y, heightWidth, heightWidth);
+ }
+
CursorMan.replaceCursor(rawBitmap, heightWidth, heightWidth, hotspot.x, hotspot.y, SCI_CURSOR_SCI0_TRANSPARENCYCOLOR);
kernelShow();
@@ -191,6 +212,26 @@ void GfxCursor::kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Co
return;
}
+ // Use the alternate silver cursors in SQ4 CD, if requested
+ if (_useSilverSQ4CDCursors) {
+ switch(viewNum) {
+ case 850:
+ case 852:
+ case 854:
+ case 856:
+ celNum = 3;
+ break;
+ case 851:
+ case 853:
+ case 855:
+ case 999:
+ celNum = 2;
+ break;
+ default:
+ break;
+ }
+ }
+
if (!_cachedCursors.contains(viewNum))
_cachedCursors[viewNum] = new GfxView(_resMan, _screen, _palette, viewNum);