diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp index b1675dd7b917..53237db4ef8e 100644 --- a/engines/parallaction/walk.cpp +++ b/engines/parallaction/walk.cpp @@ -54,25 +54,25 @@ WalkFrames _char24WalkFrames_NS = { { 2, 2, 4, 4 } }; -static int get_path_width() { +static int getPathWidth() { if (!_vm->_gfx->_backgroundInfo->_path) { - warning("get_path_width() _path is NULL!"); + warning("getPathWidth() _path is NULL!"); return 0; } else return _vm->_gfx->_backgroundInfo->_path->w; } -static int get_path_height() { +static int getPathHeight() { if (!_vm->_gfx->_backgroundInfo->_path) { - warning("get_path_height() _path is NULL!"); + warning("getPathHeight() _path is NULL!"); return 0; } else return _vm->_gfx->_backgroundInfo->_path->h; } -static bool is_path_clear(uint16 x, uint16 y) { +static bool isPathClear(uint16 x, uint16 y) { if (!_vm->_gfx->_backgroundInfo->_path) { - warning("is_path_clear() _path is NULL!"); + warning("isPathClear() _path is NULL!"); return false; } else return (_vm->_gfx->_backgroundInfo->_path->getValue(x, y) ? true : false); @@ -80,19 +80,19 @@ static bool is_path_clear(uint16 x, uint16 y) { // adjusts position towards nearest walkable point void PathWalker_NS::correctPathPoint(Common::Point &to) { - if (is_path_clear(to.x, to.y)) return; + if (isPathClear(to.x, to.y)) return; - int maxX = get_path_width(); - int maxY = get_path_height(); + int maxX = getPathWidth(); + int maxY = getPathHeight(); int16 right = to.x; int16 left = to.x; do { right++; - } while ((right < maxX) && !is_path_clear(right, to.y)); + } while ((right < maxX) && !isPathClear(right, to.y)); do { left--; - } while ((left > 0) && !is_path_clear(left, to.y)); + } while ((left > 0) && !isPathClear(left, to.y)); right = (right == maxX) ? 1000 : right - to.x; left = (left == 0) ? 1000 : to.x - left; @@ -100,10 +100,10 @@ void PathWalker_NS::correctPathPoint(Common::Point &to) { int16 bottom = to.y; do { top--; - } while ((top > 0) && !is_path_clear(to.x, top)); + } while ((top > 0) && !isPathClear(to.x, top)); do { bottom++; - } while ((bottom < maxY) && !is_path_clear(to.x, bottom)); + } while ((bottom < maxY) && !isPathClear(to.x, bottom)); top = (top == 0) ? 1000 : to.y - top; bottom = (bottom == maxY) ? 1000 : bottom - to.y; @@ -225,10 +225,10 @@ uint16 PathWalker_NS::walkFunc1(const Common::Point &to, Common::Point& node) { while (foot != arg) { - if (foot.x < to.x && is_path_clear(foot.x + 1, foot.y)) foot.x++; - if (foot.x > to.x && is_path_clear(foot.x - 1, foot.y)) foot.x--; - if (foot.y < to.y && is_path_clear(foot.x, foot.y + 1)) foot.y++; - if (foot.y > to.y && is_path_clear(foot.x, foot.y - 1)) foot.y--; + if (foot.x < to.x && isPathClear(foot.x + 1, foot.y)) foot.x++; + if (foot.x > to.x && isPathClear(foot.x - 1, foot.y)) foot.x--; + if (foot.y < to.y && isPathClear(foot.x, foot.y + 1)) foot.y++; + if (foot.y > to.y && isPathClear(foot.x, foot.y - 1)) foot.y--; if (foot == v8 && foot != arg) { // foot couldn't move and still away from target @@ -237,10 +237,10 @@ uint16 PathWalker_NS::walkFunc1(const Common::Point &to, Common::Point& node) { while (foot != arg) { - if (foot.x < to.x && !is_path_clear(foot.x + 1, foot.y)) foot.x++; - if (foot.x > to.x && !is_path_clear(foot.x - 1, foot.y)) foot.x--; - if (foot.y < to.y && !is_path_clear(foot.x, foot.y + 1)) foot.y++; - if (foot.y > to.y && !is_path_clear(foot.x, foot.y - 1)) foot.y--; + if (foot.x < to.x && !isPathClear(foot.x + 1, foot.y)) foot.x++; + if (foot.x > to.x && !isPathClear(foot.x - 1, foot.y)) foot.x--; + if (foot.y < to.y && !isPathClear(foot.x, foot.y + 1)) foot.y++; + if (foot.y > to.y && !isPathClear(foot.x, foot.y - 1)) foot.y--; if (foot == v8 && foot != arg) return 0; @@ -260,19 +260,19 @@ uint16 PathWalker_NS::walkFunc1(const Common::Point &to, Common::Point& node) { } void PathWalker_NS::clipMove(Common::Point& pos, const Common::Point& to) { - if ((pos.x < to.x) && (pos.x < get_path_width()) && is_path_clear(pos.x + 2, pos.y)) { + if ((pos.x < to.x) && (pos.x < getPathWidth()) && isPathClear(pos.x + 2, pos.y)) { pos.x = (pos.x + 2 < to.x) ? pos.x + 2 : to.x; } - if ((pos.x > to.x) && (pos.x > 0) && is_path_clear(pos.x - 2, pos.y)) { + if ((pos.x > to.x) && (pos.x > 0) && isPathClear(pos.x - 2, pos.y)) { pos.x = (pos.x - 2 > to.x) ? pos.x - 2 : to.x; } - if ((pos.y < to.y) && (pos.y < get_path_height()) && is_path_clear(pos.x, pos.y + 2)) { + if ((pos.y < to.y) && (pos.y < getPathHeight()) && isPathClear(pos.x, pos.y + 2)) { pos.y = (pos.y + 2 <= to.y) ? pos.y + 2 : to.y; } - if ((pos.y > to.y) && (pos.y > 0) && is_path_clear(pos.x, pos.y - 2)) { + if ((pos.y > to.y) && (pos.y > 0) && isPathClear(pos.x, pos.y - 2)) { pos.y = (pos.y - 2 >= to.y) ? pos.y - 2 : to.y; } } @@ -390,10 +390,10 @@ bool PathWalker_BR::directPathExists(const Common::Point &from, const Common::Po Common::Point p(copy); while (p != to) { - if (p.x < to.x && is_path_clear(p.x + 1, p.y)) p.x++; - if (p.x > to.x && is_path_clear(p.x - 1, p.y)) p.x--; - if (p.y < to.y && is_path_clear(p.x, p.y + 1)) p.y++; - if (p.y > to.y && is_path_clear(p.x, p.y - 1)) p.y--; + if (p.x < to.x && isPathClear(p.x + 1, p.y)) p.x++; + if (p.x > to.x && isPathClear(p.x - 1, p.y)) p.x--; + if (p.y < to.y && isPathClear(p.x, p.y + 1)) p.y++; + if (p.y > to.y && isPathClear(p.x, p.y - 1)) p.y--; if (p == copy && p != to) return false; @@ -642,7 +642,7 @@ void PathWalker_BR::doWalk(State &s) { assert (!s._walkPath.empty()); Common::Point p(*s._walkPath.begin()); - if (s._startFoot.y < p.y && (s._startFoot.y + yStep) < maxY && is_path_clear(s._startFoot.x, s._startFoot.y + yStep)) { + if (s._startFoot.y < p.y && (s._startFoot.y + yStep) < maxY && isPathClear(s._startFoot.x, s._startFoot.y + yStep)) { if (yStep + s._startFoot.y <= p.y) { s._stillWalkingTowardsNode = true; delta.y = yStep; @@ -653,7 +653,7 @@ void PathWalker_BR::doWalk(State &s) { } s._dirFrame = 9; } else - if (s._startFoot.y > p.y && (s._startFoot.y - yStep) > minY && is_path_clear(s._startFoot.x, s._startFoot.y - yStep)) { + if (s._startFoot.y > p.y && (s._startFoot.y - yStep) > minY && isPathClear(s._startFoot.x, s._startFoot.y - yStep)) { if (s._startFoot.y - yStep >= p.y) { s._stillWalkingTowardsNode = true; delta.y = yStep; @@ -665,7 +665,7 @@ void PathWalker_BR::doWalk(State &s) { s._dirFrame = 0; } - if (s._startFoot.x < p.x && (s._startFoot.x + xStep) < maxX && is_path_clear(s._startFoot.x + xStep, s._startFoot.y)) { + if (s._startFoot.x < p.x && (s._startFoot.x + xStep) < maxX && isPathClear(s._startFoot.x + xStep, s._startFoot.y)) { if (s._startFoot.x + xStep <= p.x) { s._stillWalkingTowardsNode = true; delta.x = xStep; @@ -678,7 +678,7 @@ void PathWalker_BR::doWalk(State &s) { s._dirFrame = 18; // right } } else - if (s._startFoot.x > p.x && (s._startFoot.x - xStep) > minX && is_path_clear(s._startFoot.x - xStep, s._startFoot.y)) { + if (s._startFoot.x > p.x && (s._startFoot.x - xStep) > minX && isPathClear(s._startFoot.x - xStep, s._startFoot.y)) { if (s._startFoot.x - xStep >= p.x) { s._stillWalkingTowardsNode = true; delta.x = xStep;