forked from mirror/openmw-tes3mp
Merge remote-tracking branch 'ragora/fixglobalcompassorient'
This commit is contained in:
commit
94a7e38194
3 changed files with 11 additions and 8 deletions
|
@ -775,8 +775,6 @@ namespace MWGui
|
||||||
if (MWBase::Environment::get().getWorld ()->isCellExterior ())
|
if (MWBase::Environment::get().getWorld ()->isCellExterior ())
|
||||||
{
|
{
|
||||||
Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedPosition ();
|
Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedPosition ();
|
||||||
Ogre::Quaternion orient = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedOrientation ();
|
|
||||||
Ogre::Vector2 dir (orient.yAxis ().x, orient.yAxis().y);
|
|
||||||
|
|
||||||
float worldX, worldY;
|
float worldX, worldY;
|
||||||
mGlobalMapRender->worldPosToImageSpace (pos.x, pos.y, worldX, worldY);
|
mGlobalMapRender->worldPosToImageSpace (pos.x, pos.y, worldX, worldY);
|
||||||
|
@ -785,12 +783,6 @@ namespace MWGui
|
||||||
|
|
||||||
mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(worldX - 16, worldY - 16));
|
mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(worldX - 16, worldY - 16));
|
||||||
|
|
||||||
MyGUI::ISubWidget* main = mPlayerArrowGlobal->getSubWidgetMain();
|
|
||||||
MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>();
|
|
||||||
rotatingSubskin->setCenter(MyGUI::IntPoint(16,16));
|
|
||||||
float angle = std::atan2(dir.x, dir.y);
|
|
||||||
rotatingSubskin->setAngle(angle);
|
|
||||||
|
|
||||||
// set the view offset so that player is in the center
|
// set the view offset so that player is in the center
|
||||||
MyGUI::IntSize viewsize = mGlobalMap->getSize();
|
MyGUI::IntSize viewsize = mGlobalMap->getSize();
|
||||||
MyGUI::IntPoint viewoffs(0.5*viewsize.width - worldX, 0.5*viewsize.height - worldY);
|
MyGUI::IntPoint viewoffs(0.5*viewsize.width - worldX, 0.5*viewsize.height - worldY);
|
||||||
|
@ -818,6 +810,15 @@ namespace MWGui
|
||||||
mGlobalMap->setViewOffset(viewoffs);
|
mGlobalMap->setViewOffset(viewoffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MapWindow::setGlobalMapPlayerDir(const float x, const float y)
|
||||||
|
{
|
||||||
|
MyGUI::ISubWidget* main = mPlayerArrowGlobal->getSubWidgetMain();
|
||||||
|
MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>();
|
||||||
|
rotatingSubskin->setCenter(MyGUI::IntPoint(16,16));
|
||||||
|
float angle = std::atan2(x,y);
|
||||||
|
rotatingSubskin->setAngle(angle);
|
||||||
|
}
|
||||||
|
|
||||||
void MapWindow::clear()
|
void MapWindow::clear()
|
||||||
{
|
{
|
||||||
mMarkers.clear();
|
mMarkers.clear();
|
||||||
|
|
|
@ -180,6 +180,7 @@ namespace MWGui
|
||||||
void cellExplored(int x, int y);
|
void cellExplored(int x, int y);
|
||||||
|
|
||||||
void setGlobalMapPlayerPosition (float worldX, float worldY);
|
void setGlobalMapPlayerPosition (float worldX, float worldY);
|
||||||
|
void setGlobalMapPlayerDir(const float x, const float y);
|
||||||
|
|
||||||
virtual void open();
|
virtual void open();
|
||||||
|
|
||||||
|
|
|
@ -909,6 +909,7 @@ namespace MWGui
|
||||||
void WindowManager::setPlayerDir(const float x, const float y)
|
void WindowManager::setPlayerDir(const float x, const float y)
|
||||||
{
|
{
|
||||||
mMap->setPlayerDir(x,y);
|
mMap->setPlayerDir(x,y);
|
||||||
|
mMap->setGlobalMapPlayerDir(x, y);
|
||||||
mHud->setPlayerDir(x,y);
|
mHud->setPlayerDir(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue