mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 20:26:43 +00:00 
			
		
		
		
	Merge branch 'correct_path' into 'master'
Use existing functions and objects to call correctMeshPath etc (#6837) Closes #6837 See merge request OpenMW/openmw!2063
This commit is contained in:
		
						commit
						451cc6a07c
					
				
					 45 changed files with 222 additions and 226 deletions
				
			
		|  | @ -337,12 +337,6 @@ namespace MWBase | |||
| 
 | ||||
|             virtual void playSound(const std::string& soundId, float volume = 1.f, float pitch = 1.f) = 0; | ||||
| 
 | ||||
|             // In WindowManager for now since there isn't a VFS singleton
 | ||||
|             virtual std::string correctIconPath(const std::string& path) = 0; | ||||
|             virtual std::string correctTexturePath(const std::string& path) = 0; | ||||
|             virtual std::string correctMeshPath(const std::string& path) = 0; | ||||
|             virtual bool textureExists(const std::string& path) = 0; | ||||
| 
 | ||||
|             virtual void addCell(MWWorld::CellStore* cell) = 0; | ||||
|             virtual void removeCell(MWWorld::CellStore* cell) = 0; | ||||
|             virtual void writeFog(MWWorld::CellStore* cell) = 0; | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ | |||
| 
 | ||||
| #include "../mwmechanics/npcstats.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|  | @ -56,13 +57,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Activator::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Activator> *ref = ptr.get<ESM::Activator>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Activator>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     bool Activator::isActivator() const | ||||
|  | @ -142,11 +137,12 @@ namespace MWClass | |||
|         const std::string model = getModel(ptr); // Assume it's not empty, since we wouldn't have gotten the soundgen otherwise
 | ||||
|         const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();  | ||||
|         std::string creatureId; | ||||
|         const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
| 
 | ||||
|         for (const ESM::Creature &iter : store.get<ESM::Creature>()) | ||||
|         { | ||||
|             if (!iter.mModel.empty() && Misc::StringUtils::ciEqual(model, | ||||
|                 MWBase::Environment::get().getWindowManager()->correctMeshPath(iter.mModel))) | ||||
|                 Misc::ResourceHelpers::correctMeshPath(iter.mModel, vfs))) | ||||
|             { | ||||
|                 creatureId = !iter.mOriginal.empty() ? iter.mOriginal : iter.mId; | ||||
|                 break; | ||||
|  |  | |||
|  | @ -18,6 +18,8 @@ | |||
| 
 | ||||
| #include "../mwgui/tooltips.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Apparatus::Apparatus() | ||||
|  | @ -34,13 +36,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Apparatus::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Apparatus> *ref = ptr.get<ESM::Apparatus>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Apparatus>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Apparatus::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -26,6 +26,8 @@ | |||
| 
 | ||||
| #include "../mwgui/tooltips.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Armor::Armor() | ||||
|  | @ -42,13 +44,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Armor::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Armor>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Armor::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -5,8 +5,7 @@ | |||
| 
 | ||||
| #include "../mwworld/cellstore.hpp" | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|  | @ -41,13 +40,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string BodyPart::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::BodyPart> *ref = ptr.get<ESM::BodyPart>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::BodyPart>(ptr); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -23,6 +23,8 @@ | |||
| 
 | ||||
| #include "../mwmechanics/npcstats.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Book::Book() | ||||
|  | @ -39,13 +41,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Book::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Book> *ref = ptr.get<ESM::Book>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Book>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Book::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
							
								
								
									
										29
									
								
								apps/openmw/mwclass/classmodel.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								apps/openmw/mwclass/classmodel.hpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | |||
| #ifndef OPENMW_MWCLASS_CLASSMODEL_H | ||||
| #define OPENMW_MWCLASS_CLASSMODEL_H | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/livecellref.hpp" | ||||
| 
 | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| 
 | ||||
| #include <string> | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     template <class Class> | ||||
|     std::string getClassModel(const MWWorld::ConstPtr& ptr) | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<Class> *ref = ptr.get<Class>(); | ||||
| 
 | ||||
|         if (!ref->mBase->mModel.empty()) | ||||
|             return Misc::ResourceHelpers::correctMeshPath(ref->mBase->mModel, | ||||
|                 MWBase::Environment::get().getResourceSystem()->getVFS()); | ||||
| 
 | ||||
|         return {}; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  | @ -21,6 +21,8 @@ | |||
| #include "../mwrender/objects.hpp" | ||||
| #include "../mwrender/renderinginterface.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Clothing::Clothing() | ||||
|  | @ -37,13 +39,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Clothing::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Clothing> *ref = ptr.get<ESM::Clothing>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Clothing>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Clothing::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -30,6 +30,8 @@ | |||
| #include "../mwmechanics/npcstats.hpp" | ||||
| #include "../mwmechanics/inventory.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     ContainerCustomData::ContainerCustomData(const ESM::Container& container, MWWorld::CellStore* cell) | ||||
|  | @ -119,13 +121,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Container::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Container>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     bool Container::useAnim() const | ||||
|  |  | |||
|  | @ -41,6 +41,8 @@ | |||
| 
 | ||||
| #include "../mwgui/tooltips.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace | ||||
| { | ||||
|     bool isFlagBitSet(const MWWorld::ConstPtr &ptr, ESM::Creature::Flags bitMask) | ||||
|  | @ -182,13 +184,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Creature::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Creature>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     void Creature::getModelsToPreload(const MWWorld::Ptr &ptr, std::vector<std::string> &models) const | ||||
|  | @ -625,11 +621,12 @@ namespace MWClass | |||
|             const std::string model = getModel(ptr); | ||||
|             if (!model.empty()) | ||||
|             { | ||||
|                 const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|                 for (const ESM::Creature &creature : store.get<ESM::Creature>()) | ||||
|                 { | ||||
|                     if (creature.mId != ourId && creature.mOriginal != ourId && !creature.mModel.empty() | ||||
|                         && Misc::StringUtils::ciEqual(model, | ||||
|                             MWBase::Environment::get().getWindowManager()->correctMeshPath(creature.mModel))) | ||||
|                             Misc::ResourceHelpers::correctMeshPath(creature.mModel, vfs))) | ||||
|                     { | ||||
|                         const std::string& fallbackId = !creature.mOriginal.empty() ? creature.mOriginal : creature.mId; | ||||
|                         sound = store.get<ESM::SoundGenerator>().begin(); | ||||
|  |  | |||
|  | @ -32,6 +32,8 @@ | |||
| 
 | ||||
| #include "../mwmechanics/actorutil.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     class DoorCustomData : public MWWorld::TypedCustomData<DoorCustomData> | ||||
|  | @ -95,13 +97,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Door::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Door>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Door::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -20,6 +20,8 @@ | |||
| #include "../mwrender/objects.hpp" | ||||
| #include "../mwrender/renderinginterface.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Ingredient::Ingredient() | ||||
|  | @ -36,13 +38,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Ingredient::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Ingredient> *ref = ptr.get<ESM::Ingredient>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Ingredient>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Ingredient::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -23,6 +23,8 @@ | |||
| #include "../mwrender/objects.hpp" | ||||
| #include "../mwrender/renderinginterface.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Light::Light() | ||||
|  | @ -67,13 +69,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Light::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Light>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Light::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -20,6 +20,8 @@ | |||
| #include "../mwrender/objects.hpp" | ||||
| #include "../mwrender/renderinginterface.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Lockpick::Lockpick() | ||||
|  | @ -36,13 +38,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Lockpick::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Lockpick> *ref = ptr.get<ESM::Lockpick>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Lockpick>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Lockpick::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -21,6 +21,8 @@ | |||
| #include "../mwrender/objects.hpp" | ||||
| #include "../mwrender/renderinginterface.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Miscellaneous::Miscellaneous() | ||||
|  | @ -46,13 +48,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Miscellaneous::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = ptr.get<ESM::Miscellaneous>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Miscellaneous>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Miscellaneous::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| 
 | ||||
| #include <components/misc/constants.hpp> | ||||
| #include <components/misc/rng.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include <components/debug/debuglog.hpp> | ||||
| #include <components/esm3/loadmgef.hpp> | ||||
|  | @ -449,20 +450,22 @@ namespace MWClass | |||
|         models.emplace_back(Settings::Manager::getString("xbaseanimfemale", "Models")); | ||||
|         models.emplace_back(Settings::Manager::getString("xbaseanim", "Models")); | ||||
| 
 | ||||
|         const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
| 
 | ||||
|         if (!npc->mBase->mModel.empty()) | ||||
|             models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(npc->mBase->mModel)); | ||||
|             models.push_back(Misc::ResourceHelpers::correctMeshPath(npc->mBase->mModel, vfs)); | ||||
| 
 | ||||
|         if (!npc->mBase->mHead.empty()) | ||||
|         { | ||||
|             const ESM::BodyPart* head = MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(npc->mBase->mHead); | ||||
|             if (head) | ||||
|                 models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(head->mModel)); | ||||
|                 models.push_back(Misc::ResourceHelpers::correctMeshPath(head->mModel, vfs)); | ||||
|         } | ||||
|         if (!npc->mBase->mHair.empty()) | ||||
|         { | ||||
|             const ESM::BodyPart* hair = MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(npc->mBase->mHair); | ||||
|             if (hair) | ||||
|                 models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(hair->mModel)); | ||||
|                 models.push_back(Misc::ResourceHelpers::correctMeshPath(hair->mModel, vfs)); | ||||
|         } | ||||
| 
 | ||||
