[Scummvm-cvs-logs] SF.net SVN: scummvm: [23081] scummvm/trunk/gui

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Tue Jun 13 11:48:54 CEST 2006


Revision: 23081
Author:   eriktorbjorn
Date:     2006-06-13 02:48:46 -0700 (Tue, 13 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23081&view=rev

Log Message:
-----------
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.)

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/he/wiz_he.cpp
    scummvm/trunk/graphics/paletteman.cpp
    scummvm/trunk/graphics/paletteman.h
    scummvm/trunk/gui/ThemeNew.cpp
Modified: scummvm/trunk/engines/scumm/he/wiz_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/wiz_he.cpp	2006-06-13 09:32:47 UTC (rev 23080)
+++ scummvm/trunk/engines/scumm/he/wiz_he.cpp	2006-06-13 09:48:46 UTC (rev 23081)
@@ -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 @@
 	_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);
 }

Modified: scummvm/trunk/graphics/paletteman.cpp
===================================================================
--- scummvm/trunk/graphics/paletteman.cpp	2006-06-13 09:32:47 UTC (rev 23080)
+++ scummvm/trunk/graphics/paletteman.cpp	2006-06-13 09:48:46 UTC (rev 23081)
@@ -37,6 +37,19 @@
 	}
 }
 
+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 @@
 
 	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);

Modified: scummvm/trunk/graphics/paletteman.h
===================================================================
--- scummvm/trunk/graphics/paletteman.h	2006-06-13 09:32:47 UTC (rev 23080)
+++ scummvm/trunk/graphics/paletteman.h	2006-06-13 09:48:46 UTC (rev 23081)
@@ -32,6 +32,13 @@
 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 @@
 		uint _num;
 		uint _size;
 
+		bool _disabled;
+
 		Palette(const byte *colors, uint start, uint num) {
 			_start = start;
 			_num = num;
@@ -88,6 +97,8 @@
 			} else {
 				_data = NULL;
 			}
+
+			_disabled = false;
 		}
 
 		~Palette() {

Modified: scummvm/trunk/gui/ThemeNew.cpp
===================================================================
--- scummvm/trunk/gui/ThemeNew.cpp	2006-06-13 09:32:47 UTC (rev 23080)
+++ scummvm/trunk/gui/ThemeNew.cpp	2006-06-13 09:48:46 UTC (rev 23081)
@@ -195,7 +195,6 @@
 }
 
 void ThemeNew::disable() {
-	_system->disableCursorPalette(true);
 	_system->hideOverlay();
 	PaletteMan.popCursorPalette();
 	_enabled = false;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list