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-10-02 22:54:36 +02:00
|
|
|
#include <components/esm/loadmgef.hpp>
|
|
|
|
|
2013-01-12 08:49:08 -08:00
|
|
|
#include "../mwworld/ptr.hpp"
|
|
|
|
|
2013-07-24 21:08:16 -07:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class ContainerStoreIterator;
|
|
|
|
class InventoryStore;
|
|
|
|
}
|
|
|
|
|
2013-01-16 10:16:37 -08:00
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
class Animation;
|
|
|
|
}
|
|
|
|
|
2013-01-10 08:35:24 -08:00
|
|
|
namespace MWMechanics
|
|
|
|
{
|
|
|
|
|
2013-03-31 00:13:56 -07:00
|
|
|
class Movement;
|
2013-07-24 21:08:16 -07:00
|
|
|
class NpcStats;
|
2013-03-31 00:13:56 -07:00
|
|
|
|
2013-05-13 00:54:44 -07:00
|
|
|
enum Priority {
|
|
|
|
Priority_Default,
|
2013-08-19 08:10:18 -07:00
|
|
|
Priority_Jump,
|
2013-07-15 22:56:23 -07:00
|
|
|
Priority_Movement,
|
2013-05-13 03:32:00 -07:00
|
|
|
Priority_Weapon,
|
2013-05-17 06:21:59 -07:00
|
|
|
Priority_Torch,
|
2013-05-13 00:54:44 -07:00
|
|
|
|
|
|
|
Priority_Death,
|
|
|
|
|
|
|
|
Num_Priorities
|
|
|
|
};
|
|
|
|
|
2013-01-12 10:10:27 -08:00
|
|
|
enum CharacterState {
|
2013-07-15 22:56:23 -07:00
|
|
|
CharState_None,
|
|
|
|
|
2013-02-23 01:54:46 -08:00
|
|
|
CharState_SpecialIdle,
|
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-03-06 16:58:56 +01:00
|
|
|
CharState_IdleSneak,
|
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-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-03 00:19:22 -08:00
|
|
|
CharState_Death1,
|
|
|
|
CharState_Death2,
|
|
|
|
CharState_Death3,
|
|
|
|
CharState_Death4,
|
2013-07-18 01:13:53 -07:00
|
|
|
CharState_Death5,
|
|
|
|
CharState_SwimDeath
|
2013-01-12 10:10:27 -08:00
|
|
|
};
|
|
|
|
|
2013-05-10 22:22:39 -07:00
|
|
|
enum WeaponType {
|
|
|
|
WeapType_None,
|
|
|
|
|
|
|
|
WeapType_HandToHand,
|
|
|
|
WeapType_OneHand,
|
|
|
|
WeapType_TwoHand,
|
|
|
|
WeapType_TwoWide,
|
|
|
|
WeapType_BowAndArrow,
|
|
|
|
WeapType_Crossbow,
|
|
|
|
WeapType_ThowWeapon,
|
2013-05-17 01:46:51 -07:00
|
|
|
WeapType_PickProbe,
|
2013-05-10 22:22:39 -07:00
|
|
|
|
|
|
|
WeapType_Spell
|
2013-04-29 13:07:49 -07:00
|
|
|
};
|
|
|
|
|
2013-07-13 22:24:52 +01:00
|
|
|
enum UpperBodyCharacterState {
|
|
|
|
UpperCharState_Nothing,
|
|
|
|
UpperCharState_EquipingWeap,
|
|
|
|
UpperCharState_UnEquipingWeap,
|
|
|
|
UpperCharState_WeapEquiped,
|
2013-07-16 23:38:55 +02:00
|
|
|
UpperCharState_StartToMinAttack,
|
|
|
|
UpperCharState_MinAttackToMaxAttack,
|
|
|
|
UpperCharState_MaxAttackToMinHit,
|
|
|
|
UpperCharState_MinHitToHit,
|
2013-07-23 07:30:54 -07:00
|
|
|
UpperCharState_FollowStartToFollowStop,
|
|
|
|
UpperCharState_CastingSpell
|
2013-07-13 22:24:52 +01:00
|
|
|
};
|
|
|
|
|
2013-08-18 23:42:56 -07:00
|
|
|
enum JumpingState {
|
|
|
|
JumpState_None,
|
|
|
|
JumpState_Falling,
|
|
|
|
JumpState_Landing
|
|
|
|
};
|
|
|
|
|
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-04-24 06:32:11 -07:00
|
|
|
typedef std::deque<std::pair<std::string,size_t> > AnimationQueue;
|
2013-01-17 13:18:40 -08:00
|
|
|
AnimationQueue mAnimQueue;
|
|
|
|
|
2013-07-15 22:56:23 -07:00
|
|
|
CharacterState mIdleState;
|
|
|
|
std::string mCurrentIdle;
|
2013-07-16 01:30:03 -07:00
|
|
|
|
2013-07-15 22:56:23 -07:00
|
|
|
CharacterState mMovementState;
|
|
|
|
std::string mCurrentMovement;
|
2013-07-16 01:30:03 -07:00
|
|
|
float mMovementSpeed;
|
2013-07-15 22:56:23 -07:00
|
|
|
|
2013-07-15 23:43:33 -07:00
|
|
|
CharacterState mDeathState;
|
|
|
|
std::string mCurrentDeath;
|
|
|
|
|
2013-07-13 22:24:52 +01:00
|
|
|
UpperBodyCharacterState mUpperBodyState;
|
2013-07-16 11:40:19 +01:00
|
|
|
|
2013-08-18 23:42:56 -07:00
|
|
|
JumpingState mJumpState;
|
2013-08-19 08:10:18 -07:00
|
|
|
std::string mCurrentJump;
|
2013-08-18 23:42:56 -07:00
|
|
|
|
2013-05-10 22:22:39 -07:00
|
|
|
WeaponType mWeaponType;
|
2013-07-23 02:50:52 -07:00
|
|
|
std::string mCurrentWeapon;
|
|
|
|
|
2013-01-16 21:25:50 -08:00
|
|
|
bool mSkipAnim;
|
2013-01-12 10:10:27 -08:00
|
|
|
|
2013-04-28 07:53:04 +02:00
|
|
|
// counted for skill increase
|
|
|
|
float mSecondsOfSwimming;
|
|
|
|
float mSecondsOfRunning;
|
|
|
|
|
2013-10-01 23:35:34 +02:00
|
|
|
// used for acrobatics progress and fall damages
|
|
|
|
float mFallHeight;
|
|
|
|
|
2013-07-16 23:32:41 +02:00
|
|
|
std::string mAttackType; // slash, chop or thrust
|
|
|
|
|
2013-07-15 22:56:23 -07:00
|
|
|
void refreshCurrentAnims(CharacterState idle, CharacterState movement, bool force=false);
|
2013-04-30 19:26:41 -07:00
|
|
|
|
2013-05-13 03:32:00 -07:00
|
|
|
static void getWeaponGroup(WeaponType weaptype, std::string &group);
|
|
|
|
|
2013-07-24 21:08:16 -07:00
|
|
|
static MWWorld::ContainerStoreIterator getActiveWeapon(NpcStats &stats,
|
|
|
|
MWWorld::InventoryStore &inv,
|
|
|
|
WeaponType *weaptype);
|
|
|
|
|
2013-05-16 06:59:41 -07:00
|
|
|
void clearAnimQueue();
|
|
|
|
|
2013-08-09 06:40:16 -07:00
|
|
|
bool updateNpcState(bool onground, bool inwater, bool isrunning, bool sneak);
|
2013-07-23 03:26:24 -07:00
|
|
|
|
2013-01-12 08:49:08 -08:00
|
|
|
public:
|
2013-07-15 23:43:33 -07:00
|
|
|
CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim);
|
2013-02-04 07:10:14 -08:00
|
|
|
virtual ~CharacterController();
|
2013-01-12 10:10:27 -08:00
|
|
|
|
2013-11-14 13:30:48 +01:00
|
|
|
// Be careful when to call this, see comment in Actors
|
|
|
|
void updateContinuousVfx();
|
|
|
|
|
2013-02-25 09:57:34 -08:00
|
|
|
void updatePtr(const MWWorld::Ptr &ptr);
|
|
|
|
|
2013-08-17 22:34:38 -07:00
|
|
|
void 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-05-24 20:10:07 -07:00
|
|
|
bool isAnimPlaying(const std::string &groupName);
|
2013-01-16 17:53:18 -08:00
|
|
|
|
2013-07-15 23:43:33 -07:00
|
|
|
void kill();
|
|
|
|
void resurrect();
|
|
|
|
bool isDead() const
|
|
|
|
{ return mDeathState != CharState_None; }
|
2013-04-25 07:08:11 -07:00
|
|
|
|
|
|
|
void forceStateUpdate();
|
2013-01-12 07:12:12 -08:00
|
|
|
};
|
|
|
|
|
2013-01-10 08:35:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* GAME_MWMECHANICS_CHARACTER_HPP */
|