|         bool female = (npc->mBase->mFlags & ESM::NPC::Female); | ||||
|  | @ -500,7 +503,7 @@ namespace MWClass | |||
|                         partname = female ? it->mMale : it->mFemale; | ||||
|                     const ESM::BodyPart* part = MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(partname); | ||||
|                     if (part && !part->mModel.empty()) | ||||
|                         models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(part->mModel)); | ||||
|                         models.push_back(Misc::ResourceHelpers::correctMeshPath(part->mModel, vfs)); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | @ -513,7 +516,7 @@ namespace MWClass | |||
|             { | ||||
|                 const ESM::BodyPart* part = *it; | ||||
|                 if (part && !part->mModel.empty()) | ||||
|                     models.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(part->mModel)); | ||||
|                     models.push_back(Misc::ResourceHelpers::correctMeshPath(part->mModel, vfs)); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -22,6 +22,8 @@ | |||
| 
 | ||||
| #include "../mwmechanics/alchemy.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Potion::Potion() | ||||
|  | @ -38,13 +40,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Potion::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Potion> *ref = ptr.get<ESM::Potion>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Potion>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Potion::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -20,6 +20,8 @@ | |||
| #include "../mwrender/objects.hpp" | ||||
| #include "../mwrender/renderinginterface.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Probe::Probe() | ||||
|  | @ -36,13 +38,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Probe::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Probe> *ref = ptr.get<ESM::Probe>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Probe>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Probe::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -17,6 +17,8 @@ | |||
| #include "../mwrender/objects.hpp" | ||||
| #include "../mwrender/renderinginterface.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Repair::Repair() | ||||
|  | @ -33,13 +35,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Repair::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Repair> *ref = ptr.get<ESM::Repair>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Repair>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Repair::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -11,8 +11,7 @@ | |||
| #include "../mwrender/renderinginterface.hpp" | ||||
| #include "../mwrender/vismask.hpp" | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|  | @ -42,13 +41,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Static::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Static> *ref = ptr.get<ESM::Static>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Static>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Static::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -26,6 +26,8 @@ | |||
| #include "../mwrender/objects.hpp" | ||||
| #include "../mwrender/renderinginterface.hpp" | ||||
| 
 | ||||
| #include "classmodel.hpp" | ||||
| 
 | ||||
