aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2005-02-20 02:04:45 +0000
committerEugene Sandulenko2005-02-20 02:04:45 +0000
commitf420dd3b785157e95f0dd6255bf35f88db1ec674 (patch)
tree1771504d1c27d911ee03dca9c51c651fad9e1611
parent47400c1932451009c58b07df53a53621ad655879 (diff)
downloadscummvm-rg350-f420dd3b785157e95f0dd6255bf35f88db1ec674.tar.gz
scummvm-rg350-f420dd3b785157e95f0dd6255bf35f88db1ec674.tar.bz2
scummvm-rg350-f420dd3b785157e95f0dd6255bf35f88db1ec674.zip
Implement OSystem method disableCursorPalette(bool disable) as mentioned
in patch #1013937 (OSystem layer with bigger resolution). svn-id: r16820
-rw-r--r--backends/sdl/graphics.cpp5
-rw-r--r--backends/sdl/sdl-common.h4
-rw-r--r--backends/sdl/sdl.cpp2
-rw-r--r--common/system.h12
4 files changed, 20 insertions, 3 deletions
diff --git a/backends/sdl/graphics.cpp b/backends/sdl/graphics.cpp
index 775db97ba1..26d59ac653 100644
--- a/backends/sdl/graphics.cpp
+++ b/backends/sdl/graphics.cpp
@@ -870,7 +870,7 @@ void OSystem_SDL::setPalette(const byte *colors, uint start, uint num) {
_paletteDirtyEnd = start + num;
// Some games blink cursors with palette
- if (!_overlayVisible && !_cursorHasOwnPalette)
+ if (!_overlayVisible && (!_cursorHasOwnPalette || _cursorPaletteDisabled))
blitCursor();
}
@@ -886,6 +886,7 @@ void OSystem_SDL::setCursorPalette(const byte *colors, uint start, uint num) {
}
_cursorHasOwnPalette = true;
+ _cursorPaletteDisabled = false;
if (!_overlayVisible)
blitCursor();
@@ -1126,7 +1127,7 @@ void OSystem_SDL::blitCursor() {
for (j = 0; j < w; j++) {
color = *srcPtr;
if (color != _mouseKeyColor) { // transparent, don't draw
- if (_cursorHasOwnPalette && !_overlayVisible)
+ if (_cursorHasOwnPalette && !_overlayVisible && !_cursorPaletteDisabled)
*(uint16 *)dstPtr = SDL_MapRGB(_mouseOrigSurface->format,
_cursorPalette[color].r, _cursorPalette[color].g,
_cursorPalette[color].b);
diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h
index 7296131b1e..61b5fb4fbf 100644
--- a/backends/sdl/sdl-common.h
+++ b/backends/sdl/sdl-common.h
@@ -87,6 +87,9 @@ public:
// Set colors of cursor palette
void setCursorPalette(const byte *colors, uint start, uint num);
+ // Disables or enables cursor palette
+ void disableCursorPalette(bool disable) { _cursorPaletteDisabled = disable; };
+
// Shaking is used in SCUMM. Set current shake position.
void setShakePos(int shake_pos);
@@ -277,6 +280,7 @@ protected:
byte _mouseKeyColor;
int _cursorTargetScale;
bool _cursorHasOwnPalette;
+ bool _cursorPaletteDisabled;
SDL_Surface *_mouseOrigSurface;
SDL_Surface *_mouseSurface;
enum {
diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp
index 0ed0568dd2..717523b9fb 100644
--- a/backends/sdl/sdl.cpp
+++ b/backends/sdl/sdl.cpp
@@ -102,7 +102,7 @@ OSystem_SDL::OSystem_SDL()
_cdrom(0), _scalerProc(0), _modeChanged(false), _dirtyChecksums(0),
_mouseVisible(false), _mouseDrawn(false), _mouseData(0), _mouseSurface(0),
_mouseOrigSurface(0), _mouseHotspotX(0), _mouseHotspotY(0), _cursorTargetScale(1),
- _cursorHasOwnPalette(false),
+ _cursorHasOwnPalette(false), _cursorPaletteDisabled(true),
_joystick(0),
_currentShakePos(0), _newShakePos(0),
_paletteDirtyStart(0), _paletteDirtyEnd(0),
diff --git a/common/system.h b/common/system.h
index fad4e6c841..0cc65cfdf1 100644
--- a/common/system.h
+++ b/common/system.h
@@ -294,6 +294,18 @@ public:
virtual void setCursorPalette(const byte *colors, uint start, uint num) {};
/**
+ * Disable or enable cursor palette.
+ *
+ * Backends which implement it should have kFeatureCursorHasPalette flag set
+ *
+ * @param disable True to disable, false to enable.
+ *
+ * @see setPalette
+ * @see kFeatureCursorHasPalette
+ */
+ virtual void disableCursorPalette(bool disable) {};
+
+ /**
* Blit a bitmap to the virtual screen.
* The real screen will not immediately be updated to reflect the changes.
* Client code has to to call updateScreen to ensure any changes are