Add convenience operator [] to AnimPriority

sceneinput
scrawl 9 years ago
parent 84747fbdd7
commit 5692ef1eae

@ -278,7 +278,7 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
mHitState = CharState_Block; mHitState = CharState_Block;
mCurrentHit = "shield"; mCurrentHit = "shield";
MWRender::Animation::AnimPriority priorityBlock (Priority_Hit); MWRender::Animation::AnimPriority priorityBlock (Priority_Hit);
priorityBlock.mPriority[MWRender::Animation::BoneGroup_LeftArm] = Priority_Block; priorityBlock[MWRender::Animation::BoneGroup_LeftArm] = Priority_Block;
mAnimation->play(mCurrentHit, priorityBlock, MWRender::Animation::BlendMask_All, true, 1, "block start", "block stop", 0.0f, 0); mAnimation->play(mCurrentHit, priorityBlock, MWRender::Animation::BlendMask_All, true, 1, "block start", "block stop", 0.0f, 0);
} }
@ -1063,7 +1063,7 @@ bool CharacterController::updateWeaponState()
} }
MWRender::Animation::AnimPriority priorityWeapon(Priority_Weapon); MWRender::Animation::AnimPriority priorityWeapon(Priority_Weapon);
priorityWeapon.mPriority[MWRender::Animation::BoneGroup_LowerBody] = Priority_WeaponLowerBody; priorityWeapon[MWRender::Animation::BoneGroup_LowerBody] = Priority_WeaponLowerBody;
bool forcestateupdate = false; bool forcestateupdate = false;
if(weaptype != mWeaponType && mHitState != CharState_KnockDown && mHitState != CharState_KnockOut if(weaptype != mWeaponType && mHitState != CharState_KnockDown && mHitState != CharState_KnockOut

@ -680,7 +680,7 @@ namespace MWRender
if(!(state->second.mBlendMask&(1<<blendMask))) if(!(state->second.mBlendMask&(1<<blendMask)))
continue; continue;
if(active == mStates.end() || active->second.mPriority.mPriority[blendMask] < state->second.mPriority.mPriority[blendMask]) if(active == mStates.end() || active->second.mPriority[blendMask] < state->second.mPriority[blendMask])
active = state; active = state;
} }

@ -105,6 +105,16 @@ public:
return true; return true;
} }
int& operator[] (int n)
{
return mPriority[n];
}
const int& operator[] (int n) const
{
return mPriority[n];
}
bool contains(int priority) const bool contains(int priority) const
{ {
for (unsigned int i=0; i<sNumBlendMasks; ++i) for (unsigned int i=0; i<sNumBlendMasks; ++i)

Loading…
Cancel
Save