diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-02-29 03:50:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-02-29 03:50:47 +0300 |
commit | e60a9be8c43b2cf0352053366b64f788fdf17318 (patch) | |
tree | 22183f2f32295c2de7236a1d1c9acbc6069ce38c | |
parent | a73e3c92a07d9739df4a709e4b3694366199982b (diff) | |
download | plus-e60a9be8c43b2cf0352053366b64f788fdf17318.tar.gz plus-e60a9be8c43b2cf0352053366b64f788fdf17318.tar.bz2 plus-e60a9be8c43b2cf0352053366b64f788fdf17318.tar.xz plus-e60a9be8c43b2cf0352053366b64f788fdf17318.zip |
Fix drawing big minimaps.
-rw-r--r-- | src/gui/minimap.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 74da37341..5a1e66c25 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -229,13 +229,11 @@ void Minimap::draw(gcn::Graphics *graphics) mMapImage->mBounds.h > a.height) { const Vector &p = player_node->getPosition(); - mMapOriginX = ((a.width) / 2) - static_cast<int>((p.x - + viewport->getCameraRelativeX()) * static_cast<int>( - mWidthProportion)) / 32; + mMapOriginX = ((a.width) / 2) - (static_cast<float>(p.x + + viewport->getCameraRelativeX()) * mWidthProportion) / 32; - mMapOriginY = ((a.height) / 2) - static_cast<int>((p.y - + viewport->getCameraRelativeX()) * static_cast<int>( - mHeightProportion)) / 32; + mMapOriginY = ((a.height) / 2) - (static_cast<float>(p.y + + viewport->getCameraRelativeX()) * mHeightProportion) / 32; const int minOriginX = a.width - mMapImage->mBounds.w; const int minOriginY = a.height - mMapImage->mBounds.h; @@ -314,9 +312,9 @@ void Minimap::draw(gcn::Graphics *graphics) const Vector &pos = being->getPosition(); graphics->fillRectangle(gcn::Rectangle( - static_cast<int>(pos.x * mWidthProportion) / 32 + static_cast<float>(pos.x * mWidthProportion) / 32 + mMapOriginX - offsetWidth, - static_cast<int>(pos.y * mHeightProportion) / 32 + static_cast<float>(pos.y * mHeightProportion) / 32 + mMapOriginY - offsetHeight, dotSize, dotSize)); } @@ -367,10 +365,10 @@ void Minimap::draw(gcn::Graphics *graphics) const Vector &pos = player_node->getPosition(); // logger->log("width:" + toString(graph->getWidth())); - int x = static_cast<int>((pos.x - (graph->getWidth() / 2) + int x = static_cast<float>((pos.x - (graph->getWidth() / 2) + viewport->getCameraRelativeX()) * mWidthProportion) / 32 + mMapOriginX; - int y = static_cast<int>((pos.y - (graph->getHeight() / 2) + int y = static_cast<float>((pos.y - (graph->getHeight() / 2) + viewport->getCameraRelativeY()) * mHeightProportion) / 32 + mMapOriginY; |