diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 6d5b928604..21ebd255af 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -30,6 +30,7 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim if(!mAnimation) return; + mAnimation->setController(this); switch(mState) { case CharState_Idle: diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index b8016d0872..4f32de3647 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -95,6 +95,12 @@ void Animation::createEntityList(Ogre::SceneNode *node, const std::string &model } +void Animation::setController(MWMechanics::CharacterController *controller) +{ + mController = controller; +} + + void Animation::updatePosition(float time) { mCurGroup.mAnimState->setTimePosition(time); diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index 859d2b9893..ed9e4f5855 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -5,6 +5,11 @@ #include "../mwworld/ptr.hpp" +namespace MWMechanics +{ + class CharacterController; +} + namespace MWRender { @@ -26,8 +31,9 @@ class Animation protected: MWWorld::Ptr mPtr; - Ogre::SceneNode* mInsert; + MWMechanics::CharacterController *mController; + Ogre::SceneNode* mInsert; NifOgre::EntityList mEntityList; std::map mTextKeys; Ogre::Bone *mAccumRoot; @@ -56,6 +62,7 @@ public: Animation(const MWWorld::Ptr &ptr); virtual ~Animation(); + void setController(MWMechanics::CharacterController *controller); void playGroup(std::string groupname, int mode, int loops); void skipAnim(); virtual void runAnimation(float timepassed);