1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-13 21:40:11 +00:00

Store the movement vector in the character controller

This commit is contained in:
Chris Robinson 2013-01-18 16:00:51 -08:00
parent 40f8e75763
commit 9235fba770
3 changed files with 14 additions and 1 deletions

View File

@ -262,6 +262,12 @@ namespace MWMechanics
if(!paused) if(!paused)
{ {
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
{
Ogre::Vector3 dir = MWWorld::Class::get(iter->first).getMovementVector(iter->first);
iter->second.setDirection(dir);
}
std::vector<std::pair<std::string, Ogre::Vector3> > movement; std::vector<std::pair<std::string, Ogre::Vector3> > movement;
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter) for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
{ {

View File

@ -123,7 +123,7 @@ Ogre::Vector3 CharacterController::update(float duration)
if(mAnimation && !mSkipAnim) if(mAnimation && !mSkipAnim)
mAnimation->runAnimation(duration); mAnimation->runAnimation(duration);
mSkipAnim = false; mSkipAnim = false;
return MWWorld::Class::get(mPtr).getMovementVector(mPtr); return mDirection;
} }

View File

@ -1,6 +1,8 @@
#ifndef GAME_MWMECHANICS_CHARACTER_HPP #ifndef GAME_MWMECHANICS_CHARACTER_HPP
#define GAME_MWMECHANICS_CHARACTER_HPP #define GAME_MWMECHANICS_CHARACTER_HPP
#include <OgreVector3.h>
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
namespace MWRender namespace MWRender
@ -27,6 +29,8 @@ class CharacterController
typedef std::deque<std::string> AnimationQueue; typedef std::deque<std::string> AnimationQueue;
AnimationQueue mAnimQueue; AnimationQueue mAnimQueue;
Ogre::Vector3 mDirection;
std::string mCurrentGroup; std::string mCurrentGroup;
CharacterState mState; CharacterState mState;
bool mSkipAnim; bool mSkipAnim;
@ -46,6 +50,9 @@ public:
void playGroup(const std::string &groupname, int mode, int count); void playGroup(const std::string &groupname, int mode, int count);
void skipAnim(); void skipAnim();
void setDirection(const Ogre::Vector3 &dir)
{ mDirection = dir; }
void setState(CharacterState state); void setState(CharacterState state);
CharacterState getState() const CharacterState getState() const
{ return mState; } { return mState; }