From 282e7abd166babd46fac9db02410d87102db0620 Mon Sep 17 00:00:00 2001 From: Ragora Date: Fri, 12 Sep 2014 18:26:38 -0400 Subject: [PATCH] Map Arrow Correction; now rotate global map arrow to whatever the local map arrow orientation is --- apps/openmw/mwgui/mapwindow.cpp | 21 +++++++++------------ apps/openmw/mwgui/mapwindow.hpp | 1 + apps/openmw/mwgui/windowmanagerimp.cpp | 1 + 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index 724ea0fbe..0282b3da3 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -754,10 +754,6 @@ namespace MWGui void MapWindow::globalMapUpdatePlayer () { - Ogre::Quaternion orient = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedOrientation (); - Ogre::Vector2 dir (orient.yAxis ().x, orient.yAxis().y); - float globalPlayerArrowAngle = std::atan2(dir.x, dir.y); - // For interiors, position is set by WindowManager via setGlobalMapPlayerPosition if (MWBase::Environment::get().getWorld ()->isCellExterior ()) { @@ -775,14 +771,6 @@ namespace MWGui MyGUI::IntPoint viewoffs(0.5*viewsize.width - worldX, 0.5*viewsize.height - worldY); mGlobalMap->setViewOffset(viewoffs); } - else - globalPlayerArrowAngle -= M_PI/2; // If we're indoors, apparently the angle is +90 degrees off. - - // Always rotate the global map compass - MyGUI::ISubWidget* main = mPlayerArrowGlobal->getSubWidgetMain(); - MyGUI::RotatingSkin* rotatingSubskin = main->castType(); - rotatingSubskin->setCenter(MyGUI::IntPoint(16,16)); - rotatingSubskin->setAngle(globalPlayerArrowAngle); } void MapWindow::notifyPlayerUpdate () @@ -805,6 +793,15 @@ namespace MWGui mGlobalMap->setViewOffset(viewoffs); } + void MapWindow::setGlobalMapPlayerDir(const float x, const float y) + { + MyGUI::ISubWidget* main = mPlayerArrowGlobal->getSubWidgetMain(); + MyGUI::RotatingSkin* rotatingSubskin = main->castType(); + rotatingSubskin->setCenter(MyGUI::IntPoint(16,16)); + float angle = std::atan2(x,y); + rotatingSubskin->setAngle(angle); + } + void MapWindow::clear() { mMarkers.clear(); diff --git a/apps/openmw/mwgui/mapwindow.hpp b/apps/openmw/mwgui/mapwindow.hpp index a9edbe0b1..77d31ca4c 100644 --- a/apps/openmw/mwgui/mapwindow.hpp +++ b/apps/openmw/mwgui/mapwindow.hpp @@ -180,6 +180,7 @@ namespace MWGui void cellExplored(int x, int y); void setGlobalMapPlayerPosition (float worldX, float worldY); + void setGlobalMapPlayerDir(const float x, const float y); virtual void open(); diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index f6ad6500c..756656e04 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -909,6 +909,7 @@ namespace MWGui void WindowManager::setPlayerDir(const float x, const float y) { mMap->setPlayerDir(x,y); + mMap->setGlobalMapPlayerDir(x, y); mHud->setPlayerDir(x,y); }