mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 17:15:34 +00:00
Initialize most of CharacterController in-class
See C++ Core Guidelines C.48
This commit is contained in:
parent
38ca20fa77
commit
788de7edcb
2 changed files with 20 additions and 41 deletions
|
@ -842,28 +842,7 @@ std::string CharacterController::chooseRandomAttackAnimation() const
|
||||||
|
|
||||||
CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim)
|
CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim)
|
||||||
: mPtr(ptr)
|
: mPtr(ptr)
|
||||||
, mWeapon(MWWorld::Ptr())
|
|
||||||
, mAnimation(anim)
|
, mAnimation(anim)
|
||||||
, mIdleState(CharState_None)
|
|
||||||
, mMovementState(CharState_None)
|
|
||||||
, mMovementAnimSpeed(0.f)
|
|
||||||
, mAdjustMovementAnimSpeed(false)
|
|
||||||
, mHasMovedInXY(false)
|
|
||||||
, mMovementAnimationControlled(true)
|
|
||||||
, mDeathState(CharState_None)
|
|
||||||
, mFloatToSurface(true)
|
|
||||||
, mHitState(CharState_None)
|
|
||||||
, mUpperBodyState(UpperCharState_Nothing)
|
|
||||||
, mJumpState(JumpState_None)
|
|
||||||
, mWeaponType(ESM::Weapon::None)
|
|
||||||
, mAttackStrength(0.f)
|
|
||||||
, mSkipAnim(false)
|
|
||||||
, mSecondsOfSwimming(0)
|
|
||||||
, mSecondsOfRunning(0)
|
|
||||||
, mTurnAnimationThreshold(0)
|
|
||||||
, mCastingManualSpell(false)
|
|
||||||
, mTimeUntilWake(0.f)
|
|
||||||
, mIsMovingBackward(false)
|
|
||||||
{
|
{
|
||||||
if(!mAnimation)
|
if(!mAnimation)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -149,50 +149,50 @@ class CharacterController : public MWRender::Animation::TextKeyListener
|
||||||
typedef std::deque<AnimationQueueEntry> AnimationQueue;
|
typedef std::deque<AnimationQueueEntry> AnimationQueue;
|
||||||
AnimationQueue mAnimQueue;
|
AnimationQueue mAnimQueue;
|
||||||
|
|
||||||
CharacterState mIdleState;
|
CharacterState mIdleState{CharState_None};
|
||||||
std::string mCurrentIdle;
|
std::string mCurrentIdle;
|
||||||
|
|
||||||
CharacterState mMovementState;
|
CharacterState mMovementState{CharState_None};
|
||||||
std::string mCurrentMovement;
|
std::string mCurrentMovement;
|
||||||
float mMovementAnimSpeed;
|
float mMovementAnimSpeed{0.f};
|
||||||
bool mAdjustMovementAnimSpeed;
|
bool mAdjustMovementAnimSpeed{false};
|
||||||
bool mHasMovedInXY;
|
bool mHasMovedInXY{false};
|
||||||
bool mMovementAnimationControlled;
|
bool mMovementAnimationControlled{true};
|
||||||
|
|
||||||
CharacterState mDeathState;
|
CharacterState mDeathState{CharState_None};
|
||||||
std::string mCurrentDeath;
|
std::string mCurrentDeath;
|
||||||
bool mFloatToSurface;
|
bool mFloatToSurface{true};
|
||||||
|
|
||||||
CharacterState mHitState;
|
CharacterState mHitState{CharState_None};
|
||||||
std::string mCurrentHit;
|
std::string mCurrentHit;
|
||||||
|
|
||||||
UpperBodyCharacterState mUpperBodyState;
|
UpperBodyCharacterState mUpperBodyState{UpperCharState_Nothing};
|
||||||
|
|
||||||
JumpingState mJumpState;
|
JumpingState mJumpState{JumpState_None};
|
||||||
std::string mCurrentJump;
|
std::string mCurrentJump;
|
||||||
|
|
||||||
int mWeaponType;
|
int mWeaponType{ESM::Weapon::None};
|
||||||
std::string mCurrentWeapon;
|
std::string mCurrentWeapon;
|
||||||
|
|
||||||
float mAttackStrength;
|
float mAttackStrength{0.f};
|
||||||
|
|
||||||
bool mSkipAnim;
|
bool mSkipAnim{false};
|
||||||
|
|
||||||
// counted for skill increase
|
// counted for skill increase
|
||||||
float mSecondsOfSwimming;
|
float mSecondsOfSwimming{0.f};
|
||||||
float mSecondsOfRunning;
|
float mSecondsOfRunning{0.f};
|
||||||
|
|
||||||
MWWorld::ConstPtr mHeadTrackTarget;
|
MWWorld::ConstPtr mHeadTrackTarget;
|
||||||
|
|
||||||
float mTurnAnimationThreshold; // how long to continue playing turning animation after actor stopped turning
|
float mTurnAnimationThreshold{0.f}; // how long to continue playing turning animation after actor stopped turning
|
||||||
|
|
||||||
std::string mAttackType; // slash, chop or thrust
|
std::string mAttackType; // slash, chop or thrust
|
||||||
|
|
||||||
bool mCastingManualSpell;
|
bool mCastingManualSpell{false};
|
||||||
|
|
||||||
float mTimeUntilWake;
|
float mTimeUntilWake{0.f};
|
||||||
|
|
||||||
bool mIsMovingBackward;
|
bool mIsMovingBackward{false};
|
||||||
osg::Vec2f mSmoothedSpeed;
|
osg::Vec2f mSmoothedSpeed;
|
||||||
|
|
||||||
void setAttackTypeBasedOnMovement();
|
void setAttackTypeBasedOnMovement();
|
||||||
|
|
Loading…
Reference in a new issue