1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-19 13:11:32 +00:00

limited activation range according to GMST settings

This commit is contained in:
Marc Zinnschlag 2010-08-05 13:29:49 +02:00
parent 7ba6bdb56c
commit 87c84e6fcd
3 changed files with 18 additions and 8 deletions

View file

@ -74,22 +74,20 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
if (focusFrameCounter++ == focusUpdateFrame) if (focusFrameCounter++ == focusUpdateFrame)
{ {
std::pair<std::string, float> handle = mEnvironment.mWorld->getMWScene()->getFacedHandle(); std::string handle = mEnvironment.mWorld->getFacedHandle();
std::string name; std::string name;
if (!handle.first.empty()) if (!handle.empty())
{ {
// TODO compare handle.second with max activation range (from a GMST) MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle);
MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle.first);
if (!ptr.isEmpty()) if (!ptr.isEmpty())
name = MWWorld::Class::get (ptr).getName (ptr); name = MWWorld::Class::get (ptr).getName (ptr);
} }
if (!name.empty()) if (!name.empty())
std::cout << "Object: " << name << ", distance: " << handle.second << std::endl; std::cout << "Object: " << name << std::endl;
focusFrameCounter = 0; focusFrameCounter = 0;
} }

View file

@ -600,4 +600,15 @@ namespace MWWorld
{ {
mCellChanged = false; mCellChanged = false;
} }
std::string World::getFacedHandle()
{
std::pair<std::string, float> result = mScene.getFacedHandle();
if (result.first.empty() ||
result.second>getStore().gameSettings.find ("iMaxActivateDist")->i)
return "";
return result.first;
}
} }

View file

@ -83,8 +83,6 @@ namespace MWWorld
~World(); ~World();
MWRender::MWScene* getMWScene() { return &mScene; }
MWRender::PlayerPos& getPlayerPos(); MWRender::PlayerPos& getPlayerPos();
ESMS::ESMStore& getStore(); ESMS::ESMStore& getStore();
@ -133,6 +131,9 @@ namespace MWWorld
///< works only for interior cells currently. ///< works only for interior cells currently.
void markCellAsUnchanged(); void markCellAsUnchanged();
std::string getFacedHandle();
///< Return handle of the object the player is looking at
}; };
} }