| namespace MWClass | ||||
| { | ||||
|     Weapon::Weapon() | ||||
|  | @ -42,13 +44,7 @@ namespace MWClass | |||
| 
 | ||||
|     std::string Weapon::getModel(const MWWorld::ConstPtr &ptr) const | ||||
|     { | ||||
|         const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>(); | ||||
| 
 | ||||
|         const std::string &model = ref->mBase->mModel; | ||||
|         if (!model.empty()) { | ||||
|             return MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|         } | ||||
|         return ""; | ||||
|         return getClassModel<ESM::Weapon>(ptr); | ||||
|     } | ||||
| 
 | ||||
|     std::string Weapon::getName (const MWWorld::ConstPtr& ptr) const | ||||
|  |  | |||
|  | @ -5,6 +5,9 @@ | |||
| #include <MyGUI_Gui.h> | ||||
| #include <MyGUI_ScrollView.h> | ||||
| 
 | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/world.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
|  | @ -190,7 +193,8 @@ namespace MWGui | |||
|         const ESM::BirthSign *birth = | ||||
|             store.get<ESM::BirthSign>().find(mCurrentBirthId); | ||||
| 
 | ||||
|         mBirthImage->setImageTexture(MWBase::Environment::get().getWindowManager()->correctTexturePath(birth->mTexture)); | ||||
|         mBirthImage->setImageTexture(Misc::ResourceHelpers::correctTexturePath(birth->mTexture, | ||||
|             MWBase::Environment::get().getResourceSystem()->getVFS())); | ||||
| 
 | ||||
|         std::vector<std::string> abilities, powers, spells; | ||||
| 
 | ||||
|  |  | |||
|  | @ -13,6 +13,9 @@ | |||
| #include "../mwworld/esmstore.hpp" | ||||
| 
 | ||||
| #include <components/debug/debuglog.hpp> | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| #include <components/vfs/manager.hpp> | ||||
| 
 | ||||
| #include "tooltips.hpp" | ||||
| 
 | ||||
|  | @ -920,8 +923,9 @@ namespace MWGui | |||
| 
 | ||||
|     void setClassImage(MyGUI::ImageBox* imageBox, const std::string &classId) | ||||
|     { | ||||
|         std::string classImage = std::string("textures\\levelup\\") + classId + ".dds"; | ||||
|         if (!MWBase::Environment::get().getWindowManager()->textureExists(classImage)) | ||||
|         const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|         std::string classImage = Misc::ResourceHelpers::correctTexturePath("textures\\levelup\\" + classId + ".dds", vfs); | ||||
|         if (!vfs->exists(classImage)) | ||||
|         { | ||||
|             Log(Debug::Warning) << "No class image for " << classId << ", falling back to default"; | ||||
|             classImage = "textures\\levelup\\warrior.dds"; | ||||
|  |  | |||
|  | @ -8,6 +8,8 @@ | |||
| #include <MyGUI_ScrollView.h> | ||||
| 
 | ||||
| #include <components/settings/settings.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
|  | @ -413,7 +415,7 @@ namespace MWGui | |||
|         std::string icon = effect->mIcon; | ||||
|         int slashPos = icon.rfind('\\'); | ||||
|         icon.insert(slashPos+1, "b_"); | ||||
|         icon = MWBase::Environment::get().getWindowManager()->correctIconPath(icon); | ||||
|         icon = Misc::ResourceHelpers::correctIconPath(icon, MWBase::Environment::get().getResourceSystem()->getVFS()); | ||||
| 
 | ||||
|         mSpellImage->setSpellIcon(icon); | ||||
|     } | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| // correctIconPath
 | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| #include <components/vfs/manager.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
|  | @ -110,11 +111,12 @@ namespace MWGui | |||
|         std::string invIcon = ptr.getClass().getInventoryIcon(ptr); | ||||
|         if (invIcon.empty()) | ||||
|             invIcon = "default icon.tga"; | ||||
|         invIcon = MWBase::Environment::get().getWindowManager()->correctIconPath(invIcon); | ||||
|         if (!MWBase::Environment::get().getResourceSystem()->getVFS()->exists(invIcon)) | ||||
|         const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|         invIcon = Misc::ResourceHelpers::correctIconPath(invIcon, vfs); | ||||
|         if (!vfs->exists(invIcon)) | ||||
|         { | ||||
|             Log(Debug::Error) << "Failed to open image: '" << invIcon << "' not found, falling back to 'default-icon.tga'"; | ||||
|             invIcon = MWBase::Environment::get().getWindowManager()->correctIconPath("default icon.tga"); | ||||
|             invIcon = Misc::ResourceHelpers::correctIconPath("default icon.tga", vfs); | ||||
|         } | ||||
|         setIcon(invIcon); | ||||
|     } | ||||
|  |  | |||
|  | @ -8,6 +8,8 @@ | |||
| 
 | ||||
| #include <components/esm3/esmwriter.hpp> | ||||
| #include <components/esm3/quickkeys.hpp> | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include "../mwworld/inventorystore.hpp" | ||||
| #include "../mwworld/class.hpp" | ||||
|  | @ -300,7 +302,7 @@ namespace MWGui | |||
|         std::string path = effect->mIcon; | ||||
|         int slashPos = path.rfind('\\'); | ||||
|         path.insert(slashPos+1, "b_"); | ||||
|         path = MWBase::Environment::get().getWindowManager()->correctIconPath(path); | ||||
|         path = Misc::ResourceHelpers::correctIconPath(path, MWBase::Environment::get().getResourceSystem()->getVFS()); | ||||
| 
 | ||||
|         float scale = 1.f; | ||||
|         MyGUI::ITexture* texture = MyGUI::RenderManager::getInstance().getTexture("textures\\menu_icon_select_magic.dds"); | ||||
|  |  | |||
|  | @ -7,6 +7,8 @@ | |||
| 
 | ||||
| #include <components/esm/records.hpp> | ||||
| #include <components/widgets/list.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| 
 | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
| #include "../mwbase/mechanicsmanager.hpp" | ||||
|  | @ -187,7 +189,8 @@ namespace MWGui | |||
| 
 | ||||
|     void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect) | ||||
|     { | ||||
|         mEffectImage->setImageTexture(MWBase::Environment::get().getWindowManager()->correctIconPath(effect->mIcon)); | ||||
|         mEffectImage->setImageTexture(Misc::ResourceHelpers::correctIconPath(effect->mIcon, | ||||
|             MWBase::Environment::get().getResourceSystem()->getVFS())); | ||||
| 
 | ||||
|         mEffectName->setCaptionWithReplacing("#{"+ESM::MagicEffect::effectIdToString  (effect->mIndex)+"}"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,6 +7,8 @@ | |||
| 
 | ||||
| #include <components/esm3/loadmgef.hpp> | ||||
| #include <components/settings/settings.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| 
 | ||||
| #include "../mwbase/world.hpp" | ||||
| #include "../mwbase/environment.hpp" | ||||
|  | @ -134,7 +136,8 @@ namespace MWGui | |||
|                         ("ImageBox", MyGUI::IntCoord(w,2,16,16), MyGUI::Align::Default); | ||||
|                     mWidgetMap[effectId] = image; | ||||
| 
 | ||||
|                     image->setImageTexture(MWBase::Environment::get().getWindowManager()->correctIconPath(effect->mIcon)); | ||||
|                     image->setImageTexture(Misc::ResourceHelpers::correctIconPath(effect->mIcon, | ||||
|                         MWBase::Environment::get().getResourceSystem()->getVFS())); | ||||
| 
 | ||||
|                     std::string name = ESM::MagicEffect::effectIdToString (effectId); | ||||
| 
 | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| 
 | ||||
| #include <components/settings/settings.hpp> | ||||
| #include <components/widgets/box.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include "../mwbase/world.hpp" | ||||
| #include "../mwbase/environment.hpp" | ||||
|  | @ -436,7 +437,8 @@ namespace MWGui | |||
| 
 | ||||
|         const int maximumWidth = MyGUI::RenderManager::getInstance().getViewSize().width - imageCaptionHPadding * 2; | ||||
| 
 | ||||
|         std::string realImage = MWBase::Environment::get().getWindowManager()->correctIconPath(image); | ||||
|         const std::string realImage = Misc::ResourceHelpers::correctIconPath(image, | ||||
|             MWBase::Environment::get().getResourceSystem()->getVFS()); | ||||
| 
 | ||||
|         Gui::EditBox* captionWidget = mDynamicToolTipBox->createWidget<Gui::EditBox>("NormalText", MyGUI::IntCoord(0, 0, 300, 300), MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipCaption"); | ||||
|         captionWidget->setEditStatic(true); | ||||
|  | @ -843,10 +845,11 @@ namespace MWGui | |||
|             MWBase::Environment::get().getWorld()->getStore(); | ||||
| 
 | ||||
|         const ESM::BirthSign *sign = store.get<ESM::BirthSign>().find(birthsignId); | ||||
|         const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
| 
 | ||||
|         widget->setUserString("ToolTipType", "Layout"); | ||||
|         widget->setUserString("ToolTipLayout", "BirthSignToolTip"); | ||||
|         widget->setUserString("ImageTexture_BirthSignImage", MWBase::Environment::get().getWindowManager()->correctTexturePath(sign->mTexture)); | ||||
|         widget->setUserString("ImageTexture_BirthSignImage", Misc::ResourceHelpers::correctTexturePath(sign->mTexture, vfs)); | ||||
|         std::string text; | ||||
| 
 | ||||
|         text += sign->mName; | ||||
|  | @ -938,7 +941,7 @@ namespace MWGui | |||
|         std::string icon = effect->mIcon; | ||||
|         int slashPos = icon.rfind('\\'); | ||||
|         icon.insert(slashPos+1, "b_"); | ||||
|         icon = MWBase::Environment::get().getWindowManager()->correctIconPath(icon); | ||||
|         icon = Misc::ResourceHelpers::correctIconPath(icon, MWBase::Environment::get().getResourceSystem()->getVFS()); | ||||
| 
 | ||||
|         widget->setUserString("ToolTipType", "Layout"); | ||||
|         widget->setUserString("ToolTipLayout", "MagicEffectToolTip"); | ||||
|  |  | |||
|  | @ -7,6 +7,9 @@ | |||
| #include <MyGUI_ImageBox.h> | ||||
| #include <MyGUI_ControllerManager.h> | ||||
| 
 | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/world.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
|  | @ -470,7 +473,7 @@ namespace MWGui::Widgets | |||
|             mTextWidget->setCaptionWithReplacing(spellLine); | ||||
|             mRequestedWidth = mTextWidget->getTextSize().width + sIconOffset; | ||||
| 
 | ||||
|             mImageWidget->setImageTexture(MWBase::Environment::get().getWindowManager()->correctIconPath(magicEffect->mIcon)); | ||||
|             mImageWidget->setImageTexture(Misc::ResourceHelpers::correctIconPath(magicEffect->mIcon, MWBase::Environment::get().getResourceSystem()->getVFS())); | ||||
|         } | ||||
| 
 | ||||
|         MWSpellEffect::~MWSpellEffect() | ||||
|  |  | |||
|  | @ -2122,27 +2122,6 @@ namespace MWGui | |||
|         mConsole->setConsoleMode(mode); | ||||
|     } | ||||
| 
 | ||||
|     std::string WindowManager::correctIconPath(const std::string& path) | ||||
|     { | ||||
|         return Misc::ResourceHelpers::correctIconPath(path, mResourceSystem->getVFS()); | ||||
|     } | ||||
| 
 | ||||
|     std::string WindowManager::correctTexturePath(const std::string& path) | ||||
|     { | ||||
|         return Misc::ResourceHelpers::correctTexturePath(path, mResourceSystem->getVFS()); | ||||
|     } | ||||
| 
 | ||||
|     std::string WindowManager::correctMeshPath(const std::string& path) | ||||
|     { | ||||
|         return Misc::ResourceHelpers::correctMeshPath(path, mResourceSystem->getVFS()); | ||||
|     } | ||||
| 
 | ||||
|     bool WindowManager::textureExists(const std::string &path) | ||||
|     { | ||||
|         std::string corrected = Misc::ResourceHelpers::correctTexturePath(path, mResourceSystem->getVFS()); | ||||
|         return mResourceSystem->getVFS()->exists(corrected); | ||||
|     } | ||||
| 
 | ||||
|     void WindowManager::createCursors() | ||||
|     { | ||||
|         // FIXME: currently we do not scale cursor since it is not a MyGUI widget.
 | ||||
|  |  | |||
|  | @ -377,12 +377,6 @@ namespace MWGui | |||
| 
 | ||||
|     void playSound(const std::string& soundId, float volume = 1.f, float pitch = 1.f) override; | ||||
| 
 | ||||
|     // In WindowManager for now since there isn't a VFS singleton
 | ||||
|     std::string correctIconPath(const std::string& path) override; | ||||
|     std::string correctTexturePath(const std::string& path) override; | ||||
|     std::string correctMeshPath(const std::string& path) override; | ||||
|     bool textureExists(const std::string& path) override; | ||||
| 
 | ||||
|     void addCell(MWWorld::CellStore* cell) override; | ||||
|     void removeCell(MWWorld::CellStore* cell) override; | ||||
|     void writeFog(MWWorld::CellStore* cell) override; | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| 
 | ||||
| #include <components/misc/rng.hpp> | ||||
| #include <components/misc/stringops.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include <components/esm3/loadmgef.hpp> | ||||
| 
 | ||||
|  | @ -17,7 +18,6 @@ | |||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/world.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
| 
 | ||||
| #include "../mwrender/animation.hpp" | ||||
| 
 | ||||
|  | @ -262,9 +262,12 @@ namespace MWMechanics | |||
|                 const ESM::Static* reflectStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find("VFX_Reflect"); | ||||
|                 MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr); | ||||
|                 if(animation && !reflectStatic->mModel.empty()) | ||||
|                 { | ||||
|                     const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|                     animation->addEffect( | ||||
|                         MWBase::Environment::get().getWindowManager()->correctMeshPath(reflectStatic->mModel), | ||||
|                         Misc::ResourceHelpers::correctMeshPath(reflectStatic->mModel, vfs), | ||||
|                         ESM::MagicEffect::Reflect, false, std::string()); | ||||
|                 } | ||||
|                 caster.getClass().getCreatureStats(caster).getActiveSpells().addSpell(*reflected); | ||||
|             } | ||||
|             if(removedSpell) | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ | |||
| #include <components/misc/rng.hpp> | ||||
| #include <components/misc/mathutil.hpp> | ||||
| #include <components/settings/settings.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include "../mwworld/esmstore.hpp" | ||||
| #include "../mwworld/class.hpp" | ||||
|  | @ -203,9 +204,12 @@ void soulTrap(const MWWorld::Ptr& creature) | |||
|             const ESM::Static* fx = world->getStore().get<ESM::Static>() | ||||
|                     .search("VFX_Soul_Trap"); | ||||
|             if (fx) | ||||
|             { | ||||
|                 const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|                 world->spawnEffect( | ||||
|                     MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel), | ||||
|                     Misc::ResourceHelpers::correctMeshPath(fx->mModel, vfs), | ||||
|                     "", 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
 | ||||
|  | @ -1747,9 +1751,12 @@ namespace MWMechanics | |||
|             const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>() | ||||
|                     .search("VFX_Summon_End"); | ||||
|             if (fx) | ||||
|             { | ||||
|                 const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|                 MWBase::Environment::get().getWorld()->spawnEffect( | ||||
|                     MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel), | ||||
|                     Misc::ResourceHelpers::correctMeshPath(fx->mModel, vfs), | ||||
|                     "", ptr.getRefData().getPosition().asVec3()); | ||||
|             } | ||||
| 
 | ||||
