1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 08:53:52 +00:00

Initialize most of CharacterController in-class

See C++ Core Guidelines C.48
This commit is contained in:
Alexei Kotov 2022-06-11 00:40:14 +03:00
parent 38ca20fa77
commit 788de7edcb
2 changed files with 20 additions and 41 deletions

View file

@ -842,28 +842,7 @@ std::string CharacterController::chooseRandomAttackAnimation() const
CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim)
: mPtr(ptr)
, mWeapon(MWWorld::Ptr())
, 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)
return;

View file

@ -149,50 +149,50 @@ class CharacterController : public MWRender::Animation::TextKeyListener
typedef std::deque<AnimationQueueEntry> AnimationQueue;
AnimationQueue mAnimQueue;
CharacterState mIdleState;
CharacterState mIdleState{CharState_None};
std::string mCurrentIdle;
CharacterState mMovementState;
CharacterState mMovementState{CharState_None};
std::string mCurrentMovement;
float mMovementAnimSpeed;
bool mAdjustMovementAnimSpeed;
bool mHasMovedInXY;
bool mMovementAnimationControlled;
float mMovementAnimSpeed{0.f};
bool mAdjustMovementAnimSpeed{false};
bool mHasMovedInXY{false};
bool mMovementAnimationControlled{true};
CharacterState mDeathState;
CharacterState mDeathState{CharState_None};
std::string mCurrentDeath;
bool mFloatToSurface;
bool mFloatToSurface{true};
CharacterState mHitState;
CharacterState mHitState{CharState_None};
std::string mCurrentHit;
UpperBodyCharacterState mUpperBodyState;
UpperBodyCharacterState mUpperBodyState{UpperCharState_Nothing};
JumpingState mJumpState;
JumpingState mJumpState{JumpState_None};
std::string mCurrentJump;
int mWeaponType;
int mWeaponType{ESM::Weapon::None};
std::string mCurrentWeapon;
float mAttackStrength;
float mAttackStrength{0.f};
bool mSkipAnim;
bool mSkipAnim{false};
// counted for skill increase
float mSecondsOfSwimming;
float mSecondsOfRunning;
float mSecondsOfSwimming{0.f};
float mSecondsOfRunning{0.f};
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
bool mCastingManualSpell;
bool mCastingManualSpell{false};
float mTimeUntilWake;
float mTimeUntilWake{0.f};
bool mIsMovingBackward;
bool mIsMovingBackward{false};
osg::Vec2f mSmoothedSpeed;
void setAttackTypeBasedOnMovement();