diff options
author | Torbjörn Andersson | 2006-04-10 23:22:26 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2006-04-10 23:22:26 +0000 |
commit | badb5218fa3989e12e1f383ed7c510102626a8ec (patch) | |
tree | 23796f83d1de0d34c9f9ad9a4d4f056eefe7d559 | |
parent | 935989d8cd960e175d577526418f589625a9d25f (diff) | |
download | scummvm-rg350-badb5218fa3989e12e1f383ed7c510102626a8ec.tar.gz scummvm-rg350-badb5218fa3989e12e1f383ed7c510102626a8ec.tar.bz2 scummvm-rg350-badb5218fa3989e12e1f383ed7c510102626a8ec.zip |
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?
svn-id: r21772
-rw-r--r-- | engines/cine/anim.cpp | 2 | ||||
-rw-r--r-- | engines/cine/various.cpp | 11 | ||||
-rw-r--r-- | engines/cine/various.h | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp index 51a1deeb7a..b5a52bed2b 100644 --- a/engines/cine/anim.cpp +++ b/engines/cine/anim.cpp @@ -855,7 +855,7 @@ void loadResourcesFromSave() { 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; diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 78dc6e2ae6..5e54e17aec 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -52,6 +52,8 @@ uint16 var3; uint16 var4; uint16 var5; +bool refreshAnimData[NUM_MAX_ANIMDATA]; + void drawString(const char *string, byte param) { } @@ -651,6 +653,7 @@ int16 makeLoad(char *saveName) { 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 @@ void makeSave(char *saveFileName) { 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 diff --git a/engines/cine/various.h b/engines/cine/various.h index eb71fd6835..079b458ec9 100644 --- a/engines/cine/various.h +++ b/engines/cine/various.h @@ -81,6 +81,8 @@ extern uint16 var3; extern uint16 var4; extern uint16 var5; +extern bool refreshAnimData[NUM_MAX_ANIMDATA]; + extern Common::File palFileHandle; extern Common::File partFileHandle; |