diff options
-rw-r--r-- | engines/fullpipe/motion.cpp | 49 | ||||
-rw-r--r-- | engines/fullpipe/motion.h | 42 | ||||
-rw-r--r-- | engines/fullpipe/utils.cpp | 6 |
3 files changed, 83 insertions, 14 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 815b0c365e..a25d47505b 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -116,4 +116,53 @@ bool CMovGraphNode::load(MfcArchive &file) { return true; } +CReactParallel::CReactParallel() { + _x1 = 0; + _x2 = 0; + _dy = 0; + _dx = 0; + _points = 0; + _y1 = 0; + _y2 = 0; +} + +bool CReactParallel::load(MfcArchive &file) { + _x1 = file.readUint32LE(); + _y1 = file.readUint32LE(); + _x2 = file.readUint32LE(); + _y2 = file.readUint32LE(); + _dx = file.readUint32LE(); + _dy = file.readUint32LE(); + + createRegion(); + + return true; +} + +void CReactParallel::createRegion() { + _points = (Common::Point **)malloc(sizeof(Common::Point *) * 4); + + for (int i = 0; i < 4; i++) + _points[i] = new Common::Point; + + double at = atan2(_x1 - _x2, _y1 - _y2) + 1.570796; + double sn = sin(at); + double cs = cos(at); + + _points[0]->x = (int16)(_x1 - _dx * cs); + _points[0]->y = (int16)(_y1 - _dx * sn); + + _points[1]->x = (int16)(_x2 - _dx * cs); + _points[1]->y = (int16)(_y2 - _dx * sn); + + _points[2]->x = (int16)(_x1 + _dy * cs); + _points[2]->y = (int16)(_y2 + _dy * sn); + + _points[3]->x = (int16)(_x1 + _dy * cs); + _points[3]->y = (int16)(_y1 + _dy * sn); + + // GdiObject::Attach(_rgn, CreatePolygonRgn(_points, 4, 2); +} + + } // End of namespace Fullpipe diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 508a7f7af6..f5e8632b26 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -88,22 +88,38 @@ class CMovGraphReact : public CObject { // Empty }; +class CReactParallel : public CMovGraphReact { + //CRgn _rgn; + int _x1; + int _y1; + int _x2; + int _y2; + int _dx; + int _dy; + Common::Point **_points; + + public: + CReactParallel(); + virtual bool load(MfcArchive &file); + void createRegion(); +}; + class CMovGraphLink : public CObject { - CMovGraphNode *_movGraphNode1; - CMovGraphNode *_movGraphNode2; - CDWordArray _dwordArray1; - CDWordArray _dwordArray2; - int _flags; - int _field_38; - int _field_3C; - double _distance; - double _angle; - CMovGraphReact *_movGraphReact; - char *_name; + CMovGraphNode *_movGraphNode1; + CMovGraphNode *_movGraphNode2; + CDWordArray _dwordArray1; + CDWordArray _dwordArray2; + int _flags; + int _field_38; + int _field_3C; + double _distance; + double _angle; + CMovGraphReact *_movGraphReact; + char *_name; public: - CMovGraphLink(); - virtual bool load(MfcArchive &file); + CMovGraphLink(); + virtual bool load(MfcArchive &file); }; class CMovGraph : public CMotionController { diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp index 4add1bae22..df6c869a82 100644 --- a/engines/fullpipe/utils.cpp +++ b/engines/fullpipe/utils.cpp @@ -83,7 +83,8 @@ enum { kCMctlCompound, kCMovGraph, kCMovGraphLink, - kCMovGraphNode + kCMovGraphNode, + kCReactParallel }; const struct { @@ -99,6 +100,7 @@ const struct { { "CMovGraph", kCMovGraph }, { "CMovGraphLink", kCMovGraphLink }, { "CMovGraphNode", kCMovGraphNode }, + { "CReactParallel", kCReactParallel }, { 0, 0 } }; @@ -133,6 +135,8 @@ static CObject *createObject(int objectId) { return new CMovGraphLink(); case kCMovGraphNode: return new CMovGraphNode(); + case kCReactParallel: + return new CReactParallel(); default: error("Unknown objectId: %d", objectId); } |