forked from teamnwah/openmw-tes3coop
Don't cache faced handle, as its context may have been changed during the frame by input events
This commit is contained in:
parent
86c286c24e
commit
7e6e248511
3 changed files with 20 additions and 26 deletions
|
@ -88,8 +88,6 @@ namespace MWGui
|
|||
|| (MWBase::Environment::get().getWindowManager()->getMode() == GM_Container)
|
||||
|| (MWBase::Environment::get().getWindowManager()->getMode() == GM_Inventory)))
|
||||
{
|
||||
mFocusObject = MWBase::Environment::get().getWorld()->getFacedObject();
|
||||
|
||||
if (mFocusObject.isEmpty ())
|
||||
return;
|
||||
|
||||
|
|
|
@ -953,9 +953,27 @@ namespace MWWorld
|
|||
|
||||
MWWorld::Ptr World::getFacedObject()
|
||||
{
|
||||
if (mFacedHandle.empty())
|
||||
std::string facedHandle;
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->isGuiMode() &&
|
||||
MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
||||
getFacedHandle(facedHandle, getMaxActivationDistance() * 50, false);
|
||||
else
|
||||
{
|
||||
float telekinesisRangeBonus =
|
||||
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).getMagicEffects()
|
||||
.get(ESM::MagicEffect::Telekinesis).getMagnitude();
|
||||
telekinesisRangeBonus = feetToGameUnits(telekinesisRangeBonus);
|
||||
|
||||
float activationDistance = getMaxActivationDistance() + telekinesisRangeBonus;
|
||||
|
||||
getFacedHandle(facedHandle, activationDistance);
|
||||
}
|
||||
|
||||
if (facedHandle.empty())
|
||||
return MWWorld::Ptr();
|
||||
return searchPtrViaHandle(mFacedHandle);
|
||||
|
||||
return searchPtrViaHandle(facedHandle);
|
||||
}
|
||||
|
||||
std::pair<MWWorld::Ptr,Ogre::Vector3> World::getHitContact(const MWWorld::Ptr &ptr, float distance)
|
||||
|
@ -1503,8 +1521,6 @@ namespace MWWorld
|
|||
Vector3 sun = mRendering->getSkyManager()->getRealSunPos();
|
||||
mRendering->getSkyManager()->setGlare(!mPhysics->castRay(Ogre::Vector3(p[0], p[1], p[2]), sun));
|
||||
}
|
||||
|
||||
updateFacedHandle ();
|
||||
}
|
||||
|
||||
void World::getFacedHandle(std::string& facedHandle, float maxDistance, bool ignorePlayer)
|
||||
|
@ -1534,24 +1550,6 @@ namespace MWWorld
|
|||
facedHandle = results.front().second;
|
||||
}
|
||||
|
||||
void World::updateFacedHandle ()
|
||||
{
|
||||
if (MWBase::Environment::get().getWindowManager()->isGuiMode() &&
|
||||
MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
||||
getFacedHandle(mFacedHandle, getMaxActivationDistance() * 50, false);
|
||||
else
|
||||
{
|
||||
float telekinesisRangeBonus =
|
||||
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).getMagicEffects()
|
||||
.get(ESM::MagicEffect::Telekinesis).getMagnitude();
|
||||
telekinesisRangeBonus = feetToGameUnits(telekinesisRangeBonus);
|
||||
|
||||
float activationDistance = getMaxActivationDistance() + telekinesisRangeBonus;
|
||||
|
||||
getFacedHandle(mFacedHandle, activationDistance);
|
||||
}
|
||||
}
|
||||
|
||||
bool World::isCellExterior() const
|
||||
{
|
||||
CellStore *currentCell = mWorldScene->getCurrentCell();
|
||||
|
|
|
@ -91,7 +91,6 @@ namespace MWWorld
|
|||
Ptr getPtrViaHandle (const std::string& handle, CellStore& cellStore);
|
||||
|
||||
int mActivationDistanceOverride;
|
||||
std::string mFacedHandle;
|
||||
|
||||
std::string mStartupScript;
|
||||
|
||||
|
@ -112,7 +111,6 @@ namespace MWWorld
|
|||
|
||||
void updateWindowManager ();
|
||||
void performUpdateSceneQueries ();
|
||||
void updateFacedHandle ();
|
||||
void getFacedHandle(std::string& facedHandle, float maxDistance, bool ignorePlayer=true);
|
||||
|
||||
float getMaxActivationDistance ();
|
||||
|
|
Loading…
Reference in a new issue