mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Store the current weapon group name
This commit is contained in:
parent
0240efa6cf
commit
22e07968af
@ -497,6 +497,7 @@ void CharacterController::update(float duration, Movement &movement)
|
|||||||
{
|
{
|
||||||
forcestateupdate = (mWeaponType != weaptype);
|
forcestateupdate = (mWeaponType != weaptype);
|
||||||
mWeaponType = weaptype;
|
mWeaponType = weaptype;
|
||||||
|
getWeaponGroup(mWeaponType, mCurrentWeapon);
|
||||||
mUpdateWeapon = false;
|
mUpdateWeapon = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,6 +525,7 @@ void CharacterController::update(float duration, Movement &movement)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mWeaponType = weaptype;
|
mWeaponType = weaptype;
|
||||||
|
getWeaponGroup(mWeaponType, mCurrentWeapon);
|
||||||
|
|
||||||
if(weapon != inv.end())
|
if(weapon != inv.end())
|
||||||
{
|
{
|
||||||
@ -545,10 +547,8 @@ void CharacterController::update(float duration, Movement &movement)
|
|||||||
if(isWeapon)
|
if(isWeapon)
|
||||||
weapSpeed = weapon->get<ESM::Weapon>()->mBase->mData.mSpeed;
|
weapSpeed = weapon->get<ESM::Weapon>()->mBase->mData.mSpeed;
|
||||||
|
|
||||||
std::string weapgroup;
|
|
||||||
getWeaponGroup(mWeaponType, weapgroup);
|
|
||||||
float complete;
|
float complete;
|
||||||
bool animPlaying = mAnimation->getInfo(weapgroup, &complete);
|
bool animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete);
|
||||||
|
|
||||||
if(cls.getCreatureStats(mPtr).getAttackingOrSpell())
|
if(cls.getCreatureStats(mPtr).getAttackingOrSpell())
|
||||||
{
|
{
|
||||||
@ -567,27 +567,20 @@ void CharacterController::update(float duration, Movement &movement)
|
|||||||
else
|
else
|
||||||
mAttackType = "thrust";
|
mAttackType = "thrust";
|
||||||
|
|
||||||
mAnimation->play(weapgroup, Priority_Weapon,
|
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
||||||
MWRender::Animation::Group_UpperBody, false,
|
MWRender::Animation::Group_UpperBody, false,
|
||||||
weapSpeed, mAttackType+" start", mAttackType+" min attack", 0.0f, 0);
|
weapSpeed, mAttackType+" start", mAttackType+" min attack",
|
||||||
|
0.0f, 0);
|
||||||
mUpperBodyState = UpperCharState_StartToMinAttack;
|
mUpperBodyState = UpperCharState_StartToMinAttack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(mUpperBodyState == UpperCharState_MinAttackToMaxAttack)
|
else if(mUpperBodyState == UpperCharState_MinAttackToMaxAttack)
|
||||||
{
|
{
|
||||||
if(animPlaying)
|
mAnimation->disable(mCurrentWeapon);
|
||||||
{
|
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
||||||
mAnimation->disable(weapgroup);
|
MWRender::Animation::Group_UpperBody, false,
|
||||||
mAnimation->play(weapgroup, Priority_Weapon,
|
weapSpeed, mAttackType+" max attack", mAttackType+" min hit",
|
||||||
MWRender::Animation::Group_UpperBody, false,
|
1.0f-complete, 0);
|
||||||
weapSpeed, mAttackType+" max attack", mAttackType+" min hit", 1-complete, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mAnimation->play(weapgroup, Priority_Weapon,
|
|
||||||
MWRender::Animation::Group_UpperBody, false,
|
|
||||||
weapSpeed, mAttackType+" max attack", mAttackType+" min hit", 0, 0);
|
|
||||||
}
|
|
||||||
mUpperBodyState = UpperCharState_MaxAttackToMinHit;
|
mUpperBodyState = UpperCharState_MaxAttackToMinHit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,31 +592,34 @@ void CharacterController::update(float duration, Movement &movement)
|
|||||||
{
|
{
|
||||||
if(mUpperBodyState == UpperCharState_StartToMinAttack && complete == 1.0f)
|
if(mUpperBodyState == UpperCharState_StartToMinAttack && complete == 1.0f)
|
||||||
{
|
{
|
||||||
mAnimation->disable(weapgroup);
|
mAnimation->disable(mCurrentWeapon);
|
||||||
mAnimation->play(weapgroup, Priority_Weapon,
|
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
||||||
MWRender::Animation::Group_UpperBody, false,
|
MWRender::Animation::Group_UpperBody, false,
|
||||||
weapSpeed, mAttackType+" min attack", mAttackType+" max attack",0, 0);
|
weapSpeed, mAttackType+" min attack", mAttackType+" max attack",
|
||||||
|
0.0f, 0);
|
||||||
mUpperBodyState = UpperCharState_MinAttackToMaxAttack;
|
mUpperBodyState = UpperCharState_MinAttackToMaxAttack;
|
||||||
}
|
}
|
||||||
else if(mUpperBodyState == UpperCharState_MaxAttackToMinHit && complete == 1.0f)
|
else if(mUpperBodyState == UpperCharState_MaxAttackToMinHit && complete == 1.0f)
|
||||||
{
|
{
|
||||||
mAnimation->disable(weapgroup);
|
mAnimation->disable(mCurrentWeapon);
|
||||||
mAnimation->play(weapgroup, Priority_Weapon,
|
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
||||||
MWRender::Animation::Group_UpperBody, false,
|
MWRender::Animation::Group_UpperBody, false,
|
||||||
weapSpeed, mAttackType+" min hit", mAttackType+" hit",0, 0);
|
weapSpeed, mAttackType+" min hit", mAttackType+" hit",
|
||||||
|
0.0f, 0);
|
||||||
mUpperBodyState = UpperCharState_MinHitToHit;
|
mUpperBodyState = UpperCharState_MinHitToHit;
|
||||||
}
|
}
|
||||||
else if(mUpperBodyState == UpperCharState_MinHitToHit && complete == 1.0f)
|
else if(mUpperBodyState == UpperCharState_MinHitToHit && complete == 1.0f)
|
||||||
{
|
{
|
||||||
mAnimation->disable(weapgroup);
|
mAnimation->disable(mCurrentWeapon);
|
||||||
mAnimation->play(weapgroup, Priority_Weapon,
|
mAnimation->play(mCurrentWeapon, Priority_Weapon,
|
||||||
MWRender::Animation::Group_UpperBody, false,
|
MWRender::Animation::Group_UpperBody, false,
|
||||||
weapSpeed, mAttackType+" large follow start", mAttackType+" large follow stop",0, 0);
|
weapSpeed, mAttackType+" large follow start", mAttackType+" large follow stop",
|
||||||
|
0.0f, 0);
|
||||||
mUpperBodyState = UpperCharState_LargeFollowStartToLargeFollowStop;
|
mUpperBodyState = UpperCharState_LargeFollowStartToLargeFollowStop;
|
||||||
}
|
}
|
||||||
else if(mUpperBodyState == UpperCharState_LargeFollowStartToLargeFollowStop && complete == 1.0f)
|
else if(mUpperBodyState == UpperCharState_LargeFollowStartToLargeFollowStop && complete == 1.0f)
|
||||||
{
|
{
|
||||||
mAnimation->disable(weapgroup);
|
mAnimation->disable(mCurrentWeapon);
|
||||||
mUpperBodyState = UpperCharState_WeapEquiped;
|
mUpperBodyState = UpperCharState_WeapEquiped;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,6 +132,8 @@ class CharacterController
|
|||||||
UpperBodyCharacterState mUpperBodyState;
|
UpperBodyCharacterState mUpperBodyState;
|
||||||
|
|
||||||
WeaponType mWeaponType;
|
WeaponType mWeaponType;
|
||||||
|
std::string mCurrentWeapon;
|
||||||
|
|
||||||
bool mSkipAnim;
|
bool mSkipAnim;
|
||||||
|
|
||||||
// Workaround for playing weapon draw animation and sound when going to new cell
|
// Workaround for playing weapon draw animation and sound when going to new cell
|
||||||
|
Loading…
x
Reference in New Issue
Block a user