[Scummvm-cvs-logs] CVS: scummvm/backends/gp32 gp32.cpp,1.19,1.20 gp32.h,1.19,1.20

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


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

Modified Files:
	gp32.cpp gp32.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: gp32.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/gp32/gp32.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- gp32.cpp	28 Mar 2004 16:30:47 -0000	1.19
+++ gp32.cpp	5 May 2004 02:30:13 -0000	1.20
@@ -67,6 +67,7 @@
 	if (_dirty_checksums)

 		free(_dirty_checksums);

 	_dirty_checksums = (uint32*)calloc(CKSUM_NUM*2, sizeof(uint32));

+	_mouseData = NULL;

 

 	unload_gfx_mode();

 	load_gfx_mode();

@@ -538,7 +539,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--;

@@ -830,14 +831,20 @@
 }

 

 // Set the bitmap that's used when drawing the cursor.

-void OSystem_GP32::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) { 

+void OSystem_GP32::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor) { 

 	_mouse_cur_state.w = w;

 	_mouse_cur_state.h = h;

 

 	_mouseHotspotX = hotspot_x;

 	_mouseHotspotY = hotspot_y;

 

-	_mouseData = (byte*)buf;

+	_mouseKeycolor = keycolor;

+

+	if (_mouseData)

+		free(_mouseData);

+

+	_mouseData = (byte *)malloc(w * h);

+	memcpy(_mouseData, buf, w * h);

 

 	undraw_mouse();

 }


Index: gp32.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/gp32/gp32.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- gp32.h	28 Mar 2004 16:30:47 -0000	1.19
+++ gp32.h	5 May 2004 02:30:13 -0000	1.20
@@ -62,7 +62,7 @@
 	void set_mouse_pos(int x, int y);

 	

 	// 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, int keycolor = 255);

 	

 	// Shaking is used in SCUMM. Set current shake position.

 	void set_shake_pos(int shake_pos);

@@ -188,6 +188,7 @@
 	MousePos _mouse_old_state;

 	int16 _mouseHotspotX;

 	int16 _mouseHotspotY;

+	byte _mouseKeycolor;
 

 	// Shake mode

 	int _currentShakePos;






More information about the Scummvm-git-logs mailing list