|
|
|
@ -33,7 +33,6 @@
|
|
|
|
|
#include "../mwphysics/object.hpp"
|
|
|
|
|
#include "../mwphysics/heightfield.hpp"
|
|
|
|
|
|
|
|
|
|
#include "actionteleport.hpp"
|
|
|
|
|
#include "player.hpp"
|
|
|
|
|
#include "localscripts.hpp"
|
|
|
|
|
#include "esmstore.hpp"
|
|
|
|
@ -258,20 +257,10 @@ namespace
|
|
|
|
|
|
|
|
|
|
struct PositionVisitor
|
|
|
|
|
{
|
|
|
|
|
float mLowestPos = std::numeric_limits<float>::max();
|
|
|
|
|
|
|
|
|
|
bool operator() (const MWWorld::Ptr& ptr)
|
|
|
|
|
{
|
|
|
|
|
if (!ptr.getRefData().isDeleted() && ptr.getRefData().isEnabled())
|
|
|
|
|
{
|
|
|
|
|
if (!ptr.getClass().isActor())
|
|
|
|
|
{
|
|
|
|
|
float objectPosZ = ptr.getRefData().getPosition().pos[2];
|
|
|
|
|
if (objectPosZ < mLowestPos)
|
|
|
|
|
mLowestPos = objectPosZ;
|
|
|
|
|
}
|
|
|
|
|
ptr.getClass().adjustPosition (ptr, false);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -498,16 +487,6 @@ namespace MWWorld
|
|
|
|
|
const auto player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
|
|
|
|
navigator->update(player.getRefData().getPosition().asVec3());
|
|
|
|
|
|
|
|
|
|
const float fallThreshold = 256.f;
|
|
|
|
|
if (mCurrentCell && !mCurrentCell->isExterior() && pos.z() < mLowestPos - fallThreshold)
|
|
|
|
|
{
|
|
|
|
|
ESM::Position newPos;
|
|
|
|
|
std::string cellName = mCurrentCell->getCell()->mName;
|
|
|
|
|
MWBase::Environment::get().getWorld()->findInteriorPosition(cellName, newPos);
|
|
|
|
|
if (newPos.pos[2] >= mLowestPos)
|
|
|
|
|
MWWorld::ActionTeleport(cellName, newPos, false).execute(player);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!mCurrentCell || !mCurrentCell->isExterior())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
@ -898,10 +877,8 @@ namespace MWWorld
|
|
|
|
|
insertVisitor.insert([&] (const MWWorld::Ptr& ptr) { addObject(ptr, *mPhysics, mNavigator); });
|
|
|
|
|
|
|
|
|
|
// do adjustPosition (snapping actors to ground) after objects are loaded, so we don't depend on the loading order
|
|
|
|
|
// Also note the lowest object position in the cell to allow infinite fall fail safe to work
|
|
|
|
|
PositionVisitor posVisitor;
|
|
|
|
|
cell.forEach (posVisitor);
|
|
|
|
|
mLowestPos = posVisitor.mLowestPos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Scene::addObjectToScene (const Ptr& ptr)
|
|
|
|
|