[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,1.20,1.21 scummvm.cpp,1.29,1.30

Travis Howell kirben at users.sourceforge.net
Sat Sep 21 07:18:01 CEST 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv27736/scumm

Modified Files:
	gfx.cpp scummvm.cpp 
Log Message:

Added the following patch:
[ 598121 ] Cursor cosmetics




Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- gfx.cpp	19 Sep 2002 23:06:54 -0000	1.20
+++ gfx.cpp	21 Sep 2002 14:17:12 -0000	1.21
@@ -257,7 +257,10 @@
 
 void Scumm::setCursor(int cursor)
 {
-	warning("setCursor(%d)", cursor);
+	if (cursor >= 0 && cursor <= 3)
+		gdi._currentCursor = cursor;
+	else
+		warning("setCursor(%d)", cursor);
 }
 
 void Scumm::setCameraAt(int pos_x, int pos_y)
@@ -2978,23 +2981,60 @@
 	15, 15, 7, 8
 };
 
+static const uint16 default_cursor_images[4][16] = {
+	/* cross-hair */
+	{ 0x0080, 0x0080, 0x0080, 0x0080, 0x0080, 0x0080, 0x0000, 0x7e3f,
+	  0x0000, 0x0080, 0x0080, 0x0080, 0x0080, 0x0080, 0x0080, 0x0000 },
+	/* hourglass */
+	{ 0x0000, 0x7ffe, 0x6006, 0x300c, 0x1818, 0x0c30, 0x0660, 0x03c0,
+	  0x0660, 0x0c30, 0x1998, 0x33cc, 0x67e6, 0x7ffe, 0x0000, 0x0000 },
+	/* arrow */
+	{ 0x0000, 0x4000, 0x6000, 0x7000, 0x7800, 0x7c00, 0x7e00, 0x7f00,
+	  0x7f80, 0x78c0, 0x7c00, 0x4600, 0x0600, 0x0300, 0x0300, 0x0180 },
+	/* hand */
+	{ 0x1e00, 0x1200, 0x1200, 0x1200, 0x1200, 0x13ff, 0x1249, 0x1249,
+	  0xf249, 0x9001, 0x9001, 0x9001, 0x8001, 0x8001, 0x8001, 0xffff },
+};
+
+static const byte default_cursor_hotspots[8] = {
+	8, 7,   8, 7,   1, 1,   5, 0
+};
+
 void Scumm::decompressDefaultCursor(int idx)
 {
-	int i;
+	int i, j;
 	byte color;
 
 	memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor));
-	_cursorWidth = 16;
-	_cursorHeight = 16;
-	_cursorHotspotX = 8;
-	_cursorHotspotY = 8;
 
 	color = default_cursor_colors[idx];
 
-	for (i = 0; i < 16; i++) {
-		if ((i < 7) || (i > 9)) {
-			_grabbedCursor[16 * 8 + i] = color;
-			_grabbedCursor[16 * i + 8] = color;
+	// FIXME: None of the stock cursors are right for Loom. Why is that?
+
+	if (_gameId == GID_LOOM256) {
+		int w;
+
+		_cursorWidth = 8;
+		_cursorHeight = 8;
+		_cursorHotspotX = 0;
+		_cursorHotspotY = 0;
+
+		for (i = 0, w = 0; i < 8; i++) {
+			w += (i >= 6) ? -2 : 1;
+			for (j = 0; j < w; j++)
+				_grabbedCursor[i * 8 + j] = color;
+		}
+	} else {
+		_cursorWidth = 16;
+		_cursorHeight = 16;
+		_cursorHotspotX = default_cursor_hotspots[2 * gdi._currentCursor];
+		_cursorHotspotY = default_cursor_hotspots[2 * gdi._currentCursor + 1];
+
+		for (i = 0; i < 16; i++) {
+			for (j = 0; j < 16; j++) {
+				if (default_cursor_images[gdi._currentCursor][i] & (1 << j))
+					_grabbedCursor[16 * i + 15 - j] = color;
+			}
 		}
 	}
 

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- scummvm.cpp	21 Sep 2002 13:48:02 -0000	1.29
+++ scummvm.cpp	21 Sep 2002 14:17:13 -0000	1.30
@@ -272,6 +272,7 @@
 	_talkDelay = 0;
 	_keepText = false;
 
+	gdi._currentCursor = 0;
 	_cursorState = 0;
 	_userPut = 0;
 





More information about the Scummvm-git-logs mailing list