|             // Remove the summoned creature's summoned creatures as well
 | ||||
|             MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr); | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ | |||
| #include <components/misc/mathutil.hpp> | ||||
| #include <components/misc/rng.hpp> | ||||
| #include <components/misc/stringops.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include <components/settings/settings.hpp> | ||||
| 
 | ||||
|  | @ -1402,16 +1403,18 @@ bool CharacterController::updateState(CharacterState idle) | |||
| 
 | ||||
|                     const ESM::Static* castStatic = world->getStore().get<ESM::Static>().find ("VFX_Hands"); | ||||
| 
 | ||||
|                     const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
| 
 | ||||
|                     for (size_t iter = 0; iter < effects.size(); ++iter) // play hands vfx for each effect
 | ||||
|                     { | ||||
|                         if (mAnimation->getNode("Bip01 L Hand")) | ||||
|                             mAnimation->addEffect( | ||||
|                                 MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel), | ||||
|                                 Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs), | ||||
|                                 -1, false, "Bip01 L Hand", effect->mParticle); | ||||
| 
 | ||||
|                         if (mAnimation->getNode("Bip01 R Hand")) | ||||
|                             mAnimation->addEffect( | ||||
|                                 MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel), | ||||
|                                 Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs), | ||||
|                                 -1, false, "Bip01 R Hand", effect->mParticle); | ||||
|                     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -2,6 +2,7 @@ | |||
| 
 | ||||
