[Scummvm-cvs-logs] scummvm master -> 68508cb87e09ac1c6c5abffdb5a1f0d314cc9ff7
sev-
sev at scummvm.org
Sun Aug 14 21:41:14 CEST 2016
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e3acf3f23e FULLPIPE: Rename mgm.* to anihandler.*
f99e47de6e FULLPIPE: Rename MGM class to AniHandler
060d1f7254 FULLPIPE: Rename various mgm variables to aniHandler
68828123da FULLPIPE: Mass renaming of AniHandler class
1bcec8bcd9 FULLPIPE: Further renames in AniHandler class
68508cb87e FULLPIPE: Renamed rest of the AniHandler class methods
Commit: e3acf3f23e2668ee6e0c2427c85cd7411e894534
https://github.com/scummvm/scummvm/commit/e3acf3f23e2668ee6e0c2427c85cd7411e894534
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-14T21:40:29+02:00
Commit Message:
FULLPIPE: Rename mgm.* to anihandler.*
Changed paths:
A engines/fullpipe/anihandler.cpp
A engines/fullpipe/anihandler.h
R engines/fullpipe/mgm.cpp
R engines/fullpipe/mgm.h
engines/fullpipe/module.mk
engines/fullpipe/motion.h
diff --git a/engines/fullpipe/anihandler.cpp b/engines/fullpipe/anihandler.cpp
new file mode 100644
index 0000000..62fbb1f
--- /dev/null
+++ b/engines/fullpipe/anihandler.cpp
@@ -0,0 +1,764 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "fullpipe/fullpipe.h"
+
+#include "fullpipe/utils.h"
+#include "fullpipe/statics.h"
+#include "fullpipe/motion.h"
+#include "fullpipe/messages.h"
+
+namespace Fullpipe {
+
+void MGM::clear() {
+ _items.clear();
+}
+
+MessageQueue *MGM::genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr) {
+ debugC(4, kDebugPathfinding, "MGM::genMQ(*%d, %d, %d, res, point)", ani->_id, staticsIndex, staticsId);
+
+ int idx = getItemIndexById(ani->_id);
+
+ if (idx == -1)
+ return 0;
+
+ int stid = staticsId;
+
+ if (!staticsId) {
+ if (ani->_movement) {
+ stid = ani->_movement->_staticsObj2->_staticsId;
+ } else {
+ if (!ani->_statics)
+ return 0;
+
+ stid = ani->_statics->_staticsId;
+ }
+ }
+
+ if (stid == staticsIndex)
+ return new MessageQueue(g_fp->_globalMessageQueueList->compact());
+
+ int startidx = getStaticsIndexById(idx, stid);
+ int endidx = getStaticsIndexById(idx, staticsIndex);
+ int subidx = startidx + endidx * _items[idx]->statics.size();
+
+ if (!_items[idx]->subItems[subidx]->movement) {
+ clearMovements2(idx);
+ recalcOffsets(idx, startidx, endidx, 0, 1);
+ }
+
+ if (!_items[idx]->subItems[subidx]->movement)
+ return 0;
+
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ Common::Point point;
+ ExCommand *ex;
+
+ int i = 0;
+ do {
+ subidx = startidx + endidx * _items[idx]->statics.size();
+
+ _items[idx]->subItems[subidx]->movement->calcSomeXY(point, 0, -1);
+
+ if (pointArr) {
+ int sz;
+
+ if (_items[idx]->subItems[subidx]->movement->_currMovement)
+ sz = _items[idx]->subItems[subidx]->movement->_currMovement->_dynamicPhases.size();
+ else
+ sz = _items[idx]->subItems[subidx]->movement->_dynamicPhases.size();
+
+ ex = new ExCommand2(20, ani->_id, &pointArr[i], sz);
+
+ ex->_messageNum = _items[idx]->subItems[subidx]->movement->_id;
+ } else {
+ ex = new ExCommand(ani->_id, 1, _items[idx]->subItems[subidx]->movement->_id, 0, 0, 0, 1, 0, 0, 0);
+ }
+
+ ex->_keyCode = ani->_okeyCode;
+ ex->_field_3C = 1;
+ ex->_field_24 = 1;
+
+ mq->addExCommandToEnd(ex);
+
+ if (resStatId)
+ *resStatId = _items[idx]->subItems[subidx]->movement->_id;
+
+ startidx = _items[idx]->subItems[subidx]->staticsIndex;
+
+ uint step;
+
+ if (_items[idx]->subItems[subidx]->movement->_currMovement)
+ step = _items[idx]->subItems[subidx]->movement->_currMovement->_dynamicPhases.size();
+ else
+ step = _items[idx]->subItems[subidx]->movement->_dynamicPhases.size();
+
+ i += step;
+ } while (startidx != endidx);
+
+ return mq;
+}
+
+MGMItem::MGMItem() {
+ objId = 0;
+}
+
+MGMSubItem::MGMSubItem() {
+ movement = 0;
+ staticsIndex = 0;
+ field_8 = 0;
+ field_C = 0;
+ x = 0;
+ y = 0;
+}
+
+void MGM::addItem(int objId) {
+ debugC(4, kDebugPathfinding, "MGM::addItem(%d)", objId);
+
+ if (getItemIndexById(objId) == -1) {
+ MGMItem *item = new MGMItem();
+
+ item->objId = objId;
+ _items.push_back(item);
+ }
+ rebuildTables(objId);
+}
+
+void MGM::rebuildTables(int objId) {
+ int idx = getItemIndexById(objId);
+
+ if (idx == -1)
+ return;
+
+ debugC(3, kDebugPathfinding, "MGM::rebuildTables. (1) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
+
+ _items[idx]->subItems.clear();
+ _items[idx]->statics.clear();
+ _items[idx]->movements1.clear();
+ _items[idx]->movements2.clear();
+
+ StaticANIObject *obj = g_fp->_currentScene->getStaticANIObject1ById(objId, -1);
+
+ if (!obj)
+ return;
+
+ debugC(1, kDebugPathfinding, "WWW rebuild. idx: %d, size: %d", idx, obj->_staticsList.size() * obj->_staticsList.size());
+ for (uint i = 0; i < obj->_staticsList.size(); i++) {
+ _items[idx]->statics.push_back((Statics *)obj->_staticsList[i]);
+
+ for (uint j = 0; j < obj->_staticsList.size(); j++) // Yes, square
+ _items[idx]->subItems.push_back(new MGMSubItem);
+ }
+
+ for (uint i = 0; i < obj->_movements.size(); i++) {
+ _items[idx]->movements1.push_back((Movement *)obj->_movements[i]);
+ _items[idx]->movements2.push_back(0);
+ }
+
+ debugC(3, kDebugPathfinding, "MGM::rebuildTables. (2) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
+}
+
+int MGM::getItemIndexById(int objId) {
+ for (uint i = 0; i < _items.size(); i++)
+ if (_items[i]->objId == objId)
+ return i;
+
+ return -1;
+}
+
+MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
+ debugC(4, kDebugPathfinding, "MGM::genMovement(*%d)", mgminfo->ani ? mgminfo->ani->_id : -1);
+
+ if (!mgminfo->ani)
+ return 0;
+
+ Movement *mov = mgminfo->ani->_movement;
+
+ if (!mov && !mgminfo->ani->_statics)
+ return 0;
+
+ if (!(mgminfo->flags & 1)) {
+ if (mov)
+ mgminfo->staticsId1 = mov->_staticsObj2->_staticsId;
+ else
+ mgminfo->staticsId1 = mgminfo->ani->_statics->_staticsId;
+ }
+
+ Common::Point point;
+
+ if (!(mgminfo->flags & 0x10) || !(mgminfo->flags & 0x20)) {
+ int nx = mgminfo->ani->_ox;
+ int ny = mgminfo->ani->_oy;
+
+ if (mgminfo->ani->_movement) {
+ mgminfo->ani->calcNextStep(&point);
+
+ nx += point.x;
+ ny += point.y;
+ }
+
+ if (!(mgminfo->flags & 0x10))
+ mgminfo->x2 = nx;
+
+ if (!(mgminfo->flags & 0x20))
+ mgminfo->y2 = ny;
+ }
+
+ mov = mgminfo->ani->getMovementById(mgminfo->movementId);
+
+ if (!mov)
+ return 0;
+
+
+ int itemIdx = getItemIndexById(mgminfo->ani->_id);
+ int subIdx = getStaticsIndexById(itemIdx, mgminfo->staticsId1);
+ int st2idx = getStaticsIndexById(itemIdx, mov->_staticsObj1->_staticsId);
+ int st1idx = getStaticsIndexById(itemIdx, mov->_staticsObj2->_staticsId);
+ int subOffset = getStaticsIndexById(itemIdx, mgminfo->staticsId2);
+
+ debugC(3, kDebugPathfinding, "MGM::genMovement. (1) movements1 sz: %d movements2 sz: %d", _items[itemIdx]->movements1.size(), _items[itemIdx]->movements2.size());
+
+ clearMovements2(itemIdx);
+ recalcOffsets(itemIdx, subIdx, st2idx, 0, 1);
+ clearMovements2(itemIdx);
+ recalcOffsets(itemIdx, st1idx, subOffset, 0, 1);
+
+ MGMSubItem *sub1 = _items[itemIdx]->subItems[subIdx + st2idx * _items[itemIdx]->statics.size()];
+ MGMSubItem *sub2 = _items[itemIdx]->subItems[st1idx + subOffset * _items[itemIdx]->statics.size()];
+
+ if (subIdx != st2idx && !sub1->movement)
+ return 0;
+
+ if (st1idx != subOffset && !sub2->movement)
+ return 0;
+
+ int n1x = mgminfo->x1 - mgminfo->x2 - sub1->x - sub2->x;
+ int n1y = mgminfo->y1 - mgminfo->y2 - sub1->y - sub2->y;
+
+ Common::Point point1;
+
+ mov->calcSomeXY(point1, 0, -1);
+
+ int n2x = point1.x;
+ int n2y = point1.y;
+ int mult;
+ int len = -1;
+
+ if (mgminfo->flags & 0x40) {
+ mult = mgminfo->field_10;
+ len = -1;
+ n2x *= mult;
+ n2y *= mult;
+ } else {
+ calcLength(&point, mov, n1x, n1y, &mult, &len, 1);
+ n2x = point.x;
+ n2y = point.y;
+ }
+
+ if (!(mgminfo->flags & 2)) {
+ len = -1;
+ n2x = mult * point1.x;
+ n1x = mult * point1.x;
+ mgminfo->x1 = mgminfo->x2 + mult * point1.x + sub1->x + sub2->x;
+ }
+
+ if (!(mgminfo->flags & 4)) {
+ n2y = mult * point1.y;
+ n1y = mult * point1.y;
+ len = -1;
+ mgminfo->y1 = mgminfo->y2 + mult * point1.y + sub1->y + sub2->y;
+ }
+
+ int px = 0;
+ int py = 0;
+
+ if (sub1->movement) {
+ px = countPhases(itemIdx, subIdx, st2idx, 1);
+ py = countPhases(itemIdx, subIdx, st2idx, 2);
+ }
+
+ if (mult > 1) {
+ px += (mult - 1) * mov->countPhasesWithFlag(-1, 1);
+ py += (mult - 1) * mov->countPhasesWithFlag(-1, 2);
+ }
+
+ if (mult > 0) {
+ px += mov->countPhasesWithFlag(len, 1);
+ py += mov->countPhasesWithFlag(len, 2);
+ }
+
+ if (sub2->movement) {
+ px += countPhases(itemIdx, st1idx, subOffset, 1);
+ py += countPhases(itemIdx, st1idx, subOffset, 2);
+ }
+
+ int dx1 = n1x - n2x;
+ int dy1 = n1y - n2y;
+ int x1, y1;
+
+ if (px) {
+ x1 = (int)((double)dx1 / (double)px);
+ } else {
+ x1 = 0;
+ }
+
+ if (py) {
+ y1 = (int)((double)dy1 / (double)py);
+ } else {
+ y1 = 0;
+ }
+
+ Common::Point x2, y2;
+
+ y2.x = dx1 - px * x1;
+ y2.y = dy1 - py * y1;
+
+ if (n1x - n2x == px * x1)
+ x2.x = 0;
+ else
+ x2.x = (dx1 - px * x1) / abs(dx1 - px * x1);
+
+ if (dy1 == py * y1)
+ x2.y = 0;
+ else
+ x2.y = (dy1 - py * y1) / abs(dy1 - py * y1);
+
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ ExCommand2 *ex2;
+
+ for (int i = subIdx; i != st2idx;) {
+ MGMSubItem *s = _items[itemIdx]->subItems[i + subOffset * _items[itemIdx]->statics.size()];
+
+ ex2 = buildExCommand2(s->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1);
+ ex2->_parId = mq->_id;
+ ex2->_keyCode = mgminfo->ani->_okeyCode;
+
+ mq->addExCommandToEnd(ex2);
+
+ i = s->staticsIndex;
+ }
+
+ for (int i = 0; i < mult; ++i) {
+ int plen;
+
+ if (i == mult - 1)
+ plen = len;
+ else
+ plen = -1;
+
+ ex2 = buildExCommand2(mov, mgminfo->ani->_id, x1, y1, &x2, &y2, plen);
+ ex2->_parId = mq->_id;
+ ex2->_keyCode = mgminfo->ani->_okeyCode;
+
+ mq->addExCommandToEnd(ex2);
+ }
+
+ for (int j = st1idx; j != subOffset;) {
+ MGMSubItem *s = _items[itemIdx]->subItems[j + subOffset * _items[itemIdx]->statics.size()];
+
+ ex2 = buildExCommand2(s->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1);
+ ex2->_parId = mq->_id;
+ ex2->_keyCode = mgminfo->ani->_okeyCode;
+
+ mq->addExCommandToEnd(ex2);
+
+ j = s->staticsIndex;
+ }
+
+ ExCommand *ex = new ExCommand(mgminfo->ani->_id, 5, -1, mgminfo->x1, mgminfo->y1, 0, 1, 0, 0, 0);
+
+ ex->_field_14 = mgminfo->field_1C;
+ ex->_keyCode = mgminfo->ani->_okeyCode;
+ ex->_field_24 = 0;
+ ex->_excFlags |= 3;
+
+ mq->addExCommandToEnd(ex);
+
+ debugC(3, kDebugPathfinding, "MGM::genMovement. (2) movements1 sz: %d movements2 sz: %d", _items[itemIdx]->movements1.size(), _items[itemIdx]->movements2.size());
+
+ return mq;
+}
+
+int MGM::countPhases(int idx, int subIdx, int endIdx, int flag) {
+ int res = 0;
+
+ if (endIdx < 0)
+ return 0;
+
+ while (subIdx != endIdx) {
+ if (subIdx < 0)
+ break;
+
+ res += _items[idx]->subItems[subIdx + endIdx * _items[idx]->statics.size()]->movement->countPhasesWithFlag(0xffffffff, flag);
+
+ subIdx = _items[idx]->subItems[subIdx + endIdx * _items[idx]->statics.size()]->staticsIndex;
+ }
+
+ return res;
+}
+void MGM::updateAnimStatics(StaticANIObject *ani, int staticsId) {
+ debugC(4, kDebugPathfinding, "MGM::updateAnimStatics(*%d, %d)", ani->_id, staticsId);
+
+ if (getItemIndexById(ani->_id) == -1)
+ return;
+
+ if (ani->_movement) {
+ ani->queueMessageQueue(0);
+ ani->_movement->gotoLastFrame();
+ ani->_statics = ani->_movement->_staticsObj2;
+
+ int x = ani->_movement->_ox;
+ int y = ani->_movement->_oy;
+
+ ani->_movement = 0;
+
+ ani->setOXY(x, y);
+ }
+
+ if (ani->_statics) {
+ Common::Point point;
+
+ getPoint(&point, ani->_id, ani->_statics->_staticsId, staticsId);
+
+ ani->setOXY(ani->_ox + point.x, ani->_oy + point.y);
+
+ ani->_statics = ani->getStaticsById(staticsId);
+ }
+}
+
+Common::Point *MGM::getPoint(Common::Point *point, int objectId, int staticsId1, int staticsId2) {
+ debugC(4, kDebugPathfinding, "MGM::getPoint([%d, %d], %d, %d, %d)", point->x, point->y, objectId, staticsId1, staticsId2);
+
+ int idx = getItemIndexById(objectId);
+
+ if (idx == -1) {
+ point->x = -1;
+ point->y = -1;
+ } else {
+ int st1idx = getStaticsIndexById(idx, staticsId1);
+ int st2idx = getStaticsIndexById(idx, staticsId2);
+
+ if (st1idx == st2idx) {
+ point->x = 0;
+ point->y = 0;
+ } else {
+ int subidx = st1idx + st2idx * _items[idx]->statics.size();
+
+ if (!_items[idx]->subItems[subidx]->movement) {
+ clearMovements2(idx);
+ recalcOffsets(idx, st1idx, st2idx, false, true);
+
+ if (!_items[idx]->subItems[subidx]->movement) {
+ clearMovements2(idx);
+ recalcOffsets(idx, st1idx, st2idx, true, false);
+ }
+ }
+
+ MGMSubItem *sub = _items[idx]->subItems[subidx];
+
+ if (sub->movement) {
+ point->x = sub->x;
+ point->y = sub->y;
+ } else {
+ point->x = 0;
+ point->y = 0;
+ }
+ }
+ }
+
+ return point;
+}
+
+int MGM::getStaticsIndexById(int idx, int16 id) {
+ if (!_items[idx]->statics.size())
+ return -1;
+
+ for (uint i = 0; i < _items[idx]->statics.size(); i++) {
+ if (_items[idx]->statics[i]->_staticsId == id)
+ return i;
+ }
+
+ return -1;
+}
+
+int MGM::getStaticsIndex(int idx, Statics *st) {
+ if (!_items[idx]->statics.size())
+ return -1;
+
+ for (uint i = 0; i < _items[idx]->statics.size(); i++) {
+ if (_items[idx]->statics[i] == st)
+ return i;
+ }
+
+ return -1;
+}
+
+void MGM::clearMovements2(int idx) {
+ debugC(2, kDebugPathfinding, "MGM::clearMovements2(%d)", idx);
+
+ for (uint i = 0; i < _items[idx]->movements2.size(); i++)
+ _items[idx]->movements2[i] = 0;
+
+ debugC(3, kDebugPathfinding, "MGM::clearMovements2. movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
+}
+
+int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
+ MGMItem *item = _items[idx];
+ int subIdx = st1idx + st2idx * item->statics.size();
+
+ debugC(2, kDebugPathfinding, "MGM::recalcOffsets(%d, %d, %d, %d, %d)", idx, st1idx, st2idx, flip, flop);
+
+ if (st1idx == st2idx) {
+ memset(item->subItems[subIdx], 0, sizeof(*(item->subItems[subIdx])));
+ return 0;
+ }
+
+ if (item->subItems[subIdx]->movement)
+ return item->subItems[subIdx]->field_8;
+
+ Common::Point point;
+
+ debugC(3, kDebugPathfinding, "MGM::recalcOffsets. movements1 sz: %d movements2 sz: %d", item->movements1.size(), item->movements2.size());
+
+ for (uint i = 0; i < item->movements1.size(); i++) {
+ Movement *mov = item->movements1[i];
+
+ if (mov->_staticsObj1 == item->statics[st1idx]) {
+ if (item->movements2[i] || (flop && !mov->_field_50))
+ continue;
+
+ item->movements2[i] = 1;
+
+ int stidx = getStaticsIndex(idx, mov->_staticsObj2);
+ int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
+ int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+ debugC(1, kDebugPathfinding, "MGM::recalcOffsets, want idx: %d, off: %d (%d + %d), sz: %d", idx, stidx + st2idx * _items[idx]->statics.size(), stidx, st2idx, item->subItems.size());
+
+ int newsz = sz + item->subItems[stidx + st2idx * _items[idx]->statics.size()]->field_C;
+
+ if (recalc < 0)
+ continue;
+
+ if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1 ||
+ (item->subItems[subIdx]->field_8 == recalc + 1 && item->subItems[subIdx]->field_C > newsz)) {
+ item->subItems[subIdx]->movement = mov;
+ item->subItems[subIdx]->staticsIndex = stidx;
+ item->subItems[subIdx]->field_8 = recalc + 1;
+ item->subItems[subIdx]->field_C = newsz;
+
+ mov->calcSomeXY(point, 0, -1);
+
+ item->subItems[subIdx]->x = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->x + point.x;
+ item->subItems[subIdx]->y = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->y + point.y;
+ }
+ } else if (flip) {
+ if (mov->_staticsObj2 != item->statics[st1idx])
+ continue;
+
+ if (item->movements2[i] || (flop && !mov->_field_50))
+ continue;
+
+ item->movements2[i] = 1;
+
+ int stidx = getStaticsIndex(idx, mov->_staticsObj1);
+ int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
+
+ if (recalc < 0)
+ continue;
+
+ if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1) {
+ item->subItems[subIdx]->movement = mov;
+ item->subItems[subIdx]->staticsIndex = stidx;
+ item->subItems[subIdx]->field_8 = recalc + 1;
+
+ int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+
+ item->subItems[subIdx]->field_C = sz + item->subItems[stidx + st2idx * _items[idx]->statics.size()]->field_C;
+
+ mov->calcSomeXY(point, 0, -1);
+
+ item->subItems[subIdx]->x = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->x - point.x;
+ item->subItems[subIdx]->y = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->y - point.y;
+ }
+ }
+ }
+
+ if (item->subItems[subIdx]->movement)
+ return item->subItems[subIdx]->field_8;
+
+ return -1;
+}
+
+int MGM::refreshOffsets(int objectId, int idx1, int idx2) {
+ debugC(4, kDebugPathfinding, "MGM::refreshOffsets(%d, %d, %d)", objectId, idx1, idx2);
+
+ int idx = getItemIndexById(objectId);
+
+ if (idx != -1) {
+ int from = getStaticsIndexById(idx, idx1);
+ int to = getStaticsIndexById(idx, idx2);
+
+ debugC(1, kDebugPathfinding, "WWW 6, want idx: %d, off: %d", idx, from + to * _items[idx]->statics.size());
+ MGMSubItem *sub = _items[idx]->subItems[from + to * _items[idx]->statics.size()];
+
+ if (sub->movement) {
+ idx = sub->field_8;
+ } else {
+ clearMovements2(idx);
+ idx = recalcOffsets(idx, from, to, 0, 1);
+ }
+ }
+
+ return idx;
+}
+
+Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *mult, int *len, int flag) {
+ Common::Point point;
+
+ mov->calcSomeXY(point, 0, -1);
+ int p1x = point.x;
+ int p1y = point.y;
+
+ int newmult = 0;
+ int oldlen = *len;
+
+ if (abs(p1y) > abs(p1x)) {
+ if (mov->calcSomeXY(point, 0, -1)->y)
+ newmult = (int)((double)y / mov->calcSomeXY(point, 0, -1)->y);
+ } else if (mov->calcSomeXY(point, 0, -1)->x) {
+ newmult = (int)((double)x / mov->calcSomeXY(point, 0, -1)->x);
+ }
+
+ if (newmult < 0)
+ newmult = 0;
+
+ *mult = newmult;
+
+ int phase = 1;
+ int sz;
+
+ if (flag) {
+ if (abs(p1y) > abs(p1x)) {
+ while (abs(p1y * newmult + mov->calcSomeXY(point, 0, phase)->y) < abs(y)) {
+ sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+
+ if (phase > sz)
+ break;
+
+ phase++;
+ }
+ } else {
+ while (abs(p1x * newmult + mov->calcSomeXY(point, 0, phase)->x) < abs(x)) {
+ sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+
+ if (phase >= sz)
+ break;
+
+ phase++;
+ }
+ }
+
+ *len = phase - 1;
+ } else {
+ *len = -1;
+ }
+
+ int p2x = 0;
+ int p2y = 0;
+
+ if (!oldlen)
+ oldlen = -1;
+
+ if (oldlen > 0) {
+ ++*mult;
+
+ mov->calcSomeXY(point, 0, oldlen);
+ p2x = point.x;
+ p2y = point.y;
+
+ if (abs(p1y) > abs(p1x))
+ p2x = p1x;
+ else
+ p2y = p1y;
+ }
+
+ pRes->x = p2x + p1x * newmult;
+ pRes->y = p2y + p1y * newmult;
+
+ return pRes;
+}
+
+ExCommand2 *MGM::buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) {
+ debugC(2, kDebugPathfinding, "MGM::buildExCommand2(mov, %d, %d, %d, [%d, %d], [%d, %d], %d)", objId, x1, y1, x2->x, x2->y, y2->x, y2->y, len);
+
+ uint cnt;
+
+ if (mov->_currMovement)
+ cnt = mov->_currMovement->_dynamicPhases.size();
+ else
+ cnt = mov->_dynamicPhases.size();
+
+ if (len > 0 && cnt > (uint)len)
+ cnt = len;
+
+ Common::Point **points = (Common::Point **)malloc(sizeof(Common::Point *) * cnt);
+
+ for (uint i = 0; i < cnt; i++) {
+ int flags = mov->getDynamicPhaseByIndex(i)->getDynFlags();
+
+ points[i] = new Common::Point;
+
+ if (flags & 1) {
+ points[i]->x = x1 + x2->x;
+
+ y2->x -= x2->x;
+
+ if (!y2->x)
+ x2->x = 0;
+ }
+
+ if (flags & 2) {
+ points[i]->y = y1 + x2->y;
+
+ y2->y -= x2->y;
+
+ if (!y2->y)
+ x2->y = 0;
+ }
+ }
+
+ ExCommand2 *ex = new ExCommand2(20, objId, points, cnt);
+ ex->_excFlags = 2;
+ ex->_messageNum = mov->_id;
+ ex->_field_14 = len;
+ ex->_field_24 = 1;
+ ex->_keyCode = -1;
+
+ for (uint i = 0; i < cnt; i++)
+ delete points[i];
+
+ free(points);
+
+ return ex;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/anihandler.h b/engines/fullpipe/anihandler.h
new file mode 100644
index 0000000..1319589
--- /dev/null
+++ b/engines/fullpipe/anihandler.h
@@ -0,0 +1,95 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef FULLPIPE_MGM_H
+#define FULLPIPE_MGM_H
+
+namespace Fullpipe {
+
+class ExCommand2;
+class Movement;
+class Statics;
+
+struct MGMSubItem {
+ Movement *movement;
+ int staticsIndex;
+ int field_8;
+ int field_C;
+ int x;
+ int y;
+
+ MGMSubItem();
+};
+
+struct MGMItem {
+ int16 objId;
+ Common::Array<MGMSubItem *> subItems;
+ Common::Array<Statics *> statics;
+ Common::Array<Movement *> movements1;
+ Common::Array<int> movements2;
+
+ MGMItem();
+};
+
+struct MGMInfo {
+ StaticANIObject *ani;
+ int staticsId1;
+ int staticsId2;
+ int movementId;
+ int field_10;
+ int x1;
+ int y1;
+ int field_1C;
+ int x2;
+ int y2;
+ int flags;
+
+ MGMInfo() { memset(this, 0, sizeof(MGMInfo)); }
+};
+
+class MGM : public CObject {
+public:
+ Common::Array<MGMItem *> _items;
+
+public:
+ void clear();
+ void addItem(int objId);
+ void rebuildTables(int objId);
+ int getItemIndexById(int objId);
+
+ MessageQueue *genMovement(MGMInfo *mgminfo);
+ void updateAnimStatics(StaticANIObject *ani, int staticsId);
+ Common::Point *getPoint(Common::Point *point, int aniId, int staticsId1, int staticsId2);
+ int getStaticsIndexById(int idx, int16 id);
+ int getStaticsIndex(int idx, Statics *st);
+ void clearMovements2(int idx);
+ int recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop);
+ Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *mult, int *len, int flag);
+ ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len);
+ MessageQueue *genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr);
+ int countPhases(int idx, int subIdx, int subOffset, int flag);
+ int refreshOffsets(int objectId, int idx1, int idx2);
+};
+
+} // End of namespace Fullpipe
+
+#endif /* FULLPIPE_MGM_H */
diff --git a/engines/fullpipe/mgm.cpp b/engines/fullpipe/mgm.cpp
deleted file mode 100644
index 62fbb1f..0000000
--- a/engines/fullpipe/mgm.cpp
+++ /dev/null
@@ -1,764 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "fullpipe/fullpipe.h"
-
-#include "fullpipe/utils.h"
-#include "fullpipe/statics.h"
-#include "fullpipe/motion.h"
-#include "fullpipe/messages.h"
-
-namespace Fullpipe {
-
-void MGM::clear() {
- _items.clear();
-}
-
-MessageQueue *MGM::genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr) {
- debugC(4, kDebugPathfinding, "MGM::genMQ(*%d, %d, %d, res, point)", ani->_id, staticsIndex, staticsId);
-
- int idx = getItemIndexById(ani->_id);
-
- if (idx == -1)
- return 0;
-
- int stid = staticsId;
-
- if (!staticsId) {
- if (ani->_movement) {
- stid = ani->_movement->_staticsObj2->_staticsId;
- } else {
- if (!ani->_statics)
- return 0;
-
- stid = ani->_statics->_staticsId;
- }
- }
-
- if (stid == staticsIndex)
- return new MessageQueue(g_fp->_globalMessageQueueList->compact());
-
- int startidx = getStaticsIndexById(idx, stid);
- int endidx = getStaticsIndexById(idx, staticsIndex);
- int subidx = startidx + endidx * _items[idx]->statics.size();
-
- if (!_items[idx]->subItems[subidx]->movement) {
- clearMovements2(idx);
- recalcOffsets(idx, startidx, endidx, 0, 1);
- }
-
- if (!_items[idx]->subItems[subidx]->movement)
- return 0;
-
- MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
- Common::Point point;
- ExCommand *ex;
-
- int i = 0;
- do {
- subidx = startidx + endidx * _items[idx]->statics.size();
-
- _items[idx]->subItems[subidx]->movement->calcSomeXY(point, 0, -1);
-
- if (pointArr) {
- int sz;
-
- if (_items[idx]->subItems[subidx]->movement->_currMovement)
- sz = _items[idx]->subItems[subidx]->movement->_currMovement->_dynamicPhases.size();
- else
- sz = _items[idx]->subItems[subidx]->movement->_dynamicPhases.size();
-
- ex = new ExCommand2(20, ani->_id, &pointArr[i], sz);
-
- ex->_messageNum = _items[idx]->subItems[subidx]->movement->_id;
- } else {
- ex = new ExCommand(ani->_id, 1, _items[idx]->subItems[subidx]->movement->_id, 0, 0, 0, 1, 0, 0, 0);
- }
-
- ex->_keyCode = ani->_okeyCode;
- ex->_field_3C = 1;
- ex->_field_24 = 1;
-
- mq->addExCommandToEnd(ex);
-
- if (resStatId)
- *resStatId = _items[idx]->subItems[subidx]->movement->_id;
-
- startidx = _items[idx]->subItems[subidx]->staticsIndex;
-
- uint step;
-
- if (_items[idx]->subItems[subidx]->movement->_currMovement)
- step = _items[idx]->subItems[subidx]->movement->_currMovement->_dynamicPhases.size();
- else
- step = _items[idx]->subItems[subidx]->movement->_dynamicPhases.size();
-
- i += step;
- } while (startidx != endidx);
-
- return mq;
-}
-
-MGMItem::MGMItem() {
- objId = 0;
-}
-
-MGMSubItem::MGMSubItem() {
- movement = 0;
- staticsIndex = 0;
- field_8 = 0;
- field_C = 0;
- x = 0;
- y = 0;
-}
-
-void MGM::addItem(int objId) {
- debugC(4, kDebugPathfinding, "MGM::addItem(%d)", objId);
-
- if (getItemIndexById(objId) == -1) {
- MGMItem *item = new MGMItem();
-
- item->objId = objId;
- _items.push_back(item);
- }
- rebuildTables(objId);
-}
-
-void MGM::rebuildTables(int objId) {
- int idx = getItemIndexById(objId);
-
- if (idx == -1)
- return;
-
- debugC(3, kDebugPathfinding, "MGM::rebuildTables. (1) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
-
- _items[idx]->subItems.clear();
- _items[idx]->statics.clear();
- _items[idx]->movements1.clear();
- _items[idx]->movements2.clear();
-
- StaticANIObject *obj = g_fp->_currentScene->getStaticANIObject1ById(objId, -1);
-
- if (!obj)
- return;
-
- debugC(1, kDebugPathfinding, "WWW rebuild. idx: %d, size: %d", idx, obj->_staticsList.size() * obj->_staticsList.size());
- for (uint i = 0; i < obj->_staticsList.size(); i++) {
- _items[idx]->statics.push_back((Statics *)obj->_staticsList[i]);
-
- for (uint j = 0; j < obj->_staticsList.size(); j++) // Yes, square
- _items[idx]->subItems.push_back(new MGMSubItem);
- }
-
- for (uint i = 0; i < obj->_movements.size(); i++) {
- _items[idx]->movements1.push_back((Movement *)obj->_movements[i]);
- _items[idx]->movements2.push_back(0);
- }
-
- debugC(3, kDebugPathfinding, "MGM::rebuildTables. (2) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
-}
-
-int MGM::getItemIndexById(int objId) {
- for (uint i = 0; i < _items.size(); i++)
- if (_items[i]->objId == objId)
- return i;
-
- return -1;
-}
-
-MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
- debugC(4, kDebugPathfinding, "MGM::genMovement(*%d)", mgminfo->ani ? mgminfo->ani->_id : -1);
-
- if (!mgminfo->ani)
- return 0;
-
- Movement *mov = mgminfo->ani->_movement;
-
- if (!mov && !mgminfo->ani->_statics)
- return 0;
-
- if (!(mgminfo->flags & 1)) {
- if (mov)
- mgminfo->staticsId1 = mov->_staticsObj2->_staticsId;
- else
- mgminfo->staticsId1 = mgminfo->ani->_statics->_staticsId;
- }
-
- Common::Point point;
-
- if (!(mgminfo->flags & 0x10) || !(mgminfo->flags & 0x20)) {
- int nx = mgminfo->ani->_ox;
- int ny = mgminfo->ani->_oy;
-
- if (mgminfo->ani->_movement) {
- mgminfo->ani->calcNextStep(&point);
-
- nx += point.x;
- ny += point.y;
- }
-
- if (!(mgminfo->flags & 0x10))
- mgminfo->x2 = nx;
-
- if (!(mgminfo->flags & 0x20))
- mgminfo->y2 = ny;
- }
-
- mov = mgminfo->ani->getMovementById(mgminfo->movementId);
-
- if (!mov)
- return 0;
-
-
- int itemIdx = getItemIndexById(mgminfo->ani->_id);
- int subIdx = getStaticsIndexById(itemIdx, mgminfo->staticsId1);
- int st2idx = getStaticsIndexById(itemIdx, mov->_staticsObj1->_staticsId);
- int st1idx = getStaticsIndexById(itemIdx, mov->_staticsObj2->_staticsId);
- int subOffset = getStaticsIndexById(itemIdx, mgminfo->staticsId2);
-
- debugC(3, kDebugPathfinding, "MGM::genMovement. (1) movements1 sz: %d movements2 sz: %d", _items[itemIdx]->movements1.size(), _items[itemIdx]->movements2.size());
-
- clearMovements2(itemIdx);
- recalcOffsets(itemIdx, subIdx, st2idx, 0, 1);
- clearMovements2(itemIdx);
- recalcOffsets(itemIdx, st1idx, subOffset, 0, 1);
-
- MGMSubItem *sub1 = _items[itemIdx]->subItems[subIdx + st2idx * _items[itemIdx]->statics.size()];
- MGMSubItem *sub2 = _items[itemIdx]->subItems[st1idx + subOffset * _items[itemIdx]->statics.size()];
-
- if (subIdx != st2idx && !sub1->movement)
- return 0;
-
- if (st1idx != subOffset && !sub2->movement)
- return 0;
-
- int n1x = mgminfo->x1 - mgminfo->x2 - sub1->x - sub2->x;
- int n1y = mgminfo->y1 - mgminfo->y2 - sub1->y - sub2->y;
-
- Common::Point point1;
-
- mov->calcSomeXY(point1, 0, -1);
-
- int n2x = point1.x;
- int n2y = point1.y;
- int mult;
- int len = -1;
-
- if (mgminfo->flags & 0x40) {
- mult = mgminfo->field_10;
- len = -1;
- n2x *= mult;
- n2y *= mult;
- } else {
- calcLength(&point, mov, n1x, n1y, &mult, &len, 1);
- n2x = point.x;
- n2y = point.y;
- }
-
- if (!(mgminfo->flags & 2)) {
- len = -1;
- n2x = mult * point1.x;
- n1x = mult * point1.x;
- mgminfo->x1 = mgminfo->x2 + mult * point1.x + sub1->x + sub2->x;
- }
-
- if (!(mgminfo->flags & 4)) {
- n2y = mult * point1.y;
- n1y = mult * point1.y;
- len = -1;
- mgminfo->y1 = mgminfo->y2 + mult * point1.y + sub1->y + sub2->y;
- }
-
- int px = 0;
- int py = 0;
-
- if (sub1->movement) {
- px = countPhases(itemIdx, subIdx, st2idx, 1);
- py = countPhases(itemIdx, subIdx, st2idx, 2);
- }
-
- if (mult > 1) {
- px += (mult - 1) * mov->countPhasesWithFlag(-1, 1);
- py += (mult - 1) * mov->countPhasesWithFlag(-1, 2);
- }
-
- if (mult > 0) {
- px += mov->countPhasesWithFlag(len, 1);
- py += mov->countPhasesWithFlag(len, 2);
- }
-
- if (sub2->movement) {
- px += countPhases(itemIdx, st1idx, subOffset, 1);
- py += countPhases(itemIdx, st1idx, subOffset, 2);
- }
-
- int dx1 = n1x - n2x;
- int dy1 = n1y - n2y;
- int x1, y1;
-
- if (px) {
- x1 = (int)((double)dx1 / (double)px);
- } else {
- x1 = 0;
- }
-
- if (py) {
- y1 = (int)((double)dy1 / (double)py);
- } else {
- y1 = 0;
- }
-
- Common::Point x2, y2;
-
- y2.x = dx1 - px * x1;
- y2.y = dy1 - py * y1;
-
- if (n1x - n2x == px * x1)
- x2.x = 0;
- else
- x2.x = (dx1 - px * x1) / abs(dx1 - px * x1);
-
- if (dy1 == py * y1)
- x2.y = 0;
- else
- x2.y = (dy1 - py * y1) / abs(dy1 - py * y1);
-
- MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
- ExCommand2 *ex2;
-
- for (int i = subIdx; i != st2idx;) {
- MGMSubItem *s = _items[itemIdx]->subItems[i + subOffset * _items[itemIdx]->statics.size()];
-
- ex2 = buildExCommand2(s->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1);
- ex2->_parId = mq->_id;
- ex2->_keyCode = mgminfo->ani->_okeyCode;
-
- mq->addExCommandToEnd(ex2);
-
- i = s->staticsIndex;
- }
-
- for (int i = 0; i < mult; ++i) {
- int plen;
-
- if (i == mult - 1)
- plen = len;
- else
- plen = -1;
-
- ex2 = buildExCommand2(mov, mgminfo->ani->_id, x1, y1, &x2, &y2, plen);
- ex2->_parId = mq->_id;
- ex2->_keyCode = mgminfo->ani->_okeyCode;
-
- mq->addExCommandToEnd(ex2);
- }
-
- for (int j = st1idx; j != subOffset;) {
- MGMSubItem *s = _items[itemIdx]->subItems[j + subOffset * _items[itemIdx]->statics.size()];
-
- ex2 = buildExCommand2(s->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1);
- ex2->_parId = mq->_id;
- ex2->_keyCode = mgminfo->ani->_okeyCode;
-
- mq->addExCommandToEnd(ex2);
-
- j = s->staticsIndex;
- }
-
- ExCommand *ex = new ExCommand(mgminfo->ani->_id, 5, -1, mgminfo->x1, mgminfo->y1, 0, 1, 0, 0, 0);
-
- ex->_field_14 = mgminfo->field_1C;
- ex->_keyCode = mgminfo->ani->_okeyCode;
- ex->_field_24 = 0;
- ex->_excFlags |= 3;
-
- mq->addExCommandToEnd(ex);
-
- debugC(3, kDebugPathfinding, "MGM::genMovement. (2) movements1 sz: %d movements2 sz: %d", _items[itemIdx]->movements1.size(), _items[itemIdx]->movements2.size());
-
- return mq;
-}
-
-int MGM::countPhases(int idx, int subIdx, int endIdx, int flag) {
- int res = 0;
-
- if (endIdx < 0)
- return 0;
-
- while (subIdx != endIdx) {
- if (subIdx < 0)
- break;
-
- res += _items[idx]->subItems[subIdx + endIdx * _items[idx]->statics.size()]->movement->countPhasesWithFlag(0xffffffff, flag);
-
- subIdx = _items[idx]->subItems[subIdx + endIdx * _items[idx]->statics.size()]->staticsIndex;
- }
-
- return res;
-}
-void MGM::updateAnimStatics(StaticANIObject *ani, int staticsId) {
- debugC(4, kDebugPathfinding, "MGM::updateAnimStatics(*%d, %d)", ani->_id, staticsId);
-
- if (getItemIndexById(ani->_id) == -1)
- return;
-
- if (ani->_movement) {
- ani->queueMessageQueue(0);
- ani->_movement->gotoLastFrame();
- ani->_statics = ani->_movement->_staticsObj2;
-
- int x = ani->_movement->_ox;
- int y = ani->_movement->_oy;
-
- ani->_movement = 0;
-
- ani->setOXY(x, y);
- }
-
- if (ani->_statics) {
- Common::Point point;
-
- getPoint(&point, ani->_id, ani->_statics->_staticsId, staticsId);
-
- ani->setOXY(ani->_ox + point.x, ani->_oy + point.y);
-
- ani->_statics = ani->getStaticsById(staticsId);
- }
-}
-
-Common::Point *MGM::getPoint(Common::Point *point, int objectId, int staticsId1, int staticsId2) {
- debugC(4, kDebugPathfinding, "MGM::getPoint([%d, %d], %d, %d, %d)", point->x, point->y, objectId, staticsId1, staticsId2);
-
- int idx = getItemIndexById(objectId);
-
- if (idx == -1) {
- point->x = -1;
- point->y = -1;
- } else {
- int st1idx = getStaticsIndexById(idx, staticsId1);
- int st2idx = getStaticsIndexById(idx, staticsId2);
-
- if (st1idx == st2idx) {
- point->x = 0;
- point->y = 0;
- } else {
- int subidx = st1idx + st2idx * _items[idx]->statics.size();
-
- if (!_items[idx]->subItems[subidx]->movement) {
- clearMovements2(idx);
- recalcOffsets(idx, st1idx, st2idx, false, true);
-
- if (!_items[idx]->subItems[subidx]->movement) {
- clearMovements2(idx);
- recalcOffsets(idx, st1idx, st2idx, true, false);
- }
- }
-
- MGMSubItem *sub = _items[idx]->subItems[subidx];
-
- if (sub->movement) {
- point->x = sub->x;
- point->y = sub->y;
- } else {
- point->x = 0;
- point->y = 0;
- }
- }
- }
-
- return point;
-}
-
-int MGM::getStaticsIndexById(int idx, int16 id) {
- if (!_items[idx]->statics.size())
- return -1;
-
- for (uint i = 0; i < _items[idx]->statics.size(); i++) {
- if (_items[idx]->statics[i]->_staticsId == id)
- return i;
- }
-
- return -1;
-}
-
-int MGM::getStaticsIndex(int idx, Statics *st) {
- if (!_items[idx]->statics.size())
- return -1;
-
- for (uint i = 0; i < _items[idx]->statics.size(); i++) {
- if (_items[idx]->statics[i] == st)
- return i;
- }
-
- return -1;
-}
-
-void MGM::clearMovements2(int idx) {
- debugC(2, kDebugPathfinding, "MGM::clearMovements2(%d)", idx);
-
- for (uint i = 0; i < _items[idx]->movements2.size(); i++)
- _items[idx]->movements2[i] = 0;
-
- debugC(3, kDebugPathfinding, "MGM::clearMovements2. movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
-}
-
-int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
- MGMItem *item = _items[idx];
- int subIdx = st1idx + st2idx * item->statics.size();
-
- debugC(2, kDebugPathfinding, "MGM::recalcOffsets(%d, %d, %d, %d, %d)", idx, st1idx, st2idx, flip, flop);
-
- if (st1idx == st2idx) {
- memset(item->subItems[subIdx], 0, sizeof(*(item->subItems[subIdx])));
- return 0;
- }
-
- if (item->subItems[subIdx]->movement)
- return item->subItems[subIdx]->field_8;
-
- Common::Point point;
-
- debugC(3, kDebugPathfinding, "MGM::recalcOffsets. movements1 sz: %d movements2 sz: %d", item->movements1.size(), item->movements2.size());
-
- for (uint i = 0; i < item->movements1.size(); i++) {
- Movement *mov = item->movements1[i];
-
- if (mov->_staticsObj1 == item->statics[st1idx]) {
- if (item->movements2[i] || (flop && !mov->_field_50))
- continue;
-
- item->movements2[i] = 1;
-
- int stidx = getStaticsIndex(idx, mov->_staticsObj2);
- int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
- int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
- debugC(1, kDebugPathfinding, "MGM::recalcOffsets, want idx: %d, off: %d (%d + %d), sz: %d", idx, stidx + st2idx * _items[idx]->statics.size(), stidx, st2idx, item->subItems.size());
-
- int newsz = sz + item->subItems[stidx + st2idx * _items[idx]->statics.size()]->field_C;
-
- if (recalc < 0)
- continue;
-
- if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1 ||
- (item->subItems[subIdx]->field_8 == recalc + 1 && item->subItems[subIdx]->field_C > newsz)) {
- item->subItems[subIdx]->movement = mov;
- item->subItems[subIdx]->staticsIndex = stidx;
- item->subItems[subIdx]->field_8 = recalc + 1;
- item->subItems[subIdx]->field_C = newsz;
-
- mov->calcSomeXY(point, 0, -1);
-
- item->subItems[subIdx]->x = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->x + point.x;
- item->subItems[subIdx]->y = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->y + point.y;
- }
- } else if (flip) {
- if (mov->_staticsObj2 != item->statics[st1idx])
- continue;
-
- if (item->movements2[i] || (flop && !mov->_field_50))
- continue;
-
- item->movements2[i] = 1;
-
- int stidx = getStaticsIndex(idx, mov->_staticsObj1);
- int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
-
- if (recalc < 0)
- continue;
-
- if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1) {
- item->subItems[subIdx]->movement = mov;
- item->subItems[subIdx]->staticsIndex = stidx;
- item->subItems[subIdx]->field_8 = recalc + 1;
-
- int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
-
- item->subItems[subIdx]->field_C = sz + item->subItems[stidx + st2idx * _items[idx]->statics.size()]->field_C;
-
- mov->calcSomeXY(point, 0, -1);
-
- item->subItems[subIdx]->x = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->x - point.x;
- item->subItems[subIdx]->y = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->y - point.y;
- }
- }
- }
-
- if (item->subItems[subIdx]->movement)
- return item->subItems[subIdx]->field_8;
-
- return -1;
-}
-
-int MGM::refreshOffsets(int objectId, int idx1, int idx2) {
- debugC(4, kDebugPathfinding, "MGM::refreshOffsets(%d, %d, %d)", objectId, idx1, idx2);
-
- int idx = getItemIndexById(objectId);
-
- if (idx != -1) {
- int from = getStaticsIndexById(idx, idx1);
- int to = getStaticsIndexById(idx, idx2);
-
- debugC(1, kDebugPathfinding, "WWW 6, want idx: %d, off: %d", idx, from + to * _items[idx]->statics.size());
- MGMSubItem *sub = _items[idx]->subItems[from + to * _items[idx]->statics.size()];
-
- if (sub->movement) {
- idx = sub->field_8;
- } else {
- clearMovements2(idx);
- idx = recalcOffsets(idx, from, to, 0, 1);
- }
- }
-
- return idx;
-}
-
-Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *mult, int *len, int flag) {
- Common::Point point;
-
- mov->calcSomeXY(point, 0, -1);
- int p1x = point.x;
- int p1y = point.y;
-
- int newmult = 0;
- int oldlen = *len;
-
- if (abs(p1y) > abs(p1x)) {
- if (mov->calcSomeXY(point, 0, -1)->y)
- newmult = (int)((double)y / mov->calcSomeXY(point, 0, -1)->y);
- } else if (mov->calcSomeXY(point, 0, -1)->x) {
- newmult = (int)((double)x / mov->calcSomeXY(point, 0, -1)->x);
- }
-
- if (newmult < 0)
- newmult = 0;
-
- *mult = newmult;
-
- int phase = 1;
- int sz;
-
- if (flag) {
- if (abs(p1y) > abs(p1x)) {
- while (abs(p1y * newmult + mov->calcSomeXY(point, 0, phase)->y) < abs(y)) {
- sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
-
- if (phase > sz)
- break;
-
- phase++;
- }
- } else {
- while (abs(p1x * newmult + mov->calcSomeXY(point, 0, phase)->x) < abs(x)) {
- sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
-
- if (phase >= sz)
- break;
-
- phase++;
- }
- }
-
- *len = phase - 1;
- } else {
- *len = -1;
- }
-
- int p2x = 0;
- int p2y = 0;
-
- if (!oldlen)
- oldlen = -1;
-
- if (oldlen > 0) {
- ++*mult;
-
- mov->calcSomeXY(point, 0, oldlen);
- p2x = point.x;
- p2y = point.y;
-
- if (abs(p1y) > abs(p1x))
- p2x = p1x;
- else
- p2y = p1y;
- }
-
- pRes->x = p2x + p1x * newmult;
- pRes->y = p2y + p1y * newmult;
-
- return pRes;
-}
-
-ExCommand2 *MGM::buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) {
- debugC(2, kDebugPathfinding, "MGM::buildExCommand2(mov, %d, %d, %d, [%d, %d], [%d, %d], %d)", objId, x1, y1, x2->x, x2->y, y2->x, y2->y, len);
-
- uint cnt;
-
- if (mov->_currMovement)
- cnt = mov->_currMovement->_dynamicPhases.size();
- else
- cnt = mov->_dynamicPhases.size();
-
- if (len > 0 && cnt > (uint)len)
- cnt = len;
-
- Common::Point **points = (Common::Point **)malloc(sizeof(Common::Point *) * cnt);
-
- for (uint i = 0; i < cnt; i++) {
- int flags = mov->getDynamicPhaseByIndex(i)->getDynFlags();
-
- points[i] = new Common::Point;
-
- if (flags & 1) {
- points[i]->x = x1 + x2->x;
-
- y2->x -= x2->x;
-
- if (!y2->x)
- x2->x = 0;
- }
-
- if (flags & 2) {
- points[i]->y = y1 + x2->y;
-
- y2->y -= x2->y;
-
- if (!y2->y)
- x2->y = 0;
- }
- }
-
- ExCommand2 *ex = new ExCommand2(20, objId, points, cnt);
- ex->_excFlags = 2;
- ex->_messageNum = mov->_id;
- ex->_field_14 = len;
- ex->_field_24 = 1;
- ex->_keyCode = -1;
-
- for (uint i = 0; i < cnt; i++)
- delete points[i];
-
- free(points);
-
- return ex;
-}
-
-} // End of namespace Fullpipe
diff --git a/engines/fullpipe/mgm.h b/engines/fullpipe/mgm.h
deleted file mode 100644
index 1319589..0000000
--- a/engines/fullpipe/mgm.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef FULLPIPE_MGM_H
-#define FULLPIPE_MGM_H
-
-namespace Fullpipe {
-
-class ExCommand2;
-class Movement;
-class Statics;
-
-struct MGMSubItem {
- Movement *movement;
- int staticsIndex;
- int field_8;
- int field_C;
- int x;
- int y;
-
- MGMSubItem();
-};
-
-struct MGMItem {
- int16 objId;
- Common::Array<MGMSubItem *> subItems;
- Common::Array<Statics *> statics;
- Common::Array<Movement *> movements1;
- Common::Array<int> movements2;
-
- MGMItem();
-};
-
-struct MGMInfo {
- StaticANIObject *ani;
- int staticsId1;
- int staticsId2;
- int movementId;
- int field_10;
- int x1;
- int y1;
- int field_1C;
- int x2;
- int y2;
- int flags;
-
- MGMInfo() { memset(this, 0, sizeof(MGMInfo)); }
-};
-
-class MGM : public CObject {
-public:
- Common::Array<MGMItem *> _items;
-
-public:
- void clear();
- void addItem(int objId);
- void rebuildTables(int objId);
- int getItemIndexById(int objId);
-
- MessageQueue *genMovement(MGMInfo *mgminfo);
- void updateAnimStatics(StaticANIObject *ani, int staticsId);
- Common::Point *getPoint(Common::Point *point, int aniId, int staticsId1, int staticsId2);
- int getStaticsIndexById(int idx, int16 id);
- int getStaticsIndex(int idx, Statics *st);
- void clearMovements2(int idx);
- int recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop);
- Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *mult, int *len, int flag);
- ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len);
- MessageQueue *genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr);
- int countPhases(int idx, int subIdx, int subOffset, int flag);
- int refreshOffsets(int objectId, int idx1, int idx2);
-};
-
-} // End of namespace Fullpipe
-
-#endif /* FULLPIPE_MGM_H */
diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk
index 96bd91f..01aba1b 100644
--- a/engines/fullpipe/module.mk
+++ b/engines/fullpipe/module.mk
@@ -1,6 +1,7 @@
MODULE := engines/fullpipe
MODULE_OBJS = \
+ anihandler.o \
behavior.o \
console.o \
detection.o \
@@ -15,7 +16,6 @@ MODULE_OBJS = \
lift.o \
messagehandlers.o \
messages.o \
- mgm.o \
modal.o \
motion.o \
ngiarchive.o \
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 41860e3..2b39d25 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -23,7 +23,7 @@
#ifndef FULLPIPE_MOTION_H
#define FULLPIPE_MOTION_H
-#include "fullpipe/mgm.h"
+#include "fullpipe/anihandler.h"
namespace Fullpipe {
Commit: f99e47de6e47910be0857e2f1e056447edba220e
https://github.com/scummvm/scummvm/commit/f99e47de6e47910be0857e2f1e056447edba220e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-14T21:40:29+02:00
Commit Message:
FULLPIPE: Rename MGM class to AniHandler
Changed paths:
engines/fullpipe/anihandler.cpp
engines/fullpipe/anihandler.h
engines/fullpipe/fullpipe.cpp
engines/fullpipe/fullpipe.h
engines/fullpipe/motion.h
engines/fullpipe/scenes.h
engines/fullpipe/scenes/scene04.cpp
engines/fullpipe/scenes/scene22.cpp
diff --git a/engines/fullpipe/anihandler.cpp b/engines/fullpipe/anihandler.cpp
index 62fbb1f..a1baed9 100644
--- a/engines/fullpipe/anihandler.cpp
+++ b/engines/fullpipe/anihandler.cpp
@@ -29,12 +29,12 @@
namespace Fullpipe {
-void MGM::clear() {
+void AniHandler::clear() {
_items.clear();
}
-MessageQueue *MGM::genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr) {
- debugC(4, kDebugPathfinding, "MGM::genMQ(*%d, %d, %d, res, point)", ani->_id, staticsIndex, staticsId);
+MessageQueue *AniHandler::genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr) {
+ debugC(4, kDebugPathfinding, "AniHandler::genMQ(*%d, %d, %d, res, point)", ani->_id, staticsIndex, staticsId);
int idx = getItemIndexById(ani->_id);
@@ -131,8 +131,8 @@ MGMSubItem::MGMSubItem() {
y = 0;
}
-void MGM::addItem(int objId) {
- debugC(4, kDebugPathfinding, "MGM::addItem(%d)", objId);
+void AniHandler::addItem(int objId) {
+ debugC(4, kDebugPathfinding, "AniHandler::addItem(%d)", objId);
if (getItemIndexById(objId) == -1) {
MGMItem *item = new MGMItem();
@@ -143,13 +143,13 @@ void MGM::addItem(int objId) {
rebuildTables(objId);
}
-void MGM::rebuildTables(int objId) {
+void AniHandler::rebuildTables(int objId) {
int idx = getItemIndexById(objId);
if (idx == -1)
return;
- debugC(3, kDebugPathfinding, "MGM::rebuildTables. (1) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
+ debugC(3, kDebugPathfinding, "AniHandler::rebuildTables. (1) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
_items[idx]->subItems.clear();
_items[idx]->statics.clear();
@@ -174,10 +174,10 @@ void MGM::rebuildTables(int objId) {
_items[idx]->movements2.push_back(0);
}
- debugC(3, kDebugPathfinding, "MGM::rebuildTables. (2) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
+ debugC(3, kDebugPathfinding, "AniHandler::rebuildTables. (2) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
}
-int MGM::getItemIndexById(int objId) {
+int AniHandler::getItemIndexById(int objId) {
for (uint i = 0; i < _items.size(); i++)
if (_items[i]->objId == objId)
return i;
@@ -185,8 +185,8 @@ int MGM::getItemIndexById(int objId) {
return -1;
}
-MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
- debugC(4, kDebugPathfinding, "MGM::genMovement(*%d)", mgminfo->ani ? mgminfo->ani->_id : -1);
+MessageQueue *AniHandler::genMovement(MGMInfo *mgminfo) {
+ debugC(4, kDebugPathfinding, "AniHandler::genMovement(*%d)", mgminfo->ani ? mgminfo->ani->_id : -1);
if (!mgminfo->ani)
return 0;
@@ -235,7 +235,7 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
int st1idx = getStaticsIndexById(itemIdx, mov->_staticsObj2->_staticsId);
int subOffset = getStaticsIndexById(itemIdx, mgminfo->staticsId2);
- debugC(3, kDebugPathfinding, "MGM::genMovement. (1) movements1 sz: %d movements2 sz: %d", _items[itemIdx]->movements1.size(), _items[itemIdx]->movements2.size());
+ debugC(3, kDebugPathfinding, "AniHandler::genMovement. (1) movements1 sz: %d movements2 sz: %d", _items[itemIdx]->movements1.size(), _items[itemIdx]->movements2.size());
clearMovements2(itemIdx);
recalcOffsets(itemIdx, subIdx, st2idx, 0, 1);
@@ -393,12 +393,12 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
mq->addExCommandToEnd(ex);
- debugC(3, kDebugPathfinding, "MGM::genMovement. (2) movements1 sz: %d movements2 sz: %d", _items[itemIdx]->movements1.size(), _items[itemIdx]->movements2.size());
+ debugC(3, kDebugPathfinding, "AniHandler::genMovement. (2) movements1 sz: %d movements2 sz: %d", _items[itemIdx]->movements1.size(), _items[itemIdx]->movements2.size());
return mq;
}
-int MGM::countPhases(int idx, int subIdx, int endIdx, int flag) {
+int AniHandler::countPhases(int idx, int subIdx, int endIdx, int flag) {
int res = 0;
if (endIdx < 0)
@@ -415,8 +415,8 @@ int MGM::countPhases(int idx, int subIdx, int endIdx, int flag) {
return res;
}
-void MGM::updateAnimStatics(StaticANIObject *ani, int staticsId) {
- debugC(4, kDebugPathfinding, "MGM::updateAnimStatics(*%d, %d)", ani->_id, staticsId);
+void AniHandler::updateAnimStatics(StaticANIObject *ani, int staticsId) {
+ debugC(4, kDebugPathfinding, "AniHandler::updateAnimStatics(*%d, %d)", ani->_id, staticsId);
if (getItemIndexById(ani->_id) == -1)
return;
@@ -445,8 +445,8 @@ void MGM::updateAnimStatics(StaticANIObject *ani, int staticsId) {
}
}
-Common::Point *MGM::getPoint(Common::Point *point, int objectId, int staticsId1, int staticsId2) {
- debugC(4, kDebugPathfinding, "MGM::getPoint([%d, %d], %d, %d, %d)", point->x, point->y, objectId, staticsId1, staticsId2);
+Common::Point *AniHandler::getPoint(Common::Point *point, int objectId, int staticsId1, int staticsId2) {
+ debugC(4, kDebugPathfinding, "AniHandler::getPoint([%d, %d], %d, %d, %d)", point->x, point->y, objectId, staticsId1, staticsId2);
int idx = getItemIndexById(objectId);
@@ -488,7 +488,7 @@ Common::Point *MGM::getPoint(Common::Point *point, int objectId, int staticsId1,
return point;
}
-int MGM::getStaticsIndexById(int idx, int16 id) {
+int AniHandler::getStaticsIndexById(int idx, int16 id) {
if (!_items[idx]->statics.size())
return -1;
@@ -500,7 +500,7 @@ int MGM::getStaticsIndexById(int idx, int16 id) {
return -1;
}
-int MGM::getStaticsIndex(int idx, Statics *st) {
+int AniHandler::getStaticsIndex(int idx, Statics *st) {
if (!_items[idx]->statics.size())
return -1;
@@ -512,20 +512,20 @@ int MGM::getStaticsIndex(int idx, Statics *st) {
return -1;
}
-void MGM::clearMovements2(int idx) {
- debugC(2, kDebugPathfinding, "MGM::clearMovements2(%d)", idx);
+void AniHandler::clearMovements2(int idx) {
+ debugC(2, kDebugPathfinding, "AniHandler::clearMovements2(%d)", idx);
for (uint i = 0; i < _items[idx]->movements2.size(); i++)
_items[idx]->movements2[i] = 0;
- debugC(3, kDebugPathfinding, "MGM::clearMovements2. movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
+ debugC(3, kDebugPathfinding, "AniHandler::clearMovements2. movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
}
-int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
+int AniHandler::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
MGMItem *item = _items[idx];
int subIdx = st1idx + st2idx * item->statics.size();
- debugC(2, kDebugPathfinding, "MGM::recalcOffsets(%d, %d, %d, %d, %d)", idx, st1idx, st2idx, flip, flop);
+ debugC(2, kDebugPathfinding, "AniHandler::recalcOffsets(%d, %d, %d, %d, %d)", idx, st1idx, st2idx, flip, flop);
if (st1idx == st2idx) {
memset(item->subItems[subIdx], 0, sizeof(*(item->subItems[subIdx])));
@@ -537,7 +537,7 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
Common::Point point;
- debugC(3, kDebugPathfinding, "MGM::recalcOffsets. movements1 sz: %d movements2 sz: %d", item->movements1.size(), item->movements2.size());
+ debugC(3, kDebugPathfinding, "AniHandler::recalcOffsets. movements1 sz: %d movements2 sz: %d", item->movements1.size(), item->movements2.size());
for (uint i = 0; i < item->movements1.size(); i++) {
Movement *mov = item->movements1[i];
@@ -551,7 +551,7 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
int stidx = getStaticsIndex(idx, mov->_staticsObj2);
int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
- debugC(1, kDebugPathfinding, "MGM::recalcOffsets, want idx: %d, off: %d (%d + %d), sz: %d", idx, stidx + st2idx * _items[idx]->statics.size(), stidx, st2idx, item->subItems.size());
+ debugC(1, kDebugPathfinding, "AniHandler::recalcOffsets, want idx: %d, off: %d (%d + %d), sz: %d", idx, stidx + st2idx * _items[idx]->statics.size(), stidx, st2idx, item->subItems.size());
int newsz = sz + item->subItems[stidx + st2idx * _items[idx]->statics.size()]->field_C;
@@ -608,8 +608,8 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
return -1;
}
-int MGM::refreshOffsets(int objectId, int idx1, int idx2) {
- debugC(4, kDebugPathfinding, "MGM::refreshOffsets(%d, %d, %d)", objectId, idx1, idx2);
+int AniHandler::refreshOffsets(int objectId, int idx1, int idx2) {
+ debugC(4, kDebugPathfinding, "AniHandler::refreshOffsets(%d, %d, %d)", objectId, idx1, idx2);
int idx = getItemIndexById(objectId);
@@ -631,7 +631,7 @@ int MGM::refreshOffsets(int objectId, int idx1, int idx2) {
return idx;
}
-Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *mult, int *len, int flag) {
+Common::Point *AniHandler::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *mult, int *len, int flag) {
Common::Point point;
mov->calcSomeXY(point, 0, -1);
@@ -707,8 +707,8 @@ Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y,
return pRes;
}
-ExCommand2 *MGM::buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) {
- debugC(2, kDebugPathfinding, "MGM::buildExCommand2(mov, %d, %d, %d, [%d, %d], [%d, %d], %d)", objId, x1, y1, x2->x, x2->y, y2->x, y2->y, len);
+ExCommand2 *AniHandler::buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) {
+ debugC(2, kDebugPathfinding, "AniHandler::buildExCommand2(mov, %d, %d, %d, [%d, %d], [%d, %d], %d)", objId, x1, y1, x2->x, x2->y, y2->x, y2->y, len);
uint cnt;
diff --git a/engines/fullpipe/anihandler.h b/engines/fullpipe/anihandler.h
index 1319589..5632a8f 100644
--- a/engines/fullpipe/anihandler.h
+++ b/engines/fullpipe/anihandler.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef FULLPIPE_MGM_H
-#define FULLPIPE_MGM_H
+#ifndef FULLPIPE_ANIHANDLER_H
+#define FULLPIPE_ANIHANDLER_H
namespace Fullpipe {
@@ -66,7 +66,7 @@ struct MGMInfo {
MGMInfo() { memset(this, 0, sizeof(MGMInfo)); }
};
-class MGM : public CObject {
+class AniHandler : public CObject {
public:
Common::Array<MGMItem *> _items;
@@ -92,4 +92,4 @@ public:
} // End of namespace Fullpipe
-#endif /* FULLPIPE_MGM_H */
+#endif /* FULLPIPE_ANIHANDLER_H */
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 164c599..f62fde2 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -217,7 +217,7 @@ void FullpipeEngine::initialize() {
_sceneRect.bottom = 599;
_floaters = new Floaters;
- _mgm = new MGM;
+ _mgm = new AniHandler;
}
void FullpipeEngine::restartGame() {
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index eb387bb..6b57eb1 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -74,7 +74,7 @@ class GlobalMessageQueueList;
struct MessageHandler;
class MessageQueue;
struct MovTable;
-class MGM;
+class AniHandler;
class NGIArchive;
class PictureObject;
struct PreloadItem;
@@ -210,7 +210,7 @@ public:
MovTable *_movTable;
Floaters *_floaters;
- MGM *_mgm;
+ AniHandler *_mgm;
Common::Array<Common::Point *> _arcadeKeys;
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 2b39d25..b67c9b1 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -149,7 +149,7 @@ public:
int _ladder_field_20;
int _ladder_field_24;
Common::Array<MctlLadderMovement *> _ladmovements;
- MGM _mgm;
+ AniHandler _mgm;
public:
MctlLadder();
@@ -282,7 +282,7 @@ public:
int _field_44;
Common::Array<MovGraphItem *> _items;
MovArr *(*_callback1)(StaticANIObject *ani, Common::Array<MovItem *> *items, signed int counter);
- MGM _mgm;
+ AniHandler _mgm;
public:
MovGraph();
diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h
index 17ef5c3..43b1bf7 100644
--- a/engines/fullpipe/scenes.h
+++ b/engines/fullpipe/scenes.h
@@ -28,7 +28,7 @@ namespace Fullpipe {
struct Bat;
struct BehaviorMove;
struct Hanger;
-class MGM;
+class AniHandler;
class MctlLadder;
struct Ring;
class StaticANIObject;
@@ -396,7 +396,7 @@ public:
StaticANIObject *scene11_boots;
StaticANIObject *scene11_dudeOnSwing;
PictureObject *scene11_hint;
- MGM scene11_mgm;
+ AniHandler scene11_mgm;
bool scene11_arcadeIsOn;
bool scene11_scrollIsEnabled;
bool scene11_scrollIsMaximized;
@@ -612,7 +612,7 @@ public:
Common::Array<WalkingBearder *> scene29_bearders;
int scene29_manX;
int scene29_manY;
- MGM scene29_mgm;
+ AniHandler scene29_mgm;
StaticANIObject *scene30_leg;
int scene30_liftFlag;
diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp
index 6c361d6..c32bfbb 100644
--- a/engines/fullpipe/scenes/scene04.cpp
+++ b/engines/fullpipe/scenes/scene04.cpp
@@ -395,7 +395,7 @@ void sceneHandler04_jumpOnLadder() {
g_fp->_aniMan->_flags |= 1;
- MGM mgm;
+ AniHandler mgm;
MGMInfo mgminfo;
mgm.addItem(ANI_MAN);
@@ -460,7 +460,7 @@ void sceneHandler04_dropBottle() {
}
void sceneHandler04_gotoLadder(ExCommand *ex) {
- MGM mgm;
+ AniHandler mgm;
MGMInfo mgminfo;
mgm.addItem(ANI_MAN);
@@ -550,7 +550,7 @@ void sceneHandler04_raisePlank() {
}
MessageQueue *sceneHandler04_kozFly3(StaticANIObject *ani, double phase) {
- MGM mgm;
+ AniHandler mgm;
MGMInfo mgminfo;
mgm.addItem(ANI_KOZAWKA);
@@ -599,7 +599,7 @@ MessageQueue *sceneHandler04_kozFly3(StaticANIObject *ani, double phase) {
}
MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) {
- MGM mgm;
+ AniHandler mgm;
MGMInfo mgminfo;
mgm.addItem(ANI_KOZAWKA);
@@ -670,7 +670,7 @@ MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) {
}
MessageQueue *sceneHandler04_kozFly6(StaticANIObject *ani) {
- MGM mgm;
+ AniHandler mgm;
MGMInfo mgminfo;
mgm.addItem(ANI_KOZAWKA);
@@ -728,7 +728,7 @@ void sceneHandler04_kozMove(Movement *mov, int from, int to, Common::Point *poin
}
MessageQueue *sceneHandler04_kozFly7(StaticANIObject *ani, double phase) {
- MGM mgm;
+ AniHandler mgm;
MGMInfo mgminfo;
mgm.addItem(ANI_KOZAWKA);
diff --git a/engines/fullpipe/scenes/scene22.cpp b/engines/fullpipe/scenes/scene22.cpp
index f51469d..ce060dc 100644
--- a/engines/fullpipe/scenes/scene22.cpp
+++ b/engines/fullpipe/scenes/scene22.cpp
@@ -239,7 +239,7 @@ void sceneHandler22_stoolLogic(ExCommand *cmd) {
goto LABEL_31;
}
- MGM mgm;
+ AniHandler mgm;
MGMInfo mgminfo;
mgm.addItem(ANI_MAN);
Commit: 060d1f7254e9fe4d61c3b1648d989d21026610d0
https://github.com/scummvm/scummvm/commit/060d1f7254e9fe4d61c3b1648d989d21026610d0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-14T21:40:29+02:00
Commit Message:
FULLPIPE: Rename various mgm variables to aniHandler
Changed paths:
engines/fullpipe/fullpipe.cpp
engines/fullpipe/fullpipe.h
engines/fullpipe/motion.cpp
engines/fullpipe/motion.h
engines/fullpipe/scenes.h
engines/fullpipe/scenes/scene04.cpp
engines/fullpipe/scenes/scene11.cpp
engines/fullpipe/scenes/scene29.cpp
engines/fullpipe/statics.cpp
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index f62fde2..22f2050 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -140,7 +140,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_scene3 = 0;
_movTable = 0;
_floaters = 0;
- _mgm = 0;
+ _aniHandler = 0;
_globalMessageQueueList = 0;
_messageHandlers = 0;
@@ -217,7 +217,7 @@ void FullpipeEngine::initialize() {
_sceneRect.bottom = 599;
_floaters = new Floaters;
- _mgm = new AniHandler;
+ _aniHandler = new AniHandler;
}
void FullpipeEngine::restartGame() {
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 6b57eb1..d9ab2aa 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -210,7 +210,7 @@ public:
MovTable *_movTable;
Floaters *_floaters;
- AniHandler *_mgm;
+ AniHandler *_aniHandler;
Common::Array<Common::Point *> _arcadeKeys;
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index ff0a6ca..f2d3a65 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -348,7 +348,7 @@ void MctlLadder::attachObject(StaticANIObject *obj) {
MctlLadderMovement *movement = new MctlLadderMovement;
if (initMovement(obj, movement)) {
- _mgm.addItem(obj->_id);
+ _aniHandler.addItem(obj->_id);
_ladmovements.push_back(movement);
} else {
delete movement;
@@ -413,7 +413,7 @@ bool MctlLadder::initMovement(StaticANIObject *ani, MctlLadderMovement *movement
void MctlLadder::detachAllObjects() {
debugC(4, kDebugPathfinding, "MctlLadder::detachAllObjects()");
- _mgm.clear();
+ _aniHandler.clear();
for (uint i = 0; i < _ladmovements.size(); i++) {
delete _ladmovements[i]->movVars;
@@ -497,7 +497,7 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
mgminfo.flags = 14;
mgminfo.movementId = direction ? _ladmovements[pos]->movVars->varDownGo : _ladmovements[pos]->movVars->varUpGo;
- return _mgm.genMovement(&mgminfo);
+ return _aniHandler.genMovement(&mgminfo);
}
if (ani->_statics->_staticsId == _ladmovements[pos]->staticIds[2]) {
@@ -515,7 +515,7 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
mgminfo.flags = 14;
mgminfo.movementId = _ladmovements[pos]->movVars->varUpGo;
- return _mgm.genMovement(&mgminfo);
+ return _aniHandler.genMovement(&mgminfo);
}
int ox = ani->_ox;
@@ -539,7 +539,7 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
mgminfo.staticsId1 = _ladmovements[pos]->staticIds[0];
mgminfo.movementId = _ladmovements[pos]->movVars->varDownGo;
- mq = _mgm.genMovement(&mgminfo);
+ mq = _aniHandler.genMovement(&mgminfo);
ex = new ExCommand(ani->_id, 1, _ladmovements[pos]->movVars->varUpStop, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = ani->_okeyCode;
@@ -551,7 +551,7 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
}
if (ani->_statics->_staticsId != _ladmovements[pos]->staticIds[3]) {
- mq = _mgm.genMQ(ani, _ladmovements[pos]->staticIds[0], 0, 0, 0);
+ mq = _aniHandler.genMQ(ani, _ladmovements[pos]->staticIds[0], 0, 0, 0);
if (!mq)
return 0;
@@ -559,7 +559,7 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
int nx = ani->_ox;
int ny = ani->_oy;
- _mgm.getPoint(&point, ani->_id, ani->_statics->_staticsId, _ladmovements[pos]->staticIds[0]);
+ _aniHandler.getPoint(&point, ani->_id, ani->_statics->_staticsId, _ladmovements[pos]->staticIds[0]);
nx += point.x;
ny += point.y;
@@ -605,7 +605,7 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
mgminfo.staticsId1 = _ladmovements[pos]->staticIds[1];
mgminfo.movementId = _ladmovements[pos]->movVars->varUpGo;
- mq = _mgm.genMovement(&mgminfo);
+ mq = _aniHandler.genMovement(&mgminfo);
ex = new ExCommand(ani->_id, 1, _ladmovements[pos]->movVars->varDownStop, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = ani->_okeyCode;
@@ -630,7 +630,7 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
mgminfo.flags = 14;
mgminfo.movementId = _ladmovements[pos]->movVars->varDownGo;
- return _mgm.genMovement(&mgminfo);
+ return _aniHandler.genMovement(&mgminfo);
}
MessageQueue *MctlLadder::controllerWalkTo(StaticANIObject *ani, int off) {
@@ -806,8 +806,8 @@ bool MovGraph::load(MfcArchive &file) {
void MovGraph::attachObject(StaticANIObject *obj) {
debugC(4, kDebugPathfinding, "MovGraph::attachObject(*%d)", obj->_id);
- _mgm.clear();
- _mgm.addItem(obj->_id);
+ _aniHandler.clear();
+ _aniHandler.addItem(obj->_id);
for (uint i = 0; i < _items.size(); i++)
if (_items[i]->ani == obj)
@@ -819,7 +819,7 @@ void MovGraph::attachObject(StaticANIObject *obj) {
_items.push_back(item);
- _mgm.addItem(obj->_id); // FIXME: Is it really needed?
+ _aniHandler.addItem(obj->_id); // FIXME: Is it really needed?
}
int MovGraph::detachObject(StaticANIObject *obj) {
@@ -1008,8 +1008,8 @@ bool MovGraph::resetPosition(StaticANIObject *ani, int flag) {
Statics *st;
if (ani->_statics) {
- int t = _mgm.refreshOffsets(ani->_id, ani->_statics->_staticsId, movarr._link->_dwordArray2[_field_44]);
- if (t > _mgm.refreshOffsets(ani->_id, ani->_statics->_staticsId, movarr._link->_dwordArray2[_field_44 + 1]))
+ int t = _aniHandler.refreshOffsets(ani->_id, ani->_statics->_staticsId, movarr._link->_dwordArray2[_field_44]);
+ if (t > _aniHandler.refreshOffsets(ani->_id, ani->_statics->_staticsId, movarr._link->_dwordArray2[_field_44 + 1]))
st = ani->getStaticsById(movarr._link->_dwordArray2[_field_44 + 1]);
else
st = ani->getStaticsById(movarr._link->_dwordArray2[_field_44]);
@@ -1247,7 +1247,7 @@ MessageQueue *MovGraph::makeWholeQueue(StaticANIObject *ani, MovArr *movarr, int
if (mq)
mgminfo.flags |= 0x31;
- MessageQueue *newmq = _mgm.genMovement(&mgminfo);
+ MessageQueue *newmq = _aniHandler.genMovement(&mgminfo);
if (mq) {
if (newmq) {
@@ -1608,14 +1608,14 @@ bool MovGraph::getHitPoint(int idx, int x, int y, MovArr *arr, int a6) {
int offmin = 100;
for (int i = 0; i < arrSize; i++) {
- int off = _mgm.refreshOffsets(_items[idx]->ani->_id, staticsId, (*movarr)[i]->_link->_dwordArray2[_field_44]);
+ int off = _aniHandler.refreshOffsets(_items[idx]->ani->_id, staticsId, (*movarr)[i]->_link->_dwordArray2[_field_44]);
if (off < offmin) {
offmin = off;
idxmin = i;
}
- off = _mgm.refreshOffsets(_items[idx]->ani->_id, staticsId, (*movarr)[i]->_link->_dwordArray2[_field_44 + 1]);
+ off = _aniHandler.refreshOffsets(_items[idx]->ani->_id, staticsId, (*movarr)[i]->_link->_dwordArray2[_field_44 + 1]);
if (off < offmin) {
offmin = off;
idxmin = i;
@@ -1689,7 +1689,7 @@ int MovGraph2::getItemSubIndexByMGM(int index, StaticANIObject *ani) {
for (int i = 0; i < 4; i++) {
debugC(1, kDebugPathfinding, "WWW 5");
- int tmp = _mgm.refreshOffsets(ani->_id, ani->_statics->_staticsId, _items2[index]->_subItems[i]._staticsId1);
+ int tmp = _aniHandler.refreshOffsets(ani->_id, ani->_statics->_staticsId, _items2[index]->_subItems[i]._staticsId1);
if (tmp >= 0 && (minidx == -1 || tmp < min)) {
minidx = i;
@@ -2023,7 +2023,7 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
mgminfo.flags = 0x7f;
mgminfo.movementId = mg2i->_movementId;
- MessageQueue *mq2 = _mgm.genMovement(&mgminfo);
+ MessageQueue *mq2 = _aniHandler.genMovement(&mgminfo);
mq->transferExCommands(mq2);
delete mq2;
@@ -2504,7 +2504,7 @@ MessageQueue *MovGraph2::genMovement(MovInfo1 *info) {
int a2 = 0;
int mgmLen;
- _mgm.calcLength(&point, _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov, x, y, &mgmLen, &a2, info->flags & 1);
+ _aniHandler.calcLength(&point, _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov, x, y, &mgmLen, &a2, info->flags & 1);
int x1 = point.x;
int y1 = point.y;
@@ -2619,7 +2619,7 @@ MessageQueue *MovGraph2::genMovement(MovInfo1 *info) {
ex->_excFlags |= 2;
mq->addExCommandToEnd(ex);
- ex = _mgm.buildExCommand2(
+ ex = _aniHandler.buildExCommand2(
_items2[info->index]->_subItems[info->subIndex]._walk[0]._mov,
_items2[info->index]->_objectId,
x1,
@@ -2641,7 +2641,7 @@ MessageQueue *MovGraph2::genMovement(MovInfo1 *info) {
else
par = -1;
- ex = _mgm.buildExCommand2(
+ ex = _aniHandler.buildExCommand2(
_items2[info->index]->_subItems[info->subIndex]._walk[1]._mov,
_items2[info->index]->_objectId,
x1,
@@ -2655,7 +2655,7 @@ MessageQueue *MovGraph2::genMovement(MovInfo1 *info) {
}
if (!(info->flags & 4)) {
- ex = _mgm.buildExCommand2(
+ ex = _aniHandler.buildExCommand2(
_items2[info->index]->_subItems[info->subIndex]._walk[2]._mov,
_items2[info->index]->_objectId,
x1,
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index b67c9b1..96bde0d 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -149,7 +149,7 @@ public:
int _ladder_field_20;
int _ladder_field_24;
Common::Array<MctlLadderMovement *> _ladmovements;
- AniHandler _mgm;
+ AniHandler _aniHandler;
public:
MctlLadder();
@@ -282,7 +282,7 @@ public:
int _field_44;
Common::Array<MovGraphItem *> _items;
MovArr *(*_callback1)(StaticANIObject *ani, Common::Array<MovItem *> *items, signed int counter);
- AniHandler _mgm;
+ AniHandler _aniHandler;
public:
MovGraph();
diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h
index 43b1bf7..fd90b5f 100644
--- a/engines/fullpipe/scenes.h
+++ b/engines/fullpipe/scenes.h
@@ -396,7 +396,7 @@ public:
StaticANIObject *scene11_boots;
StaticANIObject *scene11_dudeOnSwing;
PictureObject *scene11_hint;
- AniHandler scene11_mgm;
+ AniHandler scene11_aniHandler;
bool scene11_arcadeIsOn;
bool scene11_scrollIsEnabled;
bool scene11_scrollIsMaximized;
@@ -612,7 +612,7 @@ public:
Common::Array<WalkingBearder *> scene29_bearders;
int scene29_manX;
int scene29_manY;
- AniHandler scene29_mgm;
+ AniHandler scene29_aniHandler;
StaticANIObject *scene30_leg;
int scene30_liftFlag;
diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp
index c32bfbb..4d7b337 100644
--- a/engines/fullpipe/scenes/scene04.cpp
+++ b/engines/fullpipe/scenes/scene04.cpp
@@ -395,10 +395,10 @@ void sceneHandler04_jumpOnLadder() {
g_fp->_aniMan->_flags |= 1;
- AniHandler mgm;
+ AniHandler aniHandler;
MGMInfo mgminfo;
- mgm.addItem(ANI_MAN);
+ aniHandler.addItem(ANI_MAN);
mgminfo.ani = g_fp->_aniMan;
mgminfo.staticsId2 = ST_MAN_ONPLANK;
@@ -409,7 +409,7 @@ void sceneHandler04_jumpOnLadder() {
mgminfo.flags = 78;
mgminfo.movementId = MV_MAN_JUMPONPLANK;
- MessageQueue *mq = mgm.genMovement(&mgminfo);
+ MessageQueue *mq = aniHandler.genMovement(&mgminfo);
if (mq) {
mq->_flags |= 1;
@@ -460,10 +460,10 @@ void sceneHandler04_dropBottle() {
}
void sceneHandler04_gotoLadder(ExCommand *ex) {
- AniHandler mgm;
+ AniHandler aniHandler;
MGMInfo mgminfo;
- mgm.addItem(ANI_MAN);
+ aniHandler.addItem(ANI_MAN);
mgminfo.ani = g_fp->_aniMan;
mgminfo.staticsId2 = ST_MAN_UP;
@@ -474,7 +474,7 @@ void sceneHandler04_gotoLadder(ExCommand *ex) {
mgminfo.flags = 78;
mgminfo.movementId = MV_MAN_PLANKTOLADDER;
- MessageQueue *mq = mgm.genMovement(&mgminfo);
+ MessageQueue *mq = aniHandler.genMovement(&mgminfo);
if (mq) {
mq->deleteExCommandByIndex(mq->getCount() - 1, 1);
@@ -550,10 +550,10 @@ void sceneHandler04_raisePlank() {
}
MessageQueue *sceneHandler04_kozFly3(StaticANIObject *ani, double phase) {
- AniHandler mgm;
+ AniHandler aniHandler;
MGMInfo mgminfo;
- mgm.addItem(ANI_KOZAWKA);
+ aniHandler.addItem(ANI_KOZAWKA);
mgminfo.ani = ani;
mgminfo.staticsId2 = ST_KZW_SIT;
@@ -564,7 +564,7 @@ MessageQueue *sceneHandler04_kozFly3(StaticANIObject *ani, double phase) {
mgminfo.flags = 78;
mgminfo.movementId = MV_KZW_JUMP;
- MessageQueue *mq = mgm.genMovement(&mgminfo);
+ MessageQueue *mq = aniHandler.genMovement(&mgminfo);
if (mq) {
ExCommand *ex = new ExCommand(ANI_KOZAWKA, 1, MV_KZW_STANDUP, 0, 0, 0, 1, 0, 0, 0);
@@ -599,10 +599,10 @@ MessageQueue *sceneHandler04_kozFly3(StaticANIObject *ani, double phase) {
}
MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) {
- AniHandler mgm;
+ AniHandler aniHandler;
MGMInfo mgminfo;
- mgm.addItem(ANI_KOZAWKA);
+ aniHandler.addItem(ANI_KOZAWKA);
mgminfo.ani = ani;
mgminfo.staticsId2 = ST_KZW_JUMPOUT;
@@ -613,7 +613,7 @@ MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) {
mgminfo.flags = 78;
mgminfo.movementId = MV_KZW_JUMPHIT;
- MessageQueue *mq1 = mgm.genMovement(&mgminfo);
+ MessageQueue *mq1 = aniHandler.genMovement(&mgminfo);
memset(&mgminfo, 0, sizeof(mgminfo));
mgminfo.ani = ani;
@@ -627,7 +627,7 @@ MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) {
mgminfo.flags = 117;
mgminfo.movementId = MV_KZW_JUMPOUT;
- MessageQueue *mq2 = mgm.genMovement(&mgminfo);
+ MessageQueue *mq2 = aniHandler.genMovement(&mgminfo);
if (mq1 && mq2) {
mq1->addExCommandToEnd(mq2->getExCommandByIndex(0)->createClone());
@@ -670,10 +670,10 @@ MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) {
}
MessageQueue *sceneHandler04_kozFly6(StaticANIObject *ani) {
- AniHandler mgm;
+ AniHandler aniHandler;
MGMInfo mgminfo;
- mgm.addItem(ANI_KOZAWKA);
+ aniHandler.addItem(ANI_KOZAWKA);
mgminfo.ani = ani;
mgminfo.staticsId2 = ST_KZW_SIT;
@@ -684,7 +684,7 @@ MessageQueue *sceneHandler04_kozFly6(StaticANIObject *ani) {
mgminfo.flags = 78;
mgminfo.movementId = MV_KZW_JUMPROTATE;
- MessageQueue *mq = mgm.genMovement(&mgminfo);
+ MessageQueue *mq = aniHandler.genMovement(&mgminfo);
if (mq) {
mq->deleteExCommandByIndex(mq->getCount() - 1, 1);
@@ -728,10 +728,10 @@ void sceneHandler04_kozMove(Movement *mov, int from, int to, Common::Point *poin
}
MessageQueue *sceneHandler04_kozFly7(StaticANIObject *ani, double phase) {
- AniHandler mgm;
+ AniHandler aniHandler;
MGMInfo mgminfo;
- mgm.addItem(ANI_KOZAWKA);
+ aniHandler.addItem(ANI_KOZAWKA);
mgminfo.ani = ani;
mgminfo.staticsId2 = 560;
@@ -742,7 +742,7 @@ MessageQueue *sceneHandler04_kozFly7(StaticANIObject *ani, double phase) {
mgminfo.flags = 78;
mgminfo.movementId = MV_KZW_JUMPROTATE;
- MessageQueue *mq = mgm.genMovement(&mgminfo);
+ MessageQueue *mq = aniHandler.genMovement(&mgminfo);
if (mq) {
sceneHandler04_kozMove(ani->getMovementById(MV_KZW_JUMPROTATE), 1, 9, g_vars->scene04_jumpRotateKozyawki, phase * 0.5 + 1.5);
diff --git a/engines/fullpipe/scenes/scene11.cpp b/engines/fullpipe/scenes/scene11.cpp
index 1fa5cab..e152286 100644
--- a/engines/fullpipe/scenes/scene11.cpp
+++ b/engines/fullpipe/scenes/scene11.cpp
@@ -96,7 +96,7 @@ void scene11_setupMusic() {
void scene11_initScene(Scene *sc) {
g_vars->scene11_swingie = sc->getStaticANIObject1ById(ANI_SWINGER, -1);
g_vars->scene11_boots = sc->getStaticANIObject1ById(ANI_BOOTS_11, -1);
- g_vars->scene11_mgm.clear();
+ g_vars->scene11_aniHandler.clear();
g_vars->scene11_dudeOnSwing = sc->getStaticANIObject1ById(ANI_MAN11, -1);
g_vars->scene11_dudeOnSwing->_callback2 = scene11_dudeSwingCallback;
g_vars->scene11_dudeOnSwing = sc->getStaticANIObject1ById(ANI_KACHELI, -1);
@@ -251,7 +251,7 @@ void sceneHandler11_manToSwing() {
g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_0, 0, -1);
g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(45);
- g_vars->scene11_mgm.addItem(g_fp->_aniMan->_id);
+ g_vars->scene11_aniHandler.addItem(g_fp->_aniMan->_id);
g_fp->_currentScene->_x = 1400 - g_fp->_sceneRect.right;
@@ -402,7 +402,7 @@ void sceneHandler11_jumpHitAndWin() {
mgminfo.flags = 66;
mgminfo.movementId = MV_MAN11_JUMPHIT;
- MessageQueue *mq = g_vars->scene11_mgm.genMovement(&mgminfo);
+ MessageQueue *mq = g_vars->scene11_aniHandler.genMovement(&mgminfo);
if (mq) {
g_vars->scene11_crySound = SND_11_024;
@@ -447,7 +447,7 @@ void sceneHandler11_jumpOver(double angle) {
mgminfo.flags = 78;
mgminfo.movementId = MV_MAN11_JUMPOVER;
- MessageQueue *mq = g_vars->scene11_mgm.genMovement(&mgminfo);
+ MessageQueue *mq = g_vars->scene11_aniHandler.genMovement(&mgminfo);
if (mq) {
g_vars->scene11_crySound = SND_11_022;
@@ -487,7 +487,7 @@ void sceneHandler11_jumpHit(double angle) {
mgminfo.flags = 78;
mgminfo.movementId = MV_MAN11_JUMPHIT;
- MessageQueue *mq = g_vars->scene11_mgm.genMovement(&mgminfo);
+ MessageQueue *mq = g_vars->scene11_aniHandler.genMovement(&mgminfo);
if (mq) {
g_vars->scene11_crySound = SND_11_022;
diff --git a/engines/fullpipe/scenes/scene29.cpp b/engines/fullpipe/scenes/scene29.cpp
index a03671a..c68553c 100644
--- a/engines/fullpipe/scenes/scene29.cpp
+++ b/engines/fullpipe/scenes/scene29.cpp
@@ -503,7 +503,7 @@ void sceneHandler29_manHit() {
mgminfo.flags = (g_vars->scene29_manX <= 638 ? 2 : 0) | 0x44;
mgminfo.movementId = MV_MAN29_HIT;
- MessageQueue *mq = g_vars->scene29_mgm.genMovement(&mgminfo);
+ MessageQueue *mq = g_vars->scene29_aniHandler.genMovement(&mgminfo);
ExCommand *ex;
if (mq) {
@@ -728,7 +728,7 @@ void sceneHandler29_manToL() {
g_vars->scene29_arcadeIsOn = true;
- g_vars->scene29_mgm.addItem(g_fp->_aniMan->_id);
+ g_vars->scene29_aniHandler.addItem(g_fp->_aniMan->_id);
g_fp->_updateScreenCallback = sceneHandler29_updateScreenCallback;
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 14245d5..e025477 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -156,7 +156,7 @@ StaticANIObject::~StaticANIObject() {
_movements.clear();
- g_fp->_mgm->clear();
+ g_fp->_aniHandler->clear();
}
StaticANIObject::StaticANIObject(StaticANIObject *src) : GameObject(src) {
@@ -1040,9 +1040,9 @@ void StaticANIObject::adjustSomeXY() {
}
MessageQueue *StaticANIObject::changeStatics1(int msgNum) {
- g_fp->_mgm->addItem(_id);
+ g_fp->_aniHandler->addItem(_id);
- MessageQueue *mq = g_fp->_mgm->genMQ(this, msgNum, 0, 0, 0);
+ MessageQueue *mq = g_fp->_aniHandler->genMQ(this, msgNum, 0, 0, 0);
if (!mq)
return 0;
@@ -1071,8 +1071,8 @@ void StaticANIObject::changeStatics2(int objId) {
deleteFromGlobalMessageQueue();
if (_movement || _statics) {
- g_fp->_mgm->addItem(_id);
- g_fp->_mgm->updateAnimStatics(this, objId);
+ g_fp->_aniHandler->addItem(_id);
+ g_fp->_aniHandler->updateAnimStatics(this, objId);
} else {
_statics = getStaticsById(objId);
}
Commit: 68828123da64c2b920b4db303424ef1f6520897f
https://github.com/scummvm/scummvm/commit/68828123da64c2b920b4db303424ef1f6520897f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-14T21:40:29+02:00
Commit Message:
FULLPIPE: Mass renaming of AniHandler class
Changed paths:
engines/fullpipe/anihandler.cpp
engines/fullpipe/anihandler.h
engines/fullpipe/motion.cpp
engines/fullpipe/scenes/scene04.cpp
engines/fullpipe/scenes/scene11.cpp
engines/fullpipe/scenes/scene22.cpp
engines/fullpipe/scenes/scene29.cpp
engines/fullpipe/statics.cpp
diff --git a/engines/fullpipe/anihandler.cpp b/engines/fullpipe/anihandler.cpp
index a1baed9..a423b2b 100644
--- a/engines/fullpipe/anihandler.cpp
+++ b/engines/fullpipe/anihandler.cpp
@@ -131,7 +131,7 @@ MGMSubItem::MGMSubItem() {
y = 0;
}
-void AniHandler::addItem(int objId) {
+void AniHandler::attachObject(int objId) {
debugC(4, kDebugPathfinding, "AniHandler::addItem(%d)", objId);
if (getItemIndexById(objId) == -1) {
@@ -185,55 +185,55 @@ int AniHandler::getItemIndexById(int objId) {
return -1;
}
-MessageQueue *AniHandler::genMovement(MGMInfo *mgminfo) {
- debugC(4, kDebugPathfinding, "AniHandler::genMovement(*%d)", mgminfo->ani ? mgminfo->ani->_id : -1);
+MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
+ debugC(4, kDebugPathfinding, "AniHandler::makeRunQueue(*%d)", mkQueue->ani ? mkQueue->ani->_id : -1);
- if (!mgminfo->ani)
+ if (!mkQueue->ani)
return 0;
- Movement *mov = mgminfo->ani->_movement;
+ Movement *mov = mkQueue->ani->_movement;
- if (!mov && !mgminfo->ani->_statics)
+ if (!mov && !mkQueue->ani->_statics)
return 0;
- if (!(mgminfo->flags & 1)) {
+ if (!(mkQueue->flags & 1)) {
if (mov)
- mgminfo->staticsId1 = mov->_staticsObj2->_staticsId;
+ mkQueue->staticsId1 = mov->_staticsObj2->_staticsId;
else
- mgminfo->staticsId1 = mgminfo->ani->_statics->_staticsId;
+ mkQueue->staticsId1 = mkQueue->ani->_statics->_staticsId;
}
Common::Point point;
- if (!(mgminfo->flags & 0x10) || !(mgminfo->flags & 0x20)) {
- int nx = mgminfo->ani->_ox;
- int ny = mgminfo->ani->_oy;
+ if (!(mkQueue->flags & 0x10) || !(mkQueue->flags & 0x20)) {
+ int nx = mkQueue->ani->_ox;
+ int ny = mkQueue->ani->_oy;
- if (mgminfo->ani->_movement) {
- mgminfo->ani->calcNextStep(&point);
+ if (mkQueue->ani->_movement) {
+ mkQueue->ani->calcNextStep(&point);
nx += point.x;
ny += point.y;
}
- if (!(mgminfo->flags & 0x10))
- mgminfo->x2 = nx;
+ if (!(mkQueue->flags & 0x10))
+ mkQueue->x2 = nx;
- if (!(mgminfo->flags & 0x20))
- mgminfo->y2 = ny;
+ if (!(mkQueue->flags & 0x20))
+ mkQueue->y2 = ny;
}
- mov = mgminfo->ani->getMovementById(mgminfo->movementId);
+ mov = mkQueue->ani->getMovementById(mkQueue->movementId);
if (!mov)
return 0;
- int itemIdx = getItemIndexById(mgminfo->ani->_id);
- int subIdx = getStaticsIndexById(itemIdx, mgminfo->staticsId1);
+ int itemIdx = getItemIndexById(mkQueue->ani->_id);
+ int subIdx = getStaticsIndexById(itemIdx, mkQueue->staticsId1);
int st2idx = getStaticsIndexById(itemIdx, mov->_staticsObj1->_staticsId);
int st1idx = getStaticsIndexById(itemIdx, mov->_staticsObj2->_staticsId);
- int subOffset = getStaticsIndexById(itemIdx, mgminfo->staticsId2);
+ int subOffset = getStaticsIndexById(itemIdx, mkQueue->staticsId2);
debugC(3, kDebugPathfinding, "AniHandler::genMovement. (1) movements1 sz: %d movements2 sz: %d", _items[itemIdx]->movements1.size(), _items[itemIdx]->movements2.size());
@@ -251,8 +251,8 @@ MessageQueue *AniHandler::genMovement(MGMInfo *mgminfo) {
if (st1idx != subOffset && !sub2->movement)
return 0;
- int n1x = mgminfo->x1 - mgminfo->x2 - sub1->x - sub2->x;
- int n1y = mgminfo->y1 - mgminfo->y2 - sub1->y - sub2->y;
+ int n1x = mkQueue->x1 - mkQueue->x2 - sub1->x - sub2->x;
+ int n1y = mkQueue->y1 - mkQueue->y2 - sub1->y - sub2->y;
Common::Point point1;
@@ -263,8 +263,8 @@ MessageQueue *AniHandler::genMovement(MGMInfo *mgminfo) {
int mult;
int len = -1;
- if (mgminfo->flags & 0x40) {
- mult = mgminfo->field_10;
+ if (mkQueue->flags & 0x40) {
+ mult = mkQueue->field_10;
len = -1;
n2x *= mult;
n2y *= mult;
@@ -274,18 +274,18 @@ MessageQueue *AniHandler::genMovement(MGMInfo *mgminfo) {
n2y = point.y;
}
- if (!(mgminfo->flags & 2)) {
+ if (!(mkQueue->flags & 2)) {
len = -1;
n2x = mult * point1.x;
n1x = mult * point1.x;
- mgminfo->x1 = mgminfo->x2 + mult * point1.x + sub1->x + sub2->x;
+ mkQueue->x1 = mkQueue->x2 + mult * point1.x + sub1->x + sub2->x;
}
- if (!(mgminfo->flags & 4)) {
+ if (!(mkQueue->flags & 4)) {
n2y = mult * point1.y;
n1y = mult * point1.y;
len = -1;
- mgminfo->y1 = mgminfo->y2 + mult * point1.y + sub1->y + sub2->y;
+ mkQueue->y1 = mkQueue->y2 + mult * point1.y + sub1->y + sub2->y;
}
int px = 0;
@@ -348,9 +348,9 @@ MessageQueue *AniHandler::genMovement(MGMInfo *mgminfo) {
for (int i = subIdx; i != st2idx;) {
MGMSubItem *s = _items[itemIdx]->subItems[i + subOffset * _items[itemIdx]->statics.size()];
- ex2 = buildExCommand2(s->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1);
+ ex2 = buildExCommand2(s->movement, mkQueue->ani->_id, x1, y1, &x2, &y2, -1);
ex2->_parId = mq->_id;
- ex2->_keyCode = mgminfo->ani->_okeyCode;
+ ex2->_keyCode = mkQueue->ani->_okeyCode;
mq->addExCommandToEnd(ex2);
@@ -365,9 +365,9 @@ MessageQueue *AniHandler::genMovement(MGMInfo *mgminfo) {
else
plen = -1;
- ex2 = buildExCommand2(mov, mgminfo->ani->_id, x1, y1, &x2, &y2, plen);
+ ex2 = buildExCommand2(mov, mkQueue->ani->_id, x1, y1, &x2, &y2, plen);
ex2->_parId = mq->_id;
- ex2->_keyCode = mgminfo->ani->_okeyCode;
+ ex2->_keyCode = mkQueue->ani->_okeyCode;
mq->addExCommandToEnd(ex2);
}
@@ -375,19 +375,19 @@ MessageQueue *AniHandler::genMovement(MGMInfo *mgminfo) {
for (int j = st1idx; j != subOffset;) {
MGMSubItem *s = _items[itemIdx]->subItems[j + subOffset * _items[itemIdx]->statics.size()];
- ex2 = buildExCommand2(s->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1);
+ ex2 = buildExCommand2(s->movement, mkQueue->ani->_id, x1, y1, &x2, &y2, -1);
ex2->_parId = mq->_id;
- ex2->_keyCode = mgminfo->ani->_okeyCode;
+ ex2->_keyCode = mkQueue->ani->_okeyCode;
mq->addExCommandToEnd(ex2);
j = s->staticsIndex;
}
- ExCommand *ex = new ExCommand(mgminfo->ani->_id, 5, -1, mgminfo->x1, mgminfo->y1, 0, 1, 0, 0, 0);
+ ExCommand *ex = new ExCommand(mkQueue->ani->_id, 5, -1, mkQueue->x1, mkQueue->y1, 0, 1, 0, 0, 0);
- ex->_field_14 = mgminfo->field_1C;
- ex->_keyCode = mgminfo->ani->_okeyCode;
+ ex->_field_14 = mkQueue->field_1C;
+ ex->_keyCode = mkQueue->ani->_okeyCode;
ex->_field_24 = 0;
ex->_excFlags |= 3;
diff --git a/engines/fullpipe/anihandler.h b/engines/fullpipe/anihandler.h
index 5632a8f..ec0dcd0 100644
--- a/engines/fullpipe/anihandler.h
+++ b/engines/fullpipe/anihandler.h
@@ -50,7 +50,7 @@ struct MGMItem {
MGMItem();
};
-struct MGMInfo {
+struct MakeQueueStruct {
StaticANIObject *ani;
int staticsId1;
int staticsId2;
@@ -63,7 +63,7 @@ struct MGMInfo {
int y2;
int flags;
- MGMInfo() { memset(this, 0, sizeof(MGMInfo)); }
+ MakeQueueStruct() { memset(this, 0, sizeof(MakeQueueStruct)); }
};
class AniHandler : public CObject {
@@ -72,11 +72,11 @@ public:
public:
void clear();
- void addItem(int objId);
+ void attachObject(int objId);
void rebuildTables(int objId);
int getItemIndexById(int objId);
- MessageQueue *genMovement(MGMInfo *mgminfo);
+ MessageQueue *makeRunQueue(MakeQueueStruct *mkQueue);
void updateAnimStatics(StaticANIObject *ani, int staticsId);
Common::Point *getPoint(Common::Point *point, int aniId, int staticsId1, int staticsId2);
int getStaticsIndexById(int idx, int16 id);
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index f2d3a65..25ee191 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -348,7 +348,7 @@ void MctlLadder::attachObject(StaticANIObject *obj) {
MctlLadderMovement *movement = new MctlLadderMovement;
if (initMovement(obj, movement)) {
- _aniHandler.addItem(obj->_id);
+ _aniHandler.attachObject(obj->_id);
_ladmovements.push_back(movement);
} else {
delete movement;
@@ -459,7 +459,7 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
int direction = (normy - ani->_oy) < 0 ? 0 : 1;
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
PicAniInfo picinfo;
MessageQueue *mq;
ExCommand *ex;
@@ -484,38 +484,38 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
}
if (ani->_statics->_staticsId == _ladmovements[pos]->staticIds[0]) {
- mgminfo.ani = ani;
+ mkQueue.ani = ani;
if (staticsId)
- mgminfo.staticsId2 = staticsId;
+ mkQueue.staticsId2 = staticsId;
else
- mgminfo.staticsId2 = _ladmovements[pos]->staticIds[direction];
+ mkQueue.staticsId2 = _ladmovements[pos]->staticIds[direction];
- mgminfo.x1 = normx;
- mgminfo.y1 = normy;
- mgminfo.field_1C = _ladder_field_14;
- mgminfo.flags = 14;
- mgminfo.movementId = direction ? _ladmovements[pos]->movVars->varDownGo : _ladmovements[pos]->movVars->varUpGo;
+ mkQueue.x1 = normx;
+ mkQueue.y1 = normy;
+ mkQueue.field_1C = _ladder_field_14;
+ mkQueue.flags = 14;
+ mkQueue.movementId = direction ? _ladmovements[pos]->movVars->varDownGo : _ladmovements[pos]->movVars->varUpGo;
- return _aniHandler.genMovement(&mgminfo);
+ return _aniHandler.makeRunQueue(&mkQueue);
}
if (ani->_statics->_staticsId == _ladmovements[pos]->staticIds[2]) {
if (!direction) {
- mgminfo.ani = ani;
+ mkQueue.ani = ani;
if (staticsId)
- mgminfo.staticsId2 = staticsId;
+ mkQueue.staticsId2 = staticsId;
else
- mgminfo.staticsId2 = _ladmovements[pos]->staticIds[0];
+ mkQueue.staticsId2 = _ladmovements[pos]->staticIds[0];
- mgminfo.x1 = normx;
- mgminfo.y1 = normy;
- mgminfo.field_1C = _ladder_field_14;
- mgminfo.flags = 14;
- mgminfo.movementId = _ladmovements[pos]->movVars->varUpGo;
+ mkQueue.x1 = normx;
+ mkQueue.y1 = normy;
+ mkQueue.field_1C = _ladder_field_14;
+ mkQueue.flags = 14;
+ mkQueue.movementId = _ladmovements[pos]->movVars->varUpGo;
- return _aniHandler.genMovement(&mgminfo);
+ return _aniHandler.makeRunQueue(&mkQueue);
}
int ox = ani->_ox;
@@ -523,23 +523,23 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
ani->getMovementById(_ladmovements[pos]->movVars->varUpStop)->calcSomeXY(point, 0, -1);
- mgminfo.ani = ani;
+ mkQueue.ani = ani;
if (staticsId)
- mgminfo.staticsId2 = staticsId;
+ mkQueue.staticsId2 = staticsId;
else
- mgminfo.staticsId2 = _ladmovements[pos]->staticIds[1];
+ mkQueue.staticsId2 = _ladmovements[pos]->staticIds[1];
- mgminfo.field_1C = _ladder_field_14;
- mgminfo.x1 = normx;
- mgminfo.y1 = normy;
- mgminfo.y2 = point.y + oy;
- mgminfo.x2 = point.x + ox;
- mgminfo.flags = 63;
- mgminfo.staticsId1 = _ladmovements[pos]->staticIds[0];
- mgminfo.movementId = _ladmovements[pos]->movVars->varDownGo;
+ mkQueue.field_1C = _ladder_field_14;
+ mkQueue.x1 = normx;
+ mkQueue.y1 = normy;
+ mkQueue.y2 = point.y + oy;
+ mkQueue.x2 = point.x + ox;
+ mkQueue.flags = 63;
+ mkQueue.staticsId1 = _ladmovements[pos]->staticIds[0];
+ mkQueue.movementId = _ladmovements[pos]->movVars->varDownGo;
- mq = _aniHandler.genMovement(&mgminfo);
+ mq = _aniHandler.makeRunQueue(&mkQueue);
ex = new ExCommand(ani->_id, 1, _ladmovements[pos]->movVars->varUpStop, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = ani->_okeyCode;
@@ -590,22 +590,22 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
nx += point.x;
ny += point.y;
- mgminfo.ani = ani;
+ mkQueue.ani = ani;
if (staticsId)
- mgminfo.staticsId2 = staticsId;
+ mkQueue.staticsId2 = staticsId;
else
- mgminfo.staticsId2 = _ladmovements[pos]->staticIds[0];
+ mkQueue.staticsId2 = _ladmovements[pos]->staticIds[0];
- mgminfo.field_1C = _ladder_field_14;
- mgminfo.x1 = normx;
- mgminfo.y1 = normy;
- mgminfo.y2 = ny;
- mgminfo.x2 = nx;
- mgminfo.flags = 63;
- mgminfo.staticsId1 = _ladmovements[pos]->staticIds[1];
- mgminfo.movementId = _ladmovements[pos]->movVars->varUpGo;
+ mkQueue.field_1C = _ladder_field_14;
+ mkQueue.x1 = normx;
+ mkQueue.y1 = normy;
+ mkQueue.y2 = ny;
+ mkQueue.x2 = nx;
+ mkQueue.flags = 63;
+ mkQueue.staticsId1 = _ladmovements[pos]->staticIds[1];
+ mkQueue.movementId = _ladmovements[pos]->movVars->varUpGo;
- mq = _aniHandler.genMovement(&mgminfo);
+ mq = _aniHandler.makeRunQueue(&mkQueue);
ex = new ExCommand(ani->_id, 1, _ladmovements[pos]->movVars->varDownStop, 0, 0, 0, 1, 0, 0, 0);
ex->_keyCode = ani->_okeyCode;
@@ -617,20 +617,20 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
}
- mgminfo.ani = ani;
+ mkQueue.ani = ani;
if (staticsId)
- mgminfo.staticsId2 = staticsId;
+ mkQueue.staticsId2 = staticsId;
else
- mgminfo.staticsId2 = _ladmovements[pos]->staticIds[1];
+ mkQueue.staticsId2 = _ladmovements[pos]->staticIds[1];
- mgminfo.x1 = normx;
- mgminfo.y1 = normy;
- mgminfo.field_1C = _ladder_field_14;
- mgminfo.flags = 14;
- mgminfo.movementId = _ladmovements[pos]->movVars->varDownGo;
+ mkQueue.x1 = normx;
+ mkQueue.y1 = normy;
+ mkQueue.field_1C = _ladder_field_14;
+ mkQueue.flags = 14;
+ mkQueue.movementId = _ladmovements[pos]->movVars->varDownGo;
- return _aniHandler.genMovement(&mgminfo);
+ return _aniHandler.makeRunQueue(&mkQueue);
}
MessageQueue *MctlLadder::controllerWalkTo(StaticANIObject *ani, int off) {
@@ -807,7 +807,7 @@ void MovGraph::attachObject(StaticANIObject *obj) {
debugC(4, kDebugPathfinding, "MovGraph::attachObject(*%d)", obj->_id);
_aniHandler.clear();
- _aniHandler.addItem(obj->_id);
+ _aniHandler.attachObject(obj->_id);
for (uint i = 0; i < _items.size(); i++)
if (_items[i]->ani == obj)
@@ -819,7 +819,7 @@ void MovGraph::attachObject(StaticANIObject *obj) {
_items.push_back(item);
- _aniHandler.addItem(obj->_id); // FIXME: Is it really needed?
+ _aniHandler.attachObject(obj->_id); // FIXME: Is it really needed?
}
int MovGraph::detachObject(StaticANIObject *obj) {
@@ -1230,24 +1230,24 @@ MessageQueue *MovGraph::makeWholeQueue(StaticANIObject *ani, MovArr *movarr, int
}
}
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
- memset(&mgminfo, 0, sizeof(mgminfo));
- mgminfo.ani = ani;
- mgminfo.staticsId2 = id2;
- mgminfo.staticsId1 = id1;
- mgminfo.x1 = nx;
- mgminfo.x2 = ox;
- mgminfo.y2 = oy;
- mgminfo.y1 = ny;
- mgminfo.field_1C = nd;
- mgminfo.movementId = st->link->_dwordArray1[_field_44 + st->sfield_0];
+ memset(&mkQueue, 0, sizeof(mkQueue));
+ mkQueue.ani = ani;
+ mkQueue.staticsId2 = id2;
+ mkQueue.staticsId1 = id1;
+ mkQueue.x1 = nx;
+ mkQueue.x2 = ox;
+ mkQueue.y2 = oy;
+ mkQueue.y1 = ny;
+ mkQueue.field_1C = nd;
+ mkQueue.movementId = st->link->_dwordArray1[_field_44 + st->sfield_0];
- mgminfo.flags = 0xe;
+ mkQueue.flags = 0xe;
if (mq)
- mgminfo.flags |= 0x31;
+ mkQueue.flags |= 0x31;
- MessageQueue *newmq = _aniHandler.genMovement(&mgminfo);
+ MessageQueue *newmq = _aniHandler.makeRunQueue(&mkQueue);
if (mq) {
if (newmq) {
@@ -2006,24 +2006,24 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
curX += mg2i->_mx;
curY += mg2i->_my;
} else {
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
- memset(&mgminfo, 0, sizeof(mgminfo));
+ memset(&mkQueue, 0, sizeof(mkQueue));
- mgminfo.ani = _items2[movInfo->index]->_obj;
- mgminfo.staticsId2 = mg2i->_mov->_staticsObj2->_staticsId;
- mgminfo.x1 = movInfo->items[i + 1]->x;
- mgminfo.y1 = movInfo->items[i + 1]->y;
- mgminfo.field_1C = movInfo->items[i + 1]->distance;
- mgminfo.staticsId1 = mg2i->_mov->_staticsObj1->_staticsId;
+ mkQueue.ani = _items2[movInfo->index]->_obj;
+ mkQueue.staticsId2 = mg2i->_mov->_staticsObj2->_staticsId;
+ mkQueue.x1 = movInfo->items[i + 1]->x;
+ mkQueue.y1 = movInfo->items[i + 1]->y;
+ mkQueue.field_1C = movInfo->items[i + 1]->distance;
+ mkQueue.staticsId1 = mg2i->_mov->_staticsObj1->_staticsId;
- mgminfo.x2 = movInfo->items[i]->x;
- mgminfo.y2 = movInfo->items[i]->y;
- mgminfo.field_10 = 1;
- mgminfo.flags = 0x7f;
- mgminfo.movementId = mg2i->_movementId;
+ mkQueue.x2 = movInfo->items[i]->x;
+ mkQueue.y2 = movInfo->items[i]->y;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 0x7f;
+ mkQueue.movementId = mg2i->_movementId;
- MessageQueue *mq2 = _aniHandler.genMovement(&mgminfo);
+ MessageQueue *mq2 = _aniHandler.makeRunQueue(&mkQueue);
mq->transferExCommands(mq2);
delete mq2;
diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp
index 4d7b337..d901d74 100644
--- a/engines/fullpipe/scenes/scene04.cpp
+++ b/engines/fullpipe/scenes/scene04.cpp
@@ -396,20 +396,20 @@ void sceneHandler04_jumpOnLadder() {
g_fp->_aniMan->_flags |= 1;
AniHandler aniHandler;
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
- aniHandler.addItem(ANI_MAN);
+ aniHandler.attachObject(ANI_MAN);
- mgminfo.ani = g_fp->_aniMan;
- mgminfo.staticsId2 = ST_MAN_ONPLANK;
- mgminfo.x1 = 938;
- mgminfo.y1 = 442;
- mgminfo.field_1C = 10;
- mgminfo.field_10 = 1;
- mgminfo.flags = 78;
- mgminfo.movementId = MV_MAN_JUMPONPLANK;
+ mkQueue.ani = g_fp->_aniMan;
+ mkQueue.staticsId2 = ST_MAN_ONPLANK;
+ mkQueue.x1 = 938;
+ mkQueue.y1 = 442;
+ mkQueue.field_1C = 10;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 78;
+ mkQueue.movementId = MV_MAN_JUMPONPLANK;
- MessageQueue *mq = aniHandler.genMovement(&mgminfo);
+ MessageQueue *mq = aniHandler.makeRunQueue(&mkQueue);
if (mq) {
mq->_flags |= 1;
@@ -461,20 +461,20 @@ void sceneHandler04_dropBottle() {
void sceneHandler04_gotoLadder(ExCommand *ex) {
AniHandler aniHandler;
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
- aniHandler.addItem(ANI_MAN);
+ aniHandler.attachObject(ANI_MAN);
- mgminfo.ani = g_fp->_aniMan;
- mgminfo.staticsId2 = ST_MAN_UP;
- mgminfo.x1 = 1095;
- mgminfo.y1 = 434;
- mgminfo.field_1C = 12;
- mgminfo.field_10 = 1;
- mgminfo.flags = 78;
- mgminfo.movementId = MV_MAN_PLANKTOLADDER;
+ mkQueue.ani = g_fp->_aniMan;
+ mkQueue.staticsId2 = ST_MAN_UP;
+ mkQueue.x1 = 1095;
+ mkQueue.y1 = 434;
+ mkQueue.field_1C = 12;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 78;
+ mkQueue.movementId = MV_MAN_PLANKTOLADDER;
- MessageQueue *mq = aniHandler.genMovement(&mgminfo);
+ MessageQueue *mq = aniHandler.makeRunQueue(&mkQueue);
if (mq) {
mq->deleteExCommandByIndex(mq->getCount() - 1, 1);
@@ -551,20 +551,20 @@ void sceneHandler04_raisePlank() {
MessageQueue *sceneHandler04_kozFly3(StaticANIObject *ani, double phase) {
AniHandler aniHandler;
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
- aniHandler.addItem(ANI_KOZAWKA);
+ aniHandler.attachObject(ANI_KOZAWKA);
- mgminfo.ani = ani;
- mgminfo.staticsId2 = ST_KZW_SIT;
- mgminfo.x1 = (int)(723.0 - phase * 185.0);
- mgminfo.y1 = 486;
- mgminfo.field_1C = 10;
- mgminfo.field_10 = 1;
- mgminfo.flags = 78;
- mgminfo.movementId = MV_KZW_JUMP;
+ mkQueue.ani = ani;
+ mkQueue.staticsId2 = ST_KZW_SIT;
+ mkQueue.x1 = (int)(723.0 - phase * 185.0);
+ mkQueue.y1 = 486;
+ mkQueue.field_1C = 10;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 78;
+ mkQueue.movementId = MV_KZW_JUMP;
- MessageQueue *mq = aniHandler.genMovement(&mgminfo);
+ MessageQueue *mq = aniHandler.makeRunQueue(&mkQueue);
if (mq) {
ExCommand *ex = new ExCommand(ANI_KOZAWKA, 1, MV_KZW_STANDUP, 0, 0, 0, 1, 0, 0, 0);
@@ -600,34 +600,34 @@ MessageQueue *sceneHandler04_kozFly3(StaticANIObject *ani, double phase) {
MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) {
AniHandler aniHandler;
- MGMInfo mgminfo;
-
- aniHandler.addItem(ANI_KOZAWKA);
-
- mgminfo.ani = ani;
- mgminfo.staticsId2 = ST_KZW_JUMPOUT;
- mgminfo.x1 = 525;
- mgminfo.y1 = (int)(344.0 - (double)(320 - g_vars->scene04_bottle->_oy) * phase);
- mgminfo.field_1C = 10;
- mgminfo.field_10 = 1;
- mgminfo.flags = 78;
- mgminfo.movementId = MV_KZW_JUMPHIT;
-
- MessageQueue *mq1 = aniHandler.genMovement(&mgminfo);
-
- memset(&mgminfo, 0, sizeof(mgminfo));
- mgminfo.ani = ani;
- mgminfo.staticsId1 = ST_KZW_JUMPOUT;
- mgminfo.staticsId2 = ST_KZW_SIT;
- mgminfo.x2 = 525;
- mgminfo.y2 = (int)(344.0 - (double)(320 - g_vars->scene04_bottle->_oy) * phase);
- mgminfo.y1 = 486;
- mgminfo.field_1C = 10;
- mgminfo.field_10 = 1;
- mgminfo.flags = 117;
- mgminfo.movementId = MV_KZW_JUMPOUT;
-
- MessageQueue *mq2 = aniHandler.genMovement(&mgminfo);
+ MakeQueueStruct mkQueue;
+
+ aniHandler.attachObject(ANI_KOZAWKA);
+
+ mkQueue.ani = ani;
+ mkQueue.staticsId2 = ST_KZW_JUMPOUT;
+ mkQueue.x1 = 525;
+ mkQueue.y1 = (int)(344.0 - (double)(320 - g_vars->scene04_bottle->_oy) * phase);
+ mkQueue.field_1C = 10;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 78;
+ mkQueue.movementId = MV_KZW_JUMPHIT;
+
+ MessageQueue *mq1 = aniHandler.makeRunQueue(&mkQueue);
+
+ memset(&mkQueue, 0, sizeof(mkQueue));
+ mkQueue.ani = ani;
+ mkQueue.staticsId1 = ST_KZW_JUMPOUT;
+ mkQueue.staticsId2 = ST_KZW_SIT;
+ mkQueue.x2 = 525;
+ mkQueue.y2 = (int)(344.0 - (double)(320 - g_vars->scene04_bottle->_oy) * phase);
+ mkQueue.y1 = 486;
+ mkQueue.field_1C = 10;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 117;
+ mkQueue.movementId = MV_KZW_JUMPOUT;
+
+ MessageQueue *mq2 = aniHandler.makeRunQueue(&mkQueue);
if (mq1 && mq2) {
mq1->addExCommandToEnd(mq2->getExCommandByIndex(0)->createClone());
@@ -671,20 +671,20 @@ MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) {
MessageQueue *sceneHandler04_kozFly6(StaticANIObject *ani) {
AniHandler aniHandler;
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
- aniHandler.addItem(ANI_KOZAWKA);
+ aniHandler.attachObject(ANI_KOZAWKA);
- mgminfo.ani = ani;
- mgminfo.staticsId2 = ST_KZW_SIT;
- mgminfo.x1 = 397 - 4 * g_fp->_rnd->getRandomNumber(1);
- mgminfo.field_1C = ani->_priority;
- mgminfo.y1 = g_vars->scene04_bottle->_oy - 4 * g_fp->_rnd->getRandomNumber(1) + 109;
- mgminfo.field_10 = 1;
- mgminfo.flags = 78;
- mgminfo.movementId = MV_KZW_JUMPROTATE;
+ mkQueue.ani = ani;
+ mkQueue.staticsId2 = ST_KZW_SIT;
+ mkQueue.x1 = 397 - 4 * g_fp->_rnd->getRandomNumber(1);
+ mkQueue.field_1C = ani->_priority;
+ mkQueue.y1 = g_vars->scene04_bottle->_oy - 4 * g_fp->_rnd->getRandomNumber(1) + 109;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 78;
+ mkQueue.movementId = MV_KZW_JUMPROTATE;
- MessageQueue *mq = aniHandler.genMovement(&mgminfo);
+ MessageQueue *mq = aniHandler.makeRunQueue(&mkQueue);
if (mq) {
mq->deleteExCommandByIndex(mq->getCount() - 1, 1);
@@ -729,20 +729,20 @@ void sceneHandler04_kozMove(Movement *mov, int from, int to, Common::Point *poin
MessageQueue *sceneHandler04_kozFly7(StaticANIObject *ani, double phase) {
AniHandler aniHandler;
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
- aniHandler.addItem(ANI_KOZAWKA);
+ aniHandler.attachObject(ANI_KOZAWKA);
- mgminfo.ani = ani;
- mgminfo.staticsId2 = 560;
- mgminfo.x1 = (int)(250.0 - phase * 100.0);
- mgminfo.y1 = 455;
- mgminfo.field_1C = 10;
- mgminfo.field_10 = 1;
- mgminfo.flags = 78;
- mgminfo.movementId = MV_KZW_JUMPROTATE;
+ mkQueue.ani = ani;
+ mkQueue.staticsId2 = 560;
+ mkQueue.x1 = (int)(250.0 - phase * 100.0);
+ mkQueue.y1 = 455;
+ mkQueue.field_1C = 10;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 78;
+ mkQueue.movementId = MV_KZW_JUMPROTATE;
- MessageQueue *mq = aniHandler.genMovement(&mgminfo);
+ MessageQueue *mq = aniHandler.makeRunQueue(&mkQueue);
if (mq) {
sceneHandler04_kozMove(ani->getMovementById(MV_KZW_JUMPROTATE), 1, 9, g_vars->scene04_jumpRotateKozyawki, phase * 0.5 + 1.5);
diff --git a/engines/fullpipe/scenes/scene11.cpp b/engines/fullpipe/scenes/scene11.cpp
index e152286..4714362 100644
--- a/engines/fullpipe/scenes/scene11.cpp
+++ b/engines/fullpipe/scenes/scene11.cpp
@@ -251,7 +251,7 @@ void sceneHandler11_manToSwing() {
g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_0, 0, -1);
g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(45);
- g_vars->scene11_aniHandler.addItem(g_fp->_aniMan->_id);
+ g_vars->scene11_aniHandler.attachObject(g_fp->_aniMan->_id);
g_fp->_currentScene->_x = 1400 - g_fp->_sceneRect.right;
@@ -385,7 +385,7 @@ void sceneHandler11_emptySwing() {
}
void sceneHandler11_jumpHitAndWin() {
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
sceneHandler11_emptySwing();
@@ -393,16 +393,16 @@ void sceneHandler11_jumpHitAndWin() {
MV_MAN11_JUMPHIT, 0);
g_fp->_aniMan->_priority = 10;
- mgminfo.field_1C = 10;
- mgminfo.ani = g_fp->_aniMan;
- mgminfo.staticsId2 = ST_MAN_1PIX;
- mgminfo.x1 = 1400;
- mgminfo.y1 = 0;
- mgminfo.field_10 = 1;
- mgminfo.flags = 66;
- mgminfo.movementId = MV_MAN11_JUMPHIT;
+ mkQueue.field_1C = 10;
+ mkQueue.ani = g_fp->_aniMan;
+ mkQueue.staticsId2 = ST_MAN_1PIX;
+ mkQueue.x1 = 1400;
+ mkQueue.y1 = 0;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 66;
+ mkQueue.movementId = MV_MAN11_JUMPHIT;
- MessageQueue *mq = g_vars->scene11_aniHandler.genMovement(&mgminfo);
+ MessageQueue *mq = g_vars->scene11_aniHandler.makeRunQueue(&mkQueue);
if (mq) {
g_vars->scene11_crySound = SND_11_024;
@@ -430,7 +430,7 @@ void sceneHandler11_jumpHitAndWin() {
}
void sceneHandler11_jumpOver(double angle) {
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
sceneHandler11_emptySwing();
@@ -438,16 +438,16 @@ void sceneHandler11_jumpOver(double angle) {
MV_MAN11_JUMPOVER, 0);
g_fp->_aniMan->_priority = 0;
- mgminfo.staticsId2 = ST_MAN_1PIX;
- mgminfo.ani = g_fp->_aniMan;
- mgminfo.x1 = 1163;
- mgminfo.y1 = 837 - (int)(angle * 153.0);
- mgminfo.field_1C = 0;
- mgminfo.field_10 = 1;
- mgminfo.flags = 78;
- mgminfo.movementId = MV_MAN11_JUMPOVER;
+ mkQueue.staticsId2 = ST_MAN_1PIX;
+ mkQueue.ani = g_fp->_aniMan;
+ mkQueue.x1 = 1163;
+ mkQueue.y1 = 837 - (int)(angle * 153.0);
+ mkQueue.field_1C = 0;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 78;
+ mkQueue.movementId = MV_MAN11_JUMPOVER;
- MessageQueue *mq = g_vars->scene11_aniHandler.genMovement(&mgminfo);
+ MessageQueue *mq = g_vars->scene11_aniHandler.makeRunQueue(&mkQueue);
if (mq) {
g_vars->scene11_crySound = SND_11_022;
@@ -463,7 +463,7 @@ void sceneHandler11_jumpOver(double angle) {
}
void sceneHandler11_jumpHit(double angle) {
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
sceneHandler11_emptySwing();
@@ -478,16 +478,16 @@ void sceneHandler11_jumpHit(double angle) {
MV_MAN11_JUMPOVER, 0);
g_fp->_aniMan->_priority = 0;
- mgminfo.staticsId2 = ST_MAN_1PIX;
- mgminfo.ani = g_fp->_aniMan;
- mgminfo.x1 = 1017 - (int)(angle * -214.0);
- mgminfo.y1 = 700;
- mgminfo.field_1C = 0;
- mgminfo.field_10 = 1;
- mgminfo.flags = 78;
- mgminfo.movementId = MV_MAN11_JUMPHIT;
+ mkQueue.staticsId2 = ST_MAN_1PIX;
+ mkQueue.ani = g_fp->_aniMan;
+ mkQueue.x1 = 1017 - (int)(angle * -214.0);
+ mkQueue.y1 = 700;
+ mkQueue.field_1C = 0;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 78;
+ mkQueue.movementId = MV_MAN11_JUMPHIT;
- MessageQueue *mq = g_vars->scene11_aniHandler.genMovement(&mgminfo);
+ MessageQueue *mq = g_vars->scene11_aniHandler.makeRunQueue(&mkQueue);
if (mq) {
g_vars->scene11_crySound = SND_11_022;
diff --git a/engines/fullpipe/scenes/scene22.cpp b/engines/fullpipe/scenes/scene22.cpp
index ce060dc..84cd5f9 100644
--- a/engines/fullpipe/scenes/scene22.cpp
+++ b/engines/fullpipe/scenes/scene22.cpp
@@ -240,22 +240,22 @@ void sceneHandler22_stoolLogic(ExCommand *cmd) {
}
AniHandler mgm;
- MGMInfo mgminfo;
-
- mgm.addItem(ANI_MAN);
- mgminfo.ani = g_fp->_aniMan;
- mgminfo.staticsId2 = ST_MAN_RIGHT;
- mgminfo.x1 = 934;
- mgminfo.y1 = 391;
- mgminfo.field_1C = 10;
- mgminfo.staticsId1 = 0x4145;
- mgminfo.x2 = 981;
- mgminfo.y2 = 390;
- mgminfo.field_10 = 1;
- mgminfo.flags = 127;
- mgminfo.movementId = rMV_MAN_TURN_SRL;
-
- mq = mgm.genMovement(&mgminfo);
+ MakeQueueStruct mkQueue;
+
+ mgm.attachObject(ANI_MAN);
+ mkQueue.ani = g_fp->_aniMan;
+ mkQueue.staticsId2 = ST_MAN_RIGHT;
+ mkQueue.x1 = 934;
+ mkQueue.y1 = 391;
+ mkQueue.field_1C = 10;
+ mkQueue.staticsId1 = 0x4145;
+ mkQueue.x2 = 981;
+ mkQueue.y2 = 390;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = 127;
+ mkQueue.movementId = rMV_MAN_TURN_SRL;
+
+ mq = mgm.makeRunQueue(&mkQueue);
ExCommand *ex = mq->getExCommandByIndex(0);
diff --git a/engines/fullpipe/scenes/scene29.cpp b/engines/fullpipe/scenes/scene29.cpp
index c68553c..28d0696 100644
--- a/engines/fullpipe/scenes/scene29.cpp
+++ b/engines/fullpipe/scenes/scene29.cpp
@@ -487,23 +487,23 @@ bool sceneHandler29_checkGreenBallHit(StaticANIObject *ani, int maxx) {
}
void sceneHandler29_manHit() {
- MGMInfo mgminfo;
+ MakeQueueStruct mkQueue;
g_vars->scene29_manIsHit = true;
g_fp->_aniMan->changeStatics2(ST_MAN29_RUNR);
g_fp->_aniMan->setOXY(g_vars->scene29_manX, g_vars->scene29_manY);
- mgminfo.ani = g_fp->_aniMan;
- mgminfo.staticsId2 = ST_MAN29_SITR;
- mgminfo.y1 = 463;
- mgminfo.x1 = g_vars->scene29_manX <= 638 ? 351 : 0;
- mgminfo.field_1C = 10;
- mgminfo.field_10 = 1;
- mgminfo.flags = (g_vars->scene29_manX <= 638 ? 2 : 0) | 0x44;
- mgminfo.movementId = MV_MAN29_HIT;
+ mkQueue.ani = g_fp->_aniMan;
+ mkQueue.staticsId2 = ST_MAN29_SITR;
+ mkQueue.y1 = 463;
+ mkQueue.x1 = g_vars->scene29_manX <= 638 ? 351 : 0;
+ mkQueue.field_1C = 10;
+ mkQueue.field_10 = 1;
+ mkQueue.flags = (g_vars->scene29_manX <= 638 ? 2 : 0) | 0x44;
+ mkQueue.movementId = MV_MAN29_HIT;
- MessageQueue *mq = g_vars->scene29_aniHandler.genMovement(&mgminfo);
+ MessageQueue *mq = g_vars->scene29_aniHandler.makeRunQueue(&mkQueue);
ExCommand *ex;
if (mq) {
@@ -728,7 +728,7 @@ void sceneHandler29_manToL() {
g_vars->scene29_arcadeIsOn = true;
- g_vars->scene29_aniHandler.addItem(g_fp->_aniMan->_id);
+ g_vars->scene29_aniHandler.attachObject(g_fp->_aniMan->_id);
g_fp->_updateScreenCallback = sceneHandler29_updateScreenCallback;
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index e025477..c81b84d 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -1040,7 +1040,7 @@ void StaticANIObject::adjustSomeXY() {
}
MessageQueue *StaticANIObject::changeStatics1(int msgNum) {
- g_fp->_aniHandler->addItem(_id);
+ g_fp->_aniHandler->attachObject(_id);
MessageQueue *mq = g_fp->_aniHandler->genMQ(this, msgNum, 0, 0, 0);
@@ -1071,7 +1071,7 @@ void StaticANIObject::changeStatics2(int objId) {
deleteFromGlobalMessageQueue();
if (_movement || _statics) {
- g_fp->_aniHandler->addItem(_id);
+ g_fp->_aniHandler->attachObject(_id);
g_fp->_aniHandler->updateAnimStatics(this, objId);
} else {
_statics = getStaticsById(objId);
Commit: 1bcec8bcd9089e481a8b137f7bad0002fd773ca6
https://github.com/scummvm/scummvm/commit/1bcec8bcd9089e481a8b137f7bad0002fd773ca6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-14T21:40:29+02:00
Commit Message:
FULLPIPE: Further renames in AniHandler class
Changed paths:
engines/fullpipe/anihandler.cpp
engines/fullpipe/anihandler.h
engines/fullpipe/messages.cpp
engines/fullpipe/messages.h
engines/fullpipe/motion.cpp
engines/fullpipe/statics.cpp
diff --git a/engines/fullpipe/anihandler.cpp b/engines/fullpipe/anihandler.cpp
index a423b2b..219f20d 100644
--- a/engines/fullpipe/anihandler.cpp
+++ b/engines/fullpipe/anihandler.cpp
@@ -33,10 +33,10 @@ void AniHandler::clear() {
_items.clear();
}
-MessageQueue *AniHandler::genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr) {
- debugC(4, kDebugPathfinding, "AniHandler::genMQ(*%d, %d, %d, res, point)", ani->_id, staticsIndex, staticsId);
+MessageQueue *AniHandler::makeQueue(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr) {
+ debugC(4, kDebugPathfinding, "AniHandler::makeQueue(*%d, %d, %d, res, point)", ani->_id, staticsIndex, staticsId);
- int idx = getItemIndexById(ani->_id);
+ int idx = getIndex(ani->_id);
if (idx == -1)
return 0;
@@ -62,8 +62,8 @@ MessageQueue *AniHandler::genMQ(StaticANIObject *ani, int staticsIndex, int stat
int subidx = startidx + endidx * _items[idx]->statics.size();
if (!_items[idx]->subItems[subidx]->movement) {
- clearMovements2(idx);
- recalcOffsets(idx, startidx, endidx, 0, 1);
+ clearVisitsList(idx);
+ seekWay(idx, startidx, endidx, 0, 1);
}
if (!_items[idx]->subItems[subidx]->movement)
@@ -134,22 +134,22 @@ MGMSubItem::MGMSubItem() {
void AniHandler::attachObject(int objId) {
debugC(4, kDebugPathfinding, "AniHandler::addItem(%d)", objId);
- if (getItemIndexById(objId) == -1) {
+ if (getIndex(objId) == -1) {
MGMItem *item = new MGMItem();
item->objId = objId;
_items.push_back(item);
}
- rebuildTables(objId);
+ resetData(objId);
}
-void AniHandler::rebuildTables(int objId) {
- int idx = getItemIndexById(objId);
+void AniHandler::resetData(int objId) {
+ int idx = getIndex(objId);
if (idx == -1)
return;
- debugC(3, kDebugPathfinding, "AniHandler::rebuildTables. (1) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
+ debugC(3, kDebugPathfinding, "AniHandler::resetData. (1) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
_items[idx]->subItems.clear();
_items[idx]->statics.clear();
@@ -174,10 +174,10 @@ void AniHandler::rebuildTables(int objId) {
_items[idx]->movements2.push_back(0);
}
- debugC(3, kDebugPathfinding, "AniHandler::rebuildTables. (2) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
+ debugC(3, kDebugPathfinding, "AniHandler::resetData. (2) movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
}
-int AniHandler::getItemIndexById(int objId) {
+int AniHandler::getIndex(int objId) {
for (uint i = 0; i < _items.size(); i++)
if (_items[i]->objId == objId)
return i;
@@ -229,7 +229,7 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
return 0;
- int itemIdx = getItemIndexById(mkQueue->ani->_id);
+ int itemIdx = getIndex(mkQueue->ani->_id);
int subIdx = getStaticsIndexById(itemIdx, mkQueue->staticsId1);
int st2idx = getStaticsIndexById(itemIdx, mov->_staticsObj1->_staticsId);
int st1idx = getStaticsIndexById(itemIdx, mov->_staticsObj2->_staticsId);
@@ -237,10 +237,10 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
debugC(3, kDebugPathfinding, "AniHandler::genMovement. (1) movements1 sz: %d movements2 sz: %d", _items[itemIdx]->movements1.size(), _items[itemIdx]->movements2.size());
- clearMovements2(itemIdx);
- recalcOffsets(itemIdx, subIdx, st2idx, 0, 1);
- clearMovements2(itemIdx);
- recalcOffsets(itemIdx, st1idx, subOffset, 0, 1);
+ clearVisitsList(itemIdx);
+ seekWay(itemIdx, subIdx, st2idx, 0, 1);
+ clearVisitsList(itemIdx);
+ seekWay(itemIdx, st1idx, subOffset, 0, 1);
MGMSubItem *sub1 = _items[itemIdx]->subItems[subIdx + st2idx * _items[itemIdx]->statics.size()];
MGMSubItem *sub2 = _items[itemIdx]->subItems[st1idx + subOffset * _items[itemIdx]->statics.size()];
@@ -292,8 +292,8 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
int py = 0;
if (sub1->movement) {
- px = countPhases(itemIdx, subIdx, st2idx, 1);
- py = countPhases(itemIdx, subIdx, st2idx, 2);
+ px = getFramesCount(itemIdx, subIdx, st2idx, 1);
+ py = getFramesCount(itemIdx, subIdx, st2idx, 2);
}
if (mult > 1) {
@@ -307,8 +307,8 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
}
if (sub2->movement) {
- px += countPhases(itemIdx, st1idx, subOffset, 1);
- py += countPhases(itemIdx, st1idx, subOffset, 2);
+ px += getFramesCount(itemIdx, st1idx, subOffset, 1);
+ py += getFramesCount(itemIdx, st1idx, subOffset, 2);
}
int dx1 = n1x - n2x;
@@ -398,7 +398,7 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
return mq;
}
-int AniHandler::countPhases(int idx, int subIdx, int endIdx, int flag) {
+int AniHandler::getFramesCount(int idx, int subIdx, int endIdx, int flag) {
int res = 0;
if (endIdx < 0)
@@ -418,7 +418,7 @@ int AniHandler::countPhases(int idx, int subIdx, int endIdx, int flag) {
void AniHandler::updateAnimStatics(StaticANIObject *ani, int staticsId) {
debugC(4, kDebugPathfinding, "AniHandler::updateAnimStatics(*%d, %d)", ani->_id, staticsId);
- if (getItemIndexById(ani->_id) == -1)
+ if (getIndex(ani->_id) == -1)
return;
if (ani->_movement) {
@@ -437,7 +437,7 @@ void AniHandler::updateAnimStatics(StaticANIObject *ani, int staticsId) {
if (ani->_statics) {
Common::Point point;
- getPoint(&point, ani->_id, ani->_statics->_staticsId, staticsId);
+ getTransitionSize(&point, ani->_id, ani->_statics->_staticsId, staticsId);
ani->setOXY(ani->_ox + point.x, ani->_oy + point.y);
@@ -445,10 +445,10 @@ void AniHandler::updateAnimStatics(StaticANIObject *ani, int staticsId) {
}
}
-Common::Point *AniHandler::getPoint(Common::Point *point, int objectId, int staticsId1, int staticsId2) {
- debugC(4, kDebugPathfinding, "AniHandler::getPoint([%d, %d], %d, %d, %d)", point->x, point->y, objectId, staticsId1, staticsId2);
+Common::Point *AniHandler::getTransitionSize(Common::Point *point, int objectId, int staticsId1, int staticsId2) {
+ debugC(4, kDebugPathfinding, "AniHandler::getTransitionSize([%d, %d], %d, %d, %d)", point->x, point->y, objectId, staticsId1, staticsId2);
- int idx = getItemIndexById(objectId);
+ int idx = getIndex(objectId);
if (idx == -1) {
point->x = -1;
@@ -464,12 +464,12 @@ Common::Point *AniHandler::getPoint(Common::Point *point, int objectId, int stat
int subidx = st1idx + st2idx * _items[idx]->statics.size();
if (!_items[idx]->subItems[subidx]->movement) {
- clearMovements2(idx);
- recalcOffsets(idx, st1idx, st2idx, false, true);
+ clearVisitsList(idx);
+ seekWay(idx, st1idx, st2idx, false, true);
if (!_items[idx]->subItems[subidx]->movement) {
- clearMovements2(idx);
- recalcOffsets(idx, st1idx, st2idx, true, false);
+ clearVisitsList(idx);
+ seekWay(idx, st1idx, st2idx, true, false);
}
}
@@ -512,20 +512,20 @@ int AniHandler::getStaticsIndex(int idx, Statics *st) {
return -1;
}
-void AniHandler::clearMovements2(int idx) {
- debugC(2, kDebugPathfinding, "AniHandler::clearMovements2(%d)", idx);
+void AniHandler::clearVisitsList(int idx) {
+ debugC(2, kDebugPathfinding, "AniHandler::clearVisitsList(%d)", idx);
for (uint i = 0; i < _items[idx]->movements2.size(); i++)
_items[idx]->movements2[i] = 0;
- debugC(3, kDebugPathfinding, "AniHandler::clearMovements2. movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
+ debugC(3, kDebugPathfinding, "AniHandler::clearVisitsList. movements1 sz: %d movements2 sz: %d", _items[idx]->movements1.size(), _items[idx]->movements2.size());
}
-int AniHandler::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
+int AniHandler::seekWay(int idx, int st1idx, int st2idx, bool flip, bool flop) {
MGMItem *item = _items[idx];
int subIdx = st1idx + st2idx * item->statics.size();
- debugC(2, kDebugPathfinding, "AniHandler::recalcOffsets(%d, %d, %d, %d, %d)", idx, st1idx, st2idx, flip, flop);
+ debugC(2, kDebugPathfinding, "AniHandler::seekWay(%d, %d, %d, %d, %d)", idx, st1idx, st2idx, flip, flop);
if (st1idx == st2idx) {
memset(item->subItems[subIdx], 0, sizeof(*(item->subItems[subIdx])));
@@ -537,7 +537,7 @@ int AniHandler::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool f
Common::Point point;
- debugC(3, kDebugPathfinding, "AniHandler::recalcOffsets. movements1 sz: %d movements2 sz: %d", item->movements1.size(), item->movements2.size());
+ debugC(3, kDebugPathfinding, "AniHandler::seekWay. movements1 sz: %d movements2 sz: %d", item->movements1.size(), item->movements2.size());
for (uint i = 0; i < item->movements1.size(); i++) {
Movement *mov = item->movements1[i];
@@ -549,9 +549,9 @@ int AniHandler::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool f
item->movements2[i] = 1;
int stidx = getStaticsIndex(idx, mov->_staticsObj2);
- int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
+ int recalc = seekWay(idx, stidx, st2idx, flip, flop);
int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
- debugC(1, kDebugPathfinding, "AniHandler::recalcOffsets, want idx: %d, off: %d (%d + %d), sz: %d", idx, stidx + st2idx * _items[idx]->statics.size(), stidx, st2idx, item->subItems.size());
+ debugC(1, kDebugPathfinding, "AniHandler::seekWay, want idx: %d, off: %d (%d + %d), sz: %d", idx, stidx + st2idx * _items[idx]->statics.size(), stidx, st2idx, item->subItems.size());
int newsz = sz + item->subItems[stidx + st2idx * _items[idx]->statics.size()]->field_C;
@@ -580,7 +580,7 @@ int AniHandler::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool f
item->movements2[i] = 1;
int stidx = getStaticsIndex(idx, mov->_staticsObj1);
- int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
+ int recalc = seekWay(idx, stidx, st2idx, flip, flop);
if (recalc < 0)
continue;
@@ -608,10 +608,10 @@ int AniHandler::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool f
return -1;
}
-int AniHandler::refreshOffsets(int objectId, int idx1, int idx2) {
- debugC(4, kDebugPathfinding, "AniHandler::refreshOffsets(%d, %d, %d)", objectId, idx1, idx2);
+int AniHandler::getNumMovements(int objectId, int idx1, int idx2) {
+ debugC(4, kDebugPathfinding, "AniHandler::getNumMovements(%d, %d, %d)", objectId, idx1, idx2);
- int idx = getItemIndexById(objectId);
+ int idx = getIndex(objectId);
if (idx != -1) {
int from = getStaticsIndexById(idx, idx1);
@@ -623,8 +623,8 @@ int AniHandler::refreshOffsets(int objectId, int idx1, int idx2) {
if (sub->movement) {
idx = sub->field_8;
} else {
- clearMovements2(idx);
- idx = recalcOffsets(idx, from, to, 0, 1);
+ clearVisitsList(idx);
+ idx = seekWay(idx, from, to, 0, 1);
}
}
diff --git a/engines/fullpipe/anihandler.h b/engines/fullpipe/anihandler.h
index ec0dcd0..f0e535c 100644
--- a/engines/fullpipe/anihandler.h
+++ b/engines/fullpipe/anihandler.h
@@ -73,21 +73,21 @@ public:
public:
void clear();
void attachObject(int objId);
- void rebuildTables(int objId);
- int getItemIndexById(int objId);
+ void resetData(int objId);
+ int getIndex(int objId);
MessageQueue *makeRunQueue(MakeQueueStruct *mkQueue);
void updateAnimStatics(StaticANIObject *ani, int staticsId);
- Common::Point *getPoint(Common::Point *point, int aniId, int staticsId1, int staticsId2);
+ Common::Point *getTransitionSize(Common::Point *point, int aniId, int staticsId1, int staticsId2);
int getStaticsIndexById(int idx, int16 id);
int getStaticsIndex(int idx, Statics *st);
- void clearMovements2(int idx);
- int recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop);
+ void clearVisitsList(int idx);
+ int seekWay(int idx, int st1idx, int st2idx, bool flip, bool flop);
Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *mult, int *len, int flag);
ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len);
- MessageQueue *genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr);
- int countPhases(int idx, int subIdx, int subOffset, int flag);
- int refreshOffsets(int objectId, int idx1, int idx2);
+ MessageQueue *makeQueue(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr);
+ int getFramesCount(int idx, int subIdx, int subOffset, int flag);
+ int getNumMovements(int objectId, int idx1, int idx2);
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp
index 8652223e..9085e92 100644
--- a/engines/fullpipe/messages.cpp
+++ b/engines/fullpipe/messages.cpp
@@ -457,7 +457,7 @@ void MessageQueue::deleteExCommandByIndex(uint idx, bool doFree) {
_exCommands.erase(it);
}
-void MessageQueue::transferExCommands(MessageQueue *mq) {
+void MessageQueue::mergeQueue(MessageQueue *mq) { // Original belongs to AniHandler
while (mq->_exCommands.size()) {
_exCommands.push_back(mq->_exCommands.front());
mq->_exCommands.pop_front();
diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h
index e6f7f05..67fbb2a 100644
--- a/engines/fullpipe/messages.h
+++ b/engines/fullpipe/messages.h
@@ -142,7 +142,7 @@ class MessageQueue : public CObject {
ExCommand *getExCommandByIndex(uint idx);
void deleteExCommandByIndex(uint idx, bool doFree);
- void transferExCommands(MessageQueue *mq);
+ void mergeQueue(MessageQueue *mq);
void replaceKeyCode(int key1, int key2);
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 25ee191..995ba39 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -551,7 +551,7 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
}
if (ani->_statics->_staticsId != _ladmovements[pos]->staticIds[3]) {
- mq = _aniHandler.genMQ(ani, _ladmovements[pos]->staticIds[0], 0, 0, 0);
+ mq = _aniHandler.makeQueue(ani, _ladmovements[pos]->staticIds[0], 0, 0, 0);
if (!mq)
return 0;
@@ -559,7 +559,7 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
int nx = ani->_ox;
int ny = ani->_oy;
- _aniHandler.getPoint(&point, ani->_id, ani->_statics->_staticsId, _ladmovements[pos]->staticIds[0]);
+ _aniHandler.getTransitionSize(&point, ani->_id, ani->_statics->_staticsId, _ladmovements[pos]->staticIds[0]);
nx += point.x;
ny += point.y;
@@ -572,7 +572,7 @@ MessageQueue *MctlLadder::doWalkTo(StaticANIObject *ani, int xpos, int ypos, int
MessageQueue *newmq = doWalkTo(ani, normx, normy, fuzzyMatch, staticsId);
- mq->transferExCommands(newmq);
+ mq->mergeQueue(newmq);
delete newmq;
@@ -1008,8 +1008,8 @@ bool MovGraph::resetPosition(StaticANIObject *ani, int flag) {
Statics *st;
if (ani->_statics) {
- int t = _aniHandler.refreshOffsets(ani->_id, ani->_statics->_staticsId, movarr._link->_dwordArray2[_field_44]);
- if (t > _aniHandler.refreshOffsets(ani->_id, ani->_statics->_staticsId, movarr._link->_dwordArray2[_field_44 + 1]))
+ int t = _aniHandler.getNumMovements(ani->_id, ani->_statics->_staticsId, movarr._link->_dwordArray2[_field_44]);
+ if (t > _aniHandler.getNumMovements(ani->_id, ani->_statics->_staticsId, movarr._link->_dwordArray2[_field_44 + 1]))
st = ani->getStaticsById(movarr._link->_dwordArray2[_field_44 + 1]);
else
st = ani->getStaticsById(movarr._link->_dwordArray2[_field_44]);
@@ -1251,7 +1251,7 @@ MessageQueue *MovGraph::makeWholeQueue(StaticANIObject *ani, MovArr *movarr, int
if (mq) {
if (newmq) {
- mq->transferExCommands(newmq);
+ mq->mergeQueue(newmq);
delete newmq;
}
@@ -1608,14 +1608,14 @@ bool MovGraph::getHitPoint(int idx, int x, int y, MovArr *arr, int a6) {
int offmin = 100;
for (int i = 0; i < arrSize; i++) {
- int off = _aniHandler.refreshOffsets(_items[idx]->ani->_id, staticsId, (*movarr)[i]->_link->_dwordArray2[_field_44]);
+ int off = _aniHandler.getNumMovements(_items[idx]->ani->_id, staticsId, (*movarr)[i]->_link->_dwordArray2[_field_44]);
if (off < offmin) {
offmin = off;
idxmin = i;
}
- off = _aniHandler.refreshOffsets(_items[idx]->ani->_id, staticsId, (*movarr)[i]->_link->_dwordArray2[_field_44 + 1]);
+ off = _aniHandler.getNumMovements(_items[idx]->ani->_id, staticsId, (*movarr)[i]->_link->_dwordArray2[_field_44 + 1]);
if (off < offmin) {
offmin = off;
idxmin = i;
@@ -1689,7 +1689,7 @@ int MovGraph2::getItemSubIndexByMGM(int index, StaticANIObject *ani) {
for (int i = 0; i < 4; i++) {
debugC(1, kDebugPathfinding, "WWW 5");
- int tmp = _aniHandler.refreshOffsets(ani->_id, ani->_statics->_staticsId, _items2[index]->_subItems[i]._staticsId1);
+ int tmp = _aniHandler.getNumMovements(ani->_id, ani->_statics->_staticsId, _items2[index]->_subItems[i]._staticsId1);
if (tmp >= 0 && (minidx == -1 || tmp < min)) {
minidx = i;
@@ -2024,7 +2024,7 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
mkQueue.movementId = mg2i->_movementId;
MessageQueue *mq2 = _aniHandler.makeRunQueue(&mkQueue);
- mq->transferExCommands(mq2);
+ mq->mergeQueue(mq2);
delete mq2;
@@ -2078,7 +2078,7 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
return 0;
}
- mq->transferExCommands(mq2);
+ mq->mergeQueue(mq2);
delete mq2;
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index c81b84d..264de51 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -1042,7 +1042,7 @@ void StaticANIObject::adjustSomeXY() {
MessageQueue *StaticANIObject::changeStatics1(int msgNum) {
g_fp->_aniHandler->attachObject(_id);
- MessageQueue *mq = g_fp->_aniHandler->genMQ(this, msgNum, 0, 0, 0);
+ MessageQueue *mq = g_fp->_aniHandler->makeQueue(this, msgNum, 0, 0, 0);
if (!mq)
return 0;
Commit: 68508cb87e09ac1c6c5abffdb5a1f0d314cc9ff7
https://github.com/scummvm/scummvm/commit/68508cb87e09ac1c6c5abffdb5a1f0d314cc9ff7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-14T21:40:29+02:00
Commit Message:
FULLPIPE: Renamed rest of the AniHandler class methods
Changed paths:
engines/fullpipe/anihandler.cpp
engines/fullpipe/anihandler.h
engines/fullpipe/motion.cpp
engines/fullpipe/scenes/scene11.cpp
engines/fullpipe/statics.cpp
diff --git a/engines/fullpipe/anihandler.cpp b/engines/fullpipe/anihandler.cpp
index 219f20d..71c894b 100644
--- a/engines/fullpipe/anihandler.cpp
+++ b/engines/fullpipe/anihandler.cpp
@@ -29,7 +29,7 @@
namespace Fullpipe {
-void AniHandler::clear() {
+void AniHandler::detachAllObjects() {
_items.clear();
}
@@ -269,7 +269,7 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
n2x *= mult;
n2y *= mult;
} else {
- calcLength(&point, mov, n1x, n1y, &mult, &len, 1);
+ getNumCycles(&point, mov, n1x, n1y, &mult, &len, 1);
n2x = point.x;
n2y = point.y;
}
@@ -348,7 +348,7 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
for (int i = subIdx; i != st2idx;) {
MGMSubItem *s = _items[itemIdx]->subItems[i + subOffset * _items[itemIdx]->statics.size()];
- ex2 = buildExCommand2(s->movement, mkQueue->ani->_id, x1, y1, &x2, &y2, -1);
+ ex2 = createCommand(s->movement, mkQueue->ani->_id, x1, y1, &x2, &y2, -1);
ex2->_parId = mq->_id;
ex2->_keyCode = mkQueue->ani->_okeyCode;
@@ -365,7 +365,7 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
else
plen = -1;
- ex2 = buildExCommand2(mov, mkQueue->ani->_id, x1, y1, &x2, &y2, plen);
+ ex2 = createCommand(mov, mkQueue->ani->_id, x1, y1, &x2, &y2, plen);
ex2->_parId = mq->_id;
ex2->_keyCode = mkQueue->ani->_okeyCode;
@@ -375,7 +375,7 @@ MessageQueue *AniHandler::makeRunQueue(MakeQueueStruct *mkQueue) {
for (int j = st1idx; j != subOffset;) {
MGMSubItem *s = _items[itemIdx]->subItems[j + subOffset * _items[itemIdx]->statics.size()];
- ex2 = buildExCommand2(s->movement, mkQueue->ani->_id, x1, y1, &x2, &y2, -1);
+ ex2 = createCommand(s->movement, mkQueue->ani->_id, x1, y1, &x2, &y2, -1);
ex2->_parId = mq->_id;
ex2->_keyCode = mkQueue->ani->_okeyCode;
@@ -415,8 +415,8 @@ int AniHandler::getFramesCount(int idx, int subIdx, int endIdx, int flag) {
return res;
}
-void AniHandler::updateAnimStatics(StaticANIObject *ani, int staticsId) {
- debugC(4, kDebugPathfinding, "AniHandler::updateAnimStatics(*%d, %d)", ani->_id, staticsId);
+void AniHandler::putObjectToStatics(StaticANIObject *ani, int staticsId) {
+ debugC(4, kDebugPathfinding, "AniHandler::putObjectToStatics(*%d, %d)", ani->_id, staticsId);
if (getIndex(ani->_id) == -1)
return;
@@ -631,7 +631,7 @@ int AniHandler::getNumMovements(int objectId, int idx1, int idx2) {
return idx;
}
-Common::Point *AniHandler::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *mult, int *len, int flag) {
+Common::Point *AniHandler::getNumCycles(Common::Point *pRes, Movement *mov, int x, int y, int *mult, int *len, int flag) {
Common::Point point;
mov->calcSomeXY(point, 0, -1);
@@ -707,8 +707,8 @@ Common::Point *AniHandler::calcLength(Common::Point *pRes, Movement *mov, int x,
return pRes;
}
-ExCommand2 *AniHandler::buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) {
- debugC(2, kDebugPathfinding, "AniHandler::buildExCommand2(mov, %d, %d, %d, [%d, %d], [%d, %d], %d)", objId, x1, y1, x2->x, x2->y, y2->x, y2->y, len);
+ExCommand2 *AniHandler::createCommand(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) {
+ debugC(2, kDebugPathfinding, "AniHandler::createCommand(mov, %d, %d, %d, [%d, %d], [%d, %d], %d)", objId, x1, y1, x2->x, x2->y, y2->x, y2->y, len);
uint cnt;
diff --git a/engines/fullpipe/anihandler.h b/engines/fullpipe/anihandler.h
index f0e535c..ae16f91 100644
--- a/engines/fullpipe/anihandler.h
+++ b/engines/fullpipe/anihandler.h
@@ -71,20 +71,20 @@ public:
Common::Array<MGMItem *> _items;
public:
- void clear();
+ void detachAllObjects();
void attachObject(int objId);
void resetData(int objId);
int getIndex(int objId);
MessageQueue *makeRunQueue(MakeQueueStruct *mkQueue);
- void updateAnimStatics(StaticANIObject *ani, int staticsId);
+ void putObjectToStatics(StaticANIObject *ani, int staticsId);
Common::Point *getTransitionSize(Common::Point *point, int aniId, int staticsId1, int staticsId2);
int getStaticsIndexById(int idx, int16 id);
int getStaticsIndex(int idx, Statics *st);
void clearVisitsList(int idx);
int seekWay(int idx, int st1idx, int st2idx, bool flip, bool flop);
- Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *mult, int *len, int flag);
- ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len);
+ Common::Point *getNumCycles(Common::Point *point, Movement *mov, int x, int y, int *mult, int *len, int flag);
+ ExCommand2 *createCommand(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len);
MessageQueue *makeQueue(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr);
int getFramesCount(int idx, int subIdx, int subOffset, int flag);
int getNumMovements(int objectId, int idx1, int idx2);
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 995ba39..a8fe8b7 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -413,7 +413,7 @@ bool MctlLadder::initMovement(StaticANIObject *ani, MctlLadderMovement *movement
void MctlLadder::detachAllObjects() {
debugC(4, kDebugPathfinding, "MctlLadder::detachAllObjects()");
- _aniHandler.clear();
+ _aniHandler.detachAllObjects();
for (uint i = 0; i < _ladmovements.size(); i++) {
delete _ladmovements[i]->movVars;
@@ -806,7 +806,7 @@ bool MovGraph::load(MfcArchive &file) {
void MovGraph::attachObject(StaticANIObject *obj) {
debugC(4, kDebugPathfinding, "MovGraph::attachObject(*%d)", obj->_id);
- _aniHandler.clear();
+ _aniHandler.detachAllObjects();
_aniHandler.attachObject(obj->_id);
for (uint i = 0; i < _items.size(); i++)
@@ -2504,7 +2504,7 @@ MessageQueue *MovGraph2::genMovement(MovInfo1 *info) {
int a2 = 0;
int mgmLen;
- _aniHandler.calcLength(&point, _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov, x, y, &mgmLen, &a2, info->flags & 1);
+ _aniHandler.getNumCycles(&point, _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov, x, y, &mgmLen, &a2, info->flags & 1);
int x1 = point.x;
int y1 = point.y;
@@ -2619,7 +2619,7 @@ MessageQueue *MovGraph2::genMovement(MovInfo1 *info) {
ex->_excFlags |= 2;
mq->addExCommandToEnd(ex);
- ex = _aniHandler.buildExCommand2(
+ ex = _aniHandler.createCommand(
_items2[info->index]->_subItems[info->subIndex]._walk[0]._mov,
_items2[info->index]->_objectId,
x1,
@@ -2641,7 +2641,7 @@ MessageQueue *MovGraph2::genMovement(MovInfo1 *info) {
else
par = -1;
- ex = _aniHandler.buildExCommand2(
+ ex = _aniHandler.createCommand(
_items2[info->index]->_subItems[info->subIndex]._walk[1]._mov,
_items2[info->index]->_objectId,
x1,
@@ -2655,7 +2655,7 @@ MessageQueue *MovGraph2::genMovement(MovInfo1 *info) {
}
if (!(info->flags & 4)) {
- ex = _aniHandler.buildExCommand2(
+ ex = _aniHandler.createCommand(
_items2[info->index]->_subItems[info->subIndex]._walk[2]._mov,
_items2[info->index]->_objectId,
x1,
diff --git a/engines/fullpipe/scenes/scene11.cpp b/engines/fullpipe/scenes/scene11.cpp
index 4714362..1a8fa8e 100644
--- a/engines/fullpipe/scenes/scene11.cpp
+++ b/engines/fullpipe/scenes/scene11.cpp
@@ -96,7 +96,7 @@ void scene11_setupMusic() {
void scene11_initScene(Scene *sc) {
g_vars->scene11_swingie = sc->getStaticANIObject1ById(ANI_SWINGER, -1);
g_vars->scene11_boots = sc->getStaticANIObject1ById(ANI_BOOTS_11, -1);
- g_vars->scene11_aniHandler.clear();
+ g_vars->scene11_aniHandler.detachAllObjects();
g_vars->scene11_dudeOnSwing = sc->getStaticANIObject1ById(ANI_MAN11, -1);
g_vars->scene11_dudeOnSwing->_callback2 = scene11_dudeSwingCallback;
g_vars->scene11_dudeOnSwing = sc->getStaticANIObject1ById(ANI_KACHELI, -1);
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 264de51..45cf743 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -156,7 +156,7 @@ StaticANIObject::~StaticANIObject() {
_movements.clear();
- g_fp->_aniHandler->clear();
+ g_fp->_aniHandler->detachAllObjects();
}
StaticANIObject::StaticANIObject(StaticANIObject *src) : GameObject(src) {
@@ -1072,7 +1072,7 @@ void StaticANIObject::changeStatics2(int objId) {
if (_movement || _statics) {
g_fp->_aniHandler->attachObject(_id);
- g_fp->_aniHandler->updateAnimStatics(this, objId);
+ g_fp->_aniHandler->putObjectToStatics(this, objId);
} else {
_statics = getStaticsById(objId);
}
More information about the Scummvm-git-logs
mailing list