aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-09-04 00:57:11 +0200
committerEugene Sandulenko2016-09-04 00:57:43 +0200
commit9552dabaab8f4518a41c5c73825410da3b5a60af (patch)
treee2e91612c2f8409fe069d8e2199a4e6743d9725b
parenta47a9bf5c36742a6948adb489eb4b437c2baa414 (diff)
downloadscummvm-rg350-9552dabaab8f4518a41c5c73825410da3b5a60af.tar.gz
scummvm-rg350-9552dabaab8f4518a41c5c73825410da3b5a60af.tar.bz2
scummvm-rg350-9552dabaab8f4518a41c5c73825410da3b5a60af.zip
FULLPIPE: Implement GameLoader::saveScenePicAniInfos(). Now object states are restored
-rw-r--r--engines/fullpipe/gameloader.cpp74
-rw-r--r--engines/fullpipe/gameloader.h1
2 files changed, 74 insertions, 1 deletions
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp
index 270e69aa42..d03ac0f405 100644
--- a/engines/fullpipe/gameloader.cpp
+++ b/engines/fullpipe/gameloader.cpp
@@ -504,7 +504,79 @@ void GameLoader::applyPicAniInfos(Scene *sc, PicAniInfo **picAniInfo, int picAni
}
void GameLoader::saveScenePicAniInfos(int sceneId) {
- warning("STUB: GameLoader::saveScenePicAniInfos(%d)", sceneId);
+ SceneTag *st;
+
+ int idx = getSceneTagBySceneId(sceneId, &st);
+
+ if (idx < 0)
+ return;
+
+ if (!_sc2array[idx]._isLoaded)
+ return;
+
+ if (!st->_scene)
+ return;
+
+ int picAniInfosCount;
+
+ PicAniInfo **pic = savePicAniInfos(st->_scene, 0, 128, &picAniInfosCount);
+
+ if (_sc2array[idx]._picAniInfos)
+ free(_sc2array[idx]._picAniInfos);
+
+ _sc2array[idx]._picAniInfos = pic;
+ _sc2array[idx]._picAniInfosCount = picAniInfosCount;
+}
+
+PicAniInfo **GameLoader::savePicAniInfos(Scene *sc, int flag1, int flag2, int *picAniInfoCount) {
+ PicAniInfo **res;
+
+ *picAniInfoCount = 0;
+ if (!sc)
+ return NULL;
+
+ if (!sc->_picObjList.size())
+ return NULL;
+
+ int numInfos = sc->_staticANIObjectList1.size() + sc->_picObjList.size() - 1;
+ if (numInfos < 1)
+ return NULL;
+
+ res = (PicAniInfo **)malloc(sizeof(PicAniInfo *) * numInfos);
+
+ int idx = 0;
+
+ for (uint i = 0; i < sc->_picObjList.size(); i++) {
+ PictureObject *obj = sc->_picObjList[i];
+
+ if (obj && ((obj->_flags & flag1) == flag1) && ((obj->_field_8 & flag2) == flag2)) {
+ res[idx] = new PicAniInfo();
+ obj->getPicAniInfo(res[idx]);
+ idx++;
+ }
+ }
+
+ for (uint i = 0; i < sc->_staticANIObjectList1.size(); i++) {
+ StaticANIObject *obj = sc->_staticANIObjectList1[i];
+
+ if (obj && ((obj->_flags & flag1) == flag1) && ((obj->_field_8 & flag2) == flag2)) {
+ res[idx] = new PicAniInfo();
+ obj->getPicAniInfo(res[idx]);
+ res[idx]->type &= 0xFFFF;
+ idx++;
+ }
+ }
+
+ *picAniInfoCount = idx;
+
+ debugC(4, kDebugBehavior | kDebugAnimation, "savePicAniInfos: Stored %d infos", idx);
+
+ if (!idx) {
+ free(res);
+ return NULL;
+ }
+
+ return res;
}
void GameLoader::updateSystems(int counterdiff) {
diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h
index 772cc51130..682d1aad89 100644
--- a/engines/fullpipe/gameloader.h
+++ b/engines/fullpipe/gameloader.h
@@ -96,6 +96,7 @@ class GameLoader : public CObject {
int getSceneTagBySceneId(int sceneId, SceneTag **st);
void applyPicAniInfos(Scene *sc, PicAniInfo **picAniInfo, int picAniInfoCount);
void saveScenePicAniInfos(int sceneId);
+ PicAniInfo **savePicAniInfos(Scene *sc, int flag1, int flag2, int *picAniInfoCount);
void readSavegame(const char *fname);
void writeSavegame(Scene *sc, const char *fname);