[Scummvm-cvs-logs] CVS: scummvm/backends/morphos morphos.cpp,1.38,1.39 morphos.h,1.25,1.26

Eugene Sandulenko sev at users.sourceforge.net
Tue May 4 19:31:02 CEST 2004


Update of /cvsroot/scummvm/scummvm/backends/morphos
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22596/morphos

Modified Files:
	morphos.cpp morphos.h 
Log Message:
Extend setMouseCursor with additional keycolor parameter. Lets saga use 255
as white color. Made this function more safe by copying cursor data to
newly created buffer.


Index: morphos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/morphos/morphos.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- morphos.cpp	28 Mar 2004 16:30:47 -0000	1.38
+++ morphos.cpp	5 May 2004 02:30:13 -0000	1.39
@@ -130,6 +130,7 @@
 	ScummNoCursor = NULL;
 	UpdateRegion = NULL;
 	NewUpdateRegion = NULL;
+	MouseImage = NULL;
 }
 
 bool OSystem_MorphOS::Initialise()
@@ -1360,7 +1361,7 @@
 				if (xdraw+x < ScummBufferWidth)
 				{
 					bak[x] = dst[x];
-					if ((color=buf[x])!=0xFF)
+					if ((color=buf[x])!=MouseKeycolor)
 						dst[x] = color;
 				}
 			}
@@ -1423,7 +1424,7 @@
 	}
 }
 
-void OSystem_MorphOS::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y)
+void OSystem_MorphOS::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor = 255)
 {
 	MouseWidth = w;
 	MouseHeight	= h;
@@ -1431,7 +1432,13 @@
 	MouseHotspotX = hotspot_x;
 	MouseHotspotY = hotspot_y;
 
-	MouseImage = (byte*)buf;
+	MouseKeycolor = keycolor;
+
+	if (MouseImage)
+		free(MouseImage);
+
+	MouseImage = (byte *)malloc(w * h);
+	memcpy(mouseImage, buf, w * h);
 
 	UndrawMouse();
 }

Index: morphos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/morphos/morphos.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- morphos.h	28 Mar 2004 16:30:47 -0000	1.25
+++ morphos.h	5 May 2004 02:30:14 -0000	1.26
@@ -64,7 +64,7 @@
 		virtual void set_mouse_pos(int x, int y);
 
 		// Set the bitmap that's used when drawing the cursor.
-		virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y);
+		virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor = 255);
 
 		// Shaking is used in SCUMM. Set current shake position.
 		virtual void set_shake_pos(int shake_pos);
@@ -201,6 +201,7 @@
 		int   MouseOldWidth, MouseOldHeight;
 		int   MouseHotspotX, MouseHotspotY;
 		byte *MouseImage, MouseBackup[MAX_MOUSE_W*MAX_MOUSE_H];
+		byte  MouseKeycolor;
 		MsgPort* InputMsgPort;
 		IOStdReq*InputIORequest;
 





More information about the Scummvm-git-logs mailing list