[Scummvm-cvs-logs] scummvm master -> 111d70af7d06743d61188443b2bf474f5ba64499

clone2727 clone2727 at gmail.com
Tue Aug 16 08:50:36 CEST 2011


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:
111d70af7d SCUMM: Make the default cursor for all v80+ games be the Windows cursor


Commit: 111d70af7d06743d61188443b2bf474f5ba64499
    https://github.com/scummvm/scummvm/commit/111d70af7d06743d61188443b2bf474f5ba64499
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-08-15T23:47:23-07:00

Commit Message:
SCUMM: Make the default cursor for all v80+ games be the Windows cursor

Changed paths:
    engines/scumm/cursor.cpp
    engines/scumm/he/intern_he.h



diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp
index 6708d39..29b5eae 100644
--- a/engines/scumm/cursor.cpp
+++ b/engines/scumm/cursor.cpp
@@ -180,12 +180,8 @@ void ScummEngine_v70he::setDefaultCursor() {
 								   0xff, 0xff, 0xff,
 								   0,    0,    0,    };
 
-	if (_bytesPerPixel == 2) {
-		for (i = 0; i < 1024; i++)
-			WRITE_UINT16(_grabbedCursor + i * 2, 5);
-	} else {
-		memset(_grabbedCursor, 5, sizeof(_grabbedCursor));
-	}
+	
+	memset(_grabbedCursor, 5, sizeof(_grabbedCursor));
 
 	_cursor.hotspotX = _cursor.hotspotY = 2;
 	src = default_he_cursor;
@@ -198,16 +194,10 @@ void ScummEngine_v70he::setDefaultCursor() {
 		for (j = 0; j < 32; j++) {
 			switch ((p & (0x3 << 14)) >> 14) {
 				case 1:
-					if (_bytesPerPixel == 2)
-						WRITE_UINT16(_grabbedCursor + 64 * i + j * 2, get16BitColor(palette[4], palette[5], palette[6]));
-					else
-						_grabbedCursor[32 * i + j] = 0xfe;
+					_grabbedCursor[32 * i + j] = 0xfe;
 					break;
 				case 2:
-					if (_bytesPerPixel == 2)
-						WRITE_UINT16(_grabbedCursor + 64 * i + j * 2, get16BitColor(palette[0], palette[1], palette[2]));
-					else
-						_grabbedCursor[32 * i + j] = 0xfd;
+					_grabbedCursor[32 * i + j] = 0xfd;
 					break;
 				default:
 					break;
@@ -219,52 +209,59 @@ void ScummEngine_v70he::setDefaultCursor() {
 		}
 	}
 
-	if (_bytesPerPixel == 1) {
-		// Since white color position is not guaranteed
-		// we setup our own palette if supported by backend
-		CursorMan.disableCursorPalette(false);
-		CursorMan.replaceCursorPalette(palette, 0xfd, 3);
-	}
+	// Since white color position is not guaranteed
+	// we setup our own palette if supported by backend
+	CursorMan.disableCursorPalette(false);
+	CursorMan.replaceCursorPalette(palette, 0xfd, 3);
 
 	updateCursor();
 }
 
 #ifdef ENABLE_HE
-void ScummEngine_v100he::setDefaultCursor() {
-	if (_game.id == GID_MOONBASE) {
-		// Moonbase uses the default Windows cursor instead of the usual
-		// default HE cursor.
-		Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
+void ScummEngine_v80he::setDefaultCursor() {
+	// v80+ games use the default Windows cursor instead of the usual
+	// default HE cursor.
+	Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
 
-		// Clear the cursor
+	// Clear the cursor
+	if (_bytesPerPixel == 2) {
 		for (int i = 0; i < 1024; i++)
 			WRITE_UINT16(_grabbedCursor + i * 2, 5);
+	} else {
+		memset(_grabbedCursor, 5, sizeof(_grabbedCursor));
+	}
 
-		_cursor.width = cursor->getWidth();
-		_cursor.height = cursor->getHeight();
-		_cursor.hotspotX = cursor->getHotspotX();
-		_cursor.hotspotY = cursor->getHotspotY();
+	_cursor.width = cursor->getWidth();
+	_cursor.height = cursor->getHeight();
+	_cursor.hotspotX = cursor->getHotspotX();
+	_cursor.hotspotY = cursor->getHotspotY();
 
-		const byte *surface = cursor->getSurface();
-		const byte *palette = cursor->getPalette();
+	const byte *surface = cursor->getSurface();
+	const byte *palette = cursor->getPalette();
 
-		for (uint16 y = 0; y < _cursor.height; y++) {
-			for (uint16 x = 0; x < _cursor.width; x++) {
-				byte pixel = *surface++;
-				if (pixel != cursor->getKeyColor()) {
-					pixel -= cursor->getPaletteStartIndex();
-					WRITE_UINT16(_grabbedCursor + (y * _cursor.width + x) * 2, get16BitColor(palette[pixel * 3], palette[pixel * 3 + 1], palette[pixel * 3 + 2]));
-				}
+	for (uint16 y = 0; y < _cursor.height; y++) {
+		for (uint16 x = 0; x < _cursor.width; x++) {
+			byte pixel = *surface++;
 
+			if (pixel != cursor->getKeyColor()) {
+				pixel -= cursor->getPaletteStartIndex();
+
+				if (_bytesPerPixel == 2)
+					WRITE_UINT16(_grabbedCursor + (y * _cursor.width + x) * 2, get16BitColor(palette[pixel * 3], palette[pixel * 3 + 1], palette[pixel * 3 + 2]));
+				else
+					_grabbedCursor[y * _cursor.width + x] = (pixel == 0) ? 0xfd : 0xfe;
 			}
 		}
+	}
 
-		delete cursor;
+	delete cursor;
 
-		updateCursor();
-	} else {
-		ScummEngine_v70he::setDefaultCursor();
-	}
+	// Since white color position is not guaranteed
+	// we setup our own palette if supported by backend
+	CursorMan.disableCursorPalette(false);
+	CursorMan.replaceCursorPalette(palette, 0xfd, cursor->getPaletteCount() * 3);
+
+	updateCursor();
 }
 #endif
 
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index 145172b9..f4df657 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -383,6 +383,8 @@ protected:
 	void drawLine(int x1, int y1, int x, int unk1, int unk2, int type, int id);
 	void drawPixel(int x, int y, int flags);
 
+	virtual void setDefaultCursor();
+
 	/* HE version 80 script opcodes */
 	void o80_createSound();
 	void o80_getFileSize();
@@ -570,8 +572,6 @@ protected:
 
 	virtual void decodeParseString(int a, int b);
 
-	virtual void setDefaultCursor();
-
 	/* HE version 100 script opcodes */
 	void o100_actorOps();
 	void o100_arrayOps();






More information about the Scummvm-git-logs mailing list