diff options
author | Reid <reidyaro@gmail.com> | 2012-03-01 22:03:01 +0100 |
---|---|---|
committer | Reid <reidyaro@gmail.com> | 2012-03-01 22:03:01 +0100 |
commit | 490862919d79369112c75955a9c36ff8a081efd3 (patch) | |
tree | 6fe89466b9c53ba811f298174e6d787bbae71e09 /src/gui/viewport.cpp | |
parent | dff814619d63496acd3c4e8730b828b5d4d931fb (diff) | |
parent | d873da3e8e57480016596f714845c1bc7e712e68 (diff) | |
download | mv-490862919d79369112c75955a9c36ff8a081efd3.tar.gz mv-490862919d79369112c75955a9c36ff8a081efd3.tar.bz2 mv-490862919d79369112c75955a9c36ff8a081efd3.tar.xz mv-490862919d79369112c75955a9c36ff8a081efd3.zip |
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r-- | src/gui/viewport.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 2e1e15c92..5c50836f6 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -98,11 +98,7 @@ Viewport::Viewport(): Viewport::~Viewport() { - config.removeListener("ScrollLaziness", this); - config.removeListener("ScrollRadius", this); - config.removeListener("showBeingPopup", this); - config.removeListener("selfMouseHeal", this); - config.removeListener("enableLazyScrolling", this); + config.removeListeners(this); delete mPopupMenu; mPopupMenu = nullptr; @@ -199,7 +195,8 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) // if (debugChatTab) // debugChatTab->chatLog("incorrect player position!"); logger->log("incorrect player position: %d, %d, %d, %d", - player_x, player_y, (int)mPixelViewX, (int)mPixelViewY); + player_x, player_y, static_cast<int>(mPixelViewX), + static_cast<int>(mPixelViewY)); if (player_node) { logger->log("tile position: %d, %d", @@ -412,7 +409,6 @@ void Viewport::mousePressed(gcn::MouseEvent &event) return; // Check if we are alive and kickin' -// if (!mMap || !player_node || !player_node->isAlive()) if (!mMap || !player_node) return; @@ -421,7 +417,6 @@ void Viewport::mousePressed(gcn::MouseEvent &event) if (Being::isTalking()) return; - const int pixelX = event.getX() + static_cast<int>(mPixelViewX); const int pixelY = event.getY() + static_cast<int>(mPixelViewY); @@ -460,6 +455,13 @@ void Viewport::mousePressed(gcn::MouseEvent &event) mPopupMenu->showPopup(event.getX(), event.getY(), mHoverSign); return; } + else if (mCameraMode) + { + mPopupMenu->showMapPopup(event.getX(), event.getY(), + (getMouseX() + getCameraX()) / mMap->getTileWidth(), + (getMouseY() + getCameraY()) / mMap->getTileHeight()); + return; + } } // If a popup is active, just remove it @@ -705,6 +707,11 @@ void Viewport::showUndressPopup(int x, int y, Being *being, Item *item) mPopupMenu->showUndressPopup(x, y, being, item); } +void Viewport::showMapPopup(int x, int y) +{ + mPopupMenu->showMapPopup(getMouseX(), getMouseY(), x, y); +} + void Viewport::closePopupMenu() { if (mPopupMenu) @@ -879,7 +886,7 @@ bool Viewport::isPopupMenuVisible() void Viewport::moveCameraToActor(int actorId, int x, int y) { - if (!player_node) + if (!player_node || !actorSpriteManager) return; Actor *actor = actorSpriteManager->findBeing(actorId); |