ZVISION: Create method for getting the current location

This commit is contained in:
richiesams 2013-09-03 23:56:06 -05:00
parent 9dd54a16e0
commit b45c9e7c26
2 changed files with 17 additions and 7 deletions

View file

@ -37,8 +37,7 @@
namespace ZVision { namespace ZVision {
ScriptManager::ScriptManager(ZVision *engine) ScriptManager::ScriptManager(ZVision *engine)
: _engine(engine), : _engine(engine) {
_changeLocation(false) {
} }
ScriptManager::~ScriptManager() { ScriptManager::~ScriptManager() {
@ -61,11 +60,6 @@ void ScriptManager::initialize() {
void ScriptManager::update(uint deltaTimeMillis) { void ScriptManager::update(uint deltaTimeMillis) {
updateNodes(deltaTimeMillis); updateNodes(deltaTimeMillis);
checkPuzzleCriteria(); checkPuzzleCriteria();
if (_changeLocation) {
changeLocationIntern();
_changeLocation = false;
}
} }
void ScriptManager::createReferenceTable() { void ScriptManager::createReferenceTable() {
@ -333,6 +327,20 @@ void ScriptManager::changeLocation(char world, char room, char node, char view,
// Create the puzzle reference table // Create the puzzle reference table
createReferenceTable(); createReferenceTable();
// Update _currentLocation
_currentLocation.world = world;
_currentLocation.room = room;
_currentLocation.node = node;
_currentLocation.view = view;
_currentLocation.offset = offset;
}
Location ScriptManager::getCurrentLocation() const {
Location location = _currentLocation;
location.offset = _engine->getRenderManager()->getCurrentBackgroundOffset();
return location;
} }
} // End of namespace ZVision } // End of namespace ZVision

View file

@ -110,6 +110,8 @@ public:
void changeLocation(char world, char room, char node, char view, uint32 offset); void changeLocation(char world, char room, char node, char view, uint32 offset);
Location getCurrentLocation() const;
private: private:
void createReferenceTable(); void createReferenceTable();
void updateNodes(uint deltaTimeMillis); void updateNodes(uint deltaTimeMillis);