2013-01-10 08:35:24 -08:00
|
|
|
#ifndef GAME_MWMECHANICS_CHARACTER_HPP
|
|
|
|
#define GAME_MWMECHANICS_CHARACTER_HPP
|
|
|
|
|
2013-01-18 16:00:51 -08:00
|
|
|
#include <OgreVector3.h>
|
|
|
|
|
2013-01-12 08:49:08 -08:00
|
|
|
#include "../mwworld/ptr.hpp"
|
|
|
|
|
2013-01-16 10:16:37 -08:00
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
class Animation;
|
|
|
|
}
|
|
|
|
|
2013-01-10 08:35:24 -08:00
|
|
|
namespace MWMechanics
|
|
|
|
{
|
|
|
|
|
2013-01-12 10:10:27 -08:00
|
|
|
enum CharacterState {
|
2013-01-18 13:43:45 -08:00
|
|
|
CharState_Idle,
|
2013-02-03 00:19:22 -08:00
|
|
|
CharState_Idle2,
|
|
|
|
CharState_Idle3,
|
|
|
|
CharState_Idle4,
|
|
|
|
CharState_Idle5,
|
|
|
|
CharState_Idle6,
|
|
|
|
CharState_Idle7,
|
|
|
|
CharState_Idle8,
|
|
|
|
CharState_Idle9,
|
2013-02-05 19:05:07 -08:00
|
|
|
CharState_IdleSwim,
|
2013-01-18 18:04:00 -08:00
|
|
|
|
|
|
|
CharState_WalkForward,
|
|
|
|
CharState_WalkBack,
|
2013-01-19 16:19:47 -08:00
|
|
|
CharState_WalkLeft,
|
|
|
|
CharState_WalkRight,
|
2013-01-18 18:04:00 -08:00
|
|
|
|
2013-02-05 19:05:07 -08:00
|
|
|
CharState_SwimWalkForward,
|
|
|
|
CharState_SwimWalkBack,
|
|
|
|
CharState_SwimWalkLeft,
|
|
|
|
CharState_SwimWalkRight,
|
|
|
|
|
2013-02-03 00:19:22 -08:00
|
|
|
/* Must be last! */
|
|
|
|
CharState_Death1,
|
|
|
|
CharState_Death2,
|
|
|
|
CharState_Death3,
|
|
|
|
CharState_Death4,
|
|
|
|
CharState_Death5
|
2013-01-12 10:10:27 -08:00
|
|
|
};
|
|
|
|
|
2013-01-12 07:12:12 -08:00
|
|
|
class CharacterController
|
|
|
|
{
|
2013-01-12 08:49:08 -08:00
|
|
|
MWWorld::Ptr mPtr;
|
2013-01-16 10:16:37 -08:00
|
|
|
MWRender::Animation *mAnimation;
|
2013-01-12 07:12:12 -08:00
|
|
|
|
2013-01-17 13:18:40 -08:00
|
|
|
typedef std::deque<std::string> AnimationQueue;
|
|
|
|
AnimationQueue mAnimQueue;
|
|
|
|
|
2013-01-16 20:44:37 -08:00
|
|
|
std::string mCurrentGroup;
|
2013-01-12 10:10:27 -08:00
|
|
|
CharacterState mState;
|
2013-01-16 21:25:50 -08:00
|
|
|
bool mSkipAnim;
|
2013-01-12 10:10:27 -08:00
|
|
|
|
2013-01-16 13:09:21 -08:00
|
|
|
protected:
|
|
|
|
/* Called by the animation whenever a new text key is reached. */
|
2013-01-18 14:50:55 -08:00
|
|
|
void markerEvent(float time, const std::string &evt);
|
2013-01-16 13:09:21 -08:00
|
|
|
|
|
|
|
friend class MWRender::Animation;
|
|
|
|
|
2013-01-12 08:49:08 -08:00
|
|
|
public:
|
2013-01-19 14:22:15 -08:00
|
|
|
CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim, CharacterState state, bool loop);
|
2013-01-16 13:09:21 -08:00
|
|
|
CharacterController(const CharacterController &rhs);
|
2013-02-04 07:10:14 -08:00
|
|
|
virtual ~CharacterController();
|
2013-01-12 10:10:27 -08:00
|
|
|
|
2013-01-16 18:56:13 -08:00
|
|
|
Ogre::Vector3 update(float duration);
|
2013-01-16 16:31:09 -08:00
|
|
|
|
2013-01-16 17:53:18 -08:00
|
|
|
void playGroup(const std::string &groupname, int mode, int count);
|
|
|
|
void skipAnim();
|
|
|
|
|
2013-01-19 14:22:15 -08:00
|
|
|
void setState(CharacterState state, bool loop);
|
2013-01-12 10:10:27 -08:00
|
|
|
CharacterState getState() const
|
|
|
|
{ return mState; }
|
2013-01-12 07:12:12 -08:00
|
|
|
};
|
|
|
|
|
2013-01-10 08:35:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* GAME_MWMECHANICS_CHARACTER_HPP */
|