aboutsummaryrefslogtreecommitdiff
path: root/backends/gp32
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/gp32
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/gp32')
-rw-r--r--backends/gp32/gp32.cpp13
-rw-r--r--backends/gp32/gp32.h3
2 files changed, 12 insertions, 4 deletions
diff --git a/backends/gp32/gp32.cpp b/backends/gp32/gp32.cpp
index 6d3f7dbf02..5a636a38da 100644
--- a/backends/gp32/gp32.cpp
+++ b/backends/gp32/gp32.cpp
@@ -67,6 +67,7 @@ void OSystem_GP32::initSize(uint w, uint h) {
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 @@ void OSystem_GP32::draw_mouse() {
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 @@ void OSystem_GP32::warpMouse(int x, int y) {
}
// 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();
}
diff --git a/backends/gp32/gp32.h b/backends/gp32/gp32.h
index 37c08ce080..af5834e0f0 100644
--- a/backends/gp32/gp32.h
+++ b/backends/gp32/gp32.h
@@ -62,7 +62,7 @@ public:
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 @@ private:
MousePos _mouse_old_state;
int16 _mouseHotspotX;
int16 _mouseHotspotY;
+ byte _mouseKeycolor;
// Shake mode
int _currentShakePos;