From c82df2553cb6397769f1e56ded4845ba71ca5e3c Mon Sep 17 00:00:00 2001 From: Allofich Date: Sun, 20 Nov 2016 23:54:30 +0900 Subject: [PATCH 1/2] Allow deleting spells that have the "always succeeds" flag (Fixes #3627) --- apps/openmw/mwgui/spellwindow.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index 8422bb33f..7c12a8fc2 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -11,6 +11,7 @@ #include "../mwworld/inventorystore.hpp" #include "../mwworld/class.hpp" #include "../mwworld/esmstore.hpp" +#include "../mwworld/player.hpp" #include "../mwmechanics/spellcasting.hpp" #include "../mwmechanics/spells.hpp" @@ -122,8 +123,15 @@ namespace MWGui const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(spellId); - if (spell->mData.mFlags & ESM::Spell::F_Always - || spell->mData.mType == ESM::Spell::ST_Power) + MWWorld::Ptr player = MWMechanics::getPlayer(); + std::string raceId = player.get()->mBase->mRace; + const std::string& signId = + MWBase::Environment::get().getWorld()->getPlayer().getBirthSign(); + const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get().find(raceId); + const ESM::BirthSign* birthsign = MWBase::Environment::get().getWorld()->getStore().get().find(signId); + + // can't delete racial spells, birthsign spells or powers + if (race->mPowers.exists(spell->mId) || birthsign->mPowers.exists(spell->mId) || spell->mData.mType == ESM::Spell::ST_Power) { MWBase::Environment::get().getWindowManager()->messageBox("#{sDeleteSpellError}"); } From 16a913c54984c408a24b143edf56348f02d1e721 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 20 Nov 2016 18:46:58 +0100 Subject: [PATCH 2/2] Add emission of water ripple particles for water-walking actors (Fixes #3608) --- apps/openmw/mwbase/world.hpp | 2 +- apps/openmw/mwrender/ripplesimulation.cpp | 7 +++---- apps/openmw/mwworld/worldimp.cpp | 2 +- apps/openmw/mwworld/worldimp.hpp | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 74bc0b7fd..c9c4a22a7 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -548,7 +548,7 @@ namespace MWBase /// Resets all actors in the current active cells to their original location within that cell. virtual void resetActors() = 0; - virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor) = 0; + virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor) const = 0; /// Return a vector aiming the actor's weapon towards a target. /// @note The length of the vector is the distance between actor and target. diff --git a/apps/openmw/mwrender/ripplesimulation.cpp b/apps/openmw/mwrender/ripplesimulation.cpp index 56302077e..00082f033 100644 --- a/apps/openmw/mwrender/ripplesimulation.cpp +++ b/apps/openmw/mwrender/ripplesimulation.cpp @@ -117,6 +117,7 @@ RippleSimulation::~RippleSimulation() void RippleSimulation::update(float dt) { + const MWBase::World* world = MWBase::Environment::get().getWorld(); for (std::vector::iterator it=mEmitters.begin(); it !=mEmitters.end(); ++it) { if (it->mPtr == MWBase::Environment::get().getWorld ()->getPlayerPtr()) @@ -128,10 +129,8 @@ void RippleSimulation::update(float dt) osg::Vec3f currentPos (it->mPtr.getRefData().getPosition().asVec3()); - if ( (currentPos - it->mLastEmitPosition).length() > 10 - // Only emit when close to the water surface, not above it and not too deep in the water - && MWBase::Environment::get().getWorld ()->isUnderwater (it->mPtr.getCell(), it->mPtr.getRefData().getPosition().asVec3()) - && !MWBase::Environment::get().getWorld()->isSubmerged(it->mPtr)) + bool shouldEmit = ( world->isUnderwater (it->mPtr.getCell(), it->mPtr.getRefData().getPosition().asVec3()) && !world->isSubmerged(it->mPtr) ) || world->isWalkingOnWater(it->mPtr); + if ( shouldEmit && (currentPos - it->mLastEmitPosition).length() > 10 ) { it->mLastEmitPosition = currentPos; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 5f652650f..ccd2a25e0 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3313,7 +3313,7 @@ namespace MWWorld } } - bool World::isWalkingOnWater(const ConstPtr &actor) + bool World::isWalkingOnWater(const ConstPtr &actor) const { const MWPhysics::Actor* physicActor = mPhysics->getActor(actor); if (physicActor && physicActor->isWalkingOnWater()) diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index a9d3f3397..0d91bc641 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -651,7 +651,7 @@ namespace MWWorld /// Resets all actors in the current active cells to their original location within that cell. virtual void resetActors(); - virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor); + virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor) const; /// Return a vector aiming the actor's weapon towards a target. /// @note The length of the vector is the distance between actor and target.