mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Adjust player position to ground when using a door marker, even if the player is levitating (Fixes #1737)
This commit is contained in:
parent
89af49f669
commit
b58b8c6f8f
11 changed files with 24 additions and 17 deletions
|
@ -271,8 +271,9 @@ namespace MWBase
|
||||||
/// use the "Head" node, or alternatively the "Bip01 Head" node as a basis.
|
/// use the "Head" node, or alternatively the "Bip01 Head" node as a basis.
|
||||||
virtual std::pair<MWWorld::Ptr,Ogre::Vector3> getHitContact(const MWWorld::Ptr &ptr, float distance) = 0;
|
virtual std::pair<MWWorld::Ptr,Ogre::Vector3> getHitContact(const MWWorld::Ptr &ptr, float distance) = 0;
|
||||||
|
|
||||||
virtual void adjustPosition (const MWWorld::Ptr& ptr) = 0;
|
virtual void adjustPosition (const MWWorld::Ptr& ptr, bool force) = 0;
|
||||||
///< Adjust position after load to be on ground. Must be called after model load.
|
///< Adjust position after load to be on ground. Must be called after model load.
|
||||||
|
/// @param force do this even if the ptr is flying
|
||||||
|
|
||||||
virtual void fixPosition (const MWWorld::Ptr& actor) = 0;
|
virtual void fixPosition (const MWWorld::Ptr& actor) = 0;
|
||||||
///< Attempt to fix position so that the Ptr is no longer inside collision geometry.
|
///< Attempt to fix position so that the Ptr is no longer inside collision geometry.
|
||||||
|
|
|
@ -148,9 +148,9 @@ namespace MWClass
|
||||||
return ref->mBase->mId;
|
return ref->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::adjustPosition(const MWWorld::Ptr& ptr) const
|
void Creature::adjustPosition(const MWWorld::Ptr& ptr, bool force) const
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->adjustPosition(ptr);
|
MWBase::Environment::get().getWorld()->adjustPosition(ptr, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Creature::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
|
|
@ -49,7 +49,9 @@ namespace MWClass
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual void adjustPosition(const MWWorld::Ptr& ptr) const;
|
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
||||||
|
///< Adjust position to stand on ground. Must be called post model load
|
||||||
|
/// @param force do this even if the ptr is flying
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
|
|
@ -403,9 +403,9 @@ namespace MWClass
|
||||||
return ref->mBase->mId;
|
return ref->mBase->mId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Npc::adjustPosition(const MWWorld::Ptr& ptr) const
|
void Npc::adjustPosition(const MWWorld::Ptr& ptr, bool force) const
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->adjustPosition(ptr);
|
MWBase::Environment::get().getWorld()->adjustPosition(ptr, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
|
|
@ -55,7 +55,9 @@ namespace MWClass
|
||||||
|
|
||||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||||
|
|
||||||
virtual void adjustPosition(const MWWorld::Ptr& ptr) const;
|
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
||||||
|
///< Adjust position to stand on ground. Must be called post model load
|
||||||
|
/// @param force do this even if the ptr is flying
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
|
|
@ -327,7 +327,7 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,zRot);
|
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,zRot);
|
||||||
|
|
||||||
ptr.getClass().adjustPosition(ptr);
|
ptr.getClass().adjustPosition(ptr, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -374,7 +374,7 @@ namespace MWScript
|
||||||
zRot = zRot/60.;
|
zRot = zRot/60.;
|
||||||
}
|
}
|
||||||
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,zRot);
|
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,zRot);
|
||||||
ptr.getClass().adjustPosition(ptr);
|
ptr.getClass().adjustPosition(ptr, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -322,7 +322,7 @@ namespace MWWorld
|
||||||
return std::make_pair (1, "");
|
return std::make_pair (1, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Class::adjustPosition(const MWWorld::Ptr& ptr) const
|
void Class::adjustPosition(const MWWorld::Ptr& ptr, bool force) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,9 @@ namespace MWWorld
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
||||||
virtual void adjustPosition(const MWWorld::Ptr& ptr) const;
|
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
||||||
///< Adjust position to stand on ground. Must be called post model load
|
///< Adjust position to stand on ground. Must be called post model load
|
||||||
|
/// @param force do this even if the ptr is flying
|
||||||
|
|
||||||
virtual MWMechanics::CreatureStats& getCreatureStats (const Ptr& ptr) const;
|
virtual MWMechanics::CreatureStats& getCreatureStats (const Ptr& ptr) const;
|
||||||
///< Return creature stats or throw an exception, if class does not have creature stats
|
///< Return creature stats or throw an exception, if class does not have creature stats
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace
|
||||||
|
|
||||||
updateObjectLocalRotation(ptr, mPhysics, mRendering);
|
updateObjectLocalRotation(ptr, mPhysics, mRendering);
|
||||||
MWBase::Environment::get().getWorld()->scaleObject (ptr, ptr.getCellRef().getScale());
|
MWBase::Environment::get().getWorld()->scaleObject (ptr, ptr.getCellRef().getScale());
|
||||||
ptr.getClass().adjustPosition (ptr);
|
ptr.getClass().adjustPosition (ptr, false);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
|
@ -232,7 +232,7 @@ namespace MWWorld
|
||||||
float z = Ogre::Radian(pos.rot[2]).valueDegrees();
|
float z = Ogre::Radian(pos.rot[2]).valueDegrees();
|
||||||
world->rotateObject(player, x, y, z);
|
world->rotateObject(player, x, y, z);
|
||||||
|
|
||||||
player.getClass().adjustPosition(player);
|
player.getClass().adjustPosition(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::MechanicsManager *mechMgr =
|
MWBase::MechanicsManager *mechMgr =
|
||||||
|
@ -431,7 +431,7 @@ namespace MWWorld
|
||||||
float z = Ogre::Radian(position.rot[2]).valueDegrees();
|
float z = Ogre::Radian(position.rot[2]).valueDegrees();
|
||||||
world->rotateObject(world->getPlayerPtr(), x, y, z);
|
world->rotateObject(world->getPlayerPtr(), x, y, z);
|
||||||
|
|
||||||
world->getPlayerPtr().getClass().adjustPosition(world->getPlayerPtr());
|
world->getPlayerPtr().getClass().adjustPosition(world->getPlayerPtr(), true);
|
||||||
world->getFader()->fadeIn(0.5f);
|
world->getFader()->fadeIn(0.5f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1151,7 +1151,7 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::adjustPosition(const Ptr &ptr)
|
void World::adjustPosition(const Ptr &ptr, bool force)
|
||||||
{
|
{
|
||||||
ESM::Position pos (ptr.getRefData().getPosition());
|
ESM::Position pos (ptr.getRefData().getPosition());
|
||||||
|
|
||||||
|
@ -1170,7 +1170,7 @@ namespace MWWorld
|
||||||
|
|
||||||
ptr.getRefData().setPosition(pos);
|
ptr.getRefData().setPosition(pos);
|
||||||
|
|
||||||
if (!isFlying(ptr))
|
if (force || !isFlying(ptr))
|
||||||
{
|
{
|
||||||
Ogre::Vector3 traced = mPhysics->traceDown(ptr, 200);
|
Ogre::Vector3 traced = mPhysics->traceDown(ptr, 200);
|
||||||
if (traced.z < pos.pos[2])
|
if (traced.z < pos.pos[2])
|
||||||
|
|
|
@ -260,8 +260,9 @@ namespace MWWorld
|
||||||
virtual Ptr searchPtrViaActorId (int actorId);
|
virtual Ptr searchPtrViaActorId (int actorId);
|
||||||
///< Search is limited to the active cells.
|
///< Search is limited to the active cells.
|
||||||
|
|
||||||
virtual void adjustPosition (const Ptr& ptr);
|
virtual void adjustPosition (const Ptr& ptr, bool force);
|
||||||
///< Adjust position after load to be on ground. Must be called after model load.
|
///< Adjust position after load to be on ground. Must be called after model load.
|
||||||
|
/// @param force do this even if the ptr is flying
|
||||||
|
|
||||||
virtual void fixPosition (const Ptr& actor);
|
virtual void fixPosition (const Ptr& actor);
|
||||||
///< Attempt to fix position so that the Ptr is no longer inside collision geometry.
|
///< Attempt to fix position so that the Ptr is no longer inside collision geometry.
|
||||||
|
|
Loading…
Reference in a new issue