From 5508e67aada06a6b55eb44f420aef1d2ceef7ebf Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 20 Apr 2019 09:38:32 +0400 Subject: [PATCH] Apply looping particles when adding spell to existing actor (bug #4918) --- CHANGELOG.md | 1 + apps/openmw/mwmechanics/disease.hpp | 1 + apps/openmw/mwscript/statsextensions.cpp | 12 +++++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a44a96bb7..8fad9abdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ Bug #4896: Title screen music doesn't loop Bug #4911: Editor: QOpenGLContext::swapBuffers() warning with Qt5 Bug #4916: Specular power (shininess) material parameter is ignored when shaders are used. + Bug #4918: Abilities don't play looping VFX when they're initially applied Bug #4922: Werewolves can not attack if the transformation happens during attack Bug #4927: Spell effect having both a skill and an attribute assigned is a fatal error Bug #4932: Invalid records matching when loading save with edited plugin diff --git a/apps/openmw/mwmechanics/disease.hpp b/apps/openmw/mwmechanics/disease.hpp index 8bca9f9b5..805707333 100644 --- a/apps/openmw/mwmechanics/disease.hpp +++ b/apps/openmw/mwmechanics/disease.hpp @@ -57,6 +57,7 @@ namespace MWMechanics { // Contracted disease! actor.getClass().getCreatureStats(actor).getSpells().add(it->first); + MWBase::Environment::get().getWorld()->applyLoopingParticles(actor); std::string msg = "sMagicContractDisease"; msg = MWBase::Environment::get().getWorld()->getStore().get().find(msg)->mValue.getString(); diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 092faa926..4499f1b5a 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -455,10 +455,16 @@ namespace MWScript std::string id = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - // make sure a spell with this ID actually exists. - MWBase::Environment::get().getWorld()->getStore().get().find (id); + const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find (id); - ptr.getClass().getCreatureStats (ptr).getSpells().add (id); + MWMechanics::CreatureStats& creatureStats = ptr.getClass().getCreatureStats(ptr); + creatureStats.getSpells().add(id); + ESM::Spell::SpellType type = static_cast(spell->mData.mType); + if (type != ESM::Spell::ST_Spell && type != ESM::Spell::ST_Power) + { + // Apply looping particles immediately for constant effects + MWBase::Environment::get().getWorld()->applyLoopingParticles(ptr); + } } };