diff options
author | Eugene Sandulenko | 2016-01-04 00:42:10 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-01-04 00:42:10 +0100 |
commit | cc14b5f96fc6457e240d8c7c9a9c16422dc3586d (patch) | |
tree | 08d4e70cf0beae746a621dee01f84fc7033a877a /engines/wage/script.cpp | |
parent | 2c8922ed3094e20afa53861e95a0b5d97460feee (diff) | |
download | scummvm-rg350-cc14b5f96fc6457e240d8c7c9a9c16422dc3586d.tar.gz scummvm-rg350-cc14b5f96fc6457e240d8c7c9a9c16422dc3586d.tar.bz2 scummvm-rg350-cc14b5f96fc6457e240d8c7c9a9c16422dc3586d.zip |
WAGE: Implement handleMoveCommand()
Diffstat (limited to 'engines/wage/script.cpp')
-rw-r--r-- | engines/wage/script.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp index 740d8ec164..c08b06be22 100644 --- a/engines/wage/script.cpp +++ b/engines/wage/script.cpp @@ -925,8 +925,37 @@ void Script::appendText(String str) { _callbacks->appendText(str); } +static const int directionsX[] = { 0, 0, 1, -1 }; +static const int directionsY[] = { -1, 1, 0, 0 }; + void Script::handleMoveCommand(Scene::Directions dir, const char *dirName) { - warning("STUB: handleMoveCommand"); + Scene *playerScene = _world->_player->_currentScene; + Common::String msg(playerScene->_messages[dir]); + + warning("Dir: %s msg: %s", dirName, msg.c_str()); + + if (!playerScene->_blocked[dir]) { + int destX = playerScene->_worldX + directionsX[dir]; + int destY = playerScene->_worldY + directionsY[dir]; + + Scene *scene = _world->getSceneAt(destX, destY); + + if (scene != NULL) { + if (msg.size() > 0) { + appendText(msg); + } + _world->move(_world->_player, scene); + return; + } + } + if (msg != NULL && msg.size() > 0) { + appendText(msg); + } else { + Common::String txt("You can't go "); + txt += dirName; + txt += "."; + appendText(txt); + } } void Script::handleLookCommand() { |