[Scummvm-cvs-logs] scummvm master -> 2a6a79b1673e274420ca8c28f40f9855b1c6134f

bluegr bluegr at gmail.com
Mon Oct 27 11:30:01 CET 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2a6a79b167 SAGA: Remove the buggy actor swapping fixup code for IHNM


Commit: 2a6a79b1673e274420ca8c28f40f9855b1c6134f
    https://github.com/scummvm/scummvm/commit/2a6a79b1673e274420ca8c28f40f9855b1c6134f
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-10-27T12:28:18+02:00

Commit Message:
SAGA: Remove the buggy actor swapping fixup code for IHNM

This was a hack that was implemented while IHNM was being developed.
That code should no longer be needed. If this issue does occur again,
the actual cause should be investigated, instead of hiding it with
workarounds. The code was buggy anyway, as _currentProtag was not
initialized properly

Changed paths:
    engines/saga/actor.h
    engines/saga/saveload.cpp
    engines/saga/scene.h
    engines/saga/sfuncs.cpp



diff --git a/engines/saga/actor.h b/engines/saga/actor.h
index b8a5436..8dc27c7 100644
--- a/engines/saga/actor.h
+++ b/engines/saga/actor.h
@@ -468,7 +468,6 @@ public:
 	int actorIdToIndex(uint16 id) { return (id == ID_PROTAG) ? 0 : objectIdToIndex(id); }
 	uint16 actorIndexToId(int index) { return (index == 0) ? ID_PROTAG : objectIndexToId(kGameObjectActor, index); }
 	ActorData *getActor(uint16 actorId);
-	ActorData *getFirstActor() { return &_actors.front(); }
 
 // clarification: Obj - means game object, such Hat, Spoon etc,  Object - means Actor,Obj,HitZone,StepZone
 
diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp
index 90ba620..e659e09 100644
--- a/engines/saga/saveload.cpp
+++ b/engines/saga/saveload.cpp
@@ -215,8 +215,7 @@ void SagaEngine::save(const char *fileName, const char *saveName) {
 #ifdef ENABLE_IHNM
 	if (getGameId() == GID_IHNM) {
 		out->writeSint32LE(_scene->currentChapterNumber());
-		// Protagonist
-		out->writeSint32LE(_scene->currentProtag());
+		out->writeSint32LE(0);	// obsolete, was used for the protagonist
 		out->writeSint32LE(_scene->getCurrentMusicTrack());
 		out->writeSint32LE(_scene->getCurrentMusicRepeat());
 	}
@@ -316,7 +315,7 @@ void SagaEngine::load(const char *fileName) {
 	if (getGameId() == GID_IHNM) {
 		int currentChapter = _scene->currentChapterNumber();
 		_scene->setChapterNumber(in->readSint32LE());
-		_scene->setProtag(in->readSint32LE());
+		in->skip(4);	// obsolete, was used for setting the protagonist
 		if (_scene->currentChapterNumber() != currentChapter)
 			_scene->changeScene(-2, 0, kTransitionFade, _scene->currentChapterNumber());
 		_scene->setCurrentMusicTrack(in->readSint32LE());
@@ -366,30 +365,6 @@ void SagaEngine::load(const char *fileName) {
 	int volume = _music->getVolume();
 	_music->setVolume(0);
 
-#ifdef ENABLE_IHNM
-	// Protagonist swapping
-	if (getGameId() == GID_IHNM) {
-		if (_scene->currentProtag() != 0 && _scene->currentChapterNumber() != 6) {
-			ActorData *actor1 = _actor->getFirstActor();
-			ActorData *actor2;
-			// The original gets actor2 from the current protagonist ID, but this is sometimes wrong
-			// If the current protagonist ID is not correct, use the stored protagonist
-			if (!_actor->validActorId(_scene->currentProtag())) {
-				actor2 = _actor->_protagonist;
-			} else {
-				actor2 = _actor->getActor(_scene->currentProtag());
-			}
-
-			SWAP(actor1->_location, actor2->_location);
-
-			actor2->_flags &= ~kProtagonist;
-			actor1->_flags |= kProtagonist;
-			_actor->_protagonist = _actor->_centerActor = actor1;
-			_scene->setProtag(actor1->_id);
-		}
-	}
-#endif
-
 	_scene->clearSceneQueue();
 	_scene->changeScene(sceneNumber, ACTOR_NO_ENTRANCE, kTransitionNoFade);
 
diff --git a/engines/saga/scene.h b/engines/saga/scene.h
index 6a9571d..410713c 100644
--- a/engines/saga/scene.h
+++ b/engines/saga/scene.h
@@ -286,8 +286,6 @@ class Scene {
 	#endif
 		return _sceneLUT[sceneNumber];
 	}
-	int currentProtag() const { return _currentProtag; }
-	void setProtag(int pr) { _currentProtag = pr; }
 	int currentSceneNumber() const { return _sceneNumber; }
 	int currentChapterNumber() const { return _chapterNumber; }
 	void setChapterNumber(int ch) { _chapterNumber = ch; }
@@ -341,7 +339,6 @@ class Scene {
 	Common::Array<uint16> _sceneLUT;
 	SceneQueueList _sceneQueue;
 	bool _sceneLoaded;
-	int _currentProtag;
 	int _sceneNumber;
 	int _chapterNumber;
 	int _outsetSceneNumber;
diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp
index cb963e2..2175d8f 100644
--- a/engines/saga/sfuncs.cpp
+++ b/engines/saga/sfuncs.cpp
@@ -748,14 +748,10 @@ void Script::sfSwapActors(SCRIPTFUNC_PARAMS) {
 		actor1->_flags &= ~kProtagonist;
 		actor2->_flags |= kProtagonist;
 		_vm->_actor->_protagonist = _vm->_actor->_centerActor = actor2;
-		if (_vm->getGameId() == GID_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->getGameId() == GID_IHNM)
-			_vm->_scene->setProtag(actorId1);
 	}
 }
 






More information about the Scummvm-git-logs mailing list