1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:23:51 +00:00

Merge pull request #1926 from akortunov/warnfix

Fix MSVC warning about possibly uninitialized movestate variable
This commit is contained in:
Bret Curtis 2018-09-17 17:10:25 +02:00 committed by GitHub
commit 07be9ae8ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -415,37 +415,38 @@ void CharacterController::refreshJumpAnims(const WeaponInfo* weap, JumpingState
void CharacterController::refreshMovementAnims(const WeaponInfo* weap, CharacterState movement, CharacterState& idle, bool force) void CharacterController::refreshMovementAnims(const WeaponInfo* weap, CharacterState movement, CharacterState& idle, bool force)
{ {
if (movement == mMovementState && idle == mIdleState && !force)
return;
std::string movementAnimName; std::string movementAnimName;
MWRender::Animation::BlendMask movemask; MWRender::Animation::BlendMask movemask;
const StateInfo *movestate; const StateInfo *movestate;
if(force || movement != mMovementState || idle != mIdleState)
movemask = MWRender::Animation::BlendMask_All;
movestate = std::find_if(sMovementList, sMovementListEnd, FindCharState(movement));
if(movestate != sMovementListEnd)
{ {
movemask = MWRender::Animation::BlendMask_All; movementAnimName = movestate->groupname;
movestate = std::find_if(sMovementList, sMovementListEnd, FindCharState(movement)); if(weap != sWeaponTypeListEnd && movementAnimName.find("swim") == std::string::npos)
if(movestate != sMovementListEnd)
{ {
movementAnimName = movestate->groupname; if (mWeaponType == WeapType_Spell && (movement == CharState_TurnLeft || movement == CharState_TurnRight)) // Spellcasting stance turning is a special case
if(weap != sWeaponTypeListEnd && movementAnimName.find("swim") == std::string::npos) movementAnimName = weap->shortgroup + movementAnimName;
else
movementAnimName += weap->shortgroup;
if(!mAnimation->hasAnimation(movementAnimName))
{ {
if (mWeaponType == WeapType_Spell && (movement == CharState_TurnLeft || movement == CharState_TurnRight)) // Spellcasting stance turning is a special case movemask = MWRender::Animation::BlendMask_LowerBody;
movementAnimName = weap->shortgroup + movementAnimName; movementAnimName = movestate->groupname;
else
movementAnimName += weap->shortgroup;
if(!mAnimation->hasAnimation(movementAnimName)) // Since we apply movement only for lower body, do not reset idle animations.
{ // For upper body there will be idle animation.
movemask = MWRender::Animation::BlendMask_LowerBody; if (idle == CharState_None)
movementAnimName = movestate->groupname; idle = CharState_Idle;
// Since we apply movement only for lower body, do not reset idle animations. // For crossbow animations use 1h ones as fallback
// For upper body there will be idle animation. if (mWeaponType == WeapType_Crossbow)
if (idle == CharState_None) movementAnimName += "1h";
idle = CharState_Idle;
// For crossbow animations use 1h ones as fallback
if (mWeaponType == WeapType_Crossbow)
movementAnimName += "1h";
}
} }
} }
} }