forked from teamnwah/openmw-tes3coop
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
4 changed files with 24 additions and 3 deletions
|
@ -16,6 +16,7 @@
|
||||||
#include "../mwbase/inputmanager.hpp"
|
#include "../mwbase/inputmanager.hpp"
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
#include "journalwindow.hpp"
|
#include "journalwindow.hpp"
|
||||||
|
@ -776,9 +777,11 @@ namespace MWGui
|
||||||
mHud->setCellPrefix( cell->mCell->mName );
|
mHud->setCellPrefix( cell->mCell->mName );
|
||||||
|
|
||||||
Ogre::Vector3 worldPos;
|
Ogre::Vector3 worldPos;
|
||||||
if (MWBase::Environment::get().getWorld()->findInteriorPositionInWorldSpace(cell, worldPos))
|
if (!MWBase::Environment::get().getWorld()->findInteriorPositionInWorldSpace(cell, worldPos))
|
||||||
mMap->setGlobalMapPlayerPosition(worldPos.x, worldPos.y);
|
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)
|
Player::Player (const ESM::NPC *player, const MWBase::World& world)
|
||||||
: mCellStore(0),
|
: mCellStore(0),
|
||||||
|
mLastKnownExteriorPosition(0,0,0),
|
||||||
mAutoMove(false),
|
mAutoMove(false),
|
||||||
mForwardBackward (0)
|
mForwardBackward (0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "../mwmechanics/drawstate.hpp"
|
#include "../mwmechanics/drawstate.hpp"
|
||||||
|
|
||||||
|
#include <OgreVector3.h>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
struct NPC;
|
struct NPC;
|
||||||
|
@ -28,6 +30,8 @@ namespace MWWorld
|
||||||
MWWorld::CellStore *mCellStore;
|
MWWorld::CellStore *mCellStore;
|
||||||
std::string mSign;
|
std::string mSign;
|
||||||
|
|
||||||
|
Ogre::Vector3 mLastKnownExteriorPosition;
|
||||||
|
|
||||||
bool mAutoMove;
|
bool mAutoMove;
|
||||||
int mForwardBackward;
|
int mForwardBackward;
|
||||||
|
|
||||||
|
@ -35,6 +39,13 @@ namespace MWWorld
|
||||||
|
|
||||||
Player(const ESM::NPC *player, const MWBase::World& world);
|
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 set (const ESM::NPC *player);
|
||||||
|
|
||||||
void setCell (MWWorld::CellStore *cellStore);
|
void setCell (MWWorld::CellStore *cellStore);
|
||||||
|
|
|
@ -1297,6 +1297,12 @@ namespace MWWorld
|
||||||
performUpdateSceneQueries ();
|
performUpdateSceneQueries ();
|
||||||
|
|
||||||
updateWindowManager ();
|
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 ()
|
void World::updateWindowManager ()
|
||||||
|
|
Loading…
Reference in a new issue