From 963b7ec7425ded64ba7a9af8fba3da1d68e2ebe9 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sat, 28 Sep 2024 12:35:45 +0300 Subject: [PATCH] Unify first/third-person animation choice logic (#8179) Re-enable first-person female/beast-specific animations Use dehardcoded argonian swim animation path --- apps/openmw/mwrender/npcanimation.cpp | 53 +++++++++++++-------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index c8fc36e18a..10bc239dd7 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -484,15 +484,24 @@ namespace MWRender bool is1stPerson = mViewMode == VM_FirstPerson; bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0; + std::string_view base; + if (!isWerewolf) + { + if (!is1stPerson) + base = Settings::models().mXbaseanim.get().value(); + else + base = Settings::models().mXbaseanim1st.get().value(); + } + const std::string defaultSkeleton = Misc::ResourceHelpers::correctActorModelPath( getActorSkeleton(is1stPerson, isFemale, isBeast, isWerewolf), mResourceSystem->getVFS()); std::string smodel = defaultSkeleton; - bool isBase = !isWerewolf; + bool isCustomModel = false; if (!is1stPerson && !isWerewolf && !mNpc->mModel.empty()) { std::string model = Misc::ResourceHelpers::correctMeshPath(mNpc->mModel); - isBase = isDefaultActorSkeleton(model); + isCustomModel = !isDefaultActorSkeleton(model); smodel = Misc::ResourceHelpers::correctActorModelPath(model, mResourceSystem->getVFS()); } @@ -500,33 +509,21 @@ namespace MWRender updateParts(); - if (!is1stPerson) + if (!base.empty()) + addAnimSource(base, smodel); + + if (defaultSkeleton != base) + addAnimSource(defaultSkeleton, smodel); + + if (isCustomModel) + addAnimSource(smodel, smodel); + + const bool customArgonianSwim = !is1stPerson && !isWerewolf && isBeast && mNpc->mRace.contains("argonian"); + if (customArgonianSwim) + addAnimSource(Settings::models().mXargonianswimkna.get().value(), smodel); + + if (is1stPerson) { - const std::string& base = Settings::models().mXbaseanim.get().value(); - if (!isWerewolf) - addAnimSource(base, smodel); - - if (!isBase) - { - addAnimSource(defaultSkeleton, smodel); - addAnimSource(smodel, smodel); - } - else if (base != defaultSkeleton) - { - addAnimSource(defaultSkeleton, smodel); - } - - if (!isWerewolf && isBeast && mNpc->mRace.contains("argonian")) - addAnimSource("meshes\\xargonian_swimkna.nif", smodel); - } - else - { - if (!isWerewolf) - addAnimSource(Settings::models().mXbaseanim1st.get().value(), smodel); - - if (!isBase) - addAnimSource(smodel, smodel); - mObjectRoot->setNodeMask(Mask_FirstPerson); mObjectRoot->addCullCallback(new OverrideFieldOfViewCallback(mFirstPersonFieldOfView)); }