From b7e62e4b61c7552fa91c9dbdd9273b620d7f876b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 5 May 2004 02:32:46 +0000 Subject: 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. svn-id: r13777 --- backends/dc/dc.h | 3 ++- backends/dc/display.cpp | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'backends/dc') diff --git a/backends/dc/dc.h b/backends/dc/dc.h index 04b9fc5bb6..286cb99bb3 100644 --- a/backends/dc/dc.h +++ b/backends/dc/dc.h @@ -85,7 +85,7 @@ class OSystem_Dreamcast : public OSystem { void warpMouse(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, byte keycolor = 255); // Shaking is used in SCUMM. Set current shake position. void set_shake_pos(int shake_pos); @@ -163,6 +163,7 @@ class OSystem_Dreamcast : public OSystem { int _current_shake_pos, _screen_w, _screen_h; int _overlay_x, _overlay_y; unsigned char *_ms_buf; + unsigned char _ms_keycolor; SoundProc _sound_proc; void *_sound_proc_param; bool _overlay_visible, _overlay_dirty, _screen_dirty; diff --git a/backends/dc/display.cpp b/backends/dc/display.cpp index 50abc5e522..53aa2f9a8a 100644 --- a/backends/dc/display.cpp +++ b/backends/dc/display.cpp @@ -259,15 +259,21 @@ void OSystem_Dreamcast::warpMouse(int x, int y) } void OSystem_Dreamcast::setMouseCursor(const byte *buf, uint w, uint h, - int hotspot_x, int hotspot_y) + int hotspot_x, int hotspot_y, byte keycolor) { _ms_cur_w = w; _ms_cur_h = h; _ms_hotspot_x = hotspot_x; _ms_hotspot_y = hotspot_y; + + _ms_keycolor = keycolor; - _ms_buf = (byte*)buf; + if (_ms_buf) + free(_ms_buf); + + _ms_buf = (byte *)malloc(w * h); + memcpy(_ms_buf, buf, w * h); } void OSystem_Dreamcast::set_shake_pos(int shake_pos) @@ -456,7 +462,7 @@ void OSystem_Dreamcast::drawMouse(int xdraw, int ydraw, int w, int h, for(int y=0; y