[Scummvm-cvs-logs] SF.net SVN: scummvm: [21772] scummvm/trunk/engines/cine

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Mon Apr 10 16:23:09 CEST 2006


Revision: 21772
Author:   eriktorbjorn
Date:     2006-04-10 16:22:26 -0700 (Mon, 10 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21772&view=rev

Log Message:
-----------
If I understand things correctly, cinE used to dump the entire animDataTable
element to the savefile, including data pointers. After reading the savefile,
it would then test if ptr1 was NULL, to see if it should load the object.

I've extended the savefile format with a byte to indicate whether or not ptr1
was non-NULL. This seems to fix the problems I had with with loading savegames,
but of course any old savegame is now even more broken than before.

I still can't seem to get out of the room with the machine, though. Another
regression when migrating the code from cinE, or just my ability to get past
this annoying, timed puzzle?

Modified Paths:
--------------
    scummvm/trunk/engines/cine/anim.cpp
    scummvm/trunk/engines/cine/various.cpp
    scummvm/trunk/engines/cine/various.h
Modified: scummvm/trunk/engines/cine/anim.cpp
===================================================================
--- scummvm/trunk/engines/cine/anim.cpp	2006-04-10 22:45:05 UTC (rev 21771)
+++ scummvm/trunk/engines/cine/anim.cpp	2006-04-10 23:22:26 UTC (rev 21772)
@@ -855,7 +855,7 @@
 
 	for (currentAnim = 0; currentAnim < NUM_MAX_ANIMDATA; currentAnim++) {
 		AnimData *currentPtr = &animDataTable[currentAnim];
-		if (currentPtr->ptr1 && currentPtr->fileIdx != -1) {
+		if (refreshAnimData[currentAnim] && currentPtr->fileIdx != -1) {
 			int8 isMask = 0;
 			int8 isSpl = 0;
 			int16 foundFileIdx;

Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp	2006-04-10 22:45:05 UTC (rev 21771)
+++ scummvm/trunk/engines/cine/various.cpp	2006-04-10 23:22:26 UTC (rev 21772)
@@ -52,6 +52,8 @@
 uint16 var4;
 uint16 var5;
 
+bool refreshAnimData[NUM_MAX_ANIMDATA];
+
 void drawString(const char *string, byte param) {
 }
 
@@ -651,6 +653,7 @@
 		animDataTable[i].fileIdx = fHandle->readSint16BE();
 		animDataTable[i].frameIdx = fHandle->readSint16BE();
 		fHandle->read(animDataTable[i].name, 10);
+		refreshAnimData[i] = (fHandle->readByte() != 0);
 	}
 
 	// TODO: handle screen params (realy required ?)
@@ -811,6 +814,14 @@
 		fHandle->writeSint16BE(animDataTable[i].fileIdx);
 		fHandle->writeSint16BE(animDataTable[i].frameIdx);
 		fHandle->write(animDataTable[i].name, 10);
+
+		// Horrifyingly, cinE used to dump the entire struct to the
+		// save file, including the data pointers. While these pointers
+		// would be invalid after loading, the loadResourcesFromSave()
+		// function would still test if ptr1 was non-NULL, presumably
+		// to see if the object was present in the room.
+
+		fHandle->writeByte(animDataTable[i].ptr1 ? 1 : 0);
 	}
 
 	fHandle->writeUint16BE(0);  // Screen params, unhandled

Modified: scummvm/trunk/engines/cine/various.h
===================================================================
--- scummvm/trunk/engines/cine/various.h	2006-04-10 22:45:05 UTC (rev 21771)
+++ scummvm/trunk/engines/cine/various.h	2006-04-10 23:22:26 UTC (rev 21772)
@@ -81,6 +81,8 @@
 extern uint16 var4;
 extern uint16 var5;
 
+extern bool refreshAnimData[NUM_MAX_ANIMDATA]; 
+
 extern Common::File palFileHandle;
 extern Common::File partFileHandle;
 


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