aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/fullpipe/motion.cpp115
-rw-r--r--engines/fullpipe/motion.h9
2 files changed, 121 insertions, 3 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index f9158397c2..ef5a62b6f8 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -536,7 +536,118 @@ void MovGraph2::addObject(StaticANIObject *obj) {
}
void MovGraph2::buildMovInfo1SubItems(MovInfo1 *movinfo, Common::Array<MovGraphLink *> *linkList, LinkInfo *lnkSrc, LinkInfo *lnkDst) {
- warning("STUB: MovGraph2::buildMovInfo1SubItems()");
+ MovInfo1Sub *elem;
+ Common::Point point;
+ Common::Rect rect;
+
+ int subIndex = movinfo->subIndex;
+
+ movinfo->items.clear();
+
+ elem = new MovInfo1Sub;
+ elem->subIndex = subIndex;
+ elem->x = movinfo->pt1.x;
+ elem->y = movinfo->pt1.y;
+ elem->distance = -1;
+
+ movinfo->items.push_back(elem);
+
+ int prevSubIndex = movinfo->subIndex;
+
+ for (Common::Array<MovGraphLink *>::iterator i = linkList->begin(); i != linkList->end(); ++i) {
+ MovGraphLink *lnk = *i;
+
+ int idx1;
+
+ if (linkList->size() <= 1) {
+ if (linkList->size() == 1)
+ idx1 = getShortSide((*linkList)[0], movinfo->pt2.x - movinfo->pt1.x, movinfo->pt2.y - movinfo->pt1.y);
+ else
+ idx1 = getShortSide(0, movinfo->pt2.x - movinfo->pt1.x, movinfo->pt2.y - movinfo->pt1.y);
+
+ point.y = -1;
+ rect.bottom = -1;
+ rect.right = -1;
+ rect.top = -1;
+ rect.left = -1;
+ } else {
+ idx1 = findLink(linkList, lnk, &rect, &point);
+ }
+
+ if (idx1 != prevSubIndex) {
+ prevSubIndex = idx1;
+ subIndex = idx1;
+
+ elem = new MovInfo1Sub;
+ elem->subIndex = subIndex;
+ elem->x = rect.left;
+ elem->y = rect.top;
+ elem->distance = -1;
+
+ movinfo->items.push_back(elem);
+ }
+
+ if (i != linkList->end()) {
+ while (1) {
+ Common::Array<MovGraphLink *>::iterator j = i;
+
+ ++i;
+
+ if (findLink(linkList, *i, &rect, 0) != prevSubIndex) {
+ i = j;
+ findLink(linkList, *i, &rect, &point);
+
+ break;
+ }
+
+ if (i == linkList->end())
+ break;
+ }
+ lnk = *i;
+ }
+
+ if (movinfo->items.back()->subIndex != 10) {
+ subIndex = prevSubIndex;
+
+ elem = new MovInfo1Sub;
+ elem->subIndex = 10;
+ elem->x = -1;
+ elem->y = -1;
+ elem->distance = -1;
+
+ movinfo->items.push_back(elem);
+
+ if (i == linkList->end()) {
+ elem = new MovInfo1Sub;
+ elem->subIndex = prevSubIndex;
+ elem->x = movinfo->pt2.x;
+ elem->y = movinfo->pt2.y;
+ elem->distance = movinfo->distance2;
+
+ movinfo->items.push_back(elem);
+ } else {
+ elem = new MovInfo1Sub;
+ elem->subIndex = prevSubIndex;
+ elem->x = rect.right;
+ elem->y = rect.bottom;
+ elem->distance = point.y;
+
+ movinfo->items.push_back(elem);
+ }
+ }
+ }
+
+ if (subIndex != movinfo->item1Index) {
+ elem = new MovInfo1Sub;
+ elem->subIndex = movinfo->item1Index;
+ elem->x = movinfo->pt2.x;
+ elem->y = movinfo->pt2.y;
+ elem->distance = movinfo->distance2;
+
+ movinfo->items.push_back(elem);
+ }
+
+ movinfo->itemsCount = movinfo->items.size();
}
MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
@@ -824,7 +935,7 @@ int MovGraph2::getShortSide(MovGraphLink *lnk, int x, int y) {
return 0;
}
-int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, MovGraphLink *lnk, Common::Rect *a3, Common::Point *a4) {
+int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, MovGraphLink *lnk, Common::Rect *rect, Common::Point *point) {
warning("STUB: MovGraphLink *MovGraph2::findLink()");
return 0;
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 6901a7263a..d53bcf1bbf 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -280,6 +280,13 @@ struct LinkInfo {
MovGraphNode *node;
};
+struct MovInfo1Sub {
+ int subIndex;
+ int x;
+ int y;
+ int distance;
+};
+
struct MovInfo1 {
int field_0;
Common::Point pt1;
@@ -288,7 +295,7 @@ struct MovInfo1 {
int distance2;
int subIndex;
int item1Index;
- int items;
+ Common::Array<MovInfo1Sub *> items;
int itemsCount;
int flags;
};