mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Remember the last known exterior position of the player in case we fail to map the interior to a world position.
This commit is contained in:
parent
b02b966c44
commit
c86760e3cd
@ -16,6 +16,7 @@
|
||||
#include "../mwbase/inputmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "console.hpp"
|
||||
#include "journalwindow.hpp"
|
||||
@ -776,9 +777,11 @@ namespace MWGui
|
||||
mHud->setCellPrefix( cell->mCell->mName );
|
||||
|
||||
Ogre::Vector3 worldPos;
|
||||
if (MWBase::Environment::get().getWorld()->findInteriorPositionInWorldSpace(cell, worldPos))
|
||||
mMap->setGlobalMapPlayerPosition(worldPos.x, worldPos.y);
|
||||
|
||||
if (!MWBase::Environment::get().getWorld()->findInteriorPositionInWorldSpace(cell, worldPos))
|
||||
worldPos = MWBase::Environment::get().getWorld()->getPlayer().getLastKnownExteriorPosition();
|
||||
else
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setLastKnownExteriorPosition(worldPos);
|
||||
mMap->setGlobalMapPlayerPosition(worldPos.x, worldPos.y);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ namespace MWWorld
|
||||
{
|
||||
Player::Player (const ESM::NPC *player, const MWBase::World& world)
|
||||
: mCellStore(0),
|
||||
mLastKnownExteriorPosition(0,0,0),
|
||||
mAutoMove(false),
|
||||
mForwardBackward (0)
|
||||
{
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include "../mwmechanics/drawstate.hpp"
|
||||
|
||||
#include <OgreVector3.h>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
struct NPC;
|
||||
@ -28,6 +30,8 @@ namespace MWWorld
|
||||
MWWorld::CellStore *mCellStore;
|
||||
std::string mSign;
|
||||
|
||||
Ogre::Vector3 mLastKnownExteriorPosition;
|
||||
|
||||
bool mAutoMove;
|
||||
int mForwardBackward;
|
||||
|
||||
@ -35,6 +39,13 @@ namespace MWWorld
|
||||
|
||||
Player(const ESM::NPC *player, const MWBase::World& world);
|
||||
|
||||
/// Interiors can not always be mapped to a world position. However
|
||||
/// world position is still required for divine / almsivi magic effects
|
||||
/// and the player arrow on the global map.
|
||||
/// TODO: This should be stored in the savegame, too.
|
||||
void setLastKnownExteriorPosition (const Ogre::Vector3& position) { mLastKnownExteriorPosition = position; }
|
||||
Ogre::Vector3 getLastKnownExteriorPosition() const { return mLastKnownExteriorPosition; }
|
||||
|
||||
void set (const ESM::NPC *player);
|
||||
|
||||
void setCell (MWWorld::CellStore *cellStore);
|
||||
|
@ -1297,6 +1297,12 @@ namespace MWWorld
|
||||
performUpdateSceneQueries ();
|
||||
|
||||
updateWindowManager ();
|
||||
|
||||
if (mPlayer->getPlayer().getCell()->isExterior())
|
||||
{
|
||||
ESM::Position pos = mPlayer->getPlayer().getRefData().getPosition();
|
||||
mPlayer->setLastKnownExteriorPosition(Ogre::Vector3(pos.pos[0], pos.pos[1], pos.pos[2]));
|
||||
}
|
||||
}
|
||||
|
||||
void World::updateWindowManager ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user