diff options
-rw-r--r-- | engines/fullpipe/motion.cpp | 22 | ||||
-rw-r--r-- | engines/fullpipe/motion.h | 10 |
2 files changed, 23 insertions, 9 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index f82fe53a80..069679430f 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -2027,8 +2027,11 @@ void ReactParallel::createRegion() { // GdiObject::Attach(_rgn, CreatePolygonRgn(_points, 4, 2); } -void ReactParallel::setCenter() { - warning("STUB: ReactParallel::setCenter()"); +void ReactParallel::setCenter(int x1, int y1, int x2, int y2) { + _x1 = x1; + _y1 = y1; + _x2 = x2; + _y2 = y2; } ReactPolygonal::ReactPolygonal() { @@ -2067,8 +2070,19 @@ void ReactPolygonal::createRegion() { } } -void ReactPolygonal::setCenter() { - warning("STUB: ReactPolygonal::setCenter()"); +void ReactPolygonal::setCenter(int x1, int y1, int x2, int y2) { + int cX = (x2 + x1) / 2; + int cY = (y2 + y1) / 2; + + if (_points) { + for (int i = 0; i < _pointCount; i++) { + _points[i]->x += cX - _centerX; + _points[i]->y += cY - _centerY; + } + } + + _centerX = cX; + _centerY = cY; } bool MovGraphReact::pointInRegion(int x, int y) { diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index e482c0c476..1c8f17e13c 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -74,7 +74,7 @@ public: MovGraphReact() : _pointCount(0), _points(0) {} ~MovGraphReact() { free(_points); } - virtual void setCenter() {} + virtual void setCenter(int x1, int y1, int x2, int y2) {} virtual void createRegion() {} virtual bool pointInRegion(int x, int y); }; @@ -243,11 +243,11 @@ class ReactParallel : public MovGraphReact { int _dx; int _dy; - public: +public: ReactParallel(); virtual bool load(MfcArchive &file); - virtual void setCenter(); + virtual void setCenter(int x1, int y1, int x2, int y2); virtual void createRegion(); }; @@ -256,11 +256,11 @@ class ReactPolygonal : public MovGraphReact { int _centerX; int _centerY; - public: +public: ReactPolygonal(); virtual bool load(MfcArchive &file); - virtual void setCenter(); + virtual void setCenter(int x1, int y1, int x2, int y2); virtual void createRegion(); }; |