2013-01-10 16:35:24 +00:00
|
|
|
#ifndef GAME_MWMECHANICS_CHARACTER_HPP
|
|
|
|
#define GAME_MWMECHANICS_CHARACTER_HPP
|
|
|
|
|
2013-01-19 00:00:51 +00:00
|
|
|
#include <OgreVector3.h>
|
|
|
|
|
2013-01-12 16:49:08 +00:00
|
|
|
#include "../mwworld/ptr.hpp"
|
|
|
|
|
2013-01-16 18:16:37 +00:00
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
class Animation;
|
|
|
|
}
|
|
|
|
|
2013-01-10 16:35:24 +00:00
|
|
|
namespace MWMechanics
|
|
|
|
{
|
|
|
|
|
2013-03-31 07:13:56 +00:00
|
|
|
class Movement;
|
|
|
|
|
2013-01-12 18:10:27 +00:00
|
|
|
enum CharacterState {
|
2013-02-23 09:54:46 +00:00
|
|
|
CharState_SpecialIdle,
|
2013-01-18 21:43:45 +00:00
|
|
|
CharState_Idle,
|
2013-02-03 08:19:22 +00:00
|
|
|
CharState_Idle2,
|
|
|
|
CharState_Idle3,
|
|
|
|
CharState_Idle4,
|
|
|
|
CharState_Idle5,
|
|
|
|
CharState_Idle6,
|
|
|
|
CharState_Idle7,
|
|
|
|
CharState_Idle8,
|
|
|
|
CharState_Idle9,
|
2013-02-06 03:05:07 +00:00
|
|
|
CharState_IdleSwim,
|
2013-03-06 15:58:56 +00:00
|
|
|
CharState_IdleSneak,
|
2013-01-19 02:04:00 +00:00
|
|
|
|
|
|
|
CharState_WalkForward,
|
|
|
|
CharState_WalkBack,
|
2013-01-20 00:19:47 +00:00
|
|
|
CharState_WalkLeft,
|
|
|
|
CharState_WalkRight,
|
2013-01-19 02:04:00 +00:00
|
|
|
|
2013-02-06 03:05:07 +00:00
|
|
|
CharState_SwimWalkForward,
|
|
|
|
CharState_SwimWalkBack,
|
|
|
|
CharState_SwimWalkLeft,
|
|
|
|
CharState_SwimWalkRight,
|
|
|
|
|
2013-02-07 00:53:52 +00:00
|
|
|
CharState_RunForward,
|
|
|
|
CharState_RunBack,
|
|
|
|
CharState_RunLeft,
|
|
|
|
CharState_RunRight,
|
|
|
|
|
|
|
|
CharState_SwimRunForward,
|
|
|
|
CharState_SwimRunBack,
|
|
|
|
CharState_SwimRunLeft,
|
|
|
|
CharState_SwimRunRight,
|
|
|
|
|
2013-03-06 15:58:56 +00:00
|
|
|
CharState_SneakForward,
|
|
|
|
CharState_SneakBack,
|
|
|
|
CharState_SneakLeft,
|
|
|
|
CharState_SneakRight,
|
|
|
|
|
2013-03-31 10:50:20 +00:00
|
|
|
CharState_TurnLeft,
|
|
|
|
CharState_TurnRight,
|
|
|
|
|
2013-02-15 12:45:28 +00:00
|
|
|
CharState_Jump,
|
|
|
|
|
2013-02-15 06:41:14 +00:00
|
|
|
/* Death states must be last! */
|
2013-02-03 08:19:22 +00:00
|
|
|
CharState_Death1,
|
|
|
|
CharState_Death2,
|
|
|
|
CharState_Death3,
|
|
|
|
CharState_Death4,
|
|
|
|
CharState_Death5
|
2013-01-12 18:10:27 +00:00
|
|
|
};
|
|
|
|
|
2013-01-12 15:12:12 +00:00
|
|
|
class CharacterController
|
|
|
|
{
|
2013-01-12 16:49:08 +00:00
|
|
|
MWWorld::Ptr mPtr;
|
2013-01-16 18:16:37 +00:00
|
|
|
MWRender::Animation *mAnimation;
|
2013-01-12 15:12:12 +00:00
|
|
|
|
2013-04-24 13:32:11 +00:00
|
|
|
typedef std::deque<std::pair<std::string,size_t> > AnimationQueue;
|
2013-01-17 21:18:40 +00:00
|
|
|
AnimationQueue mAnimQueue;
|
|
|
|
|
2013-04-25 13:29:17 +00:00
|
|
|
CharacterState mCharState;
|
|
|
|
bool mLooping;
|
2013-01-17 05:25:50 +00:00
|
|
|
bool mSkipAnim;
|
2013-01-12 18:10:27 +00:00
|
|
|
|
2013-04-28 05:53:04 +00:00
|
|
|
// counted for skill increase
|
|
|
|
float mSecondsOfSwimming;
|
|
|
|
float mSecondsOfRunning;
|
|
|
|
|
2013-04-25 05:45:43 +00:00
|
|
|
bool mMovingAnim;
|
|
|
|
|
2013-01-12 16:49:08 +00:00
|
|
|
public:
|
2013-01-19 22:22:15 +00:00
|
|
|
CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim, CharacterState state, bool loop);
|
2013-02-04 15:10:14 +00:00
|
|
|
virtual ~CharacterController();
|
2013-01-12 18:10:27 +00:00
|
|
|
|
2013-02-25 17:57:34 +00:00
|
|
|
void updatePtr(const MWWorld::Ptr &ptr);
|
|
|
|
|
2013-03-31 07:13:56 +00:00
|
|
|
void update(float duration, Movement &movement);
|
2013-01-17 00:31:09 +00:00
|
|
|
|
2013-01-17 01:53:18 +00:00
|
|
|
void playGroup(const std::string &groupname, int mode, int count);
|
|
|
|
void skipAnim();
|
|
|
|
|
2013-01-19 22:22:15 +00:00
|
|
|
void setState(CharacterState state, bool loop);
|
2013-01-12 18:10:27 +00:00
|
|
|
CharacterState getState() const
|
2013-04-25 13:29:17 +00:00
|
|
|
{ return mCharState; }
|
2013-04-25 14:08:11 +00:00
|
|
|
|
|
|
|
void forceStateUpdate();
|
2013-01-12 15:12:12 +00:00
|
|
|
};
|
|
|
|
|
2013-01-10 16:35:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* GAME_MWMECHANICS_CHARACTER_HPP */
|