From d7d058cd60aae2c898f285b183416d1393c4a7ad Mon Sep 17 00:00:00 2001 From: Marisa-Chan Date: Mon, 4 Aug 2014 16:32:48 +0700 Subject: ZVISION: New scriptManager location methods --- engines/zvision/scripting/script_manager.cpp | 26 ++++++++++++++++++++++++++ engines/zvision/scripting/script_manager.h | 3 +++ 2 files changed, 29 insertions(+) (limited to 'engines/zvision') diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp index 4dd51816a0..6a9398d356 100644 --- a/engines/zvision/scripting/script_manager.cpp +++ b/engines/zvision/scripting/script_manager.cpp @@ -486,6 +486,10 @@ void ScriptManager::onKeyUp(Common::KeyState keyState) { } } +void ScriptManager::changeLocation(const Location &_newLocation) { + changeLocation(_newLocation.world, _newLocation.room, _newLocation.node, _newLocation.view, _newLocation.offset); +} + void ScriptManager::changeLocation(char _world, char _room, char _node, char _view, uint32 offset) { _nextLocation.world = _world; _nextLocation.room = _room; @@ -731,6 +735,28 @@ Location ScriptManager::getCurrentLocation() const { return location; } +Location ScriptManager::getLastLocation() { + Location location; + location.world = getStateValue(StateKey_LastWorld); + location.room = getStateValue(StateKey_LastRoom); + location.node = getStateValue(StateKey_LastNode); + location.view = getStateValue(StateKey_LastView); + location.offset = getStateValue(StateKey_LastViewPos); + + return location; +} + +Location ScriptManager::getLastMenuLocation() { + Location location; + location.world = getStateValue(StateKey_Menu_LastWorld); + location.room = getStateValue(StateKey_Menu_LastRoom); + location.node = getStateValue(StateKey_Menu_LastNode); + location.view = getStateValue(StateKey_Menu_LastView); + location.offset = getStateValue(StateKey_Menu_LastViewPos); + + return location; +} + void ScriptManager::addEvent(Common::Event event) { _controlEvents.push_back(event); } diff --git a/engines/zvision/scripting/script_manager.h b/engines/zvision/scripting/script_manager.h index 6cc957874b..4d82f36aea 100644 --- a/engines/zvision/scripting/script_manager.h +++ b/engines/zvision/scripting/script_manager.h @@ -237,11 +237,14 @@ public: /** Mark next location */ void changeLocation(char world, char room, char node, char view, uint32 offset); + void changeLocation(const Location &_newLocation); void serialize(Common::WriteStream *stream); void deserialize(Common::SeekableReadStream *stream); Location getCurrentLocation() const; + Location getLastLocation(); + Location getLastMenuLocation(); private: void referenceTableAddPuzzle(uint32 key, puzzle_ref ref); -- cgit v1.2.3