mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Add and use an MWWorld::isFlying method
This commit is contained in:
parent
17200cb226
commit
5a1a0b7338
6 changed files with 19 additions and 7 deletions
|
@ -286,6 +286,7 @@ namespace MWBase
|
|||
|
||||
virtual void processChangedSettings (const Settings::CategorySettingVector& settings) = 0;
|
||||
|
||||
virtual bool isFlying(const MWWorld::Ptr &ptr) const = 0;
|
||||
virtual bool isSwimming(const MWWorld::Ptr &object) const = 0;
|
||||
virtual bool isUnderwater(const ESM::Cell &cell, const Ogre::Vector3 &pos) const = 0;
|
||||
virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0;
|
||||
|
|
|
@ -336,7 +336,7 @@ namespace MWClass
|
|||
float moveSpeed;
|
||||
if(normalizedEncumbrance > 1.0f)
|
||||
moveSpeed = 0.0f;
|
||||
else if(0/*world->isFlying(ptr)*/)
|
||||
else if(world->isFlying(ptr))
|
||||
{
|
||||
float flySpeed = 0.01f*(npcdata->mCreatureStats.getAttribute(ESM::Attribute::Speed).getModified() +
|
||||
0.0f/*levitationBonus*/);
|
||||
|
|
|
@ -1382,6 +1382,17 @@ namespace MWWorld
|
|||
mRendering->getTriangleBatchCount(triangles, batches);
|
||||
}
|
||||
|
||||
bool
|
||||
World::isFlying(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
RefData &refdata = ptr.getRefData();
|
||||
/// \todo check for levitation effects
|
||||
const OEngine::Physic::PhysicActor *physactor = mPhysEngine->getCharacter(refdata.getHandle());
|
||||
if(physactor && physactor->getCollisionMode())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
World::isSwimming(const MWWorld::Ptr &object) const
|
||||
{
|
||||
|
|
|
@ -314,6 +314,7 @@ namespace MWWorld
|
|||
|
||||
virtual void processChangedSettings(const Settings::CategorySettingVector& settings);
|
||||
|
||||
virtual bool isFlying(const MWWorld::Ptr &ptr) const;
|
||||
virtual bool isSwimming(const MWWorld::Ptr &object) const;
|
||||
virtual bool isUnderwater(const ESM::Cell &cell, const Ogre::Vector3 &pos) const;
|
||||
virtual bool isOnGround(const MWWorld::Ptr &ptr) const;
|
||||
|
|
|
@ -54,11 +54,6 @@ namespace Physic
|
|||
collisionMode = collision;
|
||||
}
|
||||
|
||||
bool PhysicActor::getCollisionMode()
|
||||
{
|
||||
return collisionMode;
|
||||
}
|
||||
|
||||
|
||||
void PhysicActor::setRotation(const Ogre::Quaternion &quat)
|
||||
{
|
||||
|
|
|
@ -78,7 +78,11 @@ namespace Physic
|
|||
|
||||
void enableCollisions(bool collision);
|
||||
|
||||
bool getCollisionMode();
|
||||
bool getCollisionMode() const
|
||||
{
|
||||
return collisionMode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This returns the visual position of the PhysicActor (used to position a scenenode).
|
||||
|
|
Loading…
Reference in a new issue