1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-11 09:36:37 +00:00

Store an character controller in the animation

This commit is contained in:
Chris Robinson 2013-01-16 11:01:08 -08:00
parent 3c487e6019
commit f46587c383
3 changed files with 15 additions and 1 deletions

View File

@ -30,6 +30,7 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
if(!mAnimation) if(!mAnimation)
return; return;
mAnimation->setController(this);
switch(mState) switch(mState)
{ {
case CharState_Idle: case CharState_Idle:

View File

@ -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) void Animation::updatePosition(float time)
{ {
mCurGroup.mAnimState->setTimePosition(time); mCurGroup.mAnimState->setTimePosition(time);

View File

@ -5,6 +5,11 @@
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
namespace MWMechanics
{
class CharacterController;
}
namespace MWRender namespace MWRender
{ {
@ -26,8 +31,9 @@ class Animation
protected: protected:
MWWorld::Ptr mPtr; MWWorld::Ptr mPtr;
Ogre::SceneNode* mInsert; MWMechanics::CharacterController *mController;
Ogre::SceneNode* mInsert;
NifOgre::EntityList mEntityList; NifOgre::EntityList mEntityList;
std::map<std::string,NifOgre::TextKeyMap> mTextKeys; std::map<std::string,NifOgre::TextKeyMap> mTextKeys;
Ogre::Bone *mAccumRoot; Ogre::Bone *mAccumRoot;
@ -56,6 +62,7 @@ public:
Animation(const MWWorld::Ptr &ptr); Animation(const MWWorld::Ptr &ptr);
virtual ~Animation(); virtual ~Animation();
void setController(MWMechanics::CharacterController *controller);
void playGroup(std::string groupname, int mode, int loops); void playGroup(std::string groupname, int mode, int loops);
void skipAnim(); void skipAnim();
virtual void runAnimation(float timepassed); virtual void runAnimation(float timepassed);