diff options
author | Marcus Comstedt | 2005-10-15 14:33:58 +0000 |
---|---|---|
committer | Marcus Comstedt | 2005-10-15 14:33:58 +0000 |
commit | a4aefbe9b459f2dd17d978695da00d5ab63dbd7f (patch) | |
tree | 4e5fa23b7b069ca5b729b3ac808a1f729c260fcc /backends/dc | |
parent | dbea2b5a1d6920d056e9fe7bd17efc409756e11a (diff) | |
download | scummvm-rg350-a4aefbe9b459f2dd17d978695da00d5ab63dbd7f.tar.gz scummvm-rg350-a4aefbe9b459f2dd17d978695da00d5ab63dbd7f.tar.bz2 scummvm-rg350-a4aefbe9b459f2dd17d978695da00d5ab63dbd7f.zip |
Added support for cursor palettes.
svn-id: r19100
Diffstat (limited to 'backends/dc')
-rw-r--r-- | backends/dc/dc.h | 10 | ||||
-rw-r--r-- | backends/dc/dcmain.cpp | 4 | ||||
-rw-r--r-- | backends/dc/display.cpp | 22 |
3 files changed, 32 insertions, 4 deletions
diff --git a/backends/dc/dc.h b/backends/dc/dc.h index b385891168..3ceec6aa09 100644 --- a/backends/dc/dc.h +++ b/backends/dc/dc.h @@ -94,6 +94,12 @@ class OSystem_Dreamcast : public OSystem { // 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 @@ class OSystem_Dreamcast : public OSystem { 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 @@ class OSystem_Dreamcast : public OSystem { 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]; diff --git a/backends/dc/dcmain.cpp b/backends/dc/dcmain.cpp index 132b11915e..6371ff5ff0 100644 --- a/backends/dc/dcmain.cpp +++ b/backends/dc/dcmain.cpp @@ -49,7 +49,8 @@ OSystem *OSystem_Dreamcast::create() { 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 @@ bool OSystem_Dreamcast::hasFeature(Feature f) case kFeatureAspectRatioCorrection: case kFeatureVirtualKeyboard: case kFeatureOverlaySupportsAlpha: + case kFeatureCursorHasPalette: return true; default: return false; diff --git a/backends/dc/display.cpp b/backends/dc/display.cpp index b9880a7d98..1161f60e9f 100644 --- a/backends/dc/display.cpp +++ b/backends/dc/display.cpp @@ -144,6 +144,24 @@ void OSystem_Dreamcast::setPalette(const byte *colors, uint start, uint num) _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 @@ void OSystem_Dreamcast::drawMouse(int xdraw, int ydraw, int w, int h, 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 @@ void OSystem_Dreamcast::drawMouse(int xdraw, int ydraw, int w, int h, *dst++ = 0; buf++; } else - *dst++ = palette[*buf++]|0x8000; + *dst++ = pal[*buf++]|0x8000; dst += MOUSE_W-x; } else { |