diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 60dc3ffed..eca71e15e 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -528,53 +528,43 @@ void CharacterController::update(float duration, Movement &movement) } } - if(cls.getCreatureStats(mPtr).getAttackingOrSpell()) - { - if(mUpperBodyState == UpperCharState_WeapEquiped) - { - std::cout << "ATTaquiomg \n"; - std::string weapgroup; - getWeaponGroup(mWeaponType, weapgroup); - mAnimation->play(weapgroup, Priority_Weapon, - MWRender::Animation::Group_UpperBody, false, - 1.0f,"chop start", "chop min attack", 0.0f, 0); - mUpperBodyState = UpperCharState_ChopStartToMinAttack; - } - } - else if(mUpperBodyState == UpperCharState_ChopMinAttackToMaxAttack) - { - std::cout << "OMG \n"; - std::string weapgroup; - getWeaponGroup(mWeaponType, weapgroup); - std::string start; - std::string stop; - float complete; - float speedMult; - //mAnimation-> - if(mAnimation->getInfo(weapgroup,&complete,&speedMult,&start,&stop)) - { - std::cout << "BLABLABLA"; - mAnimation->disable(weapgroup); - mAnimation->play(weapgroup, Priority_Weapon, - MWRender::Animation::Group_UpperBody, false, - 1.0f,"chop max attack", "chop min hit", 1-complete, 0); - } - else - { - mAnimation->play(weapgroup, Priority_Weapon, - MWRender::Animation::Group_UpperBody, false, - 1.0f,"chop max attack", "chop min hit", 0, 0); - } - mUpperBodyState = UpperCharState_ChopMaxAttackToMinHit; - } - std::string weapgroup; getWeaponGroup(mWeaponType, weapgroup); + float weapSpeed = 1; + if(weapon != inv.end()) {weapSpeed = weapon->get()->mBase->mData.mSpeed;std::cout << "setspeed "<< weapSpeed<< "\n";} std::string start; std::string stop; float complete; float speedMult; bool animPlaying = mAnimation->getInfo(weapgroup,&complete,&speedMult,&start,&stop); + if(cls.getCreatureStats(mPtr).getAttackingOrSpell()) + { + if(mUpperBodyState == UpperCharState_WeapEquiped) + { + mAnimation->play(weapgroup, Priority_Weapon, + MWRender::Animation::Group_UpperBody, false, + weapSpeed,"chop start", "chop min attack", 0.0f, 0); + mUpperBodyState = UpperCharState_ChopStartToMinAttack; + } + } + else if(mUpperBodyState == UpperCharState_ChopMinAttackToMaxAttack) + { + if(animPlaying) + { + mAnimation->disable(weapgroup); + mAnimation->play(weapgroup, Priority_Weapon, + MWRender::Animation::Group_UpperBody, false, + weapSpeed,"chop max attack", "chop min hit", 1-complete, 0); + } + else + { + mAnimation->play(weapgroup, Priority_Weapon, + MWRender::Animation::Group_UpperBody, false, + weapSpeed,"chop max attack", "chop min hit", 0, 0); + } + mUpperBodyState = UpperCharState_ChopMaxAttackToMinHit; + } + if(mUpperBodyState == UpperCharState_EquipingWeap && !animPlaying) mUpperBodyState = UpperCharState_WeapEquiped; if(mUpperBodyState == UpperCharState_UnEquipingWeap && !animPlaying) mUpperBodyState = UpperCharState_Nothing; if(animPlaying) @@ -584,7 +574,7 @@ void CharacterController::update(float duration, Movement &movement) mAnimation->disable(weapgroup); mAnimation->play(weapgroup, Priority_Weapon, MWRender::Animation::Group_UpperBody, false, - 1.0f,"chop min attack", "chop max attack",0, 0); + weapSpeed,"chop min attack", "chop max attack",0, 0); mUpperBodyState = UpperCharState_ChopMinAttackToMaxAttack; } else if(mUpperBodyState == UpperCharState_ChopMaxAttackToMinHit && complete == 1) @@ -592,7 +582,7 @@ void CharacterController::update(float duration, Movement &movement) mAnimation->disable(weapgroup); mAnimation->play(weapgroup, Priority_Weapon, MWRender::Animation::Group_UpperBody, false, - 1.0f,"chop min hit", "chop hit",0, 0); + weapSpeed,"chop min hit", "chop hit",0, 0); mUpperBodyState = UpperCharState_ChopMinHitToHit; } else if(mUpperBodyState == UpperCharState_ChopMinHitToHit && complete == 1) @@ -600,7 +590,7 @@ void CharacterController::update(float duration, Movement &movement) mAnimation->disable(weapgroup); mAnimation->play(weapgroup, Priority_Weapon, MWRender::Animation::Group_UpperBody, false, - 1.0f,"chop large follow start", "chop large follow stop",0, 0); + weapSpeed,"chop large follow start", "chop large follow stop",0, 0); mUpperBodyState = UpperCharState_ChopLargeFollowStartToLargeFollowStop; } else if(mUpperBodyState == UpperCharState_ChopLargeFollowStartToLargeFollowStop && complete == 1)