diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 6ab5ab64fa..904b96c463 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -4,13 +4,13 @@ #include "rotationflags.hpp" #include -#include #include #include #include #include #include +#include #include "../mwworld/doorstate.hpp" #include "../mwworld/globalvariablename.hpp" @@ -515,7 +515,7 @@ namespace MWBase /// Spawn a blood effect for \a ptr at \a worldPosition virtual void spawnBloodEffect(const MWWorld::Ptr& ptr, const osg::Vec3f& worldPosition) = 0; - virtual void spawnEffect(const std::string& model, const std::string& textureOverride, + virtual void spawnEffect(VFS::Path::NormalizedView model, const std::string& textureOverride, const osg::Vec3f& worldPos, float scale = 1.f, bool isMagicVFX = true) = 0; diff --git a/apps/openmw/mwlua/animationbindings.cpp b/apps/openmw/mwlua/animationbindings.cpp index 95294f46cb..b74a3e51c3 100644 --- a/apps/openmw/mwlua/animationbindings.cpp +++ b/apps/openmw/mwlua/animationbindings.cpp @@ -319,14 +319,14 @@ namespace MWLua std::string texture = options->get_or("particleTextureOverride", ""); float scale = options->get_or("scale", 1.f); context.mLuaManager->addAction( - [world, model = std::string(model), texture = std::move(texture), worldPos, scale, + [world, model = VFS::Path::Normalized(model), texture = std::move(texture), worldPos, scale, magicVfx]() { world->spawnEffect(model, texture, worldPos, scale, magicVfx); }, "openmw.vfx.spawn"); } else { - context.mLuaManager->addAction( - [world, model = std::string(model), worldPos]() { world->spawnEffect(model, "", worldPos); }, + context.mLuaManager->addAction([world, model = VFS::Path::Normalized(model), + worldPos]() { world->spawnEffect(model, "", worldPos); }, "openmw.vfx.spawn"); } }; diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 3f2a9b46bb..401ba0ae86 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -214,7 +214,7 @@ namespace const ESM::Static* const fx = world->getStore().get().search(ESM::RefId::stringRefId("VFX_Soul_Trap")); if (fx != nullptr) - world->spawnEffect(Misc::ResourceHelpers::correctMeshPath(fx->mModel), "", + world->spawnEffect(VFS::Path::toNormalized(Misc::ResourceHelpers::correctMeshPath(fx->mModel)), "", creature.getRefData().getPosition().asVec3()); MWBase::Environment::get().getSoundManager()->playSound3D( @@ -1806,7 +1806,8 @@ namespace MWMechanics ESM::RefId::stringRefId("VFX_Summon_End")); if (fx) MWBase::Environment::get().getWorld()->spawnEffect( - Misc::ResourceHelpers::correctMeshPath(fx->mModel), "", ptr.getRefData().getPosition().asVec3()); + VFS::Path::toNormalized(Misc::ResourceHelpers::correctMeshPath(fx->mModel)), "", + ptr.getRefData().getPosition().asVec3()); // Remove the summoned creature's summoned creatures as well MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr); diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index d22b6c4837..1d847a4129 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -72,12 +72,13 @@ namespace MWMechanics { if (effectInfo.mData.mRange == ESM::RT_Target) world->spawnEffect( - Misc::ResourceHelpers::correctMeshPath(areaStatic->mModel), texture, mHitPosition, 1.0f); + VFS::Path::toNormalized(Misc::ResourceHelpers::correctMeshPath(areaStatic->mModel)), texture, + mHitPosition, 1.0f); continue; } else - world->spawnEffect(Misc::ResourceHelpers::correctMeshPath(areaStatic->mModel), texture, mHitPosition, - static_cast(effectInfo.mData.mArea * 2)); + world->spawnEffect(VFS::Path::toNormalized(Misc::ResourceHelpers::correctMeshPath(areaStatic->mModel)), + texture, mHitPosition, static_cast(effectInfo.mData.mArea * 2)); // Play explosion sound (make sure to use NoTrack, since we will delete the projectile now) { @@ -539,7 +540,8 @@ namespace MWMechanics } scale = std::max(scale, 1.f); MWBase::Environment::get().getWorld()->spawnEffect( - Misc::ResourceHelpers::correctMeshPath(castStatic->mModel), effect->mParticle, pos, scale); + VFS::Path::toNormalized(Misc::ResourceHelpers::correctMeshPath(castStatic->mModel)), + effect->mParticle, pos, scale); } if (animation && !mCaster.getClass().isActor()) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index b52d59d5e7..07da51b4f3 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3644,10 +3644,10 @@ namespace MWWorld mRendering->spawnEffect(model, texture, worldPosition, 1.0f, false); } - void World::spawnEffect(const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos, - float scale, bool isMagicVFX) + void World::spawnEffect(VFS::Path::NormalizedView model, const std::string& textureOverride, + const osg::Vec3f& worldPos, float scale, bool isMagicVFX) { - mRendering->spawnEffect(VFS::Path::toNormalized(model), textureOverride, worldPos, scale, isMagicVFX); + mRendering->spawnEffect(model, textureOverride, worldPos, scale, isMagicVFX); } struct ResetActorsVisitor diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index f4c22e94d3..9e00118533 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "../mwbase/world.hpp" @@ -603,8 +604,8 @@ namespace MWWorld /// Spawn a blood effect for \a ptr at \a worldPosition void spawnBloodEffect(const MWWorld::Ptr& ptr, const osg::Vec3f& worldPosition) override; - void spawnEffect(const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos, - float scale = 1.f, bool isMagicVFX = true) override; + void spawnEffect(VFS::Path::NormalizedView model, const std::string& textureOverride, + const osg::Vec3f& worldPos, float scale = 1.f, bool isMagicVFX = true) override; /// @see MWWorld::WeatherManager::isInStorm bool isInStorm() const override;