From e60a9be8c43b2cf0352053366b64f788fdf17318 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 29 Feb 2012 03:50:47 +0300 Subject: Fix drawing big minimaps. --- src/gui/minimap.cpp | 18 ++++++++---------- 1 file 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((p.x - + viewport->getCameraRelativeX()) * static_cast( - mWidthProportion)) / 32; + mMapOriginX = ((a.width) / 2) - (static_cast(p.x + + viewport->getCameraRelativeX()) * mWidthProportion) / 32; - mMapOriginY = ((a.height) / 2) - static_cast((p.y - + viewport->getCameraRelativeX()) * static_cast( - mHeightProportion)) / 32; + mMapOriginY = ((a.height) / 2) - (static_cast(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(pos.x * mWidthProportion) / 32 + static_cast(pos.x * mWidthProportion) / 32 + mMapOriginX - offsetWidth, - static_cast(pos.y * mHeightProportion) / 32 + static_cast(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((pos.x - (graph->getWidth() / 2) + int x = static_cast((pos.x - (graph->getWidth() / 2) + viewport->getCameraRelativeX()) * mWidthProportion) / 32 + mMapOriginX; - int y = static_cast((pos.y - (graph->getHeight() / 2) + int y = static_cast((pos.y - (graph->getHeight() / 2) + viewport->getCameraRelativeY()) * mHeightProportion) / 32 + mMapOriginY; -- cgit v1.2.3-70-g09d2