aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2013-10-25 00:34:24 +0300
committerEugene Sandulenko2013-10-25 00:34:43 +0300
commit514f93b57fff606be8ccb2151199a5c3703b50a6 (patch)
treea52cb4a3f5f5aa21af536fa258158cc043c9da05
parent0b4baa6873ae9a8249b8ce63a19fe0ed0d99f7b0 (diff)
downloadscummvm-rg350-514f93b57fff606be8ccb2151199a5c3703b50a6.tar.gz
scummvm-rg350-514f93b57fff606be8ccb2151199a5c3703b50a6.tar.bz2
scummvm-rg350-514f93b57fff606be8ccb2151199a5c3703b50a6.zip
FULLPIPE: Implement StaticANIObject::updateStepPos()
-rw-r--r--engines/fullpipe/statics.cpp41
-rw-r--r--engines/fullpipe/statics.h4
2 files changed, 45 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()");
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index 2879edd8e1..370f540792 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -42,7 +42,10 @@ class StepArray : public CObject {
void clear();
int getCurrPointIndex() { return _currPointIndex; }
+ int getPointsCount() { return _maxPointIndex; }
+
Common::Point *getCurrPoint(Common::Point *point);
+ Common::Point *getPoint(Common::Point *point, int index, int offset);
bool gotoNextPoint();
};
@@ -234,6 +237,7 @@ class StaticANIObject : public GameObject {
MovTable *countMovements();
void setSpeed(int speed);
+ void updateStepPos();
void stopAnim_maybe();
MessageQueue *changeStatics1(int msgNum);