Some more updates for saving/loading in IHNM

svn-id: r27512
This commit is contained in:
Filippos Karapetis 2007-06-17 15:45:09 +00:00
parent 2a7c76d4e4
commit 6dc0a1b234
4 changed files with 30 additions and 4 deletions

View File

@ -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];

View File

@ -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);

View File

@ -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;

View File

@ -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)