diff options
| -rw-r--r-- | engines/scumm/he/wiz_he.cpp | 4 | ||||
| -rw-r--r-- | graphics/paletteman.cpp | 15 | ||||
| -rw-r--r-- | graphics/paletteman.h | 11 | ||||
| -rw-r--r-- | gui/ThemeNew.cpp | 1 | 
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; | 
