diff options
author | Eugene Sandulenko | 2014-05-31 10:18:33 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2014-05-31 10:18:33 +0300 |
commit | aaec2e993ca7770ace9c2648f85c515fbcb9a604 (patch) | |
tree | 12165e5a42df48f87738f366d598712e89cc715a /engines/fullpipe | |
parent | 6229bcb9f291e5e8d82688f7809575c1bf3f4c99 (diff) | |
download | scummvm-rg350-aaec2e993ca7770ace9c2648f85c515fbcb9a604.tar.gz scummvm-rg350-aaec2e993ca7770ace9c2648f85c515fbcb9a604.tar.bz2 scummvm-rg350-aaec2e993ca7770ace9c2648f85c515fbcb9a604.zip |
FULLPIPE: Implement MctlCompound::findClosestConnectionPoint()
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/motion.cpp | 61 |
1 files changed, 22 insertions, 39 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 5b7419c7f4..bea9bcdc10 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -430,59 +430,42 @@ MessageQueue *MctlLadder::controllerWalkTo(StaticANIObject *ani, int off) { return doWalkTo(ani, _ladderX + off * _width, _ladderY + off * _height, 1, 0); } -MctlConnectionPoint *MctlCompound::findClosestConnectionPoint(int ox, int oy, int destIndex, int connectionX, int connectionY, int sourceIndex, double *minDistancePtr) { -#if 0 - if (destIndex == sourceIndex) { +MctlConnectionPoint *MctlCompound::findClosestConnectionPoint(int ox, int oy, int destIndex, int connectionX, int connectionY, int sourceIdx, double *minDistancePtr) { + if (destIndex == sourceIdx) { *minDistancePtr = sqrt((double)((oy - connectionY) * (oy - connectionY) + (ox - connectionX) * (ox - connectionX))); return 0; } - v11 = this->_motionControllers.m_pData; - currDistance = 0.0; - v12 = 0; - v13 = (MctlCompoundArrayItem *)*(&v11->vmt + sourceIndex); - minDistance = 1.0e10; - minConnectionPoint = 0; - if (v13->mctlConnectionPointsArray.CObArray.m_nSize > 0) { - do { - v14 = 0; - for (currMctlIndex = 0; v14 < this->_motionControllers.m_nSize; currMctlIndex = v14) { - v15 = this->_motionControllers.m_pData; - v16 = *(MovGraphReact **)(*(&v15->vmt + v14) + offsetof(MctlCompoundArrayItem, movGraphReactObj)); - if (v16) { - v17 = *(MctlConnectionPoint **)(*(_DWORD *)(*(&v15->vmt + sourceIndex) + 0x10) + 4 * v12);// MctlCompoundArrayItem.mctlConnectionPointsArray.CObArray.m_pData - LOBYTE(v18) = (*(bool (__thiscall **)(MovGraphReact *, int, int))(v16->CObject.vmt + offsetof(MovGraphReactVmt, pointInRegion)))(v16, v17->_connectionX, v17->_connectionY); - if (v18) { - v14 = currMctlIndex; - v19 = *(MctlConnectionPoint **)(*(_DWORD *)(*(&this->_motionControllers.m_pData->vmt + sourceIndex) + 0x10) + 4 * v12); - v20 = MctlCompound_findClosestConnectionPoint(this, ox, oy, destIndex, v19->_connectionX, v19->_connectionY, currMctlIndex, (int *)&currDistance); - if (currDistance < minDistance) { - minDistance = currDistance; - if (v20) - minConnectionPoint = v20; - else - minConnectionPoint = *(MctlConnectionPoint **)(*(_DWORD *)(*(&this->_motionControllers.m_pData->vmt + sourceIndex) + 0x10) + 4 * v12); - } - } else { - v14 = currMctlIndex; + double currDistance = 0.0; + double minDistance = 1.0e10; + MctlConnectionPoint *minConnectionPoint = 0; + + for (uint i = 0; i < _motionControllers[sourceIdx]->_connectionPoints.size(); i++) { + for (int j = 0; j < _motionControllers.size(); j++) { + if (_motionControllers[j]->_movGraphReactObj) { + MctlConnectionPoint *pt = _motionControllers[sourceIdx]->_connectionPoints[i]; + + if (_motionControllers[j]->_movGraphReactObj->pointInRegion(pt->_connectionX, pt->_connectionY)) { + MctlConnectionPoint *npt = findClosestConnectionPoint(ox, oy, destIndex, pt->_connectionX, pt->_connectionY, j, &currDistance); + + if (currDistance < minDistance) { + minDistance = currDistance; + + if (npt) + minConnectionPoint = npt; + else + minConnectionPoint = pt; } } - ++v14; } - ++v12; - } while (v12 < *(_DWORD *)(*(&this->_motionControllers.m_pData->vmt + sourceIndex) + 0x14)); // MctlCompoundArrayItem.mctlConnectionPointsArray.CObArray.m_nSize + } } *minDistancePtr = minDistance; return minConnectionPoint; } -#endif - warning("STUB: MctlCompound::findClosestConnectionPoint()"); - - return 0; -} void MctlCompound::replaceNodeX(int from, int to) { for (uint i = 0; i < _motionControllers.size(); i++) { |