[Scummvm-cvs-logs] SF.net SVN: scummvm:[40653] scummvm/trunk/engines/agos/cursor.cpp

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Sun May 17 16:53:47 CEST 2009


Revision: 40653
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40653&view=rev
Author:   Kirben
Date:     2009-05-17 14:53:47 +0000 (Sun, 17 May 2009)

Log Message:
-----------
Simplify cursor code.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/cursor.cpp

Modified: scummvm/trunk/engines/agos/cursor.cpp
===================================================================
--- scummvm/trunk/engines/agos/cursor.cpp	2009-05-17 14:28:43 UTC (rev 40652)
+++ scummvm/trunk/engines/agos/cursor.cpp	2009-05-17 14:53:47 UTC (rev 40653)
@@ -639,9 +639,13 @@
 }
 
 void AGOSEngine_PuzzlePack::initMouse() {
-	_maxCursorWidth = 75;
-	_maxCursorHeight = 97;
-	_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+	if (getGameId() == GID_DIMP) {
+		AGOSEngine_Simon1::initMouse();
+	} else {
+		_maxCursorWidth = 75;
+		_maxCursorHeight = 97;
+		_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+	}
 }
 
 void AGOSEngine_FeebleDemo::initMouse() {
@@ -649,6 +653,11 @@
 	AGOSEngine_Simon1::initMouse();
 }
 
+static const byte mouseCursorPalette[] = {
+	0x00, 0x00, 0x00, 0x00, // Black
+	0xFF, 0xFF, 0xFF, 0x00, // White
+};
+
 void AGOSEngine_Feeble::initMouse() {
 	_maxCursorWidth = 40;
 	_maxCursorHeight = 40;
@@ -658,21 +667,12 @@
 void AGOSEngine_Simon1::initMouse() {
 	AGOSEngine::initMouse();
 
-	uint8 color = 225;
-	if (getGameType() == GType_FF && (getFeatures() & GF_DEMO)) {
-		color = 250;
-	} else if (getPlatform() == Common::kPlatformAmiga) {
-		color = (getFeatures() & GF_32COLOR) ? 17 : 241;
-	}
-
-	memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight);
-
 	const uint16 *src = _common_mouseInfo;
 	for (int i = 0; i < 16; i++) {
 		for (int j = 0; j < 16; j++) {
 			if (src[0] & (1 << (15 - (j % 16)))) {
 				if (src[1] & (1 << (15 - (j % 16)))) {
-					_mouseData[16 * i + j] = color;
+					_mouseData[16 * i + j] = 1;
 				} else {
 					_mouseData[16 * i + j] = 0;
 				}
@@ -680,12 +680,18 @@
 		}
 		src += 2;
 	}
+
+	CursorMan.replaceCursor(_mouseData, 16, 16, 0, 0, 0xFF);
 }
 
 void AGOSEngine::initMouse() {
 	_maxCursorWidth = 16;
 	_maxCursorHeight = 16;
 	_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+
+	memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight);
+
+	CursorMan.replaceCursorPalette(mouseCursorPalette, 0, ARRAYSIZE(mouseCursorPalette) / 4);
 }
 
 void AGOSEngine_PuzzlePack::loadMouseImage() {
@@ -697,9 +703,7 @@
 }
 
 void AGOSEngine_PuzzlePack::drawMousePointer() {
-	if (getGameId() == GID_DIMP) {
-		AGOSEngine::drawMousePointer();
-	} else {
+	if (getGameId() != GID_DIMP) {
 		CursorMan.replaceCursor(_mouseData, _maxCursorWidth, _maxCursorHeight, 37, 48, 0);
 	}
 }
@@ -731,8 +735,6 @@
 }
 
 void AGOSEngine_FeebleDemo::drawMousePointer() {
-	// TODO: Add larger cursor
-	CursorMan.replaceCursor(_mouseData, 16, 16, 0, 0, 0xFF);
 }
 
 void AGOSEngine_Feeble::drawMousePointer() {
@@ -795,20 +797,10 @@
 void AGOSEngine::drawMousePointer() {
 	if (getGameType() == GType_SIMON2) {
 		CursorMan.replaceCursor(_simon2_cursors[_mouseCursor], 16, 16, 7, 7);
-	} else if (getGameType() == GType_SIMON1) {
-		CursorMan.replaceCursor(_mouseData, 16, 16, 0, 0, 0xFF);
-	} else {
+	} else if (getGameType() != GType_SIMON1) {
 		const uint16 *src;
 		int i, j;
-		uint8 color;
 
-		if (getGameType() == GType_PN) {
-			color = (getPlatform() == Common::kPlatformPC) ? 15 : 14;
-		} else if (getGameType() == GType_ELVIRA1) {
-			color = 15;
-		} else {
-			color = 65;
-		}
 		memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight);
 
 		if (getGameType() == GType_WW) {
@@ -866,7 +858,7 @@
 			for (j = 0; j < 16; j++) {
 				if (src[0] & (1 << (15 - (j % 16)))) {
 					if (src[1] & (1 << (15 - (j % 16)))) {
-						_mouseData[16 * i + j] = color;
+						_mouseData[16 * i + j] = 1;
 					} else {
 						_mouseData[16 * i + j] = 0;
 					}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list