Skip to content

Commit

Permalink
SCI: Added some sanity checks by digitall
Browse files Browse the repository at this point in the history
- Limit the LB1 cursor workaround to LB1 only (so that fanmade games
aren't affected)
- Error our when bad cursor hotspots are found
  • Loading branch information
bluegr committed Feb 17, 2012
1 parent b21f956 commit c87657f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion engines/sci/graphics/cursor.cpp
Expand Up @@ -145,7 +145,7 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) {
// 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 (resourceId == 1)
if (g_sci->getGameId() == GID_LAURABOW && resourceId == 1)
colorMapping[3] = _screen->getColorWhite();

// Seek to actual data
Expand Down Expand Up @@ -175,6 +175,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();

Expand Down

0 comments on commit c87657f

Please sign in to comment.