From b2c6483d1a22bcffd0f561f32a868371483c286b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 13 Apr 2014 11:21:06 +0300 Subject: FULLPIPE: Implement StaticANIObject::startAnimSteps() --- engines/fullpipe/statics.cpp | 84 +++++++++++++++++++++++++++++++++++++++++++- engines/fullpipe/statics.h | 1 + 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 73270579f3..7e66132664 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -105,6 +105,10 @@ bool StepArray::gotoNextPoint() { } } +void StepArray::insertPoints(Common::Point **points, int pointsCount) { + warning("STUB: StepArray::insertPoints()"); +} + StaticANIObject::StaticANIObject() { _shadowsOn = 1; _field_30 = 0; @@ -1137,7 +1141,85 @@ void StaticANIObject::playIdle() { } void StaticANIObject::startAnimSteps(int movementId, int messageQueueId, int x, int y, Common::Point **points, int pointsCount, int someDynamicPhaseIndex) { - warning("STUB: StaticANIObject::startAnimSteps()"); + Movement *mov = 0; + + if (!(_flags & 0x80)) { + if (!_messageQueueId) + for (uint i = 0; i < _movements.size(); i++) { + if (((Movement *)_movements[i])->_id == movementId) { + mov = (Movement *)_movements[i]; + break; + } + } + } + + if (!mov) { + updateGlobalMessageQueue(messageQueueId, _id); + + return; + } + + + if (_movement || !_statics) + return; + + Common::Point point; + + _statics->getSomeXY(point); + + int newx = _ox - point.x; + int newy = _oy - point.y; + + _movement = mov; + + if (_flags & 0x40) + _movement->gotoLastFrame(); + else + _movement->gotoFirstFrame(); + + _stepArray.clear(); + _stepArray.insertPoints(points, pointsCount); + + if (!(_flags & 0x40)) { + if (!_movement->_currDynamicPhaseIndex) { + _stepArray.getCurrPoint(&point); + newx += point.x + _movement->_mx; + newy += point.y + _movement->_my; + _stepArray.gotoNextPoint(); + + ExCommand *ex = _movement->_currDynamicPhase->getExCommand(); + + if (ex) { + if (ex->_messageKind == 35) { + ExCommand *newEx = ex->createClone(); + + newEx->_excFlags |= 2u; + newEx->sendMessage(); + } + } + } + } + + _movement->getCurrDynamicPhaseXY(point); + setOXY(point.x + newx, point.y + newy); + + if ((_movement->_staticsObj2->_staticsId >> 8) & 0x40) + _flags |= 8; + else + _flags &= 0xFFF7; + + _flags |= 1; + _messageQueueId = messageQueueId; + _movement->_currDynamicPhase->_countdown = _movement->_currDynamicPhase->_initialCountdown; + _movement->_counter = 0; + _counter = _initialCounter; + _someDynamicPhaseIndex = someDynamicPhaseIndex; + + ExCommand *ex = new ExCommand(_id, 17, 23, 0, 0, movementId, 1, 0, 0, 0); + + ex->_keyCode = _okeyCode; + ex->_excFlags = 2; + ex->postMessage(); } bool StaticANIObject::startAnimEx(int movid, int parId, int flag1, int flag2) { diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index 8328e7679b..89703965cd 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -47,6 +47,7 @@ class StepArray : public CObject { Common::Point *getCurrPoint(Common::Point *point); Common::Point *getPoint(Common::Point *point, int index, int offset); bool gotoNextPoint(); + void insertPoints(Common::Point **points, int pointsCount); }; class StaticPhase : public Picture { -- cgit v1.2.3