[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src palm.cpp,1.33,1.34 palm.h,1.26,1.27

Eugene Sandulenko sev at users.sourceforge.net
Tue May 4 19:32:01 CEST 2004


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

Modified Files:
	palm.cpp palm.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: palm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/palm.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- palm.cpp	28 Mar 2004 16:30:46 -0000	1.33
+++ palm.cpp	5 May 2004 02:29:59 -0000	1.34
@@ -62,6 +62,7 @@
 	_vibrate = gVars->vibrator;
 	_fullscreen = (ConfMan.getBool("fullscreen") && OPTIONS_TST(kOptModeWide));
 	_adjustAspectRatio = ConfMan.getBool("aspect_ratio");
+	_mouseDataP = NULL;
 }
 
 void OSystem_PALMOS::setPalette(const byte *colors, uint start, uint num) {
@@ -701,14 +702,19 @@
 	}
 }
 
-void OSystem_PALMOS::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) {
+void OSystem_PALMOS::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor) {
 	_mouseCurState.w = w;
 	_mouseCurState.h = h;
 
 	_mouseHotspotX = hotspot_x;
 	_mouseHotspotY = hotspot_y;
 
-	_mouseDataP = (byte*)buf;
+	_mouseKeycolor = keycolor;
+
+	if (_mouseDataP)
+		free(_mouseDataP);
+	_mouseDataP = malloc(w * h);
+	memcpy(_mouseDataP, buf, w * h);
 
 	undraw_mouse();
 }
@@ -1316,7 +1322,7 @@
 			while (width > 0) {
 				*bak++ = *dst;
 				color = *src++;
-				if (color != 0xFF)	// 0xFF = transparent, don't draw
+				if (color != _mouseKeycolor)	// transparent, don't draw
 					*dst = color;
 				dst++;
 				width--;

Index: palm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/palm.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- palm.h	28 Mar 2004 16:30:46 -0000	1.26
+++ palm.h	5 May 2004 02:30:12 -0000	1.27
@@ -76,7 +76,7 @@
 
 
 	// Set the bitmap that's used when drawing the cursor.
-	void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y);
+	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.
 	void set_shake_pos(int shake_pos);
@@ -215,6 +215,7 @@
 	MousePos _mouseOldState;
 	int16 _mouseHotspotX;
 	int16 _mouseHotspotY;
+	byte _mouseKeycolor;
 	int _current_shake_pos;
 	int _new_shake_pos;
 	
@@ -284,4 +285,4 @@
 	void init_intern(UInt16 gfx_mode);
 };
 
-#endif
\ No newline at end of file
+#endif





More information about the Scummvm-git-logs mailing list