aboutsummaryrefslogtreecommitdiff
path: root/backends/dc
diff options
context:
space:
mode:
authorEugene Sandulenko2004-05-05 02:32:46 +0000
committerEugene Sandulenko2004-05-05 02:32:46 +0000
commitb7e62e4b61c7552fa91c9dbdd9273b620d7f876b (patch)
tree61cc2d13b77e8c8514954241f050b8245155283b /backends/dc
parent5d0f0ea0c6afd7defaba3df69b39879a63256776 (diff)
downloadscummvm-rg350-b7e62e4b61c7552fa91c9dbdd9273b620d7f876b.tar.gz
scummvm-rg350-b7e62e4b61c7552fa91c9dbdd9273b620d7f876b.tar.bz2
scummvm-rg350-b7e62e4b61c7552fa91c9dbdd9273b620d7f876b.zip
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
Diffstat (limited to 'backends/dc')
-rw-r--r--backends/dc/dc.h3
-rw-r--r--backends/dc/display.cpp12
2 files changed, 11 insertions, 4 deletions
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<h; y++) {
int x;
for(x=0; x<w; x++)
- if(*buf == 0xff) {
+ if(*buf == _ms_keycolor) {
*dst++ = 0;
buf++;
} else