2018-07-18 02:28:05 +00:00
|
|
|
#include "actorutil.hpp"
|
|
|
|
|
2023-09-09 11:12:08 +00:00
|
|
|
#include <components/settings/values.hpp>
|
2024-01-01 12:58:55 +00:00
|
|
|
#include <components/vfs/pathutil.hpp>
|
2020-12-30 20:11:32 +00:00
|
|
|
|
2023-09-27 18:41:01 +00:00
|
|
|
namespace MWRender
|
2018-07-18 02:28:05 +00:00
|
|
|
{
|
2022-08-28 14:38:11 +00:00
|
|
|
const std::string& getActorSkeleton(bool firstPerson, bool isFemale, bool isBeast, bool isWerewolf)
|
2018-07-18 02:28:05 +00:00
|
|
|
{
|
|
|
|
if (!firstPerson)
|
|
|
|
{
|
|
|
|
if (isWerewolf)
|
2024-08-18 18:48:22 +00:00
|
|
|
return Settings::models().mWolfskin.get().value();
|
2018-07-18 02:28:05 +00:00
|
|
|
else if (isBeast)
|
2024-08-18 18:48:22 +00:00
|
|
|
return Settings::models().mBaseanimkna.get().value();
|
2018-07-18 02:28:05 +00:00
|
|
|
else if (isFemale)
|
2024-08-18 18:48:22 +00:00
|
|
|
return Settings::models().mBaseanimfemale.get().value();
|
2018-07-18 02:28:05 +00:00
|
|
|
else
|
2024-08-18 18:48:22 +00:00
|
|
|
return Settings::models().mBaseanim.get().value();
|
2018-07-18 02:28:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (isWerewolf)
|
2024-08-18 18:48:22 +00:00
|
|
|
return Settings::models().mWolfskin1st.get().value();
|
2018-07-18 02:28:05 +00:00
|
|
|
else if (isBeast)
|
2024-08-18 18:48:22 +00:00
|
|
|
return Settings::models().mBaseanimkna1st.get().value();
|
2018-07-18 02:28:05 +00:00
|
|
|
else if (isFemale)
|
2024-08-18 18:48:22 +00:00
|
|
|
return Settings::models().mBaseanimfemale1st.get().value();
|
2018-07-18 02:28:05 +00:00
|
|
|
else
|
2024-08-18 18:48:22 +00:00
|
|
|
return Settings::models().mXbaseanim1st.get().value();
|
2018-07-18 02:28:05 +00:00
|
|
|
}
|
|
|
|
}
|
2024-01-01 12:58:55 +00:00
|
|
|
|
|
|
|
bool isDefaultActorSkeleton(std::string_view model)
|
|
|
|
{
|
|
|
|
return VFS::Path::pathEqual(Settings::models().mBaseanimkna.get(), model)
|
|
|
|
|| VFS::Path::pathEqual(Settings::models().mBaseanimfemale.get(), model)
|
|
|
|
|| VFS::Path::pathEqual(Settings::models().mBaseanim.get(), model);
|
|
|
|
}
|
2024-03-25 21:01:46 +00:00
|
|
|
|
|
|
|
std::string addSuffixBeforeExtension(const std::string& filename, const std::string& suffix)
|
|
|
|
{
|
|
|
|
size_t dotPos = filename.rfind('.');
|
|
|
|
|
|
|
|
// No extension found; return the original filename with suffix appended
|
|
|
|
if (dotPos == std::string::npos)
|
|
|
|
return filename + suffix;
|
|
|
|
|
|
|
|
// Insert the suffix before the dot (extension) and return the new filename
|
|
|
|
return filename.substr(0, dotPos) + suffix + filename.substr(dotPos);
|
|
|
|
}
|
2018-07-18 02:28:05 +00:00
|
|
|
}
|