[Scummvm-cvs-logs] SF.net SVN: scummvm:[46568] scummvm/trunk/engines/sci/engine/savegame.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Dec 26 01:22:21 CET 2009


Revision: 46568
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46568&view=rev
Author:   thebluegr
Date:     2009-12-26 00:22:21 +0000 (Sat, 26 Dec 2009)

Log Message:
-----------
SCI/new music code: Fixed a bug where music was stopped when saving. Some cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/savegame.cpp

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2009-12-25 22:58:45 UTC (rev 46567)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2009-12-26 00:22:21 UTC (rev 46568)
@@ -102,27 +102,26 @@
 }
 #else
 
-#define FROBNICATE_HANDLE(reg) ((reg).segment << 16 | (reg).offset)
 #define DEFROBNICATE_HANDLE(handle) (make_reg((handle >> 16) & 0xffff, handle & 0xffff))
 
 static void syncSong(Common::Serializer &s, MusicEntry *song) {
 	if (s.getVersion() < 14) {
-		// Old sound system data
+		// Old sound system data. This data is only loaded, never saved (as we're never
+		// saving in the older version format)
 		uint32 handle = 0;
-		if (s.isSaving())
-			handle = FROBNICATE_HANDLE(song->soundObj);
 		s.syncAsSint32LE(handle);
-		if (s.isLoading())
-			song->soundObj = DEFROBNICATE_HANDLE(handle);
+		song->soundObj = DEFROBNICATE_HANDLE(handle);
 		s.syncAsSint32LE(song->resnum);
 		s.syncAsSint32LE(song->prio);
 		s.syncAsSint32LE(song->status);
 		s.skip(4);	// restoreBehavior
-		s.syncAsSint32LE(song->ticker);
+		uint32 restoreTime = 0;
+		s.syncAsSint32LE(restoreTime);
+		song->ticker = restoreTime * 60 / 1000;
 		s.syncAsSint32LE(song->loop);
 		s.skip(4);	// hold
 		// volume and dataInc will be synced from the sound objects
-		// when the sound list is reconstructed
+		// when the sound list is reconstructed in gamestate_restore()
 		song->volume = 100;
 		song->dataInc = 0;
 		// No fading info
@@ -146,8 +145,12 @@
 		s.syncAsByte(song->status);
 	}
 
-	song->pMidiParser = 0;
-	song->pStreamAud = 0;
+	// pMidiParser and pStreamAud will be initialized when the
+	// sound list is reconstructed in gamestate_restore()
+	if (s.isLoading()) {
+		song->pMidiParser = 0;
+		song->pStreamAud = 0;
+	}
 }
 #endif
 
@@ -615,16 +618,17 @@
 }
 #else
 static void sync_songlib(Common::Serializer &s, SciMusic *music) {
+	// Sync song lib data. When loading, the actual song lib will be initialized
+	// afterwards in gamestate_restore()
 	int songcount = 0;
 	if (s.isSaving())
 		songcount = music->_playList.size();
 	s.syncAsUint32LE(songcount);
+
 	if (s.isLoading()) {
 		music->stopAll();
 		music->_playList.resize(songcount);
-	}
 
-	if (s.isLoading()) {
 		for (int i = 0; i < songcount; i++) {
 			MusicEntry *curSong = new MusicEntry();
 			syncSong(s, curSong);


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