[Scummvm-cvs-logs] CVS: scummvm/backends/dc dc.h,1.44,1.45 dcmain.cpp,1.34,1.35 display.cpp,1.40,1.41

Marcus Comstedt marcus_c at users.sourceforge.net
Sat Oct 15 07:35:15 CEST 2005


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

Modified Files:
	dc.h dcmain.cpp display.cpp 
Log Message:
Added support for cursor palettes.

Index: dc.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/dc/dc.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- dc.h	15 Oct 2005 14:15:22 -0000	1.44
+++ dc.h	15 Oct 2005 14:33:58 -0000	1.45
@@ -94,6 +94,12 @@
   // 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, byte keycolor, int cursorTargetScale);
 
+  // Replace the specified range of cursor the palette with new colors.
+  void setCursorPalette(const byte *colors, uint start, uint num);
+
+  // Disable or enable cursor palette.
+  void disableCursorPalette(bool disable);
+
   // Shaking is used in SCUMM. Set current shake position.
   void setShakePos(int shake_pos);
 
@@ -198,7 +204,7 @@
   void *_sound_proc_param;
   bool _overlay_visible, _overlay_dirty, _screen_dirty;
   int _screen_buffer, _overlay_buffer, _mouse_buffer;
-  bool _aspect_stretch, _softkbd_on;
+  bool _aspect_stretch, _softkbd_on, _enable_cursor_palette;
   float _overlay_fade, _xscale, _yscale, _top_offset;
   int _softkbd_motion;
 
@@ -212,7 +218,7 @@
   void *screen_tx[NUM_BUFFERS];
   void *mouse_tx[NUM_BUFFERS];
   void *ovl_tx[NUM_BUFFERS];
-  unsigned short palette[256];
+  unsigned short palette[256], cursor_palette[256];
 
   int temp_sound_buffer[RING_BUFFER_SAMPLES>>SOUND_BUFFER_SHIFT];
 

Index: dcmain.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/dc/dcmain.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- dcmain.cpp	30 Jul 2005 21:10:50 -0000	1.34
+++ dcmain.cpp	15 Oct 2005 14:33:58 -0000	1.35
@@ -49,7 +49,8 @@
 OSystem_Dreamcast::OSystem_Dreamcast()
   : screen(NULL), mouse(NULL), overlay(NULL), _softkbd(this), _ms_buf(NULL),
     _sound_proc(NULL), _timer_active(false), _current_shake_pos(0),
-    _aspect_stretch(false), _softkbd_on(false), _softkbd_motion(0)
+    _aspect_stretch(false), _softkbd_on(false), _softkbd_motion(0),
+    _enable_cursor_palette(false)
 {
   memset(screen_tx, 0, sizeof(screen_tx));
   memset(mouse_tx, 0, sizeof(mouse_tx));
@@ -153,6 +154,7 @@
   case kFeatureAspectRatioCorrection:
   case kFeatureVirtualKeyboard:
   case kFeatureOverlaySupportsAlpha:
+  case kFeatureCursorHasPalette:
     return true;
   default:
     return false;

Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/dc/display.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- display.cpp	15 Oct 2005 14:15:22 -0000	1.40
+++ display.cpp	15 Oct 2005 14:33:58 -0000	1.41
@@ -144,6 +144,24 @@
   _screen_dirty = true;
 }
 
+void OSystem_Dreamcast::setCursorPalette(const byte *colors, uint start, uint num)
+{
+  unsigned short *dst = cursor_palette + start;
+  if(num>0)
+    while( num-- ) {
+      *dst++ = ((colors[0]<<7)&0x7c00)|
+	((colors[1]<<2)&0x03e0)|
+	((colors[2]>>3)&0x001f);
+      colors += 4;
+    }
+  _enable_cursor_palette = true;
+}
+
+void OSystem_Dreamcast::disableCursorPalette(bool disable)
+{
+  _enable_cursor_palette = !disable;  
+}
+
 void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num)
 {
   const unsigned short *src = palette + start;
@@ -436,6 +454,8 @@
   struct polygon_list mypoly;
   struct packed_colour_vertex_list myvertex;
 
+  unsigned short *pal = _enable_cursor_palette? cursor_palette : palette;
+
   _mouse_buffer++;
   _mouse_buffer &= NUM_BUFFERS-1;
 
@@ -450,7 +470,7 @@
 	  *dst++ = 0;
 	  buf++;
 	} else
-	  *dst++ = palette[*buf++]|0x8000;
+	  *dst++ = pal[*buf++]|0x8000;
       dst += MOUSE_W-x;
     }
   else {





More information about the Scummvm-git-logs mailing list