diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 9fbe49451cc..6e833854e07 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -445,12 +445,11 @@ namespace MWClass { const MWWorld::LiveCellRef* ref = ptr.get(); - const std::string& model = Settings::models().mBaseanim; const ESM::Race* race = MWBase::Environment::get().getESMStore()->get().find(ref->mBase->mRace); if (race->mData.mFlags & ESM::Race::Beast) - return Settings::models().mBaseanimkna; + return Settings::models().mBaseanimkna.get().value(); - return model; + return Settings::models().mBaseanim.get().value(); } void Npc::getModelsToPreload(const MWWorld::ConstPtr& ptr, std::vector& models) const diff --git a/apps/openmw/mwrender/actorutil.cpp b/apps/openmw/mwrender/actorutil.cpp index 7739d5a6f65..3cb8adb8aa5 100644 --- a/apps/openmw/mwrender/actorutil.cpp +++ b/apps/openmw/mwrender/actorutil.cpp @@ -10,24 +10,24 @@ namespace MWRender if (!firstPerson) { if (isWerewolf) - return Settings::models().mWolfskin; + return Settings::models().mWolfskin.get().value(); else if (isBeast) - return Settings::models().mBaseanimkna; + return Settings::models().mBaseanimkna.get().value(); else if (isFemale) - return Settings::models().mBaseanimfemale; + return Settings::models().mBaseanimfemale.get().value(); else - return Settings::models().mBaseanim; + return Settings::models().mBaseanim.get().value(); } else { if (isWerewolf) - return Settings::models().mWolfskin1st; + return Settings::models().mWolfskin1st.get().value(); else if (isBeast) - return Settings::models().mBaseanimkna1st; + return Settings::models().mBaseanimkna1st.get().value(); else if (isFemale) - return Settings::models().mBaseanimfemale1st; + return Settings::models().mBaseanimfemale1st.get().value(); else - return Settings::models().mXbaseanim1st; + return Settings::models().mXbaseanim1st.get().value(); } } diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 32d775a9bd1..89adc26d08f 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1590,7 +1590,7 @@ namespace MWRender MWWorld::LiveCellRef* ref = mPtr.get(); if (ref->mBase->mFlags & ESM::Creature::Bipedal) { - defaultSkeleton = Settings::models().mXbaseanim; + defaultSkeleton = Settings::models().mXbaseanim.get().value(); inject = true; } } diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 9e9d69c3998..8e8f10a362c 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -502,7 +502,7 @@ namespace MWRender if (!is1stPerson) { - const std::string& base = Settings::models().mXbaseanim; + const std::string& base = Settings::models().mXbaseanim.get().value(); if (!isWerewolf) addAnimSource(base, smodel); @@ -521,9 +521,8 @@ namespace MWRender } else { - const std::string& base = Settings::models().mXbaseanim1st; if (!isWerewolf) - addAnimSource(base, smodel); + addAnimSource(Settings::models().mXbaseanim1st.get().value(), smodel); if (!isBase) addAnimSource(smodel, smodel); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 7048f7c933a..09f9003162d 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -283,12 +283,12 @@ namespace MWRender { try { - for (std::vector::const_iterator it = mModels.begin(); it != mModels.end(); ++it) - mResourceSystem->getSceneManager()->getTemplate(*it); - for (std::vector::const_iterator it = mTextures.begin(); it != mTextures.end(); ++it) - mResourceSystem->getImageManager()->getImage(*it); - for (std::vector::const_iterator it = mKeyframes.begin(); it != mKeyframes.end(); ++it) - mResourceSystem->getKeyframeManager()->get(*it); + for (const VFS::Path::Normalized& v : mModels) + mResourceSystem->getSceneManager()->getTemplate(v); + for (const VFS::Path::Normalized& v : mTextures) + mResourceSystem->getImageManager()->getImage(v); + for (const VFS::Path::Normalized& v : mKeyframes) + mResourceSystem->getKeyframeManager()->get(v); } catch (const std::exception& e) { @@ -296,9 +296,9 @@ namespace MWRender } } - std::vector mModels; - std::vector mTextures; - std::vector mKeyframes; + std::vector mModels; + std::vector mTextures; + std::vector mKeyframes; private: Resource::ResourceSystem* mResourceSystem; diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index c75849d5326..c45fadc74f1 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -934,7 +934,8 @@ namespace MWRender mUnderwaterSwitch->setWaterLevel(height); } - void SkyManager::listAssetsToPreload(std::vector& models, std::vector& textures) + void SkyManager::listAssetsToPreload( + std::vector& models, std::vector& textures) { models.push_back(Settings::models().mSkyatmosphere); if (mSceneManager->getVFS()->exists(Settings::models().mSkynight02.get())) diff --git a/apps/openmw/mwrender/sky.hpp b/apps/openmw/mwrender/sky.hpp index e0cd26f98a3..716f49a4c7f 100644 --- a/apps/openmw/mwrender/sky.hpp +++ b/apps/openmw/mwrender/sky.hpp @@ -8,6 +8,8 @@ #include #include +#include + #include "precipitationocclusion.hpp" #include "skyutil.hpp" @@ -100,7 +102,8 @@ namespace MWRender /// Set height of water plane (used to remove underwater weather particles) void setWaterHeight(float height); - void listAssetsToPreload(std::vector& models, std::vector& textures); + void listAssetsToPreload( + std::vector& models, std::vector& textures); float getBaseWindSpeed() const; diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index c14f031fd1e..1b8b307d212 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -744,7 +744,7 @@ namespace MWRender } } - void Water::listAssetsToPreload(std::vector& textures) + void Water::listAssetsToPreload(std::vector& textures) { const int frameCount = std::clamp(Fallback::Map::getInt("Water_SurfaceFrameCount"), 0, 320); std::string_view texture = Fallback::Map::getString("Water_SurfaceTexture"); @@ -752,7 +752,7 @@ namespace MWRender { std::ostringstream texname; texname << "textures/water/" << texture << std::setw(2) << std::setfill('0') << i << ".dds"; - textures.push_back(texname.str()); + textures.emplace_back(texname.str()); } } diff --git a/apps/openmw/mwrender/water.hpp b/apps/openmw/mwrender/water.hpp index 3572f284209..92299309f04 100644 --- a/apps/openmw/mwrender/water.hpp +++ b/apps/openmw/mwrender/water.hpp @@ -9,6 +9,7 @@ #include #include +#include namespace osg { @@ -92,7 +93,7 @@ namespace MWRender void setCullCallback(osg::Callback* callback); - void listAssetsToPreload(std::vector& textures); + void listAssetsToPreload(std::vector& textures); void setEnabled(bool enabled); diff --git a/components/settings/categories/models.hpp b/components/settings/categories/models.hpp index 0d26eeba5fb..5cadca8be78 100644 --- a/components/settings/categories/models.hpp +++ b/components/settings/categories/models.hpp @@ -2,14 +2,7 @@ #define OPENMW_COMPONENTS_SETTINGS_CATEGORIES_MODELS_H #include - -#include -#include -#include - -#include -#include -#include +#include namespace Settings { @@ -18,29 +11,29 @@ namespace Settings using WithIndex::WithIndex; SettingValue mLoadUnsupportedNifFiles{ mIndex, "Models", "load unsupported nif files" }; - SettingValue mXbaseanim{ mIndex, "Models", "xbaseanim" }; - SettingValue mBaseanim{ mIndex, "Models", "baseanim" }; - SettingValue mXbaseanim1st{ mIndex, "Models", "xbaseanim1st" }; - SettingValue mBaseanimkna{ mIndex, "Models", "baseanimkna" }; - SettingValue mBaseanimkna1st{ mIndex, "Models", "baseanimkna1st" }; - SettingValue mXbaseanimfemale{ mIndex, "Models", "xbaseanimfemale" }; - SettingValue mBaseanimfemale{ mIndex, "Models", "baseanimfemale" }; - SettingValue mBaseanimfemale1st{ mIndex, "Models", "baseanimfemale1st" }; - SettingValue mWolfskin{ mIndex, "Models", "wolfskin" }; - SettingValue mWolfskin1st{ mIndex, "Models", "wolfskin1st" }; - SettingValue mXargonianswimkna{ mIndex, "Models", "xargonianswimkna" }; - SettingValue mXbaseanimkf{ mIndex, "Models", "xbaseanimkf" }; - SettingValue mXbaseanim1stkf{ mIndex, "Models", "xbaseanim1stkf" }; - SettingValue mXbaseanimfemalekf{ mIndex, "Models", "xbaseanimfemalekf" }; - SettingValue mXargonianswimknakf{ mIndex, "Models", "xargonianswimknakf" }; - SettingValue mSkyatmosphere{ mIndex, "Models", "skyatmosphere" }; - SettingValue mSkyclouds{ mIndex, "Models", "skyclouds" }; - SettingValue mSkynight01{ mIndex, "Models", "skynight01" }; - SettingValue mSkynight02{ mIndex, "Models", "skynight02" }; - SettingValue mWeatherashcloud{ mIndex, "Models", "weatherashcloud" }; - SettingValue mWeatherblightcloud{ mIndex, "Models", "weatherblightcloud" }; - SettingValue mWeathersnow{ mIndex, "Models", "weathersnow" }; - SettingValue mWeatherblizzard{ mIndex, "Models", "weatherblizzard" }; + SettingValue mXbaseanim{ mIndex, "Models", "xbaseanim" }; + SettingValue mBaseanim{ mIndex, "Models", "baseanim" }; + SettingValue mXbaseanim1st{ mIndex, "Models", "xbaseanim1st" }; + SettingValue mBaseanimkna{ mIndex, "Models", "baseanimkna" }; + SettingValue mBaseanimkna1st{ mIndex, "Models", "baseanimkna1st" }; + SettingValue mXbaseanimfemale{ mIndex, "Models", "xbaseanimfemale" }; + SettingValue mBaseanimfemale{ mIndex, "Models", "baseanimfemale" }; + SettingValue mBaseanimfemale1st{ mIndex, "Models", "baseanimfemale1st" }; + SettingValue mWolfskin{ mIndex, "Models", "wolfskin" }; + SettingValue mWolfskin1st{ mIndex, "Models", "wolfskin1st" }; + SettingValue mXargonianswimkna{ mIndex, "Models", "xargonianswimkna" }; + SettingValue mXbaseanimkf{ mIndex, "Models", "xbaseanimkf" }; + SettingValue mXbaseanim1stkf{ mIndex, "Models", "xbaseanim1stkf" }; + SettingValue mXbaseanimfemalekf{ mIndex, "Models", "xbaseanimfemalekf" }; + SettingValue mXargonianswimknakf{ mIndex, "Models", "xargonianswimknakf" }; + SettingValue mSkyatmosphere{ mIndex, "Models", "skyatmosphere" }; + SettingValue mSkyclouds{ mIndex, "Models", "skyclouds" }; + SettingValue mSkynight01{ mIndex, "Models", "skynight01" }; + SettingValue mSkynight02{ mIndex, "Models", "skynight02" }; + SettingValue mWeatherashcloud{ mIndex, "Models", "weatherashcloud" }; + SettingValue mWeatherblightcloud{ mIndex, "Models", "weatherblightcloud" }; + SettingValue mWeathersnow{ mIndex, "Models", "weathersnow" }; + SettingValue mWeatherblizzard{ mIndex, "Models", "weatherblizzard" }; SettingValue mWriteNifDebugLog{ mIndex, "Models", "write nif debug log" }; }; } diff --git a/components/settings/settings.hpp b/components/settings/settings.hpp index 5be2130259b..d269b5cea34 100644 --- a/components/settings/settings.hpp +++ b/components/settings/settings.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -263,6 +264,13 @@ namespace Settings return SDLUtil::VSyncMode::Disabled; return static_cast(value); } + + template <> + inline VFS::Path::Normalized Manager::getImpl( + std::string_view setting, std::string_view category) + { + return VFS::Path::Normalized(getString(setting, category)); + } } #endif // COMPONENTS_SETTINGS_H diff --git a/components/settings/settingvalue.hpp b/components/settings/settingvalue.hpp index b99de6eaa7b..addc557138d 100644 --- a/components/settings/settingvalue.hpp +++ b/components/settings/settingvalue.hpp @@ -6,8 +6,9 @@ #include "sanitizer.hpp" #include "settings.hpp" -#include "components/debug/debuglog.hpp" -#include "components/detournavigator/collisionshapetype.hpp" +#include +#include +#include #include @@ -44,6 +45,7 @@ namespace Settings HrtfMode, WindowMode, VSyncMode, + NormalizedPath, }; template @@ -175,6 +177,12 @@ namespace Settings return SettingValueType::VSyncMode; } + template <> + inline constexpr SettingValueType getSettingValueType() + { + return SettingValueType::NormalizedPath; + } + inline constexpr std::string_view getSettingValueTypeName(SettingValueType type) { switch (type) @@ -221,6 +229,8 @@ namespace Settings return "window mode"; case SettingValueType::VSyncMode: return "vsync mode"; + case SettingValueType::NormalizedPath: + return "normalized path"; } return "unsupported"; }