TSAGE: Proper bugfix for problem saving/restoring game in Scene #5000 and others

This commit is contained in:
Paul Gilbert 2011-04-28 20:39:09 +10:00
parent 9f74a6eda2
commit 1651ac8ca2
3 changed files with 6 additions and 17 deletions

View File

@ -43,11 +43,6 @@ static SavedObject *classFactoryProc(const Common::String &className) {
if (className == "ObjectMover2") return new ObjectMover2();
if (className == "ObjectMover3") return new ObjectMover3();
if (className == "PlayerMover") return new PlayerMover();
// The following is needed, as saved games can contain SceneObjectWrapper
// objects (e.g. scene 4050 and 5000).
// FIXME: Since SceneObjectWrapper objects are contained within other
// objects, I'm not quite sure if this is the best solution (however, saved
// games do work with this). If this is correct, please remove this FIXME.
if (className == "SceneObjectWrapper") return new SceneObjectWrapper();
return NULL;

View File

@ -177,16 +177,6 @@ Common::Error Saver::restore(int slot) {
// Loop through each registered object to load in the data
for (SynchronisedList<SavedObject *>::iterator i = _objList.begin(); i != _objList.end(); ++i) {
// Saved games can contain PlayerMover objects, but these aren't synchronized.
// Fixes loading in scene 5000.
// TODO/FIXME: Add a more proper handling for these objects
if ((*i)->getClassName() == "PlayerMover") {
warning("HACK: PlayerMover object found, removing it");
// Remove that object from the list
i = _objList.erase(i);
assert(i == _objList.end());
break;
}
serialiser.validate((*i)->getClassName());
(*i)->synchronise(serialiser);
}

View File

@ -117,7 +117,11 @@ void SceneManager::sceneChange() {
// Instantiate and set the new scene
_scene = getNewScene();
_scene->postInit();
if (!_saver->getMacroRestoreFlag())
_scene->postInit();
else
_scene->loadScene(_sceneNumber);
}
Scene *SceneManager::getNewScene() {
@ -289,7 +293,7 @@ void Scene::loadScene(int sceneNum) {
}
void Scene::loadSceneData(int sceneNum) {
_globals->_sceneManager._scene->_activeScreenNumber = sceneNum;
_activeScreenNumber = sceneNum;
// Get the basic scene size
byte *data = _resourceManager->getResource(RES_BITMAP, sceneNum, 9999);