summaryrefslogtreecommitdiff
path: root/src/gui/viewport.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-01 21:35:49 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-01 22:40:36 +0300
commitfc854786ed73fe768d6a3ca22c02f7013560a930 (patch)
tree3a12f555d194679957559760567ff8eb701b494b /src/gui/viewport.cpp
parent09d74d9273cca445b7019edacaff53452a1eee3c (diff)
downloadmv-fc854786ed73fe768d6a3ca22c02f7013560a930.tar.gz
mv-fc854786ed73fe768d6a3ca22c02f7013560a930.tar.bz2
mv-fc854786ed73fe768d6a3ca22c02f7013560a930.tar.xz
mv-fc854786ed73fe768d6a3ca22c02f7013560a930.zip
Fix code style.
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r--src/gui/viewport.cpp45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 2a8d36a60..194ad7310 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -139,7 +139,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
// Calculate viewpoint
int midTileX = (graphics->mWidth + mScrollCenterOffsetX) / 2;
- int midTileY = (graphics->mHeight + mScrollCenterOffsetX) / 2;
+ int midTileY = (graphics->mHeight + mScrollCenterOffsetY) / 2;
const Vector &playerPos = player_node->getPosition();
const int player_x = static_cast<int>(playerPos.x)
@@ -219,27 +219,25 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
mMap->getWidth() * mMap->getTileWidth() - graphics->mWidth;
const int viewYmax =
mMap->getHeight() * mMap->getTileHeight() - graphics->mHeight;
- if (mMap)
+
+ if (mPixelViewX < 0)
+ mPixelViewX = 0;
+ if (mPixelViewY < 0)
+ mPixelViewY = 0;
+ if (mPixelViewX > viewXmax)
+ mPixelViewX = viewXmax;
+ if (mPixelViewY > viewYmax)
+ mPixelViewY = viewYmax;
+
+ // Draw tiles and sprites
+ mMap->draw(graphics, mPixelViewX, mPixelViewY);
+
+ if (mShowDebugPath)
{
- if (mPixelViewX < 0)
- mPixelViewX = 0;
- if (mPixelViewY < 0)
- mPixelViewY = 0;
- if (mPixelViewX > viewXmax)
- mPixelViewX = viewXmax;
- if (mPixelViewY > viewYmax)
- mPixelViewY = viewYmax;
-
- // Draw tiles and sprites
- mMap->draw(graphics, mPixelViewX, mPixelViewY);
-
- if (mShowDebugPath)
- {
- mMap->drawCollision(graphics, mPixelViewX,
- mPixelViewY, mShowDebugPath);
- if (mShowDebugPath == Map::MAP_DEBUG)
- _drawDebugPath(graphics);
- }
+ mMap->drawCollision(graphics, mPixelViewX,
+ mPixelViewY, mShowDebugPath);
+ if (mShowDebugPath == Map::MAP_DEBUG)
+ _drawDebugPath(graphics);
}
if (player_node->getCheckNameSetting())
@@ -780,10 +778,9 @@ void Viewport::mouseMoved(gcn::MouseEvent &event A_UNUSED)
{
if (!mHoverSign->getComment().empty())
{
- if (mBeingPopup)
- mBeingPopup->setVisible(false);
+ mBeingPopup->setVisible(false);
mTextPopup->show(getMouseX(), getMouseY(),
- mHoverSign->getComment());
+ mHoverSign->getComment());
}
else
{