aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--engines/scumm/he/wiz_he.cpp4
-rw-r--r--graphics/paletteman.cpp15
-rw-r--r--graphics/paletteman.h11
-rw-r--r--gui/ThemeNew.cpp1
4 files changed, 27 insertions, 4 deletions
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index 5597741578..51763bff7f 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -24,6 +24,7 @@
#include "common/stdafx.h"
#include "common/system.h"
+#include "graphics/paletteman.h"
#include "scumm/he/intern_he.h"
#include "scumm/resource.h"
#include "scumm/scumm.h"
@@ -1526,8 +1527,7 @@ void Wiz::loadWizCursor(int resId) {
_vm->setCursorHotspot(x, y);
// Since we set up cursor palette for default cursor, disable it now
- if (_vm->_system->hasFeature(OSystem::kFeatureCursorHasPalette))
- _vm->_system->disableCursorPalette(true);
+ PaletteMan.disableCursorPalette(true);
free(cursor);
}
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() {
diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp
index 300e633060..b971680bf9 100644
--- a/gui/ThemeNew.cpp
+++ b/gui/ThemeNew.cpp
@@ -195,7 +195,6 @@ void ThemeNew::enable() {
}
void ThemeNew::disable() {
- _system->disableCursorPalette(true);
_system->hideOverlay();
PaletteMan.popCursorPalette();
_enabled = false;