| #include <components/misc/constants.hpp> | ||||
| #include <components/misc/rng.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
| #include "../mwbase/soundmanager.hpp" | ||||
|  | @ -464,6 +465,8 @@ namespace MWMechanics | |||
|     { | ||||
|         const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|         std::vector<std::string> addedEffects; | ||||
|         const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
| 
 | ||||
|         for (const ESM::ENAMstruct& effectData : effects) | ||||
|         { | ||||
|             const auto effect = store.get<ESM::MagicEffect>().find(effectData.mEffectID); | ||||
|  | @ -477,7 +480,7 @@ namespace MWMechanics | |||
| 
 | ||||
|             // check if the effect was already added
 | ||||
|             if (std::find(addedEffects.begin(), addedEffects.end(), | ||||
|                 MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel)) | ||||
|                 Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs)) | ||||
|                 != addedEffects.end()) | ||||
|                 continue; | ||||
| 
 | ||||
|  | @ -485,7 +488,7 @@ namespace MWMechanics | |||
|             if (animation) | ||||
|             { | ||||
|                 animation->addEffect( | ||||
|                     MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel), | ||||
|                     Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs), | ||||
|                     effect->mIndex, false, "", effect->mParticle); | ||||
|             } | ||||
|             else | ||||
|  | @ -516,7 +519,7 @@ namespace MWMechanics | |||
|                 } | ||||
|                 scale = std::max(scale, 1.f); | ||||
|                 MWBase::Environment::get().getWorld()->spawnEffect( | ||||
|                     MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel), | ||||
|                     Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs), | ||||
|                     effect->mParticle, pos, scale); | ||||
|             } | ||||
| 
 | ||||
