diff options
Diffstat (limited to 'Portal.h')
-rw-r--r-- | Portal.h | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -88,15 +88,19 @@ class Portal : public LevelObject, public VertexProvider { updateVertices(); } - virtual void rotate(float a) { + virtual void rotate(Vertex m, float a) { orient = fmodf(orient+a, 2*M_PI); + + s = sinf(a); + c = cosf(a); + + pos -= m; + pos.setLocation(c*pos.getX() - s*pos.getY(), c*pos.getY() + s*pos.getX()); + pos += m; + updateOrient(); } - virtual Vertex getCenter() const { - return pos; - } - virtual const Vertex* getVertex(size_t id) const { return &vertices[id]; } @@ -109,12 +113,8 @@ class Portal : public LevelObject, public VertexProvider { move(x, y); } - virtual void rotateVertex(size_t id, float a) { - pos = vertices[id]; - rotate(a); - pos = vertices[(id+2)%4]; - - updateVertices(); + virtual void rotateVertex(size_t id, Vertex m, float a) { + rotate(m, a); } }; |