Skip to content

Commit

Permalink
Prevent the Up sound playing twice during HtH->weapon switch
Browse files Browse the repository at this point in the history
  • Loading branch information
akortunov committed Mar 10, 2018
1 parent b529037 commit efe7282
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions apps/openmw/mwmechanics/character.cpp
Expand Up @@ -1164,21 +1164,15 @@ bool CharacterController::updateWeaponState()
{
MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr);
MWWorld::ContainerStoreIterator weapon = getActiveWeapon(stats, inv, &weaptype, true);
if(weapon != inv.end() && weaptype > WeapType_HandToHand && weaptype < WeapType_Spell)
{
if(weapon != inv.end() && mWeaponType != WeapType_HandToHand && weaptype > WeapType_HandToHand && weaptype < WeapType_Spell)
upSoundId = weapon->getClass().getUpSoundId(*weapon);
}

if(weapon != inv.end() && mWeaponType > WeapType_HandToHand && mWeaponType < WeapType_Spell)
{
downSoundId = weapon->getClass().getDownSoundId(*weapon);
}

// weapon->HtH switch: weapon is empty already, so we need to take sound from previous weapon
if(weapon == inv.end() && !mPreviousWeapon.isEmpty() && weaptype == WeapType_HandToHand && mWeaponType != WeapType_Spell)
{
downSoundId = mPreviousWeapon.getClass().getDownSoundId(mPreviousWeapon);
}

mPreviousWeapon = weapon != inv.end() ? *weapon : MWWorld::Ptr();
}
Expand Down

0 comments on commit efe7282

Please sign in to comment.