From 3b163ce6ce8d1bf9195cc4dd38136ec01d41b3e6 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 15 Jul 2017 10:58:19 +0400 Subject: [PATCH 1/8] Disable sound distortion for PlaySound script command --- apps/openmw/mwscript/soundextensions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwscript/soundextensions.cpp b/apps/openmw/mwscript/soundextensions.cpp index 516c58b26..bedc02138 100644 --- a/apps/openmw/mwscript/soundextensions.cpp +++ b/apps/openmw/mwscript/soundextensions.cpp @@ -82,7 +82,7 @@ namespace MWScript std::string sound = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); + MWBase::Environment::get().getSoundManager()->playSound(sound, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_NoEnv); } }; @@ -101,7 +101,7 @@ namespace MWScript Interpreter::Type_Float pitch = runtime[0].mFloat; runtime.pop(); - MWBase::Environment::get().getSoundManager()->playSound (sound, volume, pitch); + MWBase::Environment::get().getSoundManager()->playSound(sound, volume, pitch, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_NoEnv); } }; From dca83170831e66a2b0d088b0ee3a8ee63092e0b1 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 15 Jul 2017 10:59:08 +0400 Subject: [PATCH 2/8] Disable sound distortion for player actions in GUI mode --- apps/openmw/mwworld/action.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/action.cpp b/apps/openmw/mwworld/action.cpp index 92e959e41..468207e81 100644 --- a/apps/openmw/mwworld/action.cpp +++ b/apps/openmw/mwworld/action.cpp @@ -4,6 +4,7 @@ #include "../mwbase/world.hpp" #include "../mwbase/soundmanager.hpp" +#include "../mwbase/windowmanager.hpp" #include "../mwmechanics/actorutil.hpp" @@ -26,9 +27,18 @@ void MWWorld::Action::execute (const Ptr& actor, bool noSound) { if(!mSoundId.empty() && !noSound) { + MWBase::SoundManager::PlayMode envType = MWBase::SoundManager::Play_Normal; + + // Action sounds should not have a distortion in GUI mode + // example: take an item or drink a potion underwater + if (actor == MWMechanics::getPlayer() && MWBase::Environment::get().getWindowManager()->isGuiMode()) + { + envType = MWBase::SoundManager::Play_NoEnv; + } + if(mKeepSound && actor == MWMechanics::getPlayer()) MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0, - MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_Normal, mSoundOffset + MWBase::SoundManager::Play_TypeSfx, envType, mSoundOffset ); else { @@ -37,12 +47,12 @@ void MWWorld::Action::execute (const Ptr& actor, bool noSound) MWBase::Environment::get().getSoundManager()->playSound3D( (local ? actor : mTarget).getRefData().getPosition().asVec3(), mSoundId, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx, - MWBase::SoundManager::Play_Normal, mSoundOffset + envType, mSoundOffset ); else MWBase::Environment::get().getSoundManager()->playSound3D(local ? actor : mTarget, mSoundId, 1.0, 1.0, MWBase::SoundManager::Play_TypeSfx, - MWBase::SoundManager::Play_Normal, mSoundOffset + envType, mSoundOffset ); } } From 5be1c81913624b62add3db442c7b20fb152f866d Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 15 Jul 2017 14:03:36 +0400 Subject: [PATCH 3/8] Fixed Close button handler in EditEffectDialog (fixes #3956) --- apps/openmw/mwgui/spellcreationdialog.cpp | 9 +++++++++ files/mygui/openmw_edit_effect.layout | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index 7201e64c2..e22fc3c63 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -170,11 +170,20 @@ namespace MWGui mAreaSlider->setScrollPosition (effect.mArea); mDurationSlider->setScrollPosition (effect.mDuration-1); + if (mEffect.mRange == ESM::RT_Self) + mRangeButton->setCaptionWithReplacing ("#{sRangeSelf}"); + else if (mEffect.mRange == ESM::RT_Target) + mRangeButton->setCaptionWithReplacing ("#{sRangeTarget}"); + else if (mEffect.mRange == ESM::RT_Touch) + mRangeButton->setCaptionWithReplacing ("#{sRangeTouch}"); + onMagnitudeMinChanged (mMagnitudeMinSlider, effect.mMagnMin-1); onMagnitudeMaxChanged (mMagnitudeMinSlider, effect.mMagnMax-1); onAreaChanged (mAreaSlider, effect.mArea); onDurationChanged (mDurationSlider, effect.mDuration-1); eventEffectModified(mEffect); + + updateBoxes(); } void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect) diff --git a/files/mygui/openmw_edit_effect.layout b/files/mygui/openmw_edit_effect.layout index 387c01231..376e87efa 100644 --- a/files/mygui/openmw_edit_effect.layout +++ b/files/mygui/openmw_edit_effect.layout @@ -1,7 +1,7 @@ - + From 9179a019dfc60e457134bf8721c207bac70178d4 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Jul 2017 13:11:34 +0400 Subject: [PATCH 4/8] Quick keys menu fixes --- apps/openmw/mwgui/quickkeysmenu.cpp | 3 ++- files/mygui/openmw_quickkeys_menu_assign.layout | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp index 63cc14d98..619540cff 100644 --- a/apps/openmw/mwgui/quickkeysmenu.cpp +++ b/apps/openmw/mwgui/quickkeysmenu.cpp @@ -370,7 +370,8 @@ namespace MWGui mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(mParent, &QuickKeysMenu::onCancelButtonClicked); - int maxWidth = mItemButton->getTextSize ().width + 24; + int maxWidth = mLabel->getTextSize ().width + 24; + maxWidth = std::max(maxWidth, mItemButton->getTextSize ().width + 24); maxWidth = std::max(maxWidth, mMagicButton->getTextSize ().width + 24); maxWidth = std::max(maxWidth, mUnassignButton->getTextSize ().width + 24); maxWidth = std::max(maxWidth, mCancelButton->getTextSize ().width + 24); diff --git a/files/mygui/openmw_quickkeys_menu_assign.layout b/files/mygui/openmw_quickkeys_menu_assign.layout index 4bbd9f1fa..2c80fefcd 100644 --- a/files/mygui/openmw_quickkeys_menu_assign.layout +++ b/files/mygui/openmw_quickkeys_menu_assign.layout @@ -1,6 +1,6 @@ - + From 2b22d10ebc212ae2682f5c1b133c5f1c1b9cbfab Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Jul 2017 13:14:19 +0400 Subject: [PATCH 5/8] Spellview fixes --- apps/openmw/mwgui/spellview.cpp | 4 ++-- files/mygui/openmw_magicselection_dialog.layout | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwgui/spellview.cpp b/apps/openmw/mwgui/spellview.cpp index 9932cddfa..ebda8873c 100644 --- a/apps/openmw/mwgui/spellview.cpp +++ b/apps/openmw/mwgui/spellview.cpp @@ -96,9 +96,9 @@ namespace MWGui if (spell.mType == Spell::Type_Power) addGroup("#{sPowers}", ""); else if (spell.mType == Spell::Type_Spell) - addGroup("#{sSpells}", "#{sCostChance}"); + addGroup("#{sSpells}", mShowCostColumn ? "#{sCostChance}" : ""); else - addGroup("#{sMagicItem}", "#{sCostCharge}"); + addGroup("#{sMagicItem}", mShowCostColumn ? "#{sCostCharge}" : ""); curType = spell.mType; } diff --git a/files/mygui/openmw_magicselection_dialog.layout b/files/mygui/openmw_magicselection_dialog.layout index 5301ecfe9..027250d7a 100644 --- a/files/mygui/openmw_magicselection_dialog.layout +++ b/files/mygui/openmw_magicselection_dialog.layout @@ -1,6 +1,6 @@ - + From 5bb9f1b187d563d48d16bac0abb0baeee35a6e70 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Jul 2017 13:18:59 +0400 Subject: [PATCH 6/8] Make popup in character select menu non-transparent --- files/mygui/openmw_list.skin.xml | 13 +++++++++++++ files/mygui/openmw_resources.xml | 18 ++++++++++++++++++ files/mygui/openmw_savegame_dialog.layout | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/files/mygui/openmw_list.skin.xml b/files/mygui/openmw_list.skin.xml index 8a238879c..5b6f14dd5 100644 --- a/files/mygui/openmw_list.skin.xml +++ b/files/mygui/openmw_list.skin.xml @@ -150,6 +150,19 @@ + + + + + + + + + + + + + diff --git a/files/mygui/openmw_resources.xml b/files/mygui/openmw_resources.xml index ef11d10a0..437c0945b 100644 --- a/files/mygui/openmw_resources.xml +++ b/files/mygui/openmw_resources.xml @@ -114,6 +114,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/files/mygui/openmw_savegame_dialog.layout b/files/mygui/openmw_savegame_dialog.layout index f18218430..28e1e5188 100644 --- a/files/mygui/openmw_savegame_dialog.layout +++ b/files/mygui/openmw_savegame_dialog.layout @@ -16,7 +16,7 @@ - + From 98f161c7fd3077e28708b40f2815ebb46f2e9836 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Jul 2017 22:38:23 +0400 Subject: [PATCH 7/8] Combat AI: avoid enemy hits when casting Self-ranged spells (fixes #3922) --- apps/openmw/mwmechanics/aicombataction.cpp | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 46d37eb3d..aad0baae8 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -45,20 +45,18 @@ int getRangeTypes (const ESM::EffectList& effects) float suggestCombatRange(int rangeTypes) { + static const float fCombatDistance = MWBase::Environment::get().getWorld()->getStore().get().find("fCombatDistance")->getFloat(); + static float fHandToHandReach = MWBase::Environment::get().getWorld()->getStore().get().find("fHandToHandReach")->getFloat(); + + // This distance is a possible distance of melee attack + static float distance = fCombatDistance * std::max(2.f, fHandToHandReach); + if (rangeTypes & Touch) { - static const float fCombatDistance = MWBase::Environment::get().getWorld()->getStore().get().find("fCombatDistance")->getFloat(); return fCombatDistance; } - else if (rangeTypes & Target) - { - return 1000.f; - } - else - { - // For Self spells, distance doesn't matter, so back away slightly to avoid enemy hits - return 600.f; - } + + return distance * 4; } int numEffectsToDispel (const MWWorld::Ptr& actor, int effectFilter=-1, bool negative = true) @@ -640,7 +638,7 @@ namespace MWMechanics const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(mSpellId); int types = getRangeTypes(spell->mEffects); - isRanged = (types & Target); + isRanged = (types & Target) | (types & Self); return suggestCombatRange(types); } @@ -660,7 +658,8 @@ namespace MWMechanics float ActionPotion::getCombatRange(bool& isRanged) const { - // distance doesn't matter, so back away slightly to avoid enemy hits + // Distance doesn't matter since this action has no animation + // If we want to back away slightly to avoid enemy hits, we should set isRanged to "true" return 600.f; } From 679516326595a694a8c53f16ae6e347556f61351 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 16 Jul 2017 23:03:53 +0400 Subject: [PATCH 8/8] Disable transparency for all popup lists --- files/mygui/openmw_resources.xml | 18 ------------------ files/mygui/openmw_savegame_dialog.layout | 2 +- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/files/mygui/openmw_resources.xml b/files/mygui/openmw_resources.xml index 437c0945b..811fa4f7f 100644 --- a/files/mygui/openmw_resources.xml +++ b/files/mygui/openmw_resources.xml @@ -97,24 +97,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/files/mygui/openmw_savegame_dialog.layout b/files/mygui/openmw_savegame_dialog.layout index 28e1e5188..f18218430 100644 --- a/files/mygui/openmw_savegame_dialog.layout +++ b/files/mygui/openmw_savegame_dialog.layout @@ -16,7 +16,7 @@ - +