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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Jul 23 09:36:55 CEST 2010


Revision: 51194
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51194&view=rev
Author:   thebluegr
Date:     2010-07-23 07:36:55 +0000 (Fri, 23 Jul 2010)

Log Message:
-----------
SCI: Now saving the kPalVary state inside savegames

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/savegame.h
    scummvm/trunk/engines/sci/graphics/helpers.h
    scummvm/trunk/engines/sci/graphics/palette.h

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-07-23 06:57:23 UTC (rev 51193)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-07-23 07:36:55 UTC (rev 51194)
@@ -40,6 +40,7 @@
 #include "sci/engine/selector.h"
 #include "sci/engine/vm_types.h"
 #include "sci/engine/script.h"	// for SCI_OBJ_EXPORTS and SCI_OBJ_SYNONYMS
+#include "sci/graphics/palette.h"
 #include "sci/graphics/ports.h"
 #include "sci/sound/audio.h"
 #include "sci/sound/music.h"
@@ -628,6 +629,27 @@
 }
 #endif
 
+void GfxPalette::saveLoadWithSerializer(Common::Serializer &s) {
+	if (s.getVersion() < 24)
+		return;
+
+	if (s.isLoading() && _palVaryResourceId != -1)
+		palVaryRemoveTimer();
+
+	s.syncAsSint32LE(_palVaryResourceId);
+	_palVaryOriginPalette.saveLoadWithSerializer(s);
+	_palVaryTargetPalette.saveLoadWithSerializer(s);
+	s.syncAsSint16LE(_palVaryStep);
+	s.syncAsSint16LE(_palVaryStepStop);
+	s.syncAsSint16LE(_palVaryDirection);
+	s.syncAsUint16LE(_palVaryTicks);
+	s.syncAsSint32LE(_palVaryPaused);
+	s.syncAsSint32LE(_palVarySignal);
+
+	if (s.isLoading() && _palVaryResourceId != -1)
+		palVaryInstallTimer();
+}
+
 void SegManager::reconstructStack(EngineState *s) {
 	DataStack *stack = (DataStack *)(_heap[findSegmentByType(SEG_TYPE_STACK)]);
 	s->stack_base = stack->_entries;

Modified: scummvm/trunk/engines/sci/engine/savegame.h
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.h	2010-07-23 06:57:23 UTC (rev 51193)
+++ scummvm/trunk/engines/sci/engine/savegame.h	2010-07-23 07:36:55 UTC (rev 51194)
@@ -36,7 +36,7 @@
 struct EngineState;
 
 enum {
-	CURRENT_SAVEGAME_VERSION = 23,
+	CURRENT_SAVEGAME_VERSION = 24,
 	MINIMUM_SAVEGAME_VERSION = 12
 };
 

Modified: scummvm/trunk/engines/sci/graphics/helpers.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/helpers.h	2010-07-23 06:57:23 UTC (rev 51193)
+++ scummvm/trunk/engines/sci/graphics/helpers.h	2010-07-23 07:36:55 UTC (rev 51194)
@@ -28,6 +28,7 @@
 
 #include "common/endian.h"	// for READ_LE_UINT16
 #include "common/rect.h"
+#include "common/serializer.h"
 #include "sci/engine/vm_types.h"
 
 namespace Sci {
@@ -82,6 +83,13 @@
 struct Color {
 	byte used;
 	byte r, g, b;
+
+	void saveLoadWithSerializer(Common::Serializer &s) {
+		s.syncAsByte(used);
+		s.syncAsByte(r);
+		s.syncAsByte(g);
+		s.syncAsByte(b);
+	}
 };
 
 struct Palette {
@@ -89,6 +97,14 @@
 	uint32 timestamp;
 	Color colors[256];
 	byte intensity[256];
+
+	void saveLoadWithSerializer(Common::Serializer &s) {
+		s.syncBytes(mapping, 256);
+		s.syncAsUint32LE(timestamp);
+		for (int i = 0; i < 256; i++)
+			colors[i].saveLoadWithSerializer(s);
+		s.syncBytes(intensity, 256);
+	}
 };
 
 struct PalSchedule {

Modified: scummvm/trunk/engines/sci/graphics/palette.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/palette.h	2010-07-23 06:57:23 UTC (rev 51193)
+++ scummvm/trunk/engines/sci/graphics/palette.h	2010-07-23 07:36:55 UTC (rev 51194)
@@ -34,7 +34,7 @@
 /**
  * Palette class, handles palette operations like changing intensity, setting up the palette, merging different palettes
  */
-class GfxPalette {
+class GfxPalette : public Common::Serializable {
 public:
 	GfxPalette(ResourceManager *resMan, GfxScreen *screen, bool useMerging);
 	~GfxPalette();
@@ -80,6 +80,8 @@
 
 	Palette _sysPalette;
 
+	virtual void saveLoadWithSerializer(Common::Serializer &s);
+
 private:
 	void palVaryInit();
 	void palVaryInstallTimer();


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