[Scummvm-cvs-logs] scummvm master -> 1cfafc6cfd8b7de11c1bb28df082199092e5774c
sev-
sev at scummvm.org
Wed Oct 16 23:38:05 CEST 2013
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a0185d7fdc FULLPIPE: Implemented MovGraph2::method4C()
1cfafc6cfd FULLPIPE: method4C -> doWalkTo
Commit: a0185d7fdc449438ce85ef00abcae297c6e89829
https://github.com/scummvm/scummvm/commit/a0185d7fdc449438ce85ef00abcae297c6e89829
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-10-16T14:35:02-07:00
Commit Message:
FULLPIPE: Implemented MovGraph2::method4C()
Changed paths:
engines/fullpipe/messages.cpp
engines/fullpipe/messages.h
engines/fullpipe/motion.cpp
engines/fullpipe/motion.h
diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp
index b5f2cb8..d58212d 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 6b72364..a3533e1 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 8e25786..e161c4b 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 f55333e..9089cca 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);
Commit: 1cfafc6cfd8b7de11c1bb28df082199092e5774c
https://github.com/scummvm/scummvm/commit/1cfafc6cfd8b7de11c1bb28df082199092e5774c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2013-10-16T14:37:04-07:00
Commit Message:
FULLPIPE: method4C -> doWalkTo
Changed paths:
engines/fullpipe/interaction.cpp
engines/fullpipe/motion.cpp
engines/fullpipe/motion.h
diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp
index 9fd42c1..80cbce9 100644
--- a/engines/fullpipe/interaction.cpp
+++ b/engines/fullpipe/interaction.cpp
@@ -137,7 +137,7 @@ bool InteractionController::handleInteraction(StaticANIObject *subj, GameObject
obj->setPicAniInfo(&aniInfo);
if (abs(xpos - subj->_ox) > 1 || abs(ypos - subj->_oy) > 1) {
- mq = getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->method4C(subj, xpos, ypos, 1, cinter->_staticsId2);
+ mq = getSc2MctlCompoundBySceneId(g_fullpipe->_currentScene->_sceneId)->doWalkTo(subj, xpos, ypos, 1, cinter->_staticsId2);
if (mq) {
dur = mq->calcDuration(subj);
delete mq;
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index e161c4b..53b2906 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -122,7 +122,7 @@ MessageQueue *MctlCompound::method34(StaticANIObject *subj, int xpos, int ypos,
return 0;
}
-MessageQueue *MctlCompound::method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
+MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
int match1 = -1;
int match2 = -1;
@@ -154,14 +154,14 @@ MessageQueue *MctlCompound::method4C(StaticANIObject *subj, int xpos, int ypos,
return 0;
if (match1 == match2)
- return _motionControllers[match1]->_motionControllerObj->method4C(subj, xpos, ypos, fuzzyMatch, staticsId);
+ return _motionControllers[match1]->_motionControllerObj->doWalkTo(subj, xpos, ypos, fuzzyMatch, staticsId);
MctlConnectionPoint *closestP = findClosestConnectionPoint(subj->_ox, subj->_oy, match1, xpos, ypos, match2, &match2);
if (!closestP)
return 0;
- MessageQueue *mq = _motionControllers[match1]->_motionControllerObj->method4C(subj, closestP->_connectionX, closestP->_connectionY, 1, closestP->_field_14);
+ MessageQueue *mq = _motionControllers[match1]->_motionControllerObj->doWalkTo(subj, closestP->_connectionX, closestP->_connectionY, 1, closestP->_field_14);
ExCommand *ex;
@@ -309,8 +309,8 @@ int MovGraph::method44() {
return 0;
}
-MessageQueue *MovGraph::method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
- warning("STUB: MovGraph::method4C()");
+MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
+ warning("STUB: MovGraph::doWalkTo()");
return 0;
}
@@ -561,7 +561,7 @@ MessageQueue *MovGraph2::method34(StaticANIObject *subj, int xpos, int ypos, int
return 0;
}
-MessageQueue *MovGraph2::method4C(StaticANIObject *obj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
+MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
LinkInfo linkInfoDest;
LinkInfo linkInfoSource;
MovInfo1 movInfo1;
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 9089cca..eedc292 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -58,7 +58,7 @@ public:
virtual int method40() { return 0; }
virtual int method44() { return 0; }
virtual int method48() { return -1; }
- virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; }
+ virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; }
};
class MovGraphReact : public CObject {
@@ -107,7 +107,7 @@ class MctlCompound : public MotionController {
virtual int removeObject(StaticANIObject *obj);
virtual void freeItems();
virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
- virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
+ virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
void initMovGraph2();
MctlConnectionPoint *findClosestConnectionPoint(int ox, int oy, int destIndex, int connectionX, int connectionY, int sourceIndex, int *minDistancePtr);
@@ -251,7 +251,7 @@ class MovGraph : public MotionController {
virtual int changeCallback();
virtual int method3C();
virtual int method44();
- virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
+ virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
virtual int method50();
double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch);
@@ -308,7 +308,7 @@ public:
virtual int removeObject(StaticANIObject *obj);
virtual void freeItems();
virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
- virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
+ virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
int getItemIndexByGameObjectId(int objectId);
int getItemSubIndexByStaticsId(int index, int staticsId);
More information about the Scummvm-git-logs
mailing list