aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/walk.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2008-12-17 11:15:47 +0000
committerNicola Mettifogo2008-12-17 11:15:47 +0000
commit774773b7cd02e3c6932095af4905a25eb1862392 (patch)
treefd2bc1c6ee9ccaa47372639a7dfdda207335e3fd /engines/parallaction/walk.cpp
parent3591f8859ed5fe6ad4cc94671d7d43a52b9f01b6 (diff)
downloadscummvm-rg350-774773b7cd02e3c6932095af4905a25eb1862392.tar.gz
scummvm-rg350-774773b7cd02e3c6932095af4905a25eb1862392.tar.bz2
scummvm-rg350-774773b7cd02e3c6932095af4905a25eb1862392.zip
Reduced code duplication when manipulating Animations, and cleanup.
svn-id: r35408
Diffstat (limited to 'engines/parallaction/walk.cpp')
-rw-r--r--engines/parallaction/walk.cpp28
1 files changed, 7 insertions, 21 deletions
diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp
index ec24a29979..acd5daa8d5 100644
--- a/engines/parallaction/walk.cpp
+++ b/engines/parallaction/walk.cpp
@@ -360,7 +360,7 @@ void PathWalker_NS::walk() {
-PathBuilder_NS::PathBuilder_NS(Character *ch) : PathBuilder(ch), _list(0) {
+PathBuilder_NS::PathBuilder_NS(Character *ch) : PathBuilder(ch) {
}
@@ -515,25 +515,6 @@ void PathWalker_BR::walk() {
}
#endif
- GfxObj *obj = _ch->_ani->gfxobj;
-
- Common::Rect rect;
- obj->getRect(_ch->_ani->getF(), rect);
-
- uint scale;
- if (rect.bottom > _vm->_location._zeta0) {
- scale = 100;
- } else
- if (rect.bottom < _vm->_location._zeta1) {
- scale = _vm->_location._zeta2;
- } else {
- scale = _vm->_location._zeta2 + ((rect.bottom - _vm->_location._zeta1) * (100 - _vm->_location._zeta2)) / (_vm->_location._zeta0 - _vm->_location._zeta1);
- }
- int xStep = (scale * 16) / 100 + 1;
- int yStep = (scale * 10) / 100 + 1;
-
- debugC(9, kDebugWalk, "calculated step: (%i, %i)\n", xStep, yStep);
-
if (_fieldC == 0) {
_ch->_walkPath.erase(_ch->_walkPath.begin());
@@ -548,11 +529,16 @@ void PathWalker_BR::walk() {
_ch->getFoot(_startFoot);
+ uint scale = _vm->_location.getScale(_startFoot.y);
+ int xStep = (scale * 16) / 100 + 1;
+ int yStep = (scale * 10) / 100 + 1;
+
+ debugC(9, kDebugWalk, "calculated step: (%i, %i)\n", xStep, yStep);
+
_fieldC = 0;
_step++;
_step %= 8;
-
int maxX = _vm->_gfx->_backgroundInfo->width;
int minX = 0;
int maxY = _vm->_gfx->_backgroundInfo->height;