diff options
author | Eugene Sandulenko | 2013-10-25 00:34:24 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-10-25 00:34:43 +0300 |
commit | 514f93b57fff606be8ccb2151199a5c3703b50a6 (patch) | |
tree | a52cb4a3f5f5aa21af536fa258158cc043c9da05 /engines/fullpipe/statics.cpp | |
parent | 0b4baa6873ae9a8249b8ce63a19fe0ed0d99f7b0 (diff) | |
download | scummvm-rg350-514f93b57fff606be8ccb2151199a5c3703b50a6.tar.gz scummvm-rg350-514f93b57fff606be8ccb2151199a5c3703b50a6.tar.bz2 scummvm-rg350-514f93b57fff606be8ccb2151199a5c3703b50a6.zip |
FULLPIPE: Implement StaticANIObject::updateStepPos()
Diffstat (limited to 'engines/fullpipe/statics.cpp')
-rw-r--r-- | engines/fullpipe/statics.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 0e9daadd45..f1107e587b 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -73,6 +73,27 @@ Common::Point *StepArray::getCurrPoint(Common::Point *point) { return point; } +Common::Point *StepArray::getPoint(Common::Point *point, int index, int offset) { + if (index == -1) + index = _currPointIndex; + + if (index + offset > _maxPointIndex - 1) + offset = _maxPointIndex - index; + + point->x = 0; + point->y = 0; + + while (offset >= 1) { + point->x += _points[index]->x; + point->y += _points[index]->y; + + index++; + offset--; + } + + return point; +} + bool StepArray::gotoNextPoint() { if (_currPointIndex < _maxPointIndex) { _currPointIndex++; @@ -744,6 +765,26 @@ void StaticANIObject::update(int counterdiff) { } } +void StaticANIObject::updateStepPos() { + Common::Point point; + + int ox = _movement->_ox; + int oy = _movement->_oy; + + _movement->calcSomeXY(point, 1); + int x = point.x; + int y = point.y; + + _stepArray.getPoint(&point, -1, _stepArray.getPointsCount()); + x += point.x; + y += point.y; + + _statics = _movement->_staticsObj2; + _movement = 0; + + setOXY(ox + x, oy + y); +} + void StaticANIObject::stopAnim_maybe() { debug(6, "StaticANIObject::stopAnim_maybe()"); |