1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-30 07:21:12 +00:00

Address feedback

This commit is contained in:
Evil Eye 2023-12-29 21:55:22 +01:00
parent 4636ab3f3e
commit 84c15344ee

View File

@ -18,6 +18,7 @@
#include <components/lua/configuration.hpp>
#include <components/misc/algorithm.hpp>
#include <components/misc/resourcehelpers.hpp>
#include <components/vfs/pathutil.hpp>
#include "../mwmechanics/spelllist.hpp"
#include "../mwrender/actorutil.hpp"
@ -140,22 +141,17 @@ namespace
// TESCS sometimes writes the default animation nif to the animation subrecord. This harmless (as it
// will match the NPC's race) until the NPC's race is changed. If the player record contains a default
// non-beast race animation and the player selects a beast race in chargen, animations aren't applied
// properly. Morrowind.exe handles this gracefully, so we clear the animation here to force the default.
// properly. Morrowind.exe handles this gracefully, so we clear the animation here to force the default
// values to be used.
if (!npc.mModel.empty() && npc.mId == "player")
{
const bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
const std::string& defaultModel = MWRender::getActorSkeleton(false, !npc.isMale(), isBeast, false);
std::string model = Misc::ResourceHelpers::correctMeshPath(npc.mModel);
if (model.size() == defaultModel.size())
if (VFS::Path::pathEqual(defaultModel, model))
{
std::replace(model.begin(), model.end(), '/', '\\');
std::string normalizedDefault = defaultModel;
std::replace(normalizedDefault.begin(), normalizedDefault.end(), '/', '\\');
if (Misc::StringUtils::ciEqual(normalizedDefault, model))
{
npc.mModel.clear();
changed = true;
}
npc.mModel.clear();
changed = true;
}
}
}