aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2013-10-17 00:35:02 +0300
committerEugene Sandulenko2013-10-17 00:35:02 +0300
commita0185d7fdc449438ce85ef00abcae297c6e89829 (patch)
tree664b72dd090d37ad0926dcc669fd8da9a0e6810e /engines
parent769ba7f6cab51dc48f4d6aaefcb3bf8c216abaa9 (diff)
downloadscummvm-rg350-a0185d7fdc449438ce85ef00abcae297c6e89829.tar.gz
scummvm-rg350-a0185d7fdc449438ce85ef00abcae297c6e89829.tar.bz2
scummvm-rg350-a0185d7fdc449438ce85ef00abcae297c6e89829.zip
FULLPIPE: Implemented MovGraph2::method4C()
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/messages.cpp21
-rw-r--r--engines/fullpipe/messages.h2
-rw-r--r--engines/fullpipe/motion.cpp149
-rw-r--r--engines/fullpipe/motion.h5
4 files changed, 92 insertions, 85 deletions
diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp
index b5f2cb8303..d58212dc29 100644
--- a/engines/fullpipe/messages.cpp
+++ b/engines/fullpipe/messages.cpp
@@ -309,6 +309,10 @@ void MessageQueue::messageQueueCallback1(int par) {
debug(3, "STUB: MessageQueue::messageQueueCallback1()");
}
+void MessageQueue::addExCommand(ExCommand *ex) {
+ _exCommands.push_front(ex);
+}
+
ExCommand *MessageQueue::getExCommandByIndex(uint idx) {
if (idx > _exCommands.size())
return 0;
@@ -323,6 +327,23 @@ ExCommand *MessageQueue::getExCommandByIndex(uint idx) {
return *it;
}
+void MessageQueue::deleteExCommandByIndex(uint idx, bool doFree) {
+ if (idx > _exCommands.size())
+ return;
+
+ Common::List<ExCommand *>::iterator it = _exCommands.begin();
+
+ while (idx) {
+ ++it;
+ idx--;
+ }
+
+ _exCommands.erase(it);
+
+ if (doFree)
+ delete *it;
+}
+
void MessageQueue::sendNextCommand() {
if (_exCommands.size()) {
if (!(_flags & 4) && (_flags & 1)) {
diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h
index 6b72364323..a3533e1bd2 100644
--- a/engines/fullpipe/messages.h
+++ b/engines/fullpipe/messages.h
@@ -119,7 +119,9 @@ class MessageQueue : public CObject {
uint getCount() { return _exCommands.size(); }
+ void addExCommand(ExCommand *ex);
ExCommand *getExCommandByIndex(uint idx);
+ void deleteExCommandByIndex(uint idx, bool doFree);
void replaceKeyCode(int key1, int key2);
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 8e25786591..e161c4b457 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -535,6 +535,16 @@ void MovGraph2::addObject(StaticANIObject *obj) {
}
}
+void MovGraph2::buildMovInfo1SubItems(MovInfo1 *movinfo, Common::Array<MovGraphLink *> *linkList, LinkInfo *lnkSrc, LinkInfo *lnkDst) {
+ warning("STUB: MovGraph2::buildMovInfo1SubItems()");
+}
+
+MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
+ warning("STUB: MovGraph2::buildMovInfo1MessageQueue()");
+
+ return 0;
+}
+
int MovGraph2::removeObject(StaticANIObject *obj) {
warning("STUB: MovGraph2::removeObject()");
@@ -727,105 +737,62 @@ MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int
dy2 = movInfo1.pt2.y;
}
- warning("STUB: MovGraph2::method4C()");
-
-#if 0
-
if (staticsId) {
- v47 = MovGraph2_getItem1IndexByStaticsId(ex, staticsId);
- } else if (tempLinkList.m_nCount <= 1) {
- if (tempLinkList.m_nCount == 1)
- LOBYTE(v47) = MovGraph2_sub_456690(
- this,
- (int)&tempLinkList.m_pNodeHead->data->GameObject.CObject.vmt,
- dx2 - dx1,
- dy2 - dy1);
+ movInfo1.item1Index = getItemSubIndexByStaticsId(idx, staticsId);
+ } else if (tempLinkList.size() <= 1) {
+ if (tempLinkList.size() == 1)
+ movInfo1.item1Index = getShortSide(tempLinkList[0], dx2 - dx1, dy2 - dy1);
else
- LOBYTE(v47) = MovGraph2_sub_456690(this, 0, dx2 - dx1, dy2 - dy1);
+ movInfo1.item1Index = getShortSide(0, dx2 - dx1, dy2 - dy1);
} else {
- LOBYTE(v47) = MovGraph2_sub_456300(this, (int)&tempLinkList, tempLinkList.m_pNodeTail, 0, 0);
+ movInfo1.item1Index = findLink(&tempLinkList, tempLinkList.back(), 0, 0);
}
+
movInfo1.flags = fuzzyMatch != 0;
- movInfo1.item1Index = v47;
- if (*((_DWORD *)this->items.CObArray.m_pData[offsetof(MovGraph2, movGraph)]
- + 186 * movInfo1.field_0
- + 46 * movInfo1.subIndex
- + 3) != (unsigned __int16)v62) {
- v48 = movInfo1.flags;
- LOBYTE(v48) = LOBYTE(movInfo1.flags) | 2;
- movInfo1.flags = v48;
- }
- MovGraph2_buildMovInfo1SubItems(this, (int)&movInfo1, (int)&tempLinkList, (int)&linkInfoSource, (int)&linkInfoDest);
- v49 = MovGraph2_buildMovInfo1MessageQueue(this, (int)&movInfo1);
- v50 = (MessageQueue *)v49;
- v62 = (MessageQueue *)v49;
- CObjectFree((void *)movInfo1.items);
- v51 = MovGraph2_findNode(this, movInfo1.pt2.x, movInfo1.pt2.y, fuzzyMatch);
- linkInfoDest.node = v51;
- if (!v51) {
- linkInfoDest.link = MovGraph2_findLink1(this, movInfo1.pt2.x, movInfo1.pt2.y, movInfo1.item1Index, fuzzyMatch);
- v51 = linkInfoDest.node;
- }
- if (fuzzyMatch || (_DWORD)linkInfoDest.link || v51) {
- if (v50 && MessageQueue_getCount(v50) > 0 && picAniInfo.movementId) {
- v52 = MessageQueue_getExCommandByIndex(v50, 0);
- point.x = (int)v52;
- if (v52
- && ((v53 = v52->msg.messageKind, v53 == 1) || v53 == 20)
- && picAniInfo.movementId == LOWORD(v52->messageNum)
- && picAniInfo.someDynamicPhaseIndex == v52->msg.field_14) {
- MessageQueue_deleteExCommandByIndex(v50, 0, 1);
+
+ if (_items[idx]->_subItems[idxsub]._staticsId1 != obj->_statics->_staticsId)
+ movInfo1.flags |= 2;
+
+ buildMovInfo1SubItems(&movInfo1, &tempLinkList, &linkInfoSource, &linkInfoDest);
+
+ MessageQueue *mq = buildMovInfo1MessageQueue(&movInfo1);
+
+ linkInfoDest.node = findNode(movInfo1.pt2.x, movInfo1.pt2.y, fuzzyMatch);
+
+ if (!linkInfoDest.node)
+ linkInfoDest.link = findLink1(movInfo1.pt2.x, movInfo1.pt2.y, movInfo1.item1Index, fuzzyMatch);
+
+ if (fuzzyMatch || linkInfoDest.link || linkInfoDest.node) {
+ if (mq && mq->getCount() > 0 && picAniInfo.movementId) {
+ ExCommand *ex = mq->getExCommandByIndex(0);
+
+ if (ex && (ex->_messageKind == 1 || ex->_messageKind == 20)
+ && picAniInfo.movementId == ex->_messageNum
+ && picAniInfo.someDynamicPhaseIndex == ex->_field_14) {
+ mq->deleteExCommandByIndex(0, 1);
} else {
- ExCommand *ex = new ExCommand(picAniInfo.objectId, 5, v52->_messageNum, obj->_ox, obj->_oy, 0, 1, 0, 0, 0);
+ ex = new ExCommand(picAniInfo.objectId, 5, ex->_messageNum, obj->_ox, obj->_oy, 0, 1, 0, 0, 0);
ex->_field_14 = -1;
ex->_keyCode = picAniInfo.field_8;
ex->_excFlags |= 2;
- v50->addExCommand(ex);
-
- v57 = (ExCommand *)operator new(sizeof(ExCommand));
- v63 = v57;
- LOBYTE(v71.state) = 6;
- if (v57) {
- v58 = ExCommand_ctor(
- v57,
- picAniInfo.objectId,
- 22,
- *((_DWORD *)this->items.CObArray.m_pData[offsetof(MovGraph2, movGraph)]
- + 186 * ex
- + 46 * movInfo1.subIndex
- + 3),
- 0,
- 0,
- 0,
- 1,
- 0,
- 0,
- 0);
- v50 = v62;
- }
- else
- {
- v58 = 0;
- }
- v58->msg.keyCode = picAniInfo.field_8;
- v59 = v58->excFlags | 3;
- LOBYTE(v71.state) = 4;
- v58->excFlags = v59;
- MessageQueue_addExCommand(v50, v58);
+ mq->addExCommand(ex);
+
+ ex = new ExCommand(picAniInfo.objectId, 22, _items[idx]->_subItems[idxsub]._staticsId1, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_keyCode = picAniInfo.field_8;
+ ex->_excFlags |= 3;
+ mq->addExCommand(ex);
}
}
} else {
- if (v50)
- (*(void (__thiscall **)(MessageQueue *, signed int))(v50->CObject.vmt + 4))(v50, 1);
- v50 = 0;
+ if (mq)
+ delete mq;
+ mq = 0;
}
- GameObject_setPicAniInfo(obj, &picAniInfo);
- v71.state = -1;
- ObList_dtor(&tempLinkList);
- return v50;
-#endif
- return 0;
+ obj->setPicAniInfo(&picAniInfo);
+
+ return mq;
}
MovGraphNode *MovGraph2::findNode(int x, int y, int fuzzyMatch) {
@@ -834,6 +801,18 @@ MovGraphNode *MovGraph2::findNode(int x, int y, int fuzzyMatch) {
return 0;
}
+int MovGraph2::getShortSide(MovGraphLink *lnk, int x, int y) {
+ warning("STUB: MovGraph2::getShortSide()");
+
+ return 0;
+}
+
+int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, MovGraphLink *lnk, Common::Rect *a3, Common::Point *a4) {
+ warning("STUB: MovGraphLink *MovGraph2::findLink()");
+
+ return 0;
+}
+
MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) {
warning("STUB: MovGraphLink *MovGraph2::findLink1()");
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index f55333edea..9089cca520 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -315,7 +315,12 @@ public:
int getItemSubIndexByMovementId(int index, int movId);
int getItemSubIndexByMGM(int idx, StaticANIObject *ani);
+ int getShortSide(MovGraphLink *lnk, int x, int y);
+ int findLink(Common::Array<MovGraphLink *> *linkList, MovGraphLink *lnk, Common::Rect *a3, Common::Point *a4);
+
bool initDirections(StaticANIObject *obj, MovGraph2Item *item);
+ void buildMovInfo1SubItems(MovInfo1 *movinfo, Common::Array<MovGraphLink *> *linkList, LinkInfo *lnkSrc, LinkInfo *lnkDst);
+ MessageQueue *buildMovInfo1MessageQueue(MovInfo1 *movInfo);
MovGraphNode *findNode(int x, int y, int fuzzyMatch);
MovGraphLink *findLink1(int x, int y, int idx, int fuzzyMatch);