aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-01-24 20:58:18 +0100
committerEugene Sandulenko2016-02-14 17:12:52 +0100
commit851c2d6f70649f048d9723d3012354fcda8594f8 (patch)
tree9e206e7f7de98805d4f70c5ed8ce05ab11bf14db
parent9713e260a2918b1d5a172488bdeaa45c3cc033c6 (diff)
downloadscummvm-rg350-851c2d6f70649f048d9723d3012354fcda8594f8.tar.gz
scummvm-rg350-851c2d6f70649f048d9723d3012354fcda8594f8.tar.bz2
scummvm-rg350-851c2d6f70649f048d9723d3012354fcda8594f8.zip
WAGE: Implement getValidMoveDirections()
-rw-r--r--engines/wage/combat.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/engines/wage/combat.cpp b/engines/wage/combat.cpp
index 96235d7da1..9002fa9721 100644
--- a/engines/wage/combat.cpp
+++ b/engines/wage/combat.cpp
@@ -285,10 +285,26 @@ void WageEngine::performTake(Chr *npc, Obj *obj) {
_world->move(obj, npc);
}
+static const int directionsX[] = { 0, 0, 1, -1 };
+static const int directionsY[] = { -1, 1, 0, 0 };
+
int WageEngine::getValidMoveDirections(Chr *npc) {
- warning("STUB: getValidMoveDirections()");
+ int directions = 0;
+ Scene *currentScene = npc->_currentScene;
+ for (int dir = 0; dir < 4; dir++) {
+ if (!currentScene->_blocked[dir]) {
+ int destX = currentScene->_worldX + directionsX[dir];
+ int destY = currentScene->_worldY + directionsY[dir];
- return 0;
+ Scene *scene = _world->getSceneAt(destX, destY);
+
+ if (scene != NULL && scene->_chrs.size() == 0) {
+ directions |= (1 << dir);
+ }
+ }
+ }
+
+ return directions;
}
void WageEngine::regen() {
@@ -331,9 +347,6 @@ void WageEngine::takeObj(Obj *obj) {
}
}
-static const int directionsX[] = { 0, 0, 1, -1 };
-static const int directionsY[] = { -1, 1, 0, 0 };
-
bool WageEngine::handleMoveCommand(Directions dir, const char *dirName) {
Scene *playerScene = _world->_player->_currentScene;
const char *msg = playerScene->_messages[dir].c_str();