aboutsummaryrefslogtreecommitdiff
path: root/backends/morphos
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/morphos
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/morphos')
-rw-r--r--backends/morphos/morphos.cpp13
-rw-r--r--backends/morphos/morphos.h3
2 files changed, 12 insertions, 4 deletions
diff --git a/backends/morphos/morphos.cpp b/backends/morphos/morphos.cpp
index ed62106f32..d7f3f9e345 100644
--- a/backends/morphos/morphos.cpp
+++ b/backends/morphos/morphos.cpp
@@ -130,6 +130,7 @@ OSystem_MorphOS::OSystem_MorphOS(SCALERTYPE gfx_mode, bool full_screen)
ScummNoCursor = NULL;
UpdateRegion = NULL;
NewUpdateRegion = NULL;
+ MouseImage = NULL;
}
bool OSystem_MorphOS::Initialise()
@@ -1360,7 +1361,7 @@ void OSystem_MorphOS::DrawMouse()
if (xdraw+x < ScummBufferWidth)
{
bak[x] = dst[x];
- if ((color=buf[x])!=0xFF)
+ if ((color=buf[x])!=MouseKeycolor)
dst[x] = color;
}
}
@@ -1423,7 +1424,7 @@ void OSystem_MorphOS::set_mouse_pos(int x, int y)
}
}
-void OSystem_MorphOS::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y)
+void OSystem_MorphOS::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor = 255)
{
MouseWidth = w;
MouseHeight = h;
@@ -1431,7 +1432,13 @@ void OSystem_MorphOS::setMouseCursor(const byte *buf, uint w, uint h, int hotspo
MouseHotspotX = hotspot_x;
MouseHotspotY = hotspot_y;
- MouseImage = (byte*)buf;
+ MouseKeycolor = keycolor;
+
+ if (MouseImage)
+ free(MouseImage);
+
+ MouseImage = (byte *)malloc(w * h);
+ memcpy(mouseImage, buf, w * h);
UndrawMouse();
}
diff --git a/backends/morphos/morphos.h b/backends/morphos/morphos.h
index 3d23e28476..5b14f5bfa8 100644
--- a/backends/morphos/morphos.h
+++ b/backends/morphos/morphos.h
@@ -64,7 +64,7 @@ class OSystem_MorphOS : public OSystem
virtual void set_mouse_pos(int x, int y);
// Set the bitmap that's used when drawing the cursor.
- virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y);
+ virtual 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.
virtual void set_shake_pos(int shake_pos);
@@ -201,6 +201,7 @@ class OSystem_MorphOS : public OSystem
int MouseOldWidth, MouseOldHeight;
int MouseHotspotX, MouseHotspotY;
byte *MouseImage, MouseBackup[MAX_MOUSE_W*MAX_MOUSE_H];
+ byte MouseKeycolor;
MsgPort* InputMsgPort;
IOStdReq*InputIORequest;