aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2007-06-17 15:45:09 +0000
committerFilippos Karapetis2007-06-17 15:45:09 +0000
commit6dc0a1b234e4395d42dc3d73da098fe0ca355a27 (patch)
tree7ba0b93ffa4823f9bd615dd658afa672bd6b7a9d
parent2a7c76d4e4e2663edeb38cd37262f196bfc7e14f (diff)
downloadscummvm-rg350-6dc0a1b234e4395d42dc3d73da098fe0ca355a27.tar.gz
scummvm-rg350-6dc0a1b234e4395d42dc3d73da098fe0ca355a27.tar.bz2
scummvm-rg350-6dc0a1b234e4395d42dc3d73da098fe0ca355a27.zip
Some more updates for saving/loading in IHNM
svn-id: r27512
-rw-r--r--engines/saga/actor.cpp4
-rw-r--r--engines/saga/saveload.cpp15
-rw-r--r--engines/saga/scene.h7
-rw-r--r--engines/saga/sfuncs.cpp8
4 files changed, 30 insertions, 4 deletions
diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp
index d1de018b0b..0166759497 100644
--- a/engines/saga/actor.cpp
+++ b/engines/saga/actor.cpp
@@ -3119,7 +3119,9 @@ void Actor::saveState(Common::OutSaveFile *out) {
void Actor::loadState(Common::InSaveFile *in) {
int32 i;
- setProtagState(in->readSint16LE());
+ int16 protagState = in->readSint16LE();
+ if (protagState != 0)
+ setProtagState(protagState);
for (i = 0; i < _actorsCount; i++) {
ActorData *a = _actors[i];
diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp
index cf493a7c84..3facd894bc 100644
--- a/engines/saga/saveload.cpp
+++ b/engines/saga/saveload.cpp
@@ -191,6 +191,11 @@ void SagaEngine::save(const char *fileName, const char *saveName) {
// Surrounding scene
out->writeSint32LE(_scene->getOutsetSceneNumber());
+ if (getGameType() != GType_ITE) {
+ out->writeSint16LE(_scene->currentTrack());
+ // Protagonist
+ out->writeSint16LE(_scene->currentProtag());
+ }
// Inset scene
out->writeSint32LE(_scene->currentSceneNumber());
@@ -259,6 +264,11 @@ void SagaEngine::load(const char *fileName) {
// Surrounding scene
sceneNumber = in->readSint32LE();
+ // Protagonist
+ if (getGameType() != GType_ITE) {
+ _scene->setTrack(in->readSint16LE());
+ _scene->setProtag(in->readSint16LE());
+ }
// Inset scene
insetSceneNumber = in->readSint32LE();
@@ -287,6 +297,11 @@ void SagaEngine::load(const char *fileName) {
_isoMap->setMapPosition(mapx, mapy);
+ // Protagonist swapping
+ if (getGameType() != GType_ITE) {
+ // TODO
+ }
+
_scene->clearSceneQueue();
_scene->changeScene(sceneNumber, ACTOR_NO_ENTRANCE, kTransitionNoFade);
diff --git a/engines/saga/scene.h b/engines/saga/scene.h
index 9f2305cfc5..6a67ac7430 100644
--- a/engines/saga/scene.h
+++ b/engines/saga/scene.h
@@ -310,6 +310,11 @@ class Scene {
#endif
return _sceneLUT[sceneNumber];
}
+ int currentProtag() const { return _currentProtag; }
+ int currentTrack() const { return _currentTrack; }
+ void setProtag(int pr) { _currentProtag = pr; }
+ void setTrack(int tr) { _currentTrack = tr; }
+
int currentSceneNumber() const { return _sceneNumber; }
int currentChapterNumber() const { return _chapterNumber; }
void setChapterNumber(int ch) { _chapterNumber = ch; }
@@ -347,6 +352,8 @@ class Scene {
int _sceneCount;
SceneQueueList _sceneQueue;
bool _sceneLoaded;
+ int _currentProtag;
+ int _currentTrack;
int _sceneNumber;
int _chapterNumber;
int _outsetSceneNumber;
diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp
index 2b936844cc..deee3ed68d 100644
--- a/engines/saga/sfuncs.cpp
+++ b/engines/saga/sfuncs.cpp
@@ -875,15 +875,17 @@ void Script::sfSwapActors(SCRIPTFUNC_PARAMS) {
actor1->_flags &= ~kProtagonist;
actor2->_flags |= kProtagonist;
_vm->_actor->_protagonist = _vm->_actor->_centerActor = actor2;
+ if (_vm->getGameType() == GType_IHNM)
+ _vm->_scene->setProtag(actorId2);
} else if (actor2->_flags & kProtagonist) {
actor2->_flags &= ~kProtagonist;
actor1->_flags |= kProtagonist;
_vm->_actor->_protagonist = _vm->_actor->_centerActor = actor1;
+ if (_vm->getGameType() == GType_IHNM)
+ _vm->_scene->setProtag(actorId1);
}
- // Here non-protagonist ID gets saved in variable
- if (_vm->getGameType() == GType_IHNM)
- warning("sfSwapActors: incomplete implementation");
+ // TODO: where is the protagonist ID used?
}
// Script function #35 (0x23)