aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarisa-Chan2014-02-24 22:49:44 +0700
committerMarisa-Chan2014-02-24 22:49:44 +0700
commit3608a0f6c6be65cc86aac7b75dbed5505859f267 (patch)
tree0473e3b280432921f45b42b65c9bb2ccac4615c9
parent1af6f404f441a7a2d77bb0f23d1dbb1c838cf56c (diff)
downloadscummvm-rg350-3608a0f6c6be65cc86aac7b75dbed5505859f267.tar.gz
scummvm-rg350-3608a0f6c6be65cc86aac7b75dbed5505859f267.tar.bz2
scummvm-rg350-3608a0f6c6be65cc86aac7b75dbed5505859f267.zip
ZVISION: Change changelocation code for identical work to original.
-rw-r--r--engines/zvision/script_manager.cpp89
1 files changed, 59 insertions, 30 deletions
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp
index a1003197ef..54d126f8cb 100644
--- a/engines/zvision/script_manager.cpp
+++ b/engines/zvision/script_manager.cpp
@@ -58,10 +58,10 @@ void ScriptManager::initialize() {
cleanScriptScope(room);
cleanScriptScope(nodeview);
- _currentLocation.node = '0';
- _currentLocation.world = '0';
- _currentLocation.room = '0';
- _currentLocation.view = '0';
+ _currentLocation.node = 0;
+ _currentLocation.world = 0;
+ _currentLocation.room = 0;
+ _currentLocation.view = 0;
parseScrFile("universe.scr", universe);
changeLocation('g', 'a', 'r', 'y', 0);
@@ -489,46 +489,75 @@ void ScriptManager::do_changeLocation() {
setStateValue(StateKey_View, _nextLocation.view);
setStateValue(StateKey_ViewPos, _nextLocation.offset);
- // Clear all the containers
_referenceTable.clear();
- cleanScriptScope(nodeview);
- cleanScriptScope(room);
- cleanScriptScope(world);
-
addPuzzlesToReferenceTable(universe);
- // Parse into puzzles and controls
- Common::String fileName = Common::String::format("%c%c%c%c.scr", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view);
- parseScrFile(fileName, nodeview);
- addPuzzlesToReferenceTable(nodeview);
+ if (_nextLocation.world != _currentLocation.world) {
+ cleanScriptScope(nodeview);
+ cleanScriptScope(room);
+ cleanScriptScope(world);
+
+ Common::String fileName = Common::String::format("%c%c%c%c.scr", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view);
+ parseScrFile(fileName, nodeview);
+ addPuzzlesToReferenceTable(nodeview);
+
+ fileName = Common::String::format("%c%c.scr", _nextLocation.world, _nextLocation.room);
+ parseScrFile(fileName, room);
+ addPuzzlesToReferenceTable(room);
+
+ fileName = Common::String::format("%c.scr", _nextLocation.world);
+ parseScrFile(fileName, world);
+ addPuzzlesToReferenceTable(world);
+ } else if (_nextLocation.room != _currentLocation.room) {
+ cleanScriptScope(nodeview);
+ cleanScriptScope(room);
+
+ addPuzzlesToReferenceTable(world);
+
+ Common::String fileName = Common::String::format("%c%c%c%c.scr", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view);
+ parseScrFile(fileName, nodeview);
+ addPuzzlesToReferenceTable(nodeview);
- fileName = Common::String::format("%c%c.scr", _nextLocation.world, _nextLocation.room);
- parseScrFile(fileName, room);
- addPuzzlesToReferenceTable(room);
+ fileName = Common::String::format("%c%c.scr", _nextLocation.world, _nextLocation.room);
+ parseScrFile(fileName, room);
+ addPuzzlesToReferenceTable(room);
- fileName = Common::String::format("%c.scr", _nextLocation.world);
- parseScrFile(fileName, world);
- addPuzzlesToReferenceTable(world);
+ } else if (_nextLocation.node != _currentLocation.node || _nextLocation.view != _currentLocation.view) {
+ cleanScriptScope(nodeview);
+
+ addPuzzlesToReferenceTable(room);
+ addPuzzlesToReferenceTable(world);
+
+ Common::String fileName = Common::String::format("%c%c%c%c.scr", _nextLocation.world, _nextLocation.room, _nextLocation.node, _nextLocation.view);
+ parseScrFile(fileName, nodeview);
+ addPuzzlesToReferenceTable(nodeview);
+ }
_activeControls = &nodeview._controls;
// Revert to the idle cursor
_engine->getCursorManager()->changeCursor(CursorIndex_Idle);
- // Reset the background velocity
- //_engine->getRenderManager()->setBackgroundVelocity(0);
-
- // Remove any alphaEntries
- //_engine->getRenderManager()->clearAlphaEntries();
-
// Change the background position
_engine->getRenderManager()->setBackgroundPosition(_nextLocation.offset);
- // Update _currentLocation
- _currentLocation = _nextLocation;
-
- execScope(room);
- execScope(nodeview);
+ if (_currentLocation.world == 0 && _currentLocation.room == 0 && _currentLocation.node == 0 && _currentLocation.view == 0) {
+ _currentLocation = _nextLocation;
+ execScope(world);
+ execScope(room);
+ execScope(nodeview);
+ } else if (_nextLocation.world != _currentLocation.world) {
+ _currentLocation = _nextLocation;
+ execScope(room);
+ execScope(nodeview);
+ } else if (_nextLocation.room != _currentLocation.room) {
+ _currentLocation = _nextLocation;
+ execScope(room);
+ execScope(nodeview);
+ } else if (_nextLocation.node != _currentLocation.node || _nextLocation.view != _currentLocation.view) {
+ _currentLocation = _nextLocation;
+ execScope(nodeview);
+ }
}
void ScriptManager::serializeStateTable(Common::WriteStream *stream) {