|
|
|
@ -395,6 +395,9 @@ namespace MWGui
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MapWindow::globalMapUpdatePlayer ()
|
|
|
|
|
{
|
|
|
|
|
// For interiors, position is set by WindowManager via setGlobalMapPlayerPosition
|
|
|
|
|
if (MWBase::Environment::get().getWorld ()->isCellExterior ())
|
|
|
|
|
{
|
|
|
|
|
Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer().getRefData ().getBaseNode ()->_getDerivedPosition ();
|
|
|
|
|
Ogre::Quaternion orient = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer().getRefData ().getBaseNode ()->_getDerivedOrientation ();
|
|
|
|
@ -405,11 +408,6 @@ namespace MWGui
|
|
|
|
|
worldX *= mGlobalMapRender->getWidth();
|
|
|
|
|
worldY *= mGlobalMapRender->getHeight();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// for interiors, we have no choice other than using the last position & direction.
|
|
|
|
|
/// \todo save this last position in the savegame?
|
|
|
|
|
if (MWBase::Environment::get().getWorld ()->isCellExterior ())
|
|
|
|
|
{
|
|
|
|
|
mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(worldX - 16, worldY - 16));
|
|
|
|
|
|
|
|
|
|
MyGUI::ISubWidget* main = mPlayerArrowGlobal->getSubWidgetMain();
|
|
|
|
@ -444,4 +442,19 @@ namespace MWGui
|
|
|
|
|
"#{sWorld}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MapWindow::setGlobalMapPlayerPosition(float worldX, float worldY)
|
|
|
|
|
{
|
|
|
|
|
float x, y;
|
|
|
|
|
mGlobalMapRender->worldPosToImageSpace (worldX, worldY, x, y);
|
|
|
|
|
x *= mGlobalMapRender->getWidth();
|
|
|
|
|
y *= mGlobalMapRender->getHeight();
|
|
|
|
|
|
|
|
|
|
mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(x - 16, y - 16));
|
|
|
|
|
|
|
|
|
|
// set the view offset so that player is in the center
|
|
|
|
|
MyGUI::IntSize viewsize = mGlobalMap->getSize();
|
|
|
|
|
MyGUI::IntPoint viewoffs(0.5*viewsize.width - x, 0.5*viewsize.height - y);
|
|
|
|
|
mGlobalMap->setViewOffset(viewoffs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|