1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-21 05:39:42 +00:00

Merge pull request #2698 from Capostrophic/wander

Support movement deceleration for wander AI
This commit is contained in:
Andrei Kortunov 2020-02-11 17:22:07 +04:00 committed by GitHub
commit 10fafabd7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 4 deletions

View file

@ -44,7 +44,7 @@ namespace MWMechanics
void fastForward(const MWWorld::Ptr& actor, AiState& state);
virtual osg::Vec3f getDestination() { return osg::Vec3f(mX, mY, mZ); }
virtual osg::Vec3f getDestination() const { return osg::Vec3f(mX, mY, mZ); }
private:
std::string mCellId;

View file

@ -76,7 +76,7 @@ namespace MWMechanics
void fastForward(const MWWorld::Ptr& actor, AiState& state);
virtual osg::Vec3f getDestination()
virtual osg::Vec3f getDestination() const
{
MWWorld::Ptr target = getTarget();
if (target.isEmpty())

View file

@ -102,7 +102,7 @@ namespace MWMechanics
/// Return true if this package should repeat. Currently only used for Wander packages.
virtual bool getRepeat() const;
virtual osg::Vec3f getDestination() { return osg::Vec3f(0, 0, 0); }
virtual osg::Vec3f getDestination() const { return osg::Vec3f(0, 0, 0); }
// Return true if any loaded actor with this AI package must be active.
virtual bool alwaysActive() const { return false; }

View file

@ -36,7 +36,7 @@ namespace MWMechanics
virtual bool alwaysActive() const { return true; }
virtual osg::Vec3f getDestination() { return osg::Vec3f(mX, mY, mZ); }
virtual osg::Vec3f getDestination() const { return osg::Vec3f(mX, mY, mZ); }
private:
float mX;

View file

@ -97,6 +97,8 @@ namespace MWMechanics
virtual int getTypeId() const;
virtual bool useVariableSpeed() const { return true;}
virtual void writeState(ESM::AiSequence::AiSequence &sequence) const;
virtual void fastForward(const MWWorld::Ptr& actor, AiState& state);
@ -105,6 +107,14 @@ namespace MWMechanics
osg::Vec3f getDestination(const MWWorld::Ptr& actor) const;
virtual osg::Vec3f getDestination() const
{
if (!mHasDestination)
return osg::Vec3f(0, 0, 0);
return mDestination;
}
private:
// NOTE: mDistance and mDuration must be set already
void init();