aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrichiesams2013-07-29 21:57:45 -0500
committerrichiesams2013-08-04 13:32:53 -0500
commit00eb2792438f118775546011d2f1abdc9b0bc0cd (patch)
treecc6f034c8aed8c6dc5f2f8410fb6e9bdff39222a
parent070042fcb4ea473cd2bfbebf9838957cdb9150b8 (diff)
downloadscummvm-rg350-00eb2792438f118775546011d2f1abdc9b0bc0cd.tar.gz
scummvm-rg350-00eb2792438f118775546011d2f1abdc9b0bc0cd.tar.bz2
scummvm-rg350-00eb2792438f118775546011d2f1abdc9b0bc0cd.zip
ZVISION: Create ScriptManager member function to change location
-rw-r--r--engines/zvision/actions.cpp2
-rw-r--r--engines/zvision/actions.h3
-rw-r--r--engines/zvision/script_manager.cpp24
-rw-r--r--engines/zvision/script_manager.h2
4 files changed, 29 insertions, 2 deletions
diff --git a/engines/zvision/actions.cpp b/engines/zvision/actions.cpp
index 35e5d4886d..0cec6af76e 100644
--- a/engines/zvision/actions.cpp
+++ b/engines/zvision/actions.cpp
@@ -88,7 +88,7 @@ bool ActionAttenuate::execute(ZVision *engine) {
//////////////////////////////////////////////////////////////////////////////
ActionChangeLocation::ActionChangeLocation(Common::String *line) {
- sscanf(line->c_str(), ":change_location(%c,%c,%2c,%hu)", &_world, &_room, &_nodeview, &_x);
+ sscanf(line->c_str(), ":change_location(%c,%c,%c%c,%hu)", &_world, &_room, &_node, &_view, &_x);
}
ResultAction *ActionChangeLocation::clone() const {
diff --git a/engines/zvision/actions.h b/engines/zvision/actions.h
index 75cffab59b..83f871d4e7 100644
--- a/engines/zvision/actions.h
+++ b/engines/zvision/actions.h
@@ -113,7 +113,8 @@ public:
private:
char _world;
char _room;
- char _nodeview[2];
+ char _node;
+ char _view;
int16 _x;
};
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp
index 85c900bc0e..97f2cadfce 100644
--- a/engines/zvision/script_manager.cpp
+++ b/engines/zvision/script_manager.cpp
@@ -136,4 +136,28 @@ void ScriptManager::addActionNode(ActionNode *node) {
_activeNodes.push_back(node);
}
+void ScriptManager::changeLocation(char world, char room, char node, char view, uint16 x) {
+ // Clear all the containers
+ _referenceTable.clear();
+ _puzzlesToCheck.clear();
+ _activePuzzles.clear();
+ // _activeControls is a list of pointers to the heap, so we have to delete the Controls before we call clear()
+ for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
+ delete (*iter);
+ }
+ _activeControls.clear();
+
+ // Parse into puzzles and controls
+ Common::String fileName = Common::String::format("%c%c%c&c.scr", world, room, node, view);
+ parseScrFile(fileName);
+
+ // Create the puzzle reference table
+ createReferenceTable();
+
+ // Add all the puzzles to the stack to be checked
+ for (Common::List<Puzzle>::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); iter++) {
+ _puzzlesToCheck.push(&(*iter));
+ }
+}
+
} // End of namespace ZVision
diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h
index 8ffd3a0ad2..caec0dd550 100644
--- a/engines/zvision/script_manager.h
+++ b/engines/zvision/script_manager.h
@@ -74,6 +74,8 @@ public:
void addActionNode(ActionNode *node);
+ void changeLocation(char world, char room, char node, char view, uint16 x);
+
private:
void createReferenceTable();