[Scummvm-cvs-logs] SF.net SVN: scummvm:[47893] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Feb 5 00:17:34 CET 2010


Revision: 47893
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47893&view=rev
Author:   thebluegr
Date:     2010-02-04 23:17:33 +0000 (Thu, 04 Feb 2010)

Log Message:
-----------
Moved the PalVary code inside the GfxPalette class

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/graphics/gui.cpp
    scummvm/trunk/engines/sci/graphics/gui.h
    scummvm/trunk/engines/sci/graphics/palette.cpp
    scummvm/trunk/engines/sci/graphics/palette.h

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-04 22:30:46 UTC (rev 47892)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-04 23:17:33 UTC (rev 47893)
@@ -691,7 +691,7 @@
 		if (argc == 3) {
 			paletteId = argv[1].toUint16();
 			time = argv[2].toUint16();
-			s->_gui->startPalVary(paletteId, time);
+			s->_gfxPalette->startPalVary(paletteId, time);
 		} else {
 			warning("kPalVary(init) called with unsupported argc %d", argc);
 		}
@@ -699,7 +699,7 @@
 	}
 	case 3: { // DeInit
 		if (argc == 1) {
-			s->_gui->stopPalVary();
+			s->_gfxPalette->stopPalVary();
 		} else {
 			warning("kPalVary(deinit) called with unsupported argc %d", argc);
 		}
@@ -709,7 +709,7 @@
 		bool pauseState;
 		if (argc == 2) {
 			pauseState = argv[1].isNull() ? false : true;
-			s->_gui->togglePalVary(pauseState);
+			s->_gfxPalette->togglePalVary(pauseState);
 		} else {
 			warning("kPalVary(pause) called with unsupported argc %d", argc);
 		}

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-04 22:30:46 UTC (rev 47892)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-04 23:17:33 UTC (rev 47893)
@@ -463,39 +463,6 @@
 void SciGui::portraitUnload(uint16 portraitId) {
 }
 
-void SciGui::startPalVary(uint16 paletteId, uint16 ticks) {
-	if (_palVaryId >= 0)	// another palvary is taking place, return
-		return;
-
-	_palVaryId = paletteId;
-	_palVaryStart = g_system->getMillis();
-	_palVaryEnd = _palVaryStart + ticks * 1000 / 60;
-	((SciEngine*)g_engine)->getTimerManager()->installTimerProc(&palVaryCallback, 1000 / 60, this);
-}
-
-void SciGui::togglePalVary(bool pause) {
-	// this call is actually counting states, so calling this 3 times with true will require calling it later
-	// 3 times with false to actually remove pause
-
-	// TODO
-}
-
-void SciGui::stopPalVary() {
-	((SciEngine*)g_engine)->getTimerManager()->removeTimerProc(&palVaryCallback);
-	_palVaryId = -1;	// invalidate the target palette
-
-	// HACK: just set the target palette
-	_palette->kernelSetFromResource(_palVaryId, true);
-}
-
-void SciGui::palVaryCallback(void *refCon) {
-	((SciGui *)refCon)->doPalVary();
-}
-
-void SciGui::doPalVary() {
-	// TODO: do palette transition here...
-}
-
 bool SciGui::debugUndither(bool flag) {
 	_screen->unditherSetState(flag);
 	return false;

Modified: scummvm/trunk/engines/sci/graphics/gui.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.h	2010-02-04 22:30:46 UTC (rev 47892)
+++ scummvm/trunk/engines/sci/graphics/gui.h	2010-02-04 23:17:33 UTC (rev 47893)
@@ -101,10 +101,6 @@
 	virtual void portraitShow(Common::String resourceName, Common::Point position, uint16 resourceNum, uint16 noun, uint16 verb, uint16 cond, uint16 seq);
 	virtual void portraitUnload(uint16 portraitId);
 
-	void startPalVary(uint16 paletteId, uint16 ticks);
-	void togglePalVary(bool pause);
-	void stopPalVary();
-
 	virtual bool debugUndither(bool flag);
 	virtual bool debugShowMap(int mapNo);
 	virtual bool debugEGAdrawingVisualize(bool state);
@@ -124,8 +120,6 @@
 
 private:
 	virtual void initPriorityBands();
-	static void palVaryCallback(void *refCon);
-	void doPalVary();
 
 	AudioPlayer *_audio;
 	GfxAnimate *_animate;
@@ -133,9 +127,6 @@
 	GfxMenu *_menu;
 	GfxText16 *_text16;
 	GfxTransitions *_transitions;
-	int16 _palVaryId;
-	uint32 _palVaryStart;
-	uint32 _palVaryEnd;
 
 	bool _usesOldGfxFunctions;
 };

Modified: scummvm/trunk/engines/sci/graphics/palette.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/palette.cpp	2010-02-04 22:30:46 UTC (rev 47892)
+++ scummvm/trunk/engines/sci/graphics/palette.cpp	2010-02-04 23:17:33 UTC (rev 47893)
@@ -417,4 +417,37 @@
 // Saving/restoring
 //         need to save start and target-palette, when palVaryOn = true
 
+void GfxPalette::startPalVary(uint16 paletteId, uint16 ticks) {
+	if (_palVaryId >= 0)	// another palvary is taking place, return
+		return;
+
+	_palVaryId = paletteId;
+	_palVaryStart = g_system->getMillis();
+	_palVaryEnd = _palVaryStart + ticks * 1000 / 60;
+	((SciEngine*)g_engine)->getTimerManager()->installTimerProc(&palVaryCallback, 1000 / 60, this);
+}
+
+void GfxPalette::togglePalVary(bool pause) {
+	// this call is actually counting states, so calling this 3 times with true will require calling it later
+	// 3 times with false to actually remove pause
+
+	// TODO
+}
+
+void GfxPalette::stopPalVary() {
+	((SciEngine*)g_engine)->getTimerManager()->removeTimerProc(&palVaryCallback);
+	_palVaryId = -1;	// invalidate the target palette
+
+	// HACK: just set the target palette
+	kernelSetFromResource(_palVaryId, true);
+}
+
+void GfxPalette::palVaryCallback(void *refCon) {
+	((GfxPalette *)refCon)->doPalVary();
+}
+
+void GfxPalette::doPalVary() {
+	// TODO: do palette transition here...
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/graphics/palette.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/palette.h	2010-02-04 22:30:46 UTC (rev 47892)
+++ scummvm/trunk/engines/sci/graphics/palette.h	2010-02-04 23:17:33 UTC (rev 47893)
@@ -55,11 +55,21 @@
 	bool kernelAnimate(byte fromColor, byte toColor, int speed);
 	void kernelAnimateSet();
 
+	void startPalVary(uint16 paletteId, uint16 ticks);
+	void togglePalVary(bool pause);
+	void stopPalVary();
+
 	Palette _sysPalette;
 
 private:
+	static void palVaryCallback(void *refCon);
+	void doPalVary();
+
 	GfxScreen *_screen;
 	ResourceManager *_resMan;
+	int16 _palVaryId;
+	uint32 _palVaryStart;
+	uint32 _palVaryEnd;
 
 	Common::Array<PalSchedule> _schedules;
 };


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