diff options
-rw-r--r-- | engines/zvision/scr_file_handling.cpp | 39 | ||||
-rw-r--r-- | engines/zvision/script_manager.h | 8 |
2 files changed, 35 insertions, 12 deletions
diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index ca66e3bccd..ec73fa1fdf 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -56,13 +56,11 @@ void ScriptManager::parseScrFile(Common::String fileName) { parsePuzzle(puzzle, file); _activePuzzles.push_back(puzzle); } else if (line.matchString("control:*", true)) { - Control control; - char controlType[20]; - sscanf(line.c_str(),"control:%u %s",&(control.id), controlType); - - parseControl(control, file); - /** Holds the currently active puzzles */ - _activeControls.push_back(control); + Control *control = parseControl(line, file); + // Some controls don't require nodes. They just initialize the scene + if (control != 0) { + _activeControls.push_back(control); + } } } } @@ -284,13 +282,38 @@ byte ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { } else if (line.matchString("DISABLED", true)) { flags |= DISABLED; } + + line = stream.readLine(); + trimCommentsAndWhiteSpace(&line); } return flags; } -void ScriptManager::parseControl(Control &control, Common::SeekableReadStream &stream) { +Control *ScriptManager::parseControl(Common::String &line, Common::SeekableReadStream &stream) { + Control *control = 0; + uint32 key; + char controlTypeBuffer[20]; + + sscanf(line.c_str(), "control:%u %s {", &key, controlTypeBuffer); + + Common::String controlType(controlTypeBuffer); + + if (controlType.equalsIgnoreCase("push_toggle")) { + + } else if (controlType.equalsIgnoreCase("flat")) { + Control::parseFlatControl(_engine); + return 0; + } else if (controlType.equalsIgnoreCase("pana")) { + Control::parsePanoramaControl(_engine, stream); + return 0; + } + else if (controlType.equalsIgnoreCase("tilt")) { + Control::parseTiltControl(_engine, stream); + return 0; + } + return control; } } // End of namespace ZVision diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 1b12a0693d..8ffd3a0ad2 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -60,7 +60,7 @@ private: /** Holds the currently active puzzles */ Common::List<Puzzle> _activePuzzles; /** Holds the currently active controls */ - Common::List<Control> _activeControls; + Common::List<Control *> _activeControls; public: @@ -123,10 +123,10 @@ private: /** * Helper method for parseScrFile. Parses the stream into a Control object * - * @param control The object to store what is parsed - * @param stream Scr file stream + * @param line The line initially read + * @param stream Scr file stream */ - void parseControl(Control &control, Common::SeekableReadStream &stream); + Control *parseControl(Common::String &line, Common::SeekableReadStream &stream); }; |