|  | @ -527,7 +530,7 @@ namespace MWMechanics | |||
|                 "alteration", "conjuration", "destruction", "illusion", "mysticism", "restoration" | ||||
|             }; | ||||
| 
 | ||||
|             addedEffects.push_back(MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel)); | ||||
|             addedEffects.push_back(Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs)); | ||||
| 
 | ||||
|             MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); | ||||
|             if(!effect->mCastSound.empty()) | ||||
|  | @ -565,9 +568,12 @@ namespace MWMechanics | |||
|         { | ||||
|             // Don't play particle VFX unless the effect is new or it should be looping.
 | ||||
|             if (playNonLooping || loop) | ||||
|             { | ||||
|                 const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|                 anim->addEffect( | ||||
|                     MWBase::Environment::get().getWindowManager()->correctMeshPath(castStatic->mModel), | ||||
|                     Misc::ResourceHelpers::correctMeshPath(castStatic->mModel, vfs), | ||||
|                     magicEffect.mIndex, loop, "", magicEffect.mParticle); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| #include <components/esm3/loadmgef.hpp> | ||||
| #include <components/misc/rng.hpp> | ||||
| #include <components/settings/settings.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/mechanicsmanager.hpp" | ||||
|  | @ -272,9 +273,12 @@ namespace | |||
|         const ESM::Static* absorbStatic = esmStore.get<ESM::Static>().find("VFX_Absorb"); | ||||
|         MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target); | ||||
|         if (animation && !absorbStatic->mModel.empty()) | ||||
|         { | ||||
|             const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|             animation->addEffect( | ||||
|                 MWBase::Environment::get().getWindowManager()->correctMeshPath(absorbStatic->mModel), | ||||
|                 Misc::ResourceHelpers::correctMeshPath(absorbStatic->mModel, vfs), | ||||
|                 ESM::MagicEffect::SpellAbsorption, false, std::string()); | ||||
|         } | ||||
|         const ESM::Spell* spell = esmStore.get<ESM::Spell>().search(spellId); | ||||
|         int spellCost = 0; | ||||
|         if (spell) | ||||
|  | @ -432,7 +436,10 @@ void applyMagicEffect(const MWWorld::Ptr& target, const MWWorld::Ptr& caster, co | |||
|                     anim->removeEffect(effect.mEffectId); | ||||
|                     const ESM::Static* fx = world->getStore().get<ESM::Static>().search("VFX_Summon_end"); | ||||
|                     if (fx) | ||||
|                         anim->addEffect(MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel), -1); | ||||
|                     { | ||||
|                         const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|                         anim->addEffect(Misc::ResourceHelpers::correctMeshPath(fx->mModel, vfs), -1); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             else if (caster == getPlayer()) | ||||
|  |  | |||
|  | @ -3,7 +3,6 @@ | |||
| #include <limits> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
| #include "../mwbase/world.hpp" | ||||
| 
 | ||||
| #include "../mwworld/class.hpp" | ||||
|  |  | |||
|  | @ -1,11 +1,11 @@ | |||
| #include "summoning.hpp" | ||||
| 
 | ||||
| #include <components/debug/debuglog.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/world.hpp" | ||||
| #include "../mwbase/mechanicsmanager.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
| 
 | ||||
| #include "../mwworld/esmstore.hpp" | ||||
| #include "../mwworld/class.hpp" | ||||
|  | @ -86,7 +86,10 @@ namespace MWMechanics | |||
|                 { | ||||
|                     const ESM::Static* fx = world->getStore().get<ESM::Static>().search("VFX_Summon_Start"); | ||||
|                     if (fx) | ||||
|                         anim->addEffect(MWBase::Environment::get().getWindowManager()->correctMeshPath(fx->mModel), -1, false); | ||||
|                     { | ||||
|                         const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|                         anim->addEffect(Misc::ResourceHelpers::correctMeshPath(fx->mModel, vfs), -1, false); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             catch (std::exception& e) | ||||
|  |  | |||
|  | @ -17,6 +17,7 @@ | |||
| #include <components/sceneutil/visitor.hpp> | ||||
| 
 | ||||
| #include <components/misc/stringops.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include <components/settings/settings.hpp> | ||||
| 
 | ||||
|  | @ -24,7 +25,6 @@ | |||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/world.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/class.hpp" | ||||
| #include "../mwworld/cellstore.hpp" | ||||
|  | @ -128,7 +128,8 @@ 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 MWBase::Environment::get().getWindowManager()->correctMeshPath(bodypart->mModel); | ||||
|                     return Misc::ResourceHelpers::correctMeshPath(bodypart->mModel, | ||||
|                         MWBase::Environment::get().getResourceSystem()->getVFS()); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  |  | |||
|  | @ -39,7 +39,6 @@ | |||
| #include "../mwbase/world.hpp" | ||||
| #include "../mwbase/mechanicsmanager.hpp" | ||||
| #include "../mwbase/soundmanager.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
| 
 | ||||
| #include "camera.hpp" | ||||
| #include "rotatecontroller.hpp" | ||||
|  | @ -51,7 +50,7 @@ | |||
| namespace | ||||
| { | ||||
| 
 | ||||
| std::string getVampireHead(const std::string& race, bool female) | ||||
| std::string getVampireHead(const std::string& race, bool female, const VFS::Manager& vfs) | ||||
| { | ||||
|     static std::map <std::pair<std::string,int>, const ESM::BodyPart* > sVampireMapping; | ||||
| 
 | ||||
|  | @ -81,7 +80,7 @@ std::string getVampireHead(const std::string& race, bool female) | |||
|     const ESM::BodyPart* bodyPart = sVampireMapping[thisCombination]; | ||||
|     if (!bodyPart) | ||||
|         return std::string(); | ||||
|     return MWBase::Environment::get().getWindowManager()->correctMeshPath(bodyPart->mModel); | ||||
|     return Misc::ResourceHelpers::correctMeshPath(bodyPart->mModel, &vfs); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  | @ -470,7 +469,7 @@ void NpcAnimation::updateNpcBase() | |||
|     { | ||||
|         const ESM::BodyPart* bp = store.get<ESM::BodyPart>().search(headName); | ||||
|         if (bp) | ||||
|             mHeadModel = MWBase::Environment::get().getWindowManager()->correctMeshPath(bp->mModel); | ||||
|             mHeadModel = Misc::ResourceHelpers::correctMeshPath(bp->mModel, mResourceSystem->getVFS()); | ||||
|         else | ||||
|             Log(Debug::Warning) << "Warning: Failed to load body part '" << headName << "'"; | ||||
|     } | ||||
|  | @ -479,12 +478,12 @@ void NpcAnimation::updateNpcBase() | |||
|     { | ||||
|         const ESM::BodyPart* bp = store.get<ESM::BodyPart>().search(hairName); | ||||
|         if (bp) | ||||
|             mHairModel = MWBase::Environment::get().getWindowManager()->correctMeshPath(bp->mModel); | ||||
|             mHairModel = Misc::ResourceHelpers::correctMeshPath(bp->mModel, mResourceSystem->getVFS()); | ||||
|         else | ||||
|             Log(Debug::Warning) << "Warning: Failed to load body part '" << hairName << "'"; | ||||
|     } | ||||
| 
 | ||||
|     const std::string& vampireHead = getVampireHead(mNpc->mRace, isFemale); | ||||
|     const std::string vampireHead = getVampireHead(mNpc->mRace, isFemale, *mResourceSystem->getVFS()); | ||||
|     if (!isWerewolf && isVampire && !vampireHead.empty()) | ||||
|         mHeadModel = vampireHead; | ||||
| 
 | ||||
|  | @ -497,7 +496,7 @@ void NpcAnimation::updateNpcBase() | |||
|     std::string smodel = defaultSkeleton; | ||||
|     if (!is1stPerson && !isWerewolf && !mNpc->mModel.empty()) | ||||
|         smodel = Misc::ResourceHelpers::correctActorModelPath( | ||||
|             MWBase::Environment::get().getWindowManager()->correctMeshPath(mNpc->mModel), mResourceSystem->getVFS()); | ||||
|             Misc::ResourceHelpers::correctMeshPath(mNpc->mModel, mResourceSystem->getVFS()), mResourceSystem->getVFS()); | ||||
| 
 | ||||
|     setObjectRoot(smodel, true, true, false); | ||||
| 
 | ||||
|  | @ -657,8 +656,9 @@ void NpcAnimation::updateParts() | |||
|         if(store != inv.end() && (part=*store).getType() == ESM::Light::sRecordId) | ||||
|         { | ||||
|             const ESM::Light *light = part.get<ESM::Light>()->mBase; | ||||
|             const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|             addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1, | ||||
|                 MWBase::Environment::get().getWindowManager()->correctMeshPath(light->mModel), false, nullptr, true); | ||||
|                 Misc::ResourceHelpers::correctMeshPath(light->mModel, vfs), false, nullptr, true); | ||||
|             if (mObjectParts[ESM::PRT_Shield]) | ||||
|                 addExtraLight(mObjectParts[ESM::PRT_Shield]->getNode()->asGroup(), light); | ||||
|         } | ||||
|  | @ -677,8 +677,11 @@ void NpcAnimation::updateParts() | |||
|         { | ||||
|             const ESM::BodyPart* bodypart = parts[part]; | ||||
|             if(bodypart) | ||||
|                 addOrReplaceIndividualPart((ESM::PartReferenceType)part, -1, 1, | ||||
|                     MWBase::Environment::get().getWindowManager()->correctMeshPath(bodypart->mModel)); | ||||
|             { | ||||
|                 const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|                 addOrReplaceIndividualPart(static_cast<ESM::PartReferenceType>(part), -1, 1, | ||||
|                     Misc::ResourceHelpers::correctMeshPath(bodypart->mModel, vfs)); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | @ -908,8 +911,11 @@ void NpcAnimation::addPartGroup(int group, int priority, const std::vector<ESM:: | |||
|         } | ||||
| 
 | ||||
|         if(bodypart) | ||||
|             addOrReplaceIndividualPart((ESM::PartReferenceType)part.mPart, group, priority, | ||||
|                 MWBase::Environment::get().getWindowManager()->correctMeshPath(bodypart->mModel), enchantedGlow, glowColor); | ||||
|         { | ||||
|             const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
|             addOrReplaceIndividualPart(static_cast<ESM::PartReferenceType>(part.mPart), group, priority, | ||||
|                 Misc::ResourceHelpers::correctMeshPath(bodypart->mModel, vfs), enchantedGlow, glowColor); | ||||
|         } | ||||
|         else | ||||
|             reserveIndividualPart((ESM::PartReferenceType)part.mPart, group, priority); | ||||
|     } | ||||
|  |  | |||
|  | @ -32,10 +32,11 @@ | |||
| #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" | ||||
| 
 | ||||
| #include <condition_variable> | ||||
| 
 | ||||
| namespace MWRender | ||||
| { | ||||
| 
 | ||||
|  | @ -532,7 +533,7 @@ namespace MWRender | |||
|             int type = store.findStatic(ref.mRefID); | ||||
|             std::string model = getModel(type, ref.mRefID, store); | ||||
|             if (model.empty()) continue; | ||||
|             model = MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|             model = Misc::ResourceHelpers::correctMeshPath(model, mSceneManager->getVFS()); | ||||
| 
 | ||||
|             if (activeGrid && type != ESM::REC_STAT) | ||||
|             { | ||||
|  |  | |||
|  | @ -4,9 +4,10 @@ | |||
| #include <components/esmloader/esmdata.hpp> | ||||
| #include <components/misc/stringops.hpp> | ||||
| #include <components/esm3/readerscache.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| 
 | ||||
| #include <apps/openmw/mwbase/environment.hpp> | ||||
| #include <apps/openmw/mwbase/windowmanager.hpp> | ||||
| 
 | ||||
| #include "store.hpp" | ||||
| 
 | ||||
|  | @ -23,6 +24,8 @@ namespace MWWorld | |||
|         const ::EsmLoader::EsmData content = ::EsmLoader::loadEsmData(query, groundcoverFiles, fileCollections, | ||||
|                                                                       readers, encoder, listener); | ||||
| 
 | ||||
|         const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
| 
 | ||||
|         static constexpr std::string_view prefix = "grass\\"; | ||||
|         for (const ESM::Static& stat : statics) | ||||
|         { | ||||
|  | @ -31,7 +34,7 @@ namespace MWWorld | |||
|             std::replace(model.begin(), model.end(), '/', '\\'); | ||||
|             if (model.compare(0, prefix.size(), prefix) != 0) | ||||
|                 continue; | ||||
|             mMeshCache[id] = MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|             mMeshCache[id] = Misc::ResourceHelpers::correctMeshPath(model, vfs); | ||||
|         } | ||||
| 
 | ||||
|         for (const ESM::Static& stat : content.mStatics) | ||||
|  | @ -41,7 +44,7 @@ namespace MWWorld | |||
|             std::replace(model.begin(), model.end(), '/', '\\'); | ||||
|             if (model.compare(0, prefix.size(), prefix) != 0) | ||||
|                 continue; | ||||
|             mMeshCache[id] = MWBase::Environment::get().getWindowManager()->correctMeshPath(model); | ||||
|             mMeshCache[id] = Misc::ResourceHelpers::correctMeshPath(model, vfs); | ||||
|         } | ||||
| 
 | ||||
|         for (const ESM::Cell& cell : content.mCells) | ||||
|  |  | |||
|  | @ -13,6 +13,7 @@ | |||
| 
 | ||||
| #include <components/misc/constants.hpp> | ||||
| #include <components/misc/convert.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| 
 | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| #include <components/resource/scenemanager.hpp> | ||||
|  | @ -211,6 +212,9 @@ namespace MWWorld | |||
|         osg::ref_ptr<osg::Node> projectile = mResourceSystem->getSceneManager()->getInstance(model, attachTo); | ||||
| 
 | ||||
|         if (state.mIdMagic.size() > 1) | ||||
|         { | ||||
|             const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS(); | ||||
| 
 | ||||
|             for (size_t iter = 1; iter != state.mIdMagic.size(); ++iter) | ||||
|             { | ||||
|                 std::ostringstream nodeName; | ||||
|  | @ -220,8 +224,9 @@ namespace MWWorld | |||
|                 attachTo->accept(findVisitor); | ||||
|                 if (findVisitor.mFoundNode) | ||||
|                     mResourceSystem->getSceneManager()->getInstance( | ||||
|                         MWBase::Environment::get().getWindowManager()->correctMeshPath(weapon->mModel), findVisitor.mFoundNode); | ||||
|                         Misc::ResourceHelpers::correctMeshPath(weapon->mModel, vfs), findVisitor.mFoundNode); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (createLight) | ||||
|         { | ||||
|  | @ -320,8 +325,11 @@ 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 = MWBase::Environment::get().getWindowManager()->correctMeshPath( | ||||
|                 MWBase::Environment::get().getWorld()->getStore().get<ESM::Weapon>().find(state.mIdMagic[1])->mModel); | ||||
|         { | ||||
|             model = Misc::ResourceHelpers::correctMeshPath( | ||||
|                 MWBase::Environment::get().getWorld()->getStore().get<ESM::Weapon>().find(state.mIdMagic[1])->mModel, | ||||
|                 MWBase::Environment::get().getResourceSystem()->getVFS()); | ||||
|         } | ||||
|         state.mProjectileId = mPhysics->addProjectile(caster, pos, model, true); | ||||
|         state.mToDelete = false; | ||||
|         mMagicBolts.push_back(state); | ||||
|  |  | |||
|  | @ -3690,8 +3690,9 @@ namespace MWWorld | |||
|         if (texture.empty()) | ||||
|             texture = Fallback::Map::getString("Blood_Texture_0"); | ||||
| 
 | ||||
|         std::string model = MWBase::Environment::get().getWindowManager()->correctMeshPath( | ||||
|             Fallback::Map::getString("Blood_Model_" + std::to_string(Misc::Rng::rollDice(3)))); // [0, 2]
 | ||||
|         std::string model = Misc::ResourceHelpers::correctMeshPath( | ||||
|             Fallback::Map::getString("Blood_Model_" + std::to_string(Misc::Rng::rollDice(3))), // [0, 2]
 | ||||
|             mResourceSystem->getVFS()); | ||||
| 
 | ||||
|         mRendering->spawnEffect(model, texture, worldPosition, 1.0f, false); | ||||
|     } | ||||
|  | @ -3731,13 +3732,13 @@ namespace MWWorld | |||
|             { | ||||
|                 if (effectInfo.mRange == ESM::RT_Target) | ||||
|                     mRendering->spawnEffect( | ||||
|                         MWBase::Environment::get().getWindowManager()->correctMeshPath(areaStatic->mModel), | ||||
|                         Misc::ResourceHelpers::correctMeshPath(areaStatic->mModel, mResourceSystem->getVFS()), | ||||
|                         texture, origin, 1.0f); | ||||
|                 continue; | ||||
|             } | ||||
|             else | ||||
|                 mRendering->spawnEffect( | ||||
|                     MWBase::Environment::get().getWindowManager()->correctMeshPath(areaStatic->mModel), | ||||
|                     Misc::ResourceHelpers::correctMeshPath(areaStatic->mModel, mResourceSystem->getVFS()), | ||||
|                     texture, origin, static_cast<float>(effectInfo.mArea * 2)); | ||||
| 
 | ||||
|             // Play explosion sound (make sure to use NoTrack, since we will delete the projectile now)
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue