[Scummvm-git-logs] scummvm master -> 61323e8d990c102d030b70728a98e1c010056bb3

bluegr noreply at scummvm.org
Thu May 30 19:44:27 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
61323e8d99 SCI: Use correct SCI0/SCI1 cursor colors


Commit: 61323e8d990c102d030b70728a98e1c010056bb3
    https://github.com/scummvm/scummvm/commit/61323e8d990c102d030b70728a98e1c010056bb3
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-05-30T22:44:23+03:00

Commit Message:
SCI: Use correct SCI0/SCI1 cursor colors

Fixes bugs #15142, #5983, #5971

Changed paths:
    engines/sci/graphics/cursor.cpp
    engines/sci/graphics/cursor.h


diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index f2e446b6e43..c5e3e7c58cf 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -117,7 +117,8 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) {
 		error("cursor resource %d has invalid size", resourceId);
 
 	Common::Point hotspot;
-	if (getSciVersion() <= SCI_VERSION_01) {
+	bool isSci0Cursor = (getSciVersion() <= SCI_VERSION_01);
+	if (isSci0Cursor) {
 		// 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.
@@ -128,19 +129,18 @@ void GfxCursor::kernelSetShape(GuiResourceId resourceId) {
 		hotspot.y = resource->getUint16LEAt(2);
 	}
 
-	// Now find out what colors we are supposed to use
+	// SCI0 cursors are black and white and transparent.
+	// SCI1 cursors introduce gray when both masks are set.
+	// These colors are hard-coded in the video driver.
 	byte colorMapping[4];
-	colorMapping[0] = 0; // Black is hardcoded
-	colorMapping[1] = _screen->getColorWhite(); // White is also hardcoded
+	colorMapping[0] = 0; // black
+	colorMapping[1] = _screen->getColorWhite();
 	colorMapping[2] = SCI_CURSOR_SCI0_TRANSPARENCYCOLOR;
-	colorMapping[3] = _palette->matchColor(170, 170, 170) & SCI_PALETTE_MATCH_COLORMASK; // Grey
-	// TODO: Figure out if the grey color is hardcoded
-	// HACK for the magnifier cursor in LB1, fixes its color (bug #5971)
-	if (g_sci->getGameId() == GID_LAURABOW && resourceId == 1)
+	if (isSci0Cursor) {
 		colorMapping[3] = _screen->getColorWhite();
-	// HACK for Longbow cursors, fixes the shade of grey they're using (bug #5983)
-	if (g_sci->getGameId() == GID_LONGBOW)
-		colorMapping[3] = _palette->matchColor(223, 223, 223) & SCI_PALETTE_MATCH_COLORMASK; // Light Grey
+	} else {
+		colorMapping[3] = SCI_CURSOR_SCI1_GRAY;
+	}
 
 	Common::SpanOwner<SciSpan<byte> > rawBitmap;
 	rawBitmap->allocate(SCI_CURSOR_SCI0_HEIGHTWIDTH * SCI_CURSOR_SCI0_HEIGHTWIDTH, resource->name() + " copy");
diff --git a/engines/sci/graphics/cursor.h b/engines/sci/graphics/cursor.h
index f8f331f7189..a2856c4492a 100644
--- a/engines/sci/graphics/cursor.h
+++ b/engines/sci/graphics/cursor.h
@@ -33,7 +33,8 @@ namespace Sci {
 enum {
 	SCI_CURSOR_SCI0_HEIGHTWIDTH = 16,
 	SCI_CURSOR_SCI0_RESOURCESIZE = 68,
-	SCI_CURSOR_SCI0_TRANSPARENCYCOLOR = 1
+	SCI_CURSOR_SCI0_TRANSPARENCYCOLOR = 1,
+	SCI_CURSOR_SCI1_GRAY = 7
 };
 
 class GfxView;




More information about the Scummvm-git-logs mailing list