From 93eb4700249611a38901593b6e7bc1f1b1c61c60 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Fri, 29 Jul 2022 13:53:12 +0300 Subject: [PATCH] Break invisibility after stopping preparing the attack (bug #5976) --- CHANGELOG.md | 1 + apps/openmw/mwmechanics/character.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00d526a335..6e7c584be6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Bug #5863: GetEffect should return true after the player has teleported Bug #5913: Failed assertion during Ritual of Trees quest Bug #5937: Lights always need to be rotated by 90 degrees + Bug #5976: Invisibility is broken when the attack starts instead of when it ends Bug #5978: NPCs and Creatures talk to and headtrack a player character with a 75% chameleon effect or more Bug #5989: Simple water isn't affected by texture filter settings Bug #6037: Launcher: Morrowind content language cannot be set to English diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 3ec17dc0f4..6ac5e0b760 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1352,7 +1352,6 @@ bool CharacterController::updateState(CharacterState idle) bool resetIdle = ammunition; if(mUpperBodyState == UpperCharState_WeapEquiped && (mHitState == CharState_None || mHitState == CharState_Block)) { - world->breakInvisibility(mPtr); mAttackStrength = 0; // Randomize attacks for non-bipedal creatures @@ -1397,6 +1396,7 @@ bool CharacterController::updateState(CharacterState idle) static const bool useCastingAnimations = Settings::Manager::getBool("use magic item animations", "Game"); if (isMagicItem && !useCastingAnimations) { + world->breakInvisibility(mPtr); // Enchanted items by default do not use casting animations world->castSpell(mPtr); resetIdle = false; @@ -1404,6 +1404,7 @@ bool CharacterController::updateState(CharacterState idle) } else if(!spellid.empty() && canCast) { + world->breakInvisibility(mPtr); MWMechanics::CastSpell cast(mPtr, nullptr, false, mCastingManualSpell); cast.playSpellCastingEffects(spellid, isMagicItem); @@ -1476,6 +1477,7 @@ bool CharacterController::updateState(CharacterState idle) } else if(mWeaponType == ESM::Weapon::PickProbe) { + world->breakInvisibility(mPtr); MWWorld::ContainerStoreIterator weapon = cls.getInventoryStore(mPtr).getSlot(MWWorld::InventoryStore::Slot_CarriedRight); MWWorld::Ptr item = *weapon; // TODO: this will only work for the player, and needs to be fixed if NPCs should ever use lockpicks/probes. @@ -1576,6 +1578,7 @@ bool CharacterController::updateState(CharacterState idle) animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete); if(mUpperBodyState == UpperCharState_MinAttackToMaxAttack && !isKnockedDown()) { + world->breakInvisibility(mPtr); float attackStrength = complete; float minAttackTime = mAnimation->getTextKeyTime(mCurrentWeapon+": "+mAttackType+" "+"min attack"); float maxAttackTime = mAnimation->getTextKeyTime(mCurrentWeapon+": "+mAttackType+" "+"max attack"); @@ -1703,6 +1706,7 @@ bool CharacterController::updateState(CharacterState idle) break; } + world->breakInvisibility(mPtr); if(weapclass != ESM::WeaponType::Ranged && weapclass != ESM::WeaponType::Thrown) playSwishSound(0.0f); }