1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00
OpenMW/apps/openmw/mwmechanics/character.hpp

127 lines
2.5 KiB
C++
Raw Normal View History

#ifndef GAME_MWMECHANICS_CHARACTER_HPP
#define GAME_MWMECHANICS_CHARACTER_HPP
#include <OgreVector3.h>
#include "../mwworld/ptr.hpp"
namespace MWRender
{
class Animation;
}
namespace MWMechanics
{
class Movement;
enum CharacterState {
CharState_SpecialIdle,
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-03-06 16:58:56 +01:00
CharState_IdleSneak,
CharState_WalkForward,
CharState_WalkBack,
CharState_WalkLeft,
CharState_WalkRight,
2013-02-05 19:05:07 -08:00
CharState_SwimWalkForward,
CharState_SwimWalkBack,
CharState_SwimWalkLeft,
CharState_SwimWalkRight,
2013-02-06 16:53:52 -08:00
CharState_RunForward,
CharState_RunBack,
CharState_RunLeft,
CharState_RunRight,
CharState_SwimRunForward,
CharState_SwimRunBack,
CharState_SwimRunLeft,
CharState_SwimRunRight,
2013-03-06 16:58:56 +01:00
CharState_SneakForward,
CharState_SneakBack,
CharState_SneakLeft,
CharState_SneakRight,
2013-03-31 03:50:20 -07:00
CharState_TurnLeft,
CharState_TurnRight,
2013-02-15 04:45:28 -08:00
CharState_Jump,
2013-02-14 22:41:14 -08:00
/* Death states must be last! */
2013-02-03 00:19:22 -08:00
CharState_Death1,
CharState_Death2,
CharState_Death3,
CharState_Death4,
CharState_Death5
};
enum WeaponState {
WeapState_None,
WeapState_HandToHand,
WeapState_OneHand,
WeapState_TwoHand,
WeapState_TwoWide,
WeapState_BowAndArrow,
WeapState_Crossbow,
WeapState_ThowWeapon,
WeapState_Spell
};
class CharacterController
{
MWWorld::Ptr mPtr;
MWRender::Animation *mAnimation;
typedef std::deque<std::pair<std::string,size_t> > AnimationQueue;
AnimationQueue mAnimQueue;
CharacterState mCharState;
WeaponState mWeapState;
bool mLooping;
bool mSkipAnim;
2013-04-28 07:53:04 +02:00
// counted for skill increase
float mSecondsOfSwimming;
float mSecondsOfRunning;
bool mMovingAnim;
// Gets an animation group name from the current character state.
void getCurrentGroup(std::string &group) const;
public:
CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim, CharacterState state, bool loop);
virtual ~CharacterController();
void updatePtr(const MWWorld::Ptr &ptr);
void update(float duration, Movement &movement);
void playGroup(const std::string &groupname, int mode, int count);
void skipAnim();
void setState(CharacterState state, bool loop);
CharacterState getState() const
{ return mCharState; }
void forceStateUpdate();
};
}
#endif /* GAME_MWMECHANICS_CHARACTER_HPP */