From fd7965d77fea28146c1546df413b26d7c7bc96c2 Mon Sep 17 00:00:00 2001 From: uramer Date: Fri, 13 May 2022 19:28:53 +0200 Subject: [PATCH] Use correctMeshPath instead of string constants --- apps/navmeshtool/worldspacedata.cpp | 2 +- apps/openmw/mwclass/activator.cpp | 5 +++-- apps/openmw/mwclass/apparatus.cpp | 2 +- apps/openmw/mwclass/armor.cpp | 2 +- apps/openmw/mwclass/bodypart.cpp | 5 ++++- apps/openmw/mwclass/book.cpp | 2 +- apps/openmw/mwclass/clothing.cpp | 2 +- apps/openmw/mwclass/container.cpp | 2 +- apps/openmw/mwclass/creature.cpp | 5 +++-- apps/openmw/mwclass/door.cpp | 2 +- apps/openmw/mwclass/ingredient.cpp | 2 +- apps/openmw/mwclass/light.cpp | 2 +- apps/openmw/mwclass/lockpick.cpp | 2 +- apps/openmw/mwclass/misc.cpp | 2 +- apps/openmw/mwclass/npc.cpp | 10 +++++----- apps/openmw/mwclass/potion.cpp | 2 +- apps/openmw/mwclass/probe.cpp | 2 +- apps/openmw/mwclass/repair.cpp | 2 +- apps/openmw/mwclass/static.cpp | 5 ++++- apps/openmw/mwclass/weapon.cpp | 2 +- apps/openmw/mwmechanics/activespells.cpp | 5 ++++- apps/openmw/mwmechanics/actors.cpp | 7 +++++-- apps/openmw/mwmechanics/character.cpp | 8 ++++++-- apps/openmw/mwmechanics/spellcasting.cpp | 18 +++++++++++++----- apps/openmw/mwmechanics/spelleffects.cpp | 6 ++++-- apps/openmw/mwmechanics/summoning.cpp | 3 ++- apps/openmw/mwrender/actoranimation.cpp | 3 ++- apps/openmw/mwrender/npcanimation.cpp | 19 +++++++++++-------- apps/openmw/mwrender/objectpaging.cpp | 3 ++- apps/openmw/mwworld/groundcoverstore.cpp | 9 +++++++-- apps/openmw/mwworld/projectilemanager.cpp | 7 +++++-- apps/openmw/mwworld/worldimp.cpp | 11 ++++++++--- 32 files changed, 103 insertions(+), 56 deletions(-) diff --git a/apps/navmeshtool/worldspacedata.cpp b/apps/navmeshtool/worldspacedata.cpp index 56f9147ff3..e93b50842c 100644 --- a/apps/navmeshtool/worldspacedata.cpp +++ b/apps/navmeshtool/worldspacedata.cpp @@ -122,7 +122,7 @@ namespace NavMeshTool { try { - return bulletShapeManager.getShape("meshes/" + model); + return bulletShapeManager.getShape(Misc::ResourceHelpers::correctMeshPath(model, &vfs)); } catch (const std::exception& e) { diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp index f2212e7c95..e50b3cca85 100644 --- a/apps/openmw/mwclass/activator.cpp +++ b/apps/openmw/mwclass/activator.cpp @@ -60,7 +60,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } @@ -145,7 +145,8 @@ namespace MWClass for (const ESM::Creature &iter : store.get()) { - if (!iter.mModel.empty() && Misc::StringUtils::ciEqual(model, "meshes\\" + iter.mModel)) + if (!iter.mModel.empty() && Misc::StringUtils::ciEqual(model, + MWBase::Environment::get().getWindowManager()->correctMeshPath(iter.mModel))) { creatureId = !iter.mOriginal.empty() ? iter.mOriginal : iter.mId; break; diff --git a/apps/openmw/mwclass/apparatus.cpp b/apps/openmw/mwclass/apparatus.cpp index 6004868ac0..07dac3e2d7 100644 --- a/apps/openmw/mwclass/apparatus.cpp +++ b/apps/openmw/mwclass/apparatus.cpp @@ -38,7 +38,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/armor.cpp b/apps/openmw/mwclass/armor.cpp index 9bd7deb38f..d2b5c096cb 100644 --- a/apps/openmw/mwclass/armor.cpp +++ b/apps/openmw/mwclass/armor.cpp @@ -46,7 +46,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/bodypart.cpp b/apps/openmw/mwclass/bodypart.cpp index ecc59f5459..bd32784a7d 100644 --- a/apps/openmw/mwclass/bodypart.cpp +++ b/apps/openmw/mwclass/bodypart.cpp @@ -5,6 +5,9 @@ #include "../mwworld/cellstore.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/windowmanager.hpp" + namespace MWClass { BodyPart::BodyPart() @@ -42,7 +45,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/book.cpp b/apps/openmw/mwclass/book.cpp index 2247d388e8..c057182187 100644 --- a/apps/openmw/mwclass/book.cpp +++ b/apps/openmw/mwclass/book.cpp @@ -43,7 +43,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp index de2b1c870f..0a922b30af 100644 --- a/apps/openmw/mwclass/clothing.cpp +++ b/apps/openmw/mwclass/clothing.cpp @@ -41,7 +41,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index d4fa3e2f1c..9f9666534d 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -123,7 +123,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 667942b320..026ef268fe 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -184,7 +184,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } @@ -626,7 +626,8 @@ namespace MWClass for (const ESM::Creature &creature : store.get()) { if (creature.mId != ourId && creature.mOriginal != ourId && !creature.mModel.empty() - && Misc::StringUtils::ciEqual(model, "meshes\\" + creature.mModel)) + && Misc::StringUtils::ciEqual(model, + MWBase::Environment::get().getWindowManager()->correctMeshPath(creature.mModel))) { const std::string& fallbackId = !creature.mOriginal.empty() ? creature.mOriginal : creature.mId; sound = store.get().begin(); diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 37b45e531b..23e492bec4 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -99,7 +99,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp index 73f9fb4ac9..1996e1742e 100644 --- a/apps/openmw/mwclass/ingredient.cpp +++ b/apps/openmw/mwclass/ingredient.cpp @@ -40,7 +40,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index 3ab9d3b630..3b1cb19068 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -71,7 +71,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp index ef4af50c6a..ff23535145 100644 --- a/apps/openmw/mwclass/lockpick.cpp +++ b/apps/openmw/mwclass/lockpick.cpp @@ -40,7 +40,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 571bbda0ea..10fada6dbb 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -50,7 +50,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index b6105df4d7..76e60c7880 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -443,19 +443,19 @@ namespace MWClass models.emplace_back(Settings::Manager::getString("xbaseanim", "Models")); if (!npc->mBase->mModel.empty()) - models.push_back("meshes/"+npc->mBase->mModel); + models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(npc->mBase->mModel)); if (!npc->mBase->mHead.empty()) { const ESM::BodyPart* head = MWBase::Environment::get().getWorld()->getStore().get().search(npc->mBase->mHead); if (head) - models.push_back("meshes/"+head->mModel); + models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(head->mModel)); } if (!npc->mBase->mHair.empty()) { const ESM::BodyPart* hair = MWBase::Environment::get().getWorld()->getStore().get().search(npc->mBase->mHair); if (hair) - models.push_back("meshes/"+hair->mModel); + models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(hair->mModel)); } bool female = (npc->mBase->mFlags & ESM::NPC::Female); @@ -493,7 +493,7 @@ namespace MWClass partname = female ? it->mMale : it->mFemale; const ESM::BodyPart* part = MWBase::Environment::get().getWorld()->getStore().get().search(partname); if (part && !part->mModel.empty()) - models.push_back("meshes/"+part->mModel); + models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(part->mModel)); } } } @@ -506,7 +506,7 @@ namespace MWClass { const ESM::BodyPart* part = *it; if (part && !part->mModel.empty()) - models.push_back("meshes/"+part->mModel); + models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(part->mModel)); } } diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp index 3b55cbc679..20f4c3bcce 100644 --- a/apps/openmw/mwclass/potion.cpp +++ b/apps/openmw/mwclass/potion.cpp @@ -42,7 +42,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/probe.cpp b/apps/openmw/mwclass/probe.cpp index a528068f23..ea90c1e78c 100644 --- a/apps/openmw/mwclass/probe.cpp +++ b/apps/openmw/mwclass/probe.cpp @@ -40,7 +40,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/repair.cpp b/apps/openmw/mwclass/repair.cpp index e9a504f22c..6a23c43303 100644 --- a/apps/openmw/mwclass/repair.cpp +++ b/apps/openmw/mwclass/repair.cpp @@ -37,7 +37,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/static.cpp b/apps/openmw/mwclass/static.cpp index 8b793dbc67..27b04481ad 100644 --- a/apps/openmw/mwclass/static.cpp +++ b/apps/openmw/mwclass/static.cpp @@ -11,6 +11,9 @@ #include "../mwrender/renderinginterface.hpp" #include "../mwrender/vismask.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/windowmanager.hpp" + namespace MWClass { Static::Static() @@ -43,7 +46,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 505b2a4d1e..478e67036c 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -46,7 +46,7 @@ namespace MWClass const std::string &model = ref->mBase->mModel; if (!model.empty()) { - return "meshes\\" + model; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); } return ""; } diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index 8dcf6ca90c..663809d109 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -17,6 +17,7 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" +#include "../mwbase/windowmanager.hpp" #include "../mwrender/animation.hpp" @@ -261,7 +262,9 @@ namespace MWMechanics const ESM::Static* reflectStatic = MWBase::Environment::get().getWorld()->getStore().get().find("VFX_Reflect"); MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr); if(animation && !reflectStatic->mModel.empty()) - animation->addEffect("meshes\\" + reflectStatic->mModel, ESM::MagicEffect::Reflect, false, std::string()); + animation->addEffect( + MWBase::Environment::get().getWindowManager()->correctMeshPath(reflectStatic->mModel), + ESM::MagicEffect::Reflect, false, std::string()); caster.getClass().getCreatureStats(caster).getActiveSpells().addSpell(*reflected); } if(removedSpell) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index a384a2edfa..2353f3729d 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -203,7 +203,9 @@ void soulTrap(const MWWorld::Ptr& creature) const ESM::Static* fx = world->getStore().get() .search("VFX_Soul_Trap"); if (fx) - world->spawnEffect("meshes\\" + fx->mModel, "", creature.getRefData().getPosition().asVec3()); + world->spawnEffect( + MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel), + "", creature.getRefData().getPosition().asVec3()); MWBase::Environment::get().getSoundManager()->playSound3D(creature.getRefData().getPosition().asVec3(), "conjuration hit", 1.f, 1.f); return; //remove to get vanilla behaviour @@ -1745,7 +1747,8 @@ namespace MWMechanics const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get() .search("VFX_Summon_End"); if (fx) - MWBase::Environment::get().getWorld()->spawnEffect("meshes\\" + fx->mModel, + MWBase::Environment::get().getWorld()->spawnEffect( + MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel), "", ptr.getRefData().getPosition().asVec3()); // Remove the summoned creature's summoned creatures as well diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 471ec7b5f4..b76ebc91a7 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1433,10 +1433,14 @@ bool CharacterController::updateState(CharacterState idle) for (size_t iter = 0; iter < effects.size(); ++iter) // play hands vfx for each effect { if (mAnimation->getNode("Bip01 L Hand")) - mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Bip01 L Hand", effect->mParticle); + mAnimation->addEffect( + MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel), + -1, false, "Bip01 L Hand", effect->mParticle); if (mAnimation->getNode("Bip01 R Hand")) - mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Bip01 R Hand", effect->mParticle); + mAnimation->addEffect( + MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel), + -1, false, "Bip01 R Hand", effect->mParticle); } const ESM::ENAMstruct &firstEffect = effects.at(0); // first effect used for casting animation diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index b92cbc74fb..dcfd125519 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -476,13 +476,17 @@ namespace MWMechanics castStatic = store.get().find ("VFX_DefaultCast"); // check if the effect was already added - if (std::find(addedEffects.begin(), addedEffects.end(), "meshes\\" + castStatic->mModel) != addedEffects.end()) + if (std::find(addedEffects.begin(), addedEffects.end(), + MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel)) + != addedEffects.end()) continue; MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(mCaster); if (animation) { - animation->addEffect("meshes\\" + castStatic->mModel, effect->mIndex, false, "", effect->mParticle); + animation->addEffect( + MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel), + effect->mIndex, false, "", effect->mParticle); } else { @@ -511,7 +515,9 @@ namespace MWMechanics scale *= npcScaleVec.z(); } scale = std::max(scale, 1.f); - MWBase::Environment::get().getWorld()->spawnEffect("meshes\\" + castStatic->mModel, effect->mParticle, pos, scale); + MWBase::Environment::get().getWorld()->spawnEffect( + MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel), + effect->mParticle, pos, scale); } if (animation && !mCaster.getClass().isActor()) @@ -521,7 +527,7 @@ namespace MWMechanics "alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration" }; - addedEffects.push_back("meshes\\" + castStatic->mModel); + addedEffects.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel)); MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); if(!effect->mCastSound.empty()) @@ -559,7 +565,9 @@ namespace MWMechanics { // Don't play particle VFX unless the effect is new or it should be looping. if (playNonLooping || loop) - anim->addEffect("meshes\\" + castStatic->mModel, magicEffect.mIndex, loop, "", magicEffect.mParticle); + anim->addEffect( + MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel), + magicEffect.mIndex, loop, "", magicEffect.mParticle); } } } diff --git a/apps/openmw/mwmechanics/spelleffects.cpp b/apps/openmw/mwmechanics/spelleffects.cpp index ae18c6ae0c..e10eaa3ff9 100644 --- a/apps/openmw/mwmechanics/spelleffects.cpp +++ b/apps/openmw/mwmechanics/spelleffects.cpp @@ -272,7 +272,9 @@ namespace const ESM::Static* absorbStatic = esmStore.get().find("VFX_Absorb"); MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target); if (animation && !absorbStatic->mModel.empty()) - animation->addEffect( "meshes\\" + absorbStatic->mModel, ESM::MagicEffect::SpellAbsorption, false, std::string()); + animation->addEffect( + MWBase::Environment::get().getWindowManager()->correctMeshPath(absorbStatic->mModel), + ESM::MagicEffect::SpellAbsorption, false, std::string()); const ESM::Spell* spell = esmStore.get().search(spellId); int spellCost = 0; if (spell) @@ -430,7 +432,7 @@ void applyMagicEffect(const MWWorld::Ptr& target, const MWWorld::Ptr& caster, co anim->removeEffect(effect.mEffectId); const ESM::Static* fx = world->getStore().get().search("VFX_Summon_end"); if (fx) - anim->addEffect("meshes\\" + fx->mModel, -1); + anim->addEffect(MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel), -1); } } else if (caster == getPlayer()) diff --git a/apps/openmw/mwmechanics/summoning.cpp b/apps/openmw/mwmechanics/summoning.cpp index c1923d4337..5fc39f416b 100644 --- a/apps/openmw/mwmechanics/summoning.cpp +++ b/apps/openmw/mwmechanics/summoning.cpp @@ -5,6 +5,7 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/mechanicsmanager.hpp" +#include "../mwbase/windowmanager.hpp" #include "../mwworld/esmstore.hpp" #include "../mwworld/class.hpp" @@ -85,7 +86,7 @@ namespace MWMechanics { const ESM::Static* fx = world->getStore().get().search("VFX_Summon_Start"); if (fx) - anim->addEffect("meshes\\" + fx->mModel, -1, false); + anim->addEffect(MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel), -1, false); } } catch (std::exception& e) diff --git a/apps/openmw/mwrender/actoranimation.cpp b/apps/openmw/mwrender/actoranimation.cpp index b3d76d423c..777a095c9e 100644 --- a/apps/openmw/mwrender/actoranimation.cpp +++ b/apps/openmw/mwrender/actoranimation.cpp @@ -24,6 +24,7 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" +#include "../mwbase/windowmanager.hpp" #include "../mwworld/ptr.hpp" #include "../mwworld/class.hpp" #include "../mwworld/cellstore.hpp" @@ -127,7 +128,7 @@ std::string ActorAnimation::getShieldMesh(const MWWorld::ConstPtr& shield, bool if (bodypart == nullptr || bodypart->mData.mType != ESM::BodyPart::MT_Armor) return std::string(); if (!bodypart->mModel.empty()) - return "meshes\\" + bodypart->mModel; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(bodypart->mModel); } } } diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 8a7da4c800..ba44a94cd9 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -39,6 +39,7 @@ #include "../mwbase/world.hpp" #include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/soundmanager.hpp" +#include "../mwbase/windowmanager.hpp" #include "camera.hpp" #include "rotatecontroller.hpp" @@ -80,7 +81,7 @@ std::string getVampireHead(const std::string& race, bool female) const ESM::BodyPart* bodyPart = sVampireMapping[thisCombination]; if (!bodyPart) return std::string(); - return "meshes\\" + bodyPart->mModel; + return MWBase::Environment::get().getWindowManager()->correctMeshPath(bodyPart->mModel); } } @@ -467,7 +468,7 @@ void NpcAnimation::updateNpcBase() { const ESM::BodyPart* bp = store.get().search(headName); if (bp) - mHeadModel = "meshes\\" + bp->mModel; + mHeadModel = MWBase::Environment::get().getWindowManager()->correctMeshPath(bp->mModel); else Log(Debug::Warning) << "Warning: Failed to load body part '" << headName << "'"; } @@ -476,7 +477,7 @@ void NpcAnimation::updateNpcBase() { const ESM::BodyPart* bp = store.get().search(hairName); if (bp) - mHairModel = "meshes\\" + bp->mModel; + mHairModel = MWBase::Environment::get().getWindowManager()->correctMeshPath(bp->mModel); else Log(Debug::Warning) << "Warning: Failed to load body part '" << hairName << "'"; } @@ -493,7 +494,8 @@ void NpcAnimation::updateNpcBase() std::string smodel = defaultSkeleton; if (!is1stPerson && !isWerewolf && !mNpc->mModel.empty()) - smodel = Misc::ResourceHelpers::correctActorModelPath("meshes\\" + mNpc->mModel, mResourceSystem->getVFS()); + smodel = Misc::ResourceHelpers::correctActorModelPath( + MWBase::Environment::get().getWindowManager()->correctMeshPath(mNpc->mModel), mResourceSystem->getVFS()); setObjectRoot(smodel, true, true, false); @@ -653,8 +655,8 @@ void NpcAnimation::updateParts() if(store != inv.end() && (part=*store).getType() == ESM::Light::sRecordId) { const ESM::Light *light = part.get()->mBase; - addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, - 1, "meshes\\"+light->mModel, false, nullptr, true); + addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1, + MWBase::Environment::get().getWindowManager()->correctMeshPath(light->mModel), false, nullptr, true); if (mObjectParts[ESM::PRT_Shield]) addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(), light); } @@ -674,7 +676,7 @@ void NpcAnimation::updateParts() const ESM::BodyPart* bodypart = parts[part]; if(bodypart) addOrReplaceIndividualPart((ESM::PartReferenceType)part, -1, 1, - "meshes\\"+bodypart->mModel); + MWBase::Environment::get().getWindowManager()->correctMeshPath(bodypart->mModel)); } } @@ -904,7 +906,8 @@ void NpcAnimation::addPartGroup(int group, int priority, const std::vectormModel, enchantedGlow, glowColor); + addOrReplaceIndividualPart((ESM::PartReferenceType)part.mPart, group, priority, + MWBase::Environment::get().getWindowManager()->correctMeshPath(bodypart->mModel), enchantedGlow, glowColor); else reserveIndividualPart((ESM::PartReferenceType)part.mPart, group, priority); } diff --git a/apps/openmw/mwrender/objectpaging.cpp b/apps/openmw/mwrender/objectpaging.cpp index 23532f8b07..7513ecdabe 100644 --- a/apps/openmw/mwrender/objectpaging.cpp +++ b/apps/openmw/mwrender/objectpaging.cpp @@ -31,6 +31,7 @@ #include "apps/openmw/mwworld/esmstore.hpp" #include "apps/openmw/mwbase/environment.hpp" #include "apps/openmw/mwbase/world.hpp" +#include "apps/openmw/mwbase/windowmanager.hpp" #include "vismask.hpp" @@ -528,7 +529,7 @@ namespace MWRender int type = store.findStatic(ref.mRefID); std::string model = getModel(type, ref.mRefID, store); if (model.empty()) continue; - model = "meshes/" + model; + model = MWBase::Environment::get().getWindowManager()->correctMeshPath(model); if (activeGrid && type != ESM::REC_STAT) { diff --git a/apps/openmw/mwworld/groundcoverstore.cpp b/apps/openmw/mwworld/groundcoverstore.cpp index 1b27f8eed3..1c75ce19f2 100644 --- a/apps/openmw/mwworld/groundcoverstore.cpp +++ b/apps/openmw/mwworld/groundcoverstore.cpp @@ -4,6 +4,9 @@ #include #include +#include +#include + namespace MWWorld { void GroundcoverStore::init(const Store& statics, const Files::Collections& fileCollections, const std::vector& groundcoverFiles, ToUTF8::Utf8Encoder* encoder) @@ -18,13 +21,15 @@ namespace MWWorld for (const ESM::Static& stat : statics) { std::string id = Misc::StringUtils::lowerCase(stat.mId); - mMeshCache[id] = "meshes\\" + Misc::StringUtils::lowerCase(stat.mModel); + mMeshCache[id] = Misc::StringUtils::lowerCase( + MWBase::Environment::get().getWindowManager()->correctMeshPath(stat.mModel)); } for (const ESM::Static& stat : content.mStatics) { std::string id = Misc::StringUtils::lowerCase(stat.mId); - mMeshCache[id] = "meshes\\" + Misc::StringUtils::lowerCase(stat.mModel); + mMeshCache[id] = Misc::StringUtils::lowerCase( + MWBase::Environment::get().getWindowManager()->correctMeshPath(stat.mModel)); } for (const ESM::Cell& cell : content.mCells) diff --git a/apps/openmw/mwworld/projectilemanager.cpp b/apps/openmw/mwworld/projectilemanager.cpp index e931afa07b..3acef2db3f 100644 --- a/apps/openmw/mwworld/projectilemanager.cpp +++ b/apps/openmw/mwworld/projectilemanager.cpp @@ -32,6 +32,7 @@ #include "../mwbase/soundmanager.hpp" #include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" +#include "../mwbase/windowmanager.hpp" #include "../mwmechanics/combat.hpp" #include "../mwmechanics/creaturestats.hpp" @@ -218,7 +219,8 @@ namespace MWWorld SceneUtil::FindByNameVisitor findVisitor(nodeName.str()); attachTo->accept(findVisitor); if (findVisitor.mFoundNode) - mResourceSystem->getSceneManager()->getInstance("meshes\\" + weapon->mModel, findVisitor.mFoundNode); + mResourceSystem->getSceneManager()->getInstance( + MWBase::Environment::get().getWindowManager()->correctMeshPath(weapon->mModel), findVisitor.mFoundNode); } if (createLight) @@ -318,7 +320,8 @@ namespace MWWorld // in case there are multiple effects, the model is a dummy without geometry. Use the second effect for physics shape if (state.mIdMagic.size() > 1) - model = "meshes\\" + MWBase::Environment::get().getWorld()->getStore().get().find(state.mIdMagic[1])->mModel; + model = MWBase::Environment::get().getWindowManager()->correctMeshPath( + MWBase::Environment::get().getWorld()->getStore().get().find(state.mIdMagic[1])->mModel); state.mProjectileId = mPhysics->addProjectile(caster, pos, model, true); state.mToDelete = false; mMagicBolts.push_back(state); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 3c0d796e9b..0c0b3d593d 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3683,7 +3683,8 @@ namespace MWWorld if (texture.empty()) texture = Fallback::Map::getString("Blood_Texture_0"); - std::string model = "meshes\\" + Fallback::Map::getString("Blood_Model_" + std::to_string(Misc::Rng::rollDice(3))); // [0, 2] + std::string model = MWBase::Environment::get().getWindowManager()->correctMeshPath( + Fallback::Map::getString("Blood_Model_" + std::to_string(Misc::Rng::rollDice(3)))); // [0, 2] mRendering->spawnEffect(model, texture, worldPosition, 1.0f, false); } @@ -3722,11 +3723,15 @@ namespace MWWorld if (effectInfo.mArea <= 0) { if (effectInfo.mRange == ESM::RT_Target) - mRendering->spawnEffect("meshes\\" + areaStatic->mModel, texture, origin, 1.0f); + mRendering->spawnEffect( + MWBase::Environment::get().getWindowManager()->correctMeshPath(areaStatic->mModel), + texture, origin, 1.0f); continue; } else - mRendering->spawnEffect("meshes\\" + areaStatic->mModel, texture, origin, static_cast(effectInfo.mArea * 2)); + mRendering->spawnEffect( + MWBase::Environment::get().getWindowManager()->correctMeshPath(areaStatic->mModel), + texture, origin, static_cast(effectInfo.mArea * 2)); // Play explosion sound (make sure to use NoTrack, since we will delete the projectile now) static const std::string schools[] = {