aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-06-13 09:48:46 +0000
committerTorbjörn Andersson2006-06-13 09:48:46 +0000
commitdf4f95f805b698057381525ca43e5b03cc379633 (patch)
treec8e3bea526ac5d154f8e8db7fafdb5091463ab8a /graphics
parent243e6b2d2711da4901110868c7bd8e4d9d20a74d (diff)
downloadscummvm-rg350-df4f95f805b698057381525ca43e5b03cc379633.tar.gz
scummvm-rg350-df4f95f805b698057381525ca43e5b03cc379633.tar.bz2
scummvm-rg350-df4f95f805b698057381525ca43e5b03cc379633.zip
Let the [cursor] palette manager handle disableCursorPalette() too, to avoid
cursor glitch in at least some HE games which first set a cursor palette, and then disable it. (The disabled palette would be re-enabled after dismissing the GUI.) svn-id: r23081
Diffstat (limited to 'graphics')
-rw-r--r--graphics/paletteman.cpp15
-rw-r--r--graphics/paletteman.h11
2 files changed, 25 insertions, 1 deletions
diff --git a/graphics/paletteman.cpp b/graphics/paletteman.cpp
index 7950095aa6..b3f47bf585 100644
--- a/graphics/paletteman.cpp
+++ b/graphics/paletteman.cpp
@@ -37,6 +37,19 @@ PaletteManager::PaletteManager() {
}
}
+void PaletteManager::disableCursorPalette(bool disable) {
+ if (!g_system->hasFeature(OSystem::kFeatureCursorHasPalette))
+ return;
+
+ if (_cursorPaletteStack.empty())
+ return;
+
+ Palette *pal = _cursorPaletteStack.top();
+ pal->_disabled = disable;
+
+ g_system->disableCursorPalette(true);
+}
+
void PaletteManager::pushCursorPalette(const byte *colors, uint start, uint num) {
if (!g_system->hasFeature(OSystem::kFeatureCursorHasPalette))
return;
@@ -67,7 +80,7 @@ void PaletteManager::popCursorPalette() {
pal = _cursorPaletteStack.top();
- if (pal->_num)
+ if (pal->_num && !pal->_disabled)
g_system->setCursorPalette(pal->_data, pal->_start, pal->_num);
else
g_system->disableCursorPalette(true);
diff --git a/graphics/paletteman.h b/graphics/paletteman.h
index 425cb50447..dc3f03dbaa 100644
--- a/graphics/paletteman.h
+++ b/graphics/paletteman.h
@@ -32,6 +32,13 @@ namespace Graphics {
class PaletteManager : public Common::Singleton<PaletteManager> {
public:
/**
+ * Enable/Disable the current cursor palette.
+ *
+ * @param disable
+ */
+ void disableCursorPalette(bool disable);
+
+ /**
* Push a new cursor palette onto the stack, and set it in the backend.
* The palette entries from 'start' till (start+num-1) will be replaced
* so a full palette updated is accomplished via start=0, num=256.
@@ -77,6 +84,8 @@ private:
uint _num;
uint _size;
+ bool _disabled;
+
Palette(const byte *colors, uint start, uint num) {
_start = start;
_num = num;
@@ -88,6 +97,8 @@ private:
} else {
_data = NULL;
}
+
+ _disabled = false;
}
~